]> git.0d.be Git - empathy.git/blobdiff - src/empathy-chatrooms-window.c
Updated Polish translation
[empathy.git] / src / empathy-chatrooms-window.c
index 474a3ef1064efac203d5e5866a73102b12f975c7..aae8aac3234588659fcc7ae562daad1eddd6c8ca 100644 (file)
@@ -15,8 +15,8 @@
  *
  * You should have received a copy of the GNU General Public
  * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301  USA
  *
  * Authors: Xavier Claessens <xclaesse@gmail.com>
  *          Martyn Russell <martyn@imendio.com>
@@ -29,7 +29,6 @@
 #include <stdio.h>
 
 #include <gtk/gtk.h>
-#include <glade/glade.h>
 #include <glib.h>
 #include <glib/gi18n.h>
 
@@ -53,8 +52,6 @@ typedef struct {
        GtkWidget             *button_remove;
        GtkWidget             *button_edit;
        GtkWidget             *button_close;
-
-       gint                   room_column;
 } EmpathyChatroomsWindow;
 
 static void             chatrooms_window_destroy_cb                      (GtkWidget             *widget,
@@ -107,8 +104,8 @@ void
 empathy_chatrooms_window_show (GtkWindow *parent)
 {
        static EmpathyChatroomsWindow *window = NULL;
-       GladeXML                     *glade;
-       gchar                        *filename;
+       GtkBuilder                    *gui;
+       gchar                         *filename;
 
        if (window) {
                gtk_window_present (GTK_WINDOW (window->window));
@@ -117,10 +114,8 @@ empathy_chatrooms_window_show (GtkWindow *parent)
 
        window = g_new0 (EmpathyChatroomsWindow, 1);
 
-       filename = empathy_file_lookup ("empathy-chatrooms-window.glade", "src");
-       glade = empathy_glade_get_file (filename,
-                                      "chatrooms_window",
-                                      NULL,
+       filename = empathy_file_lookup ("empathy-chatrooms-window.ui", "src");
+       gui = empathy_builder_get_file (filename,
                                       "chatrooms_window", &window->window,
                                       "hbox_account", &window->hbox_account,
                                       "label_account", &window->label_account,
@@ -131,20 +126,19 @@ empathy_chatrooms_window_show (GtkWindow *parent)
                                       NULL);
        g_free (filename);
 
-       empathy_glade_connect (glade,
-                             window,
+       empathy_builder_connect (gui, window,
                              "chatrooms_window", "destroy", chatrooms_window_destroy_cb,
                              "button_remove", "clicked", chatrooms_window_button_remove_clicked_cb,
                              "button_edit", "clicked", chatrooms_window_button_edit_clicked_cb,
                              "button_close", "clicked", chatrooms_window_button_close_clicked_cb,
                              NULL);
 
-       g_object_unref (glade);
+       g_object_unref (gui);
 
        g_object_add_weak_pointer (G_OBJECT (window->window), (gpointer) &window);
 
        /* Get the session and chat room manager */
-       window->manager = empathy_chatroom_manager_new ();
+       window->manager = empathy_chatroom_manager_dup_singleton (NULL);
 
        g_signal_connect (window->manager, "chatroom-added",
                          G_CALLBACK (chatrooms_window_chatroom_added_cb),
@@ -158,7 +152,7 @@ empathy_chatrooms_window_show (GtkWindow *parent)
        empathy_account_chooser_set_filter (EMPATHY_ACCOUNT_CHOOSER (window->account_chooser),
                                            empathy_account_chooser_filter_is_connected,
                                            NULL);
-       g_object_set (window->account_chooser, 
+       g_object_set (window->account_chooser,
                      "has-all-option", TRUE,
                      NULL);
        empathy_account_chooser_set_account (EMPATHY_ACCOUNT_CHOOSER (window->account_chooser), NULL);
@@ -226,7 +220,7 @@ chatrooms_window_model_setup (EmpathyChatroomsWindow *window)
 
        gtk_tree_view_set_model (view, GTK_TREE_MODEL (store));
 
-       /* Selection */ 
+       /* Selection */
        selection = gtk_tree_view_get_selection (view);
        gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
 
@@ -277,16 +271,15 @@ chatrooms_window_model_add_columns (EmpathyChatroomsWindow *window)
 
        /* Room */
        cell = gtk_cell_renderer_text_new ();
-       column = gtk_tree_view_column_new_with_attributes (_("Room"), cell, 
-                                                          "text", COL_ROOM, 
+       column = gtk_tree_view_column_new_with_attributes (_("Room"), cell,
+                                                          "text", COL_ROOM,
                                                           NULL);
        count = gtk_tree_view_append_column (view, column);
        gtk_tree_view_column_set_sort_column_id (column, count - 1);
-       window->room_column = count - 1;
 
        /* Chatroom auto connect */
        cell = gtk_cell_renderer_toggle_new ();
-       column = gtk_tree_view_column_new_with_attributes (_("Auto Connect"), cell,
+       column = gtk_tree_view_column_new_with_attributes (_("Auto-Connect"), cell,
                                                           "active", COL_AUTO_CONNECT,
                                                           NULL);
        count = gtk_tree_view_append_column (view, column);
@@ -297,7 +290,7 @@ chatrooms_window_model_add_columns (EmpathyChatroomsWindow *window)
                          window);
 
        /* Sort model */
-       gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), 0, 
+       gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), 0,
                                              GTK_SORT_ASCENDING);
 }
 
@@ -310,9 +303,8 @@ chatrooms_window_model_refresh_data (EmpathyChatroomsWindow *window,
        GtkTreeModel          *model;
        GtkListStore          *store;
        GtkTreeIter            iter;
-       GtkTreeViewColumn     *column;
        EmpathyAccountChooser  *account_chooser;
-       McAccount             *account;
+       TpAccount             *account;
        GList                 *chatrooms, *l;
 
        view = GTK_TREE_VIEW (window->treeview);
@@ -322,21 +314,10 @@ chatrooms_window_model_refresh_data (EmpathyChatroomsWindow *window,
 
        /* Look up chatrooms */
        account_chooser = EMPATHY_ACCOUNT_CHOOSER (window->account_chooser);
-       account = empathy_account_chooser_get_account (account_chooser);
+       account = empathy_account_chooser_dup_account (account_chooser);
 
        chatrooms = empathy_chatroom_manager_get_chatrooms (window->manager, account);
 
-       /* Sort out columns, we only show the server column for
-        * selected protocol types, such as Jabber. 
-        */
-       if (account) {
-               column = gtk_tree_view_get_column (view, window->room_column);
-               gtk_tree_view_column_set_visible (column, TRUE);
-       } else {
-               column = gtk_tree_view_get_column (view, window->room_column);
-               gtk_tree_view_column_set_visible (column, FALSE);
-       }
-
        /* Clean out the store */
        gtk_list_store_clear (store);
 
@@ -413,7 +394,6 @@ chatrooms_window_model_cell_auto_connect_toggled (GtkCellRendererToggle  *cell,
        enabled = !enabled;
 
        empathy_chatroom_set_auto_connect (chatroom, enabled);
-       empathy_chatroom_manager_store (window->manager);
 
        gtk_list_store_set (store, &iter, COL_AUTO_CONNECT, enabled, -1);
        gtk_tree_path_free (path);
@@ -443,19 +423,9 @@ static void
 chatrooms_window_model_action_selected (EmpathyChatroomsWindow *window)
 {
        EmpathyChatroom *chatroom;
-       GtkTreeView    *view;
-       GtkTreeModel   *model;
-
-       view = GTK_TREE_VIEW (window->treeview);
-       model = gtk_tree_view_get_model (view);
 
+       /* FIXME: This is still not implemented since Gossip fork */
        chatroom = chatrooms_window_model_get_selected (window);
-       if (!chatroom) {
-               return;
-       }
-
-       //empathy_edit_chatroom_dialog_show (GTK_WINDOW (window->window), chatroom);
-
        g_object_unref (chatroom);
 }
 
@@ -465,7 +435,7 @@ chatrooms_window_row_activated_cb (GtkTreeView           *tree_view,
                                   GtkTreeViewColumn     *column,
                                   EmpathyChatroomsWindow *window)
 {
-       if (GTK_WIDGET_IS_SENSITIVE (window->button_edit)) {
+       if (gtk_widget_is_sensitive (window->button_edit)) {
                chatrooms_window_model_action_selected (window);
        }
 }
@@ -503,13 +473,8 @@ chatrooms_window_button_edit_clicked_cb (GtkWidget             *widget,
 {
        EmpathyChatroom *chatroom;
 
+       /* FIXME: This is still not implemented since Gossip fork */
        chatroom = chatrooms_window_model_get_selected (window);
-       if (!chatroom) {
-               return;
-       }
-
-       //empathy_edit_chatroom_dialog_show (GTK_WINDOW (window->window), chatroom);
-
        g_object_unref (chatroom);
 }
 
@@ -526,15 +491,15 @@ chatrooms_window_chatroom_added_cb (EmpathyChatroomManager *manager,
                                    EmpathyChatroomsWindow *window)
 {
        EmpathyAccountChooser *account_chooser;
-       McAccount            *account;
+       TpAccount             *account;
 
        account_chooser = EMPATHY_ACCOUNT_CHOOSER (window->account_chooser);
-       account = empathy_account_chooser_get_account (account_chooser);
+       account = empathy_account_chooser_dup_account (account_chooser);
 
        if (!account) {
                chatrooms_window_model_add (window, chatroom, FALSE);
        } else {
-               if (empathy_account_equal (account, empathy_chatroom_get_account (chatroom))) {
+               if (account == empathy_chatroom_get_account (chatroom)) {
                        chatrooms_window_model_add (window, chatroom, FALSE);
                }