diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-08-23 20:08:18 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-08-23 22:09:36 +0800 |
commit | 1ad15d157971b6550cb11787a03463e891d29364 (patch) | |
tree | d477032973b531993eb8d9c58f7415cbc8a609d8 /src/empathy-main-window.c | |
parent | a54170335d7c6246f1606347ed109e682c883927 (diff) | |
download | gsoc2013-empathy-1ad15d157971b6550cb11787a03463e891d29364.tar gsoc2013-empathy-1ad15d157971b6550cb11787a03463e891d29364.tar.gz gsoc2013-empathy-1ad15d157971b6550cb11787a03463e891d29364.tar.bz2 gsoc2013-empathy-1ad15d157971b6550cb11787a03463e891d29364.tar.lz gsoc2013-empathy-1ad15d157971b6550cb11787a03463e891d29364.tar.xz gsoc2013-empathy-1ad15d157971b6550cb11787a03463e891d29364.tar.zst gsoc2013-empathy-1ad15d157971b6550cb11787a03463e891d29364.zip |
Move main window's UI manager to its own UI file
Glade doesn't support GtkUIManager so it was impossible to edit the main window at all
because of that.
Diffstat (limited to 'src/empathy-main-window.c')
-rw-r--r-- | src/empathy-main-window.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index fa50ef587..1463e8ed9 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -2096,7 +2096,7 @@ empathy_main_window_init (EmpathyMainWindow *window) { EmpathyMainWindowPriv *priv; EmpathyIndividualManager *individual_manager; - GtkBuilder *gui; + GtkBuilder *gui, *gui_mgr; GtkWidget *sw; GtkToggleAction *show_offline_widget; GtkAction *show_map_widget; @@ -2106,6 +2106,7 @@ empathy_main_window_init (EmpathyMainWindow *window) GSList *l; GtkTreeModel *model; GtkWidget *search_vbox; + GtkWidget *menubar; priv = window->priv = G_TYPE_INSTANCE_GET_PRIVATE (window, EMPATHY_TYPE_MAIN_WINDOW, EmpathyMainWindowPriv); @@ -2126,6 +2127,17 @@ empathy_main_window_init (EmpathyMainWindow *window) "balance_vbox", &priv->balance_vbox, "errors_vbox", &priv->errors_vbox, "auth_vbox", &priv->auth_vbox, + "search_vbox", &search_vbox, + "presence_toolbar", &priv->presence_toolbar, + "notebook", &priv->notebook, + "no_entry_label", &priv->no_entry_label, + "roster_scrolledwindow", &sw, + NULL); + g_free (filename); + + /* Set UI manager */ + filename = empathy_file_lookup ("empathy-main-window-menubar.ui", "src"); + gui_mgr = empathy_builder_get_file (filename, "ui_manager", &priv->ui_manager, "view_show_offline", &show_offline_widget, "view_show_protocols", &priv->show_protocols, @@ -2137,22 +2149,24 @@ empathy_main_window_init (EmpathyMainWindow *window) "view_history", &priv->view_history, "view_show_map", &show_map_widget, "room_join_favorites", &priv->room_join_favorites, - "presence_toolbar", &priv->presence_toolbar, - "notebook", &priv->notebook, - "no_entry_label", &priv->no_entry_label, - "roster_scrolledwindow", &sw, "view_balance_show_in_roster", &priv->view_balance_show_in_roster, - "search_vbox", &search_vbox, + "menubar", &menubar, NULL); g_free (filename); + /* The UI manager is living in its own .ui file as Glade doesn't support + * those. The GtkMenubar has to be in this file as well to we manually add + * it to the first position of the vbox. */ + gtk_box_pack_start (GTK_BOX (priv->main_vbox), menubar, FALSE, FALSE, 0); + gtk_box_reorder_child (GTK_BOX (priv->main_vbox), menubar, 0); + gtk_container_add (GTK_CONTAINER (window), priv->main_vbox); gtk_widget_show (priv->main_vbox); g_signal_connect (window, "key-press-event", G_CALLBACK (main_window_key_press_event_cb), NULL); - empathy_builder_connect (gui, window, + empathy_builder_connect (gui_mgr, window, "chat_quit", "activate", main_window_chat_quit_cb, "chat_new_message", "activate", main_window_chat_new_message_cb, "chat_new_call", "activate", main_window_chat_new_call_cb, @@ -2180,10 +2194,11 @@ empathy_main_window_init (EmpathyMainWindow *window) NULL); /* Set up connection related widgets. */ - main_window_connection_items_setup (window, gui); + main_window_connection_items_setup (window, gui_mgr); g_object_ref (priv->ui_manager); g_object_unref (gui); + g_object_unref (gui_mgr); #ifndef HAVE_LIBCHAMPLAIN gtk_action_set_visible (show_map_widget, FALSE); |