[empathy: 9/12] PresetDialog: GNOME 3-ify the remove button



commit fb207a362a266da923f6f87c91c0dd649cfa9183
Author: Will Thompson <will thompson collabora co uk>
Date:   Fri Jun 24 11:09:28 2011 +0100

    PresetDialog: GNOME 3-ify the remove button
    
    Yum yum joined-toolbar!

 libempathy-gtk/empathy-status-preset-dialog.c  |   12 ++++-
 libempathy-gtk/empathy-status-preset-dialog.ui |   70 +++++++++++++++---------
 2 files changed, 54 insertions(+), 28 deletions(-)
---
diff --git a/libempathy-gtk/empathy-status-preset-dialog.c b/libempathy-gtk/empathy-status-preset-dialog.c
index 1230555..30c5c6b 100644
--- a/libempathy-gtk/empathy-status-preset-dialog.c
+++ b/libempathy-gtk/empathy-status-preset-dialog.c
@@ -524,9 +524,11 @@ empathy_status_preset_dialog_init (EmpathyStatusPresetDialog *self)
 			EMPATHY_TYPE_STATUS_PRESET_DIALOG,
 			EmpathyStatusPresetDialogPriv);
 	GtkBuilder *gui;
-	GtkWidget *toplevel_vbox, *remove_button, *entry;
+	GtkWidget *toplevel_vbox, *presets_sw, *remove_toolbar, *remove_button,
+		*entry;
 	GtkTreeSelection *selection;
 	char *filename;
+	GtkStyleContext *context;
 
 	gtk_window_set_title (GTK_WINDOW (self),
 			_("Edit Custom Messages"));
@@ -538,13 +540,21 @@ empathy_status_preset_dialog_init (EmpathyStatusPresetDialog *self)
 			"libempathy-gtk");
 	gui = empathy_builder_get_file (filename,
 			"toplevel-vbox", &toplevel_vbox,
+			"presets-sw", &presets_sw,
 			"presets-treeview", &priv->presets_treeview,
+			"remove-toolbar", &remove_toolbar,
 			"remove-button", &remove_button,
 			"add-combobox", &priv->add_combobox,
 			"add-button", &priv->add_button,
 			NULL);
 	g_free (filename);
 
+	/* join the remove toolbar to the treeview */
+	context = gtk_widget_get_style_context (presets_sw);
+	gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
+	context = gtk_widget_get_style_context (remove_toolbar);
+	gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
+
 	selection = gtk_tree_view_get_selection (
 		GTK_TREE_VIEW (priv->presets_treeview));
 	g_signal_connect (selection,
diff --git a/libempathy-gtk/empathy-status-preset-dialog.ui b/libempathy-gtk/empathy-status-preset-dialog.ui
index c287f8e..b39e9a7 100644
--- a/libempathy-gtk/empathy-status-preset-dialog.ui
+++ b/libempathy-gtk/empathy-status-preset-dialog.ui
@@ -23,48 +23,64 @@
       </packing>
     </child>
     <child>
-      <object class="GtkScrolledWindow" id="scrolledwindow1">
-        <property name="width_request">408</property>
-        <property name="height_request">252</property>
+      <object class="GtkVBox" id="vbox1">
         <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="hscrollbar_policy">never</property>
-        <property name="shadow_type">etched-in</property>
+        <property name="can_focus">False</property>
         <child>
-          <object class="GtkTreeView" id="presets-treeview">
+          <object class="GtkScrolledWindow" id="presets-sw">
+            <property name="width_request">408</property>
+            <property name="height_request">252</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="headers_visible">False</property>
+            <property name="hscrollbar_policy">never</property>
+            <property name="shadow_type">etched-in</property>
+            <child>
+              <object class="GtkTreeView" id="presets-treeview">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="headers_visible">False</property>
+              </object>
+            </child>
           </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
         </child>
-      </object>
-      <packing>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkHButtonBox" id="hbuttonbox1">
-        <property name="visible">True</property>
-        <property name="layout_style">end</property>
         <child>
-          <object class="GtkButton" id="remove-button">
-            <property name="label">gtk-remove</property>
+          <object class="GtkToolbar" id="remove-toolbar">
             <property name="visible">True</property>
-            <property name="sensitive">False</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">True</property>
-            <property name="use_stock">True</property>
+            <property name="can_focus">False</property>
+            <property name="icon_size">1</property>
+            <style>
+              <class name="inline-toolbar"/>
+            </style>
+            <child>
+              <object class="GtkToolButton" id="remove-button">
+                <property name="tooltip-text" translatable="yes">Remove</property>
+                <property name="visible">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="stock_id">gtk-remove</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">0</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </object>
       <packing>
-        <property name="expand">False</property>
-        <property name="position">2</property>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
       </packing>
     </child>
     <child>



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