]> git.0d.be Git - empathy.git/blobdiff - src/empathy-main-window.c
Don't destroy MainWindow on delete-event, just hide it
[empathy.git] / src / empathy-main-window.c
index 62089b8b2c8df5cd238e8fdacd2a10a31ec869eb..0e75b1cbe07e4abba421779f973c36114dafd986 100644 (file)
@@ -1984,9 +1984,11 @@ main_window_connection_items_setup (EmpathyMainWindow *window,
                "room_join_favorites",
                "chat_new_message",
                "chat_new_call",
+               "chat_search_contacts",
                "chat_add_contact",
                "edit_personal_information",
-               "edit_blocked_contacts"
+               "edit_blocked_contacts",
+               "edit_search_contacts"
        };
 
        for (i = 0, list = NULL; i < G_N_ELEMENTS (actions_connected); i++) {
@@ -2096,7 +2098,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 +2108,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);
@@ -2119,6 +2122,10 @@ empathy_main_window_init (EmpathyMainWindow *window)
        gtk_window_set_role (GTK_WINDOW (window), "contact_list");
        gtk_window_set_default_size (GTK_WINDOW (window), 225, 325);
 
+       /* don't finalize the widget on delete-event, just hide it */
+       g_signal_connect (window, "delete-event",
+               G_CALLBACK (gtk_widget_hide_on_delete), NULL);
+
        /* Set up interface */
        filename = empathy_file_lookup ("empathy-main-window.ui", "src");
        gui = empathy_builder_get_file (filename,
@@ -2126,6 +2133,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 +2155,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 +2200,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);
@@ -2234,7 +2255,6 @@ empathy_main_window_init (EmpathyMainWindow *window)
        /* Set up the throbber */
        priv->throbber = gtk_spinner_new ();
        gtk_widget_set_size_request (priv->throbber, 16, -1);
-       gtk_widget_set_tooltip_text (priv->throbber, _("Show and edit accounts"));
        gtk_widget_set_events (priv->throbber, GDK_BUTTON_PRESS_MASK);
        g_signal_connect (priv->throbber, "button-press-event",
                G_CALLBACK (main_window_throbber_button_press_event_cb),