diff options
Diffstat (limited to 'shell/e-shell-window.c')
-rw-r--r-- | shell/e-shell-window.c | 74 |
1 files changed, 35 insertions, 39 deletions
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index 5513efbe95..f6176c1a35 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -19,10 +19,17 @@ * */ +/** + * SECTION: e-shell-window + * @short_description: the main window + * @include: shell/e-shell-window.h + **/ + #include "e-shell-window-private.h" #include <gconf/gconf-client.h> +#include <e-util/e-extensible.h> #include <e-util/e-plugin-ui.h> #include <e-util/e-util-private.h> @@ -45,9 +52,12 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static gulong signals[LAST_SIGNAL]; +G_DEFINE_TYPE_WITH_CODE ( + EShellWindow, e_shell_window, GTK_TYPE_WINDOW, + G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) + static void shell_window_menubar_update_new_menu (EShellWindow *shell_window) { @@ -299,7 +309,7 @@ shell_window_dispose (GObject *object) e_shell_window_private_dispose (E_SHELL_WINDOW (object)); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_shell_window_parent_class)->dispose (object); } static void @@ -308,13 +318,15 @@ shell_window_finalize (GObject *object) e_shell_window_private_finalize (E_SHELL_WINDOW (object)); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_shell_window_parent_class)->finalize (object); } static void shell_window_constructed (GObject *object) { e_shell_window_private_constructed (E_SHELL_WINDOW (object)); + + e_extensible_load_extensions (E_EXTENSIBLE (object)); } static GtkWidget * @@ -337,17 +349,21 @@ static GtkWidget * shell_window_construct_toolbar (EShellWindow *shell_window) { GtkUIManager *ui_manager; - GtkWidget *main_toolbar; + GtkWidget *toolbar; + GtkWidget *box; GtkToolItem *item; ui_manager = e_shell_window_get_ui_manager (shell_window); - main_toolbar = e_shell_window_get_managed_widget ( - shell_window, "/main-toolbar"); + box = gtk_hbox_new (FALSE, 0); + gtk_widget_show (box); e_binding_new ( shell_window, "toolbar-visible", - main_toolbar, "visible"); + box, "visible"); + + toolbar = e_shell_window_get_managed_widget ( + shell_window, "/main-toolbar"); /* XXX Having this separator in the UI definition doesn't work * because GtkUIManager is unaware of the "New" button, so @@ -360,7 +376,7 @@ shell_window_construct_toolbar (EShellWindow *shell_window) * convinced having it proxy some new type of GtkAction * is worth the extra effort. */ item = gtk_separator_tool_item_new (); - gtk_toolbar_insert (GTK_TOOLBAR (main_toolbar), item, 0); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0); gtk_widget_show (GTK_WIDGET (item)); item = e_menu_tool_button_new (_("New")); @@ -369,7 +385,7 @@ shell_window_construct_toolbar (EShellWindow *shell_window) GTK_WIDGET (item), "clicked", gtk_ui_manager_get_accel_group (ui_manager), GDK_N, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); - gtk_toolbar_insert (GTK_TOOLBAR (main_toolbar), item, 0); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0); gtk_widget_show (GTK_WIDGET (item)); g_signal_connect ( @@ -377,7 +393,14 @@ shell_window_construct_toolbar (EShellWindow *shell_window) G_CALLBACK (shell_window_toolbar_update_new_menu), GTK_MENU_TOOL_BUTTON (item)); - return main_toolbar; + gtk_box_pack_start (GTK_BOX (box), toolbar, TRUE, TRUE, 0); + + toolbar = e_shell_window_get_managed_widget ( + shell_window, "/search-toolbar"); + gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE); + gtk_box_pack_start (GTK_BOX (box), toolbar, FALSE, FALSE, 0); + + return box; } static GtkWidget * @@ -582,11 +605,10 @@ shell_window_create_shell_view (EShellWindow *shell_window, } static void -shell_window_class_init (EShellWindowClass *class) +e_shell_window_class_init (EShellWindowClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EShellWindowPrivate)); object_class = G_OBJECT_CLASS (class); @@ -779,39 +801,13 @@ shell_window_class_init (EShellWindowClass *class) } static void -shell_window_init (EShellWindow *shell_window) +e_shell_window_init (EShellWindow *shell_window) { shell_window->priv = E_SHELL_WINDOW_GET_PRIVATE (shell_window); e_shell_window_private_init (shell_window); } -GType -e_shell_window_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EShellWindowClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) shell_window_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EShellWindow), - 0, /* n_preallocs */ - (GInstanceInitFunc) shell_window_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_WINDOW, "EShellWindow", &type_info, 0); - } - - return type; -} - /** * e_shell_window_new: * @shell: an #EShell |