[gnome-chat] chat-contacts-list-dialog: Set a headerbar as our titlebar and add a close button and a done button



commit dce249995316e645f41df4aa521057530ebb8fb4
Author: Yosef Or Boczko <yoseforb gmail com>
Date:   Fri Sep 13 00:26:28 2013 +0300

    chat-contacts-list-dialog: Set a headerbar as our titlebar and add a close button and a done button

 src/chat-contacts-list-dialog.c  |    4 +++
 src/chat-contacts-list-dialog.ui |   41 +++++++++++++++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 3 deletions(-)
---
diff --git a/src/chat-contacts-list-dialog.c b/src/chat-contacts-list-dialog.c
index 80b772d..9eba12b 100644
--- a/src/chat-contacts-list-dialog.c
+++ b/src/chat-contacts-list-dialog.c
@@ -31,6 +31,7 @@
 struct _ChatContactsListDialogPrivate
 {
   GtkWidget *list_box;
+  GtkWidget *cancel_button;
   GHashTable *accounts;
   TpAccountManager *am;
 };
@@ -320,6 +321,8 @@ chat_contacts_list_dialog_init (ChatContactsListDialog *self)
                               (GtkListBoxSortFunc) chat_contacts_list_dialog_sort_func, NULL, NULL);
   gtk_list_box_set_header_func (GTK_LIST_BOX (priv->list_box), chat_contacts_list_dialog_update_header_func, 
NULL, NULL);
 
+  g_signal_connect_swapped (priv->cancel_button, "clicked", G_CALLBACK (gtk_widget_destroy), self);
+
   priv->accounts = g_hash_table_new_full (g_direct_hash,
                                           chat_contacts_list_dialog_accounts_key_equal_func,
                                           g_object_unref,
@@ -340,6 +343,7 @@ chat_contacts_list_dialog_class_init (ChatContactsListDialogClass *class)
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/chat/contacts-list-dialog.ui");
   gtk_widget_class_bind_template_child_private (widget_class, ChatContactsListDialog, list_box);
+  gtk_widget_class_bind_template_child_private (widget_class, ChatContactsListDialog, cancel_button);
 }
 
 
diff --git a/src/chat-contacts-list-dialog.ui b/src/chat-contacts-list-dialog.ui
index c378572..a674b62 100644
--- a/src/chat-contacts-list-dialog.ui
+++ b/src/chat-contacts-list-dialog.ui
@@ -3,12 +3,49 @@
   <!-- interface-requires gtk+ 3.10 -->
   <template class="ChatContactsListDialog" parent="GtkDialog">
     <property name="can_focus">False</property>
-    <property name="title" translatable="yes">Contacts</property>
+    <property name="title" translatable="yes">New Conversation</property>
     <property name="modal">True</property>
     <property name="default_width">400</property>
     <property name="default_height">600</property>
     <property name="destroy_with_parent">True</property>
     <property name="type_hint">dialog</property>
+    <child type="titlebar">
+      <object class="GtkHeaderBar" id="header_bar">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="vexpand">False</property>
+        <property name="title" translatable="yes">New Conversation</property>
+        <child>
+          <object class="GtkButton" id="cancel_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Cancel</property>
+            <style>
+              <class name="text-button"/>
+            </style>
+          </object>
+          <packing>
+            <property name="pack_type">start</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="done_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Done</property>
+            <style>
+              <class name="text-button"/>
+              <class name="suggested-action"/>
+            </style>
+          </object>
+          <packing>
+            <property name="pack_type">end</property>
+          </packing>
+        </child>
+      </object>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="box">
         <property name="can_focus">False</property>
@@ -17,7 +54,6 @@
           <object class="GtkScrolledWindow" id="scrolledwindow1">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="shadow_type">in</property>
             <child>
               <object class="GtkListBox" id="list_box">
               </object>
@@ -26,7 +62,6 @@
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
           </packing>
         </child>
       </object>


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