[balsa] Set-statusbar is a BalsaWindow method



commit 65f54cb33dbeace50fcc1eaabf74e180845df999
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Aug 26 20:53:44 2009 -0400

    Set-statusbar is a BalsaWindow method

 ChangeLog          |   11 +++++++++++
 src/balsa-index.c  |    2 +-
 src/balsa-mblist.c |   52 ++--------------------------------------------------
 src/balsa-mblist.h |    1 -
 src/main-window.c  |   51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/main-window.h  |    2 ++
 6 files changed, 66 insertions(+), 53 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a97b104..421d10e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-08-26  Peter Bloomfield 
+
+	set-statusbar is a BalsaWindow method.
+
+	* src/balsa-index.c (balsa_index_transfer):
+	* src/balsa-mblist.c (balsa_mblist_open_mailbox),
+	(bmbl_update_mailbox):
+	* src/balsa-mblist.h:
+	* src/main-window.c:
+	* src/main-window.h:
+
 2009-08-20  Peter Bloomfield
 
 	* src/main-window.c: build with --disable-threads.
diff --git a/src/balsa-index.c b/src/balsa-index.c
index 37135ed..4cfd576 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -2165,7 +2165,7 @@ balsa_index_transfer(BalsaIndex *index, GArray * msgnos,
 	return;
     }
 
-    balsa_mblist_set_status_bar(from_mailbox);
+    balsa_window_set_statusbar(balsa_app.main_window, from_mailbox);
 
     if (from_mailbox == balsa_app.trash && !copy)
         enable_empty_trash(balsa_app.main_window, TRASH_CHECK);
diff --git a/src/balsa-mblist.c b/src/balsa-mblist.c
index dbb2ca1..eee1dc6 100644
--- a/src/balsa-mblist.c
+++ b/src/balsa-mblist.c
@@ -1150,7 +1150,7 @@ balsa_mblist_open_mailbox(LibBalsaMailbox * mailbox)
     }
     g_object_unref(mbnode);
     
-    balsa_mblist_set_status_bar(mailbox);
+    balsa_window_set_statusbar(balsa_app.main_window, mailbox);
 }
 
 void
@@ -1407,7 +1407,7 @@ bmbl_update_mailbox(GtkTreeStore * store, LibBalsaMailbox * mailbox)
     if (!bindex || mailbox != BALSA_INDEX(bindex)->mailbox_node->mailbox)
         return;
 
-    balsa_mblist_set_status_bar(mailbox);
+    balsa_window_set_statusbar(balsa_app.main_window, mailbox);
 }
 
 void
@@ -2165,54 +2165,6 @@ balsa_mblist_mru_option_menu_get(GtkWidget * combo_box)
     return g_slist_nth_data(mro->real_urls, active);
 }
 
-void
-balsa_mblist_set_status_bar(LibBalsaMailbox * mailbox)
-{
-    gint total_messages = libbalsa_mailbox_total_messages(mailbox);
-    gint unread_messages = mailbox->unread_messages;
-    gint hidden_messages;
-    GString *desc = g_string_new(NULL);
-    GtkStatusbar *statusbar;
-    guint context_id;
-
-    hidden_messages =
-        mailbox->msg_tree ? total_messages -
-        (g_node_n_nodes(mailbox->msg_tree, G_TRAVERSE_ALL) - 1) : 0;
-
-    /* xgettext: this is the first part of the message
-     * "Shown mailbox: %s with %d messages, %d new, %d hidden". */
-    g_string_append_printf(desc, _("Shown mailbox: %s "), mailbox->name);
-    if (total_messages > 0) {
-        /* xgettext: this is the second part of the message
-         * "Shown mailbox: %s with %d messages, %d new, %d hidden". */
-        g_string_append_printf(desc,
-                               ngettext("with %d message",
-                                        "with %d messages",
-                                        total_messages), total_messages);
-        if (unread_messages > 0)
-            /* xgettext: this is the third part of the message
-             * "Shown mailbox: %s with %d messages, %d new, %d hidden". */
-            g_string_append_printf(desc,
-                                   ngettext(", %d new", ", %d new",
-                                            unread_messages),
-                                   unread_messages);
-        if (hidden_messages > 0)
-            /* xgettext: this is the fourth part of the message
-             * "Shown mailbox: %s with %d messages, %d new, %d hidden". */
-            g_string_append_printf(desc,
-                                   ngettext(", %d hidden", ", %d hidden",
-                                            hidden_messages),
-                                   hidden_messages);
-    }
-
-    statusbar = GTK_STATUSBAR(balsa_app.main_window->statusbar);
-    context_id = gtk_statusbar_get_context_id(statusbar, "BalsaMBList message");
-    gtk_statusbar_pop(statusbar, context_id);
-    gtk_statusbar_push(statusbar, context_id, desc->str);
-
-    g_string_free(desc, TRUE);
-}
-
 static void
 bmbl_expand_to_row(BalsaMBList * mblist, GtkTreePath * path)
 {
diff --git a/src/balsa-mblist.h b/src/balsa-mblist.h
index 111c482..499dbb0 100644
--- a/src/balsa-mblist.h
+++ b/src/balsa-mblist.h
@@ -86,7 +86,6 @@ GtkWidget *balsa_mblist_mru_option_menu(GtkWindow * window,
 void balsa_mblist_mru_option_menu_set(GtkWidget * option_menu,
                                       const gchar * url);
 const gchar *balsa_mblist_mru_option_menu_get(GtkWidget * option_menu);
-void balsa_mblist_set_status_bar(LibBalsaMailbox * mailbox);
 
 /* BalsaMailboxNode methods */
 void balsa_mblist_mailbox_node_append(BalsaMailboxNode * root,
diff --git a/src/main-window.c b/src/main-window.c
index cf3e0f0..ed26a5d 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -4682,7 +4682,7 @@ bw_notebook_switch_page_cb(GtkWidget * notebook,
     gtk_combo_box_set_active(GTK_COMBO_BOX(window->filter_choice),
                              index->filter_no);
     balsa_mblist_focus_mailbox(balsa_app.mblist, mailbox);
-    balsa_mblist_set_status_bar(mailbox);
+    balsa_window_set_statusbar(window, mailbox);
 
     balsa_index_refresh_date(index);
     balsa_index_refresh_size(index);
@@ -5185,3 +5185,52 @@ balsa_window_select_all(GtkWindow * window)
 #endif /* HAVE_GTKHTML */
     }
 }
+
+void
+balsa_window_set_statusbar(BalsaWindow * window, LibBalsaMailbox * mailbox)
+{
+    gint total_messages = libbalsa_mailbox_total_messages(mailbox);
+    gint unread_messages = mailbox->unread_messages;
+    gint hidden_messages;
+    GString *desc = g_string_new(NULL);
+    GtkStatusbar *statusbar;
+    guint context_id;
+
+    hidden_messages =
+        mailbox->msg_tree ? total_messages -
+        (g_node_n_nodes(mailbox->msg_tree, G_TRAVERSE_ALL) - 1) : 0;
+
+    /* xgettext: this is the first part of the message
+     * "Shown mailbox: %s with %d messages, %d new, %d hidden". */
+    g_string_append_printf(desc, _("Shown mailbox: %s "), mailbox->name);
+    if (total_messages > 0) {
+        /* xgettext: this is the second part of the message
+         * "Shown mailbox: %s with %d messages, %d new, %d hidden". */
+        g_string_append_printf(desc,
+                               ngettext("with %d message",
+                                        "with %d messages",
+                                        total_messages), total_messages);
+        if (unread_messages > 0)
+            /* xgettext: this is the third part of the message
+             * "Shown mailbox: %s with %d messages, %d new, %d hidden". */
+            g_string_append_printf(desc,
+                                   ngettext(", %d new", ", %d new",
+                                            unread_messages),
+                                   unread_messages);
+        if (hidden_messages > 0)
+            /* xgettext: this is the fourth part of the message
+             * "Shown mailbox: %s with %d messages, %d new, %d hidden". */
+            g_string_append_printf(desc,
+                                   ngettext(", %d hidden", ", %d hidden",
+                                            hidden_messages),
+                                   hidden_messages);
+    }
+
+    statusbar = GTK_STATUSBAR(window->statusbar);
+    context_id =
+        gtk_statusbar_get_context_id(statusbar, "BalsaMBList message");
+    gtk_statusbar_pop(statusbar, context_id);
+    gtk_statusbar_push(statusbar, context_id, desc->str);
+
+    g_string_free(desc, TRUE);
+}
diff --git a/src/main-window.h b/src/main-window.h
index 1b6564c..889cc4d 100644
--- a/src/main-window.h
+++ b/src/main-window.h
@@ -152,6 +152,8 @@ void balsa_window_increase_activity(BalsaWindow * window,
                                     const gchar * message);
 void balsa_window_decrease_activity(BalsaWindow * window,
                                     const gchar * message);
+void balsa_window_set_statusbar(BalsaWindow     * window,
+                                LibBalsaMailbox * mailbox);
 
 #if defined(__FILE__) && defined(__LINE__)
 # ifdef __FUNCTION__



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