[gthumb] statusbar: show different info depending on the browser mode



commit 521a3a65b5c2c9555af912040c5c2c64456c2471
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Nov 3 18:19:24 2013 +0100

    statusbar: show different info depending on the browser mode

 gthumb/gth-browser.c   |    3 +-
 gthumb/gth-statusbar.c |   66 +++++++++++++++++++-----------------------------
 gthumb/gth-statusbar.h |   33 ++++++++++++++---------
 3 files changed, 48 insertions(+), 54 deletions(-)
---
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 5bc36ed..b5f2c1a 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -68,7 +68,7 @@
 #define UPDATE_SELECTION_DELAY 200
 #define MIN_SIDEBAR_SIZE 100
 #define MIN_VIEWER_SIZE 256
-#define STATUSBAR_SEPARATOR " · "
+#define STATUSBAR_SEPARATOR "  ·  "
 #define SHIRNK_WRAP_WIDTH_OFFSET 100
 #define SHIRNK_WRAP_HEIGHT_OFFSET 125
 #define FILE_PROPERTIES_MINIMUM_HEIGHT 100
@@ -2155,6 +2155,7 @@ _gth_browser_real_set_current_page (GthWindow *window,
 
        /* update the ui commands */
 
+       gth_statusbar_show_section (GTH_STATUSBAR (browser->priv->statusbar), (page == 
GTH_BROWSER_PAGE_BROWSER) ? GTH_STATUSBAR_SECTION_FILE_LIST : GTH_STATUSBAR_SECTION_FILE);
        _gth_browser_hide_infobar (browser);
 
        _gth_browser_update_header_section_visibility (browser, 
GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION, page == GTH_BROWSER_PAGE_BROWSER);
diff --git a/gthumb/gth-statusbar.c b/gthumb/gth-statusbar.c
index 1f564ab..cb5db84 100644
--- a/gthumb/gth-statusbar.c
+++ b/gthumb/gth-statusbar.c
@@ -25,11 +25,9 @@
 
 
 struct _GthStatusbarPrivate {
-       GtkWidget *list_info_label;
+       GtkWidget *list_info;
        GtkWidget *primary_text;
-       GtkWidget *primary_text_frame;
        GtkWidget *secondary_text;
-       GtkWidget *secondary_text_frame;
        GtkWidget *action_area;
 };
 
@@ -57,41 +55,29 @@ gth_statusbar_init (GthStatusbar *statusbar)
 
        /* List info */
 
-       statusbar->priv->list_info_label = gtk_label_new (NULL);
-       gtk_label_set_ellipsize (GTK_LABEL (statusbar->priv->list_info_label), PANGO_ELLIPSIZE_END);
-       gtk_widget_show (statusbar->priv->list_info_label);
-       gtk_box_pack_start (GTK_BOX (statusbar), statusbar->priv->list_info_label, FALSE, FALSE, 0);
-
-       /* Action area */
-
-       statusbar->priv->action_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-       gtk_widget_show (statusbar->priv->action_area);
-       gtk_box_pack_end (GTK_BOX (statusbar), statusbar->priv->action_area, FALSE, FALSE, 0);
+       statusbar->priv->list_info = gtk_label_new (NULL);
+       gtk_label_set_ellipsize (GTK_LABEL (statusbar->priv->list_info), PANGO_ELLIPSIZE_END);
+       gtk_box_pack_start (GTK_BOX (statusbar), statusbar->priv->list_info, FALSE, FALSE, 0);
 
        /* Primary text */
 
        statusbar->priv->primary_text = gtk_label_new (NULL);
        gtk_label_set_ellipsize (GTK_LABEL (statusbar->priv->primary_text), PANGO_ELLIPSIZE_END);
-       gtk_widget_show (statusbar->priv->primary_text);
-
-       statusbar->priv->primary_text_frame = gtk_frame_new (NULL);
-       gtk_widget_show (statusbar->priv->primary_text_frame);
-
-       gtk_frame_set_shadow_type (GTK_FRAME (statusbar->priv->primary_text_frame), GTK_SHADOW_NONE);
-       gtk_container_add (GTK_CONTAINER (statusbar->priv->primary_text_frame), 
statusbar->priv->primary_text);
-       gtk_box_pack_end (GTK_BOX (statusbar), statusbar->priv->primary_text_frame, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (statusbar), statusbar->priv->primary_text, FALSE, FALSE, 0);
 
        /* Secondary text */
 
        statusbar->priv->secondary_text = gtk_label_new (NULL);
        gtk_label_set_ellipsize (GTK_LABEL (statusbar->priv->secondary_text), PANGO_ELLIPSIZE_END);
-       gtk_widget_show (statusbar->priv->secondary_text);
+       gtk_box_pack_start (GTK_BOX (statusbar), statusbar->priv->secondary_text, FALSE, FALSE, 12);
+
+       /* Action area */
 
-       statusbar->priv->secondary_text_frame = gtk_frame_new (NULL);
-       gtk_widget_show (statusbar->priv->secondary_text_frame);
-       gtk_frame_set_shadow_type (GTK_FRAME (statusbar->priv->secondary_text_frame), GTK_SHADOW_NONE);
-       gtk_container_add (GTK_CONTAINER (statusbar->priv->secondary_text_frame), 
statusbar->priv->secondary_text);
-       gtk_box_pack_end (GTK_BOX (statusbar), statusbar->priv->secondary_text_frame, FALSE, FALSE, 0);
+       statusbar->priv->action_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+       gtk_widget_show (statusbar->priv->action_area);
+       gtk_box_pack_end (GTK_BOX (statusbar), statusbar->priv->action_area, FALSE, FALSE, 0);
+
+       gth_statusbar_show_section (statusbar, GTH_STATUSBAR_SECTION_FILE_LIST);
 }
 
 
@@ -106,7 +92,7 @@ void
 gth_statusbar_set_list_info (GthStatusbar *statusbar,
                             const char   *text)
 {
-       gtk_label_set_text (GTK_LABEL (statusbar->priv->list_info_label), text);
+       gtk_label_set_text (GTK_LABEL (statusbar->priv->list_info), text);
 }
 
 
@@ -114,12 +100,7 @@ void
 gth_statusbar_set_primary_text (GthStatusbar *statusbar,
                                const char   *text)
 {
-       if (text != NULL) {
-               gtk_label_set_text (GTK_LABEL (statusbar->priv->primary_text), text);
-               gtk_widget_show (statusbar->priv->primary_text_frame);
-       }
-       else
-               gtk_widget_hide (statusbar->priv->primary_text_frame);
+       gtk_label_set_text (GTK_LABEL (statusbar->priv->primary_text), text);
 }
 
 
@@ -127,12 +108,17 @@ void
 gth_statusbar_set_secondary_text (GthStatusbar *statusbar,
                                  const char   *text)
 {
-       if (text != NULL) {
-               gtk_label_set_text (GTK_LABEL (statusbar->priv->secondary_text), text);
-               gtk_widget_show (statusbar->priv->secondary_text_frame);
-       }
-       else
-               gtk_widget_hide (statusbar->priv->secondary_text_frame);
+       gtk_label_set_text (GTK_LABEL (statusbar->priv->secondary_text), text);
+}
+
+
+void
+gth_statusbar_show_section (GthStatusbar               *statusbar,
+                           GthStatusbarSection          section)
+{
+       gtk_widget_set_visible (statusbar->priv->list_info, section == GTH_STATUSBAR_SECTION_FILE_LIST);
+       gtk_widget_set_visible (statusbar->priv->primary_text, section == GTH_STATUSBAR_SECTION_FILE);
+       gtk_widget_set_visible (statusbar->priv->secondary_text, section == GTH_STATUSBAR_SECTION_FILE);
 }
 
 
diff --git a/gthumb/gth-statusbar.h b/gthumb/gth-statusbar.h
index b0dbb80..a69f84d 100644
--- a/gthumb/gth-statusbar.h
+++ b/gthumb/gth-statusbar.h
@@ -26,6 +26,11 @@
 
 G_BEGIN_DECLS
 
+typedef enum {
+       GTH_STATUSBAR_SECTION_FILE_LIST,
+       GTH_STATUSBAR_SECTION_FILE
+} GthStatusbarSection;
+
 #define GTH_TYPE_STATUSBAR            (gth_statusbar_get_type ())
 #define GTH_STATUSBAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_STATUSBAR, GthStatusbar))
 #define GTH_STATUSBAR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_STATUSBAR, 
GthStatusbarClass))
@@ -46,19 +51,21 @@ struct _GthStatusbarClass {
        GtkBoxClass parent_class;
 };
 
-GType        gth_statusbar_get_type             (void);
-GtkWidget *  gth_statusbar_new                  (void);
-void         gth_statusbar_set_list_info        (GthStatusbar *statusbar,
-                                                const char   *text);
-void         gth_statusbar_set_primary_text     (GthStatusbar *statusbar,
-                                                const char   *text);
-void         gth_statusbar_set_secondary_text   (GthStatusbar *statusbar,
-                                                const char   *text);
-void         gth_statusbar_set_progress         (GthStatusbar *statusbar,
-                                                const char   *text,
-                                                gboolean      pulse,
-                                                double        fraction);
-GtkWidget *  gth_statubar_get_action_area       (GthStatusbar *statusbar);
+GType          gth_statusbar_get_type                  (void);
+GtkWidget *    gth_statusbar_new                       (void);
+void           gth_statusbar_set_list_info             (GthStatusbar           *statusbar,
+                                                        const char             *text);
+void           gth_statusbar_set_primary_text          (GthStatusbar           *statusbar,
+                                                        const char             *text);
+void           gth_statusbar_set_secondary_text        (GthStatusbar           *statusbar,
+                                                        const char             *text);
+void           gth_statusbar_set_progress              (GthStatusbar           *statusbar,
+                                                        const char             *text,
+                                                        gboolean                pulse,
+                                                        double                  fraction);
+void           gth_statusbar_show_section              (GthStatusbar           *statusbar,
+                                                        GthStatusbarSection     section);
+GtkWidget *    gth_statubar_get_action_area            (GthStatusbar           *statusbar);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]