Commit 5b9f6f5e authored by Felix Riemann's avatar Felix Riemann

EogSidebar: Center and reformat page selector

parent fec0939d
......@@ -5,3 +5,7 @@ GtkScrollbar#eog-image-gallery-scrollbar {
-GtkScrollbar-has-secondary-forward-stepper: false;
-GtkScrollbar-min-slider-length: 60;
}
GtkLabel#eog-sidebar-title {
font-weight: bold;
}
......@@ -60,6 +60,7 @@ struct _EogSidebarPrivate {
GtkWidget *menu;
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *arrow;
GtkTreeModel *page_model;
};
......@@ -356,6 +357,16 @@ eog_sidebar_menu_item_activate_cb (GtkWidget *widget,
g_object_notify (G_OBJECT (eog_sidebar), "current-page");
}
static void
eog_sidebar_update_arrow_visibility (EogSidebar *sidebar)
{
EogSidebarPrivate *priv = sidebar->priv;
const gint n_pages = eog_sidebar_get_n_pages (sidebar);
gtk_widget_set_visible (GTK_WIDGET (priv->arrow),
n_pages > 1);
}
static void
eog_sidebar_init (EogSidebar *eog_sidebar)
{
......@@ -393,9 +404,10 @@ eog_sidebar_init (EogSidebar *eog_sidebar)
G_CALLBACK (eog_sidebar_select_button_key_press_cb),
eog_sidebar);
select_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
select_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
eog_sidebar->priv->label = gtk_label_new ("");
gtk_widget_set_name (eog_sidebar->priv->label, "eog-sidebar-title");
gtk_box_pack_start (GTK_BOX (select_hbox),
eog_sidebar->priv->label,
......@@ -405,12 +417,13 @@ eog_sidebar_init (EogSidebar *eog_sidebar)
arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_box_pack_end (GTK_BOX (select_hbox), arrow, FALSE, FALSE, 0);
gtk_widget_show (arrow);
eog_sidebar->priv->arrow = arrow;
gtk_widget_set_visible (arrow, FALSE);
gtk_container_add (GTK_CONTAINER (eog_sidebar->priv->select_button), select_hbox);
gtk_widget_show (select_hbox);
gtk_box_pack_start (GTK_BOX (hbox), eog_sidebar->priv->select_button, TRUE, TRUE, 0);
gtk_box_set_center_widget (GTK_BOX (hbox), eog_sidebar->priv->select_button);
gtk_widget_show (eog_sidebar->priv->select_button);
close_button = gtk_button_new ();
......@@ -521,6 +534,8 @@ eog_sidebar_add_page (EogSidebar *eog_sidebar,
g_free (label_title);
eog_sidebar_update_arrow_visibility (eog_sidebar);
g_signal_emit (G_OBJECT (eog_sidebar),
signals[SIGNAL_PAGE_ADDED], 0, main_widget);
}
......@@ -565,6 +580,8 @@ eog_sidebar_remove_page (EogSidebar *eog_sidebar, GtkWidget *main_widget)
gtk_list_store_remove (GTK_LIST_STORE (eog_sidebar->priv->page_model),
&iter);
eog_sidebar_update_arrow_visibility (eog_sidebar);
g_signal_emit (G_OBJECT (eog_sidebar),
signals[SIGNAL_PAGE_REMOVED], 0, main_widget);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment