diff options
author | Felix Riemann <[email protected]> | 2015-01-16 22:20:13 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-08-01 12:20:45 +0200 |
commit | 6319bb340d24a6e0c99b58efa825054374f573f0 (patch) | |
tree | d1327073f6124c893f8a6aab306b1ea3a175c338 /src/eom-sidebar.c | |
parent | ece3c970b4cfb6cbb8f02cbb2d78176bb2a9461f (diff) | |
download | eom-6319bb340d24a6e0c99b58efa825054374f573f0.tar.bz2 eom-6319bb340d24a6e0c99b58efa825054374f573f0.tar.xz |
EomSidebar: Center and reformat page selector
origin comit:
https://gitlab.gnome.org/GNOME/eog/commit/5b9f6f5
Diffstat (limited to 'src/eom-sidebar.c')
-rw-r--r-- | src/eom-sidebar.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/eom-sidebar.c b/src/eom-sidebar.c index 18e86ec..51dd1e4 100644 --- a/src/eom-sidebar.c +++ b/src/eom-sidebar.c @@ -60,6 +60,7 @@ struct _EomSidebarPrivate { GtkWidget *menu; GtkWidget *hbox; GtkWidget *label; + GtkWidget *arrow; GtkTreeModel *page_model; }; @@ -337,6 +338,16 @@ eom_sidebar_menu_item_activate_cb (GtkWidget *widget, } static void +eom_sidebar_update_arrow_visibility (EomSidebar *sidebar) +{ + EomSidebarPrivate *priv = sidebar->priv; + const gint n_pages = eom_sidebar_get_n_pages (sidebar); + + gtk_widget_set_visible (GTK_WIDGET (priv->arrow), + n_pages > 1); +} + +static void eom_sidebar_init (EomSidebar *eom_sidebar) { GtkWidget *hbox; @@ -373,9 +384,10 @@ eom_sidebar_init (EomSidebar *eom_sidebar) G_CALLBACK (eom_sidebar_select_button_key_press_cb), eom_sidebar); - select_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + select_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); eom_sidebar->priv->label = gtk_label_new (""); + gtk_widget_set_name (eom_sidebar->priv->label, "eom-sidebar-title"); gtk_box_pack_start (GTK_BOX (select_hbox), eom_sidebar->priv->label, @@ -385,12 +397,13 @@ eom_sidebar_init (EomSidebar *eom_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); + eom_sidebar->priv->arrow = arrow; + gtk_widget_set_visible (arrow, FALSE); gtk_container_add (GTK_CONTAINER (eom_sidebar->priv->select_button), select_hbox); gtk_widget_show (select_hbox); - gtk_box_pack_start (GTK_BOX (hbox), eom_sidebar->priv->select_button, TRUE, TRUE, 0); + gtk_box_set_center_widget (GTK_BOX (hbox), eom_sidebar->priv->select_button); gtk_widget_show (eom_sidebar->priv->select_button); close_button = gtk_button_new (); @@ -501,6 +514,8 @@ eom_sidebar_add_page (EomSidebar *eom_sidebar, g_free (label_title); + eom_sidebar_update_arrow_visibility (eom_sidebar); + g_signal_emit (G_OBJECT (eom_sidebar), signals[SIGNAL_PAGE_ADDED], 0, main_widget); } @@ -545,6 +560,8 @@ eom_sidebar_remove_page (EomSidebar *eom_sidebar, GtkWidget *main_widget) gtk_list_store_remove (GTK_LIST_STORE (eom_sidebar->priv->page_model), &iter); + eom_sidebar_update_arrow_visibility (eom_sidebar); + g_signal_emit (G_OBJECT (eom_sidebar), signals[SIGNAL_PAGE_REMOVED], 0, main_widget); } |