balsa r7961 - in trunk: . src



Author: PeterB
Date: Sun Aug 24 14:15:12 2008
New Revision: 7961
URL: http://svn.gnome.org/viewvc/balsa?rev=7961&view=rev

Log:
simplify get-toolbar and ui-manager

Modified:
   trunk/ChangeLog
   trunk/src/main-window.c
   trunk/src/main-window.h
   trunk/src/message-window.c
   trunk/src/message-window.h
   trunk/src/pref-manager.c
   trunk/src/sendmsg-window.c
   trunk/src/sendmsg-window.h
   trunk/src/toolbar-prefs.c

Modified: trunk/src/main-window.c
==============================================================================
--- trunk/src/main-window.c	(original)
+++ trunk/src/main-window.c	Sun Aug 24 14:15:12 2008
@@ -1348,8 +1348,8 @@
 #endif /* defined(ENABLE_TOUCH_UI) */
 };
 
-static BalsaToolbarModel *
-bw_get_toolbar_model(void)
+BalsaToolbarModel *
+balsa_window_get_toolbar_model(void)
 {
     static BalsaToolbarModel *model = NULL;
     GSList *standard;
@@ -1383,8 +1383,8 @@
 /* Create a GtkUIManager for a main window, with all the actions, but no
  * ui.
  */
-static GtkUIManager *
-bw_get_ui_manager(BalsaWindow * window)
+GtkUIManager *
+balsa_window_ui_manager_new(BalsaWindow * window)
 {
     GtkUIManager *ui_manager;
     GtkActionGroup *action_group;
@@ -1480,24 +1480,6 @@
     return ui_manager;
 }
 
-static BalsaToolbarModel *
-bw_get_toolbar_model_and_ui_manager(BalsaWindow * window,
-                                    GtkUIManager ** ui_manager)
-{
-    BalsaToolbarModel *model = bw_get_toolbar_model();
-
-    if (ui_manager)
-        *ui_manager = bw_get_ui_manager(window);
-
-    return model;
-}
-
-BalsaToolbarModel *
-balsa_window_get_toolbar_model(GtkUIManager ** ui_manager)
-{
-    return bw_get_toolbar_model_and_ui_manager(NULL, ui_manager);
-}
-
 /*
  * "window-state-event" signal handler
  *
@@ -1546,7 +1528,8 @@
     gtk_window_set_title(GTK_WINDOW(window), "Balsa");
     register_balsa_pixbufs(GTK_WIDGET(window));
 
-    model = bw_get_toolbar_model_and_ui_manager(window, &ui_manager);
+    model = balsa_window_get_toolbar_model();
+    ui_manager = balsa_window_ui_manager_new(window);
 
     accel_group = gtk_ui_manager_get_accel_group(ui_manager);
     gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);

Modified: trunk/src/main-window.h
==============================================================================
--- trunk/src/main-window.h	(original)
+++ trunk/src/main-window.h	Sun Aug 24 14:15:12 2008
@@ -122,8 +122,8 @@
 void check_new_messages_count(LibBalsaMailbox * mailbox, gboolean notify);
 void empty_trash(BalsaWindow * window);
 void update_view_menu(BalsaWindow * window);
-BalsaToolbarModel *balsa_window_get_toolbar_model(GtkUIManager **
-                                                  ui_manager);
+BalsaToolbarModel *balsa_window_get_toolbar_model(void);
+GtkUIManager *balsa_window_ui_manager_new(BalsaWindow * window);
 void balsa_window_select_all(GtkWindow * window);
 gboolean balsa_window_next_unread(BalsaWindow * window);
 

Modified: trunk/src/message-window.c
==============================================================================
--- trunk/src/message-window.c	(original)
+++ trunk/src/message-window.c	Sun Aug 24 14:15:12 2008
@@ -21,23 +21,18 @@
 
 #include "config.h"
 
-#include <gnome.h>
+#include "message-window.h"
 #include "balsa-app.h"
 #include "balsa-message.h"
 #include "balsa-icons.h"
 #include "balsa-index.h"
 #include "main-window.h"
 #include "sendmsg-window.h"
-#include "message-window.h"
 #include "print.h"
-#include "toolbar-factory.h"
 #include "mailbox-node.h"
 
-#include "libbalsa.h"
 #include <glib/gi18n.h>
 
-typedef struct _MessageWindow MessageWindow;
-
 /* callbacks */
 static void destroy_message_window(GtkWidget * widget, MessageWindow * mw);
 static void mw_expunged_cb(LibBalsaMailbox * mailbox, guint msgno,
@@ -388,8 +383,8 @@
 /* Create a GtkUIManager for a message window, with all the actions, but no
  * ui.
  */
-static GtkUIManager *
-mw_get_ui_manager(MessageWindow * mw)
+GtkUIManager *
+message_window_ui_manager_new(MessageWindow * mw)
 {
     GtkUIManager *ui_manager;
     GtkActionGroup *action_group;
@@ -450,8 +445,8 @@
 
 /* Create the toolbar model for the message window's toolbar.
  */
-static BalsaToolbarModel *
-mw_get_toolbar_model(void)
+BalsaToolbarModel *
+message_window_get_toolbar_model(void)
 {
     static BalsaToolbarModel *model = NULL;
     GSList *standard;
@@ -474,24 +469,6 @@
     return model;
 }
 
-static BalsaToolbarModel *
-mw_get_toolbar_model_and_ui_manager(MessageWindow * window,
-                                    GtkUIManager ** ui_manager)
-{
-    BalsaToolbarModel *model = mw_get_toolbar_model();
-
-    if (ui_manager)
-        *ui_manager = mw_get_ui_manager(window);
-
-    return model;
-}
-
-BalsaToolbarModel *
-message_window_get_toolbar_model(GtkUIManager ** ui_manager)
-{
-    return mw_get_toolbar_model_and_ui_manager(NULL, ui_manager);
-}
-
 /*
  * end of UI definitions and functions
  */
@@ -575,7 +552,8 @@
     mw->headers_shown=balsa_app.shown_headers;
     mw->show_all_headers = FALSE;
 
-    model = mw_get_toolbar_model_and_ui_manager(mw, &ui_manager);
+    model = message_window_get_toolbar_model();
+    ui_manager = message_window_ui_manager_new(mw);
 
     accel_group = gtk_ui_manager_get_accel_group(ui_manager);
     gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);

Modified: trunk/src/message-window.h
==============================================================================
--- trunk/src/message-window.h	(original)
+++ trunk/src/message-window.h	Sun Aug 24 14:15:12 2008
@@ -23,9 +23,13 @@
 #define __MESSAGE_WINDOW_H__
 
 #include "libbalsa.h"
+#include "toolbar-factory.h"
+#include <gtk/gtk.h>
+
+typedef struct _MessageWindow MessageWindow;
 
 void message_window_new(LibBalsaMailbox * mailbox, guint msgno);
-BalsaToolbarModel *message_window_get_toolbar_model(GtkUIManager **
-                                                    ui_manager);
+BalsaToolbarModel *message_window_get_toolbar_model(void);
+GtkUIManager *message_window_ui_manager_new(MessageWindow * mw);
 
 #endif				/* __MESSAGE_WINDOW_H__ */

Modified: trunk/src/pref-manager.c
==============================================================================
--- trunk/src/pref-manager.c	(original)
+++ trunk/src/pref-manager.c	Sun Aug 24 14:15:12 2008
@@ -911,7 +911,7 @@
     balsa_app.always_queue_sent_mail =
         GTK_TOGGLE_BUTTON(pui->always_queue_sent_mail)->active;
     if (balsa_app.always_queue_sent_mail != save_setting)
-        balsa_toolbar_model_changed(balsa_window_get_toolbar_model(NULL));
+        balsa_toolbar_model_changed(balsa_window_get_toolbar_model());
 
     balsa_app.copy_to_sentbox =
         GTK_TOGGLE_BUTTON(pui->copy_to_sentbox)->active;

Modified: trunk/src/sendmsg-window.c
==============================================================================
--- trunk/src/sendmsg-window.c	(original)
+++ trunk/src/sendmsg-window.c	Sun Aug 24 14:15:12 2008
@@ -596,8 +596,8 @@
 /* Create a GtkUIManager for a compose window, with all the actions, but
  * no ui.
  */
-static GtkUIManager *
-sw_get_ui_manager(BalsaSendmsg * bsmsg)
+GtkUIManager *
+sendmsg_window_ui_manager_new(BalsaSendmsg * bsmsg)
 {
     GtkUIManager *ui_manager;
     GtkActionGroup *action_group;
@@ -4439,8 +4439,8 @@
 
 /* Create the toolbar model for the compose window's toolbar.
  */
-static BalsaToolbarModel *
-sw_get_toolbar_model(void)
+BalsaToolbarModel *
+sendmsg_window_get_toolbar_model(void)
 {
     static BalsaToolbarModel *model = NULL;
     GSList *standard;
@@ -4466,24 +4466,6 @@
     return model;
 }
 
-static BalsaToolbarModel *
-sw_get_toolbar_model_and_ui_manager(BalsaSendmsg * bsmsg,
-                                    GtkUIManager ** ui_manager)
-{
-    BalsaToolbarModel *model = sw_get_toolbar_model();
-
-    if (ui_manager)
-        *ui_manager = sw_get_ui_manager(bsmsg);
-
-    return model;
-}
-
-BalsaToolbarModel *
-sendmsg_window_get_toolbar_model(GtkUIManager ** ui_manager)
-{
-    return sw_get_toolbar_model_and_ui_manager(NULL, ui_manager);
-}
-
 static void
 bsmsg_identities_changed_cb(BalsaSendmsg * bsmsg)
 {
@@ -4574,7 +4556,8 @@
     g_signal_connect(G_OBJECT(window), "size_allocate",
 		     G_CALLBACK(sw_size_alloc_cb), bsmsg);
 
-    model = sw_get_toolbar_model_and_ui_manager(bsmsg, &ui_manager);
+    model = sendmsg_window_get_toolbar_model();
+    ui_manager = sendmsg_window_ui_manager_new(bsmsg);
 
     accel_group = gtk_ui_manager_get_accel_group(ui_manager);
     gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);

Modified: trunk/src/sendmsg-window.h
==============================================================================
--- trunk/src/sendmsg-window.h	(original)
+++ trunk/src/sendmsg-window.h	Sun Aug 24 14:15:12 2008
@@ -141,8 +141,8 @@
     BalsaSendmsg *sendmsg_window_new_from_list(LibBalsaMailbox * mailbox,
                                                GArray * selected,
                                                SendType type);
-    BalsaToolbarModel *sendmsg_window_get_toolbar_model(GtkUIManager **
-                                                        ui_manager);
+    BalsaToolbarModel *sendmsg_window_get_toolbar_model(void);
+    GtkUIManager *sendmsg_window_ui_manager_new(BalsaSendmsg * bsmsg);
 
 #define SENDMSG_WINDOW_QUIT_ON_CLOSE(bsmsg) ((bsmsg)->quit_on_close=TRUE)
 

Modified: trunk/src/toolbar-prefs.c
==============================================================================
--- trunk/src/toolbar-prefs.c	(original)
+++ trunk/src/toolbar-prefs.c	Sun Aug 24 14:15:12 2008
@@ -145,19 +145,22 @@
 
     /* The order of pages must be consistent with the BalsaToolbarType
      * enum. */
-    model = balsa_window_get_toolbar_model(&ui_manager);
+    model = balsa_window_get_toolbar_model();
+    ui_manager = balsa_window_ui_manager_new(NULL);
     child = create_toolbar_page(model, ui_manager);
     g_object_unref(ui_manager);
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook), child,
                              gtk_label_new(_("Main window")));
 
-    model = sendmsg_window_get_toolbar_model(&ui_manager);
+    model = sendmsg_window_get_toolbar_model();
+    ui_manager = sendmsg_window_ui_manager_new(NULL);
     child = create_toolbar_page(model, ui_manager);
     g_object_unref(ui_manager);
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook), child,
                              gtk_label_new(_("Compose window")));
 
-    model = message_window_get_toolbar_model(&ui_manager);
+    model = message_window_get_toolbar_model();
+    ui_manager = message_window_ui_manager_new(NULL);
     child = create_toolbar_page(model, ui_manager);
     g_object_unref(ui_manager);
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook), child,



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