From 1ad15d157971b6550cb11787a03463e891d29364 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 23 Aug 2011 14:08:18 +0200 Subject: 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. --- src/empathy-main-window-menubar.ui | 307 ++++++++++++++++++++++++++++++++++++ src/empathy-main-window.c | 31 +++- src/empathy-main-window.ui | 309 ------------------------------------- 3 files changed, 330 insertions(+), 317 deletions(-) create mode 100644 src/empathy-main-window-menubar.ui (limited to 'src') diff --git a/src/empathy-main-window-menubar.ui b/src/empathy-main-window-menubar.ui new file mode 100644 index 000000000..979afe215 --- /dev/null +++ b/src/empathy-main-window-menubar.ui @@ -0,0 +1,307 @@ + + + + + + + + + chat + _Chat + + + + + im-message-new + chat_new_message + _New Conversation… + + + + + + audio-input-microphone + chat_new_call + New _Call… + + + + + + document-open-recent + view_history + _Previous Conversations + + + + + + gtk-add + chat_add_contact + _Add Contact… + + + + + gtk-find + chat_search_contacts + _Search for Contacts… + + + + + + document-send + view_show_ft_manager + _File Transfers + + + + + view_show_offline + _Offline Contacts + + + + + + view_show_protocols + Show P_rotocols + + + + + view_balance_show_in_roster + Credit Balance + False + + + + + view_show_map + Contacts on a _Map + + + + + gtk-quit + chat_quit + + + + + + edit + _Edit + + + + + edit_context + Context + + + + + edit_accounts + _Accounts + + + + + + edit_personal_information + _Personal Information + + + + + edit_blocked_contacts + _Blocked Contacts + + + + + gtk-preferences + edit_preferences + P_references + + + + + edit_search_contacts + Find in Contact _List + + + + + + view + _View + + + + + view_sort_by_name + True + Sort by _Name + True + 1 + 1 + + + + + view_sort_by_status + True + Sort by _Status + True + view_sort_by_name + 0 + + + + + view_normal_size_with_avatars + True + Normal Size With _Avatars + True + 0 + 0 + + + + + + view_normal_size + True + N_ormal Size + True + view_normal_size_with_avatars + 1 + + + + + + view_compact_size + True + _Compact Size + True + view_normal_size_with_avatars + 2 + + + + + + room + _Room + + + + + room_join_new + _Join… + + + + + room_join_favorites + Join _Favorites + + + + + + system-users + room_manage_favorites + Manage Favorites + + + + + help + _Help + + + + + gtk-help + help_contents + _Contents + + + + + + help_debug + _Debug + + + + + gtk-about + help_about + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + + 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); diff --git a/src/empathy-main-window.ui b/src/empathy-main-window.ui index bab01c10e..a92dd7327 100644 --- a/src/empathy-main-window.ui +++ b/src/empathy-main-window.ui @@ -1,317 +1,8 @@ - - - - - - chat - _Chat - - - - - im-message-new - chat_new_message - _New Conversation… - - - - - - audio-input-microphone - chat_new_call - New _Call… - - - - - - document-open-recent - view_history - _Previous Conversations - - - - - - gtk-add - chat_add_contact - _Add Contact… - - - - - gtk-find - chat_search_contacts - _Search for Contacts… - - - - - - document-send - view_show_ft_manager - _File Transfers - - - - - view_show_offline - _Offline Contacts - - - - - - view_show_protocols - Show P_rotocols - - - - - view_balance_show_in_roster - Credit Balance - False - - - - - view_show_map - Contacts on a _Map - - - - - gtk-quit - chat_quit - - - - - - edit - _Edit - - - - - edit_context - Context - - - - - edit_accounts - _Accounts - - - - - - edit_personal_information - _Personal Information - - - - - edit_blocked_contacts - _Blocked Contacts - - - - - gtk-preferences - edit_preferences - P_references - - - - - edit_search_contacts - Find in Contact _List - - - - - - view - _View - - - - - view_sort_by_name - True - Sort by _Name - True - 1 - 1 - - - - - view_sort_by_status - True - Sort by _Status - True - view_sort_by_name - 0 - - - - - view_normal_size_with_avatars - True - Normal Size With _Avatars - True - 0 - 0 - - - - - - view_normal_size - True - N_ormal Size - True - view_normal_size_with_avatars - 1 - - - - - - view_compact_size - True - _Compact Size - True - view_normal_size_with_avatars - 2 - - - - - - room - _Room - - - - - room_join_new - _Join… - - - - - room_join_favorites - Join _Favorites - - - - - - system-users - room_manage_favorites - Manage Favorites - - - - - help - _Help - - - - - gtk-help - help_contents - _Contents - - - - - - help_debug - _Debug - - - - - gtk-about - help_about - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - - - True - - - False - False - - True -- cgit v1.2.3