[gnome-chat] window: Use ChatContactsListDialog



commit b5d6ea52fd128a94799a266893accfc9af7298de
Author: Yosef Or Boczko <yoseforb gmail com>
Date:   Tue Sep 10 14:04:58 2013 +0300

    window: Use ChatContactsListDialog

 src/chat-main-toolbar.ui |    1 +
 src/chat-main-window.c   |   18 +++++++++++++++++-
 src/chat-main-window.h   |    2 ++
 3 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/chat-main-toolbar.ui b/src/chat-main-toolbar.ui
index 006005d..1098366 100644
--- a/src/chat-main-toolbar.ui
+++ b/src/chat-main-toolbar.ui
@@ -42,6 +42,7 @@
             <property name="focus_on_click">False</property>
             <property name="valign">center</property>
             <property name="visible">True</property>
+            <property name="action_name">win.add-conversation</property>
             <style>
               <class name="image-button"/>
             </style>
diff --git a/src/chat-main-window.c b/src/chat-main-window.c
index 3816195..7b82509 100644
--- a/src/chat-main-window.c
+++ b/src/chat-main-window.c
@@ -25,6 +25,7 @@
 #include <glib/gi18n.h>
 
 #include "chat-about-data.h"
+#include "chat-contacts-list-dialog.h"
 #include "chat-embed.h"
 #include "chat-main-window.h"
 #include "chat-settings.h"
@@ -158,11 +159,11 @@ chat_main_window_dispose (GObject *object)
   G_OBJECT_CLASS (chat_main_window_parent_class)->dispose (object);
 }
 
-
 static void
 chat_main_window_init (ChatMainWindow *self)
 {
   ChatMainWindowPrivate *priv;
+  GSimpleAction *action;
   GVariant *variant;
   gboolean maximized;
   const gint32 *position;
@@ -174,6 +175,11 @@ chat_main_window_init (ChatMainWindow *self)
 
   gtk_widget_init_template (GTK_WIDGET (self));
 
+  action = g_simple_action_new ("add-conversation", NULL);
+  g_signal_connect_swapped (action, "activate", G_CALLBACK (chat_main_window_add_conversation_cb), self);
+  g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (action));
+  g_object_unref (action);
+
   priv->settings = chat_settings_dup_singleton ();
 
   variant = g_settings_get_value (priv->settings, "window-size");
@@ -251,3 +257,13 @@ chat_main_window_show_about (ChatMainWindow *self)
   gtk_widget_show (about_dialog);
   g_signal_connect (about_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
 }
+
+void chat_main_window_add_conversation_cb (ChatMainWindow *self)
+{
+  GtkWidget *contact_lists;
+
+  contact_lists = chat_contacts_list_dialog_new ();
+  gtk_window_set_transient_for (GTK_WINDOW (contact_lists), GTK_WINDOW (self));
+
+  gtk_widget_show_all (contact_lists);
+}
diff --git a/src/chat-main-window.h b/src/chat-main-window.h
index abddd4e..5b11bae 100644
--- a/src/chat-main-window.h
+++ b/src/chat-main-window.h
@@ -69,6 +69,8 @@ GtkWidget             *chat_main_window_new                    (GtkApplication *
 
 void                   chat_main_window_show_about             (ChatMainWindow *self);
 
+void                   chat_main_window_add_conversation_cb    (ChatMainWindow *self);
+
 G_END_DECLS
 
 #endif /* CHAT_MAIN_WINDOW_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]