[gnome-color-manager] trivial: use the inline-toolbar style in gcm-prefs



commit 82183740905f9e47cb122c4c8ba8e50014c30687
Author: Richard Hughes <richard hughsie com>
Date:   Mon Mar 28 19:50:47 2011 +0100

    trivial: use the inline-toolbar style in gcm-prefs

 data/gcm-prefs.ui |  121 ++++++++++++++++++++++++-----------------------------
 src/gcm-prefs.c   |   55 +++++++++++++++++-------
 2 files changed, 95 insertions(+), 81 deletions(-)
---
diff --git a/data/gcm-prefs.ui b/data/gcm-prefs.ui
index e7f8083..e3a654e 100644
--- a/data/gcm-prefs.ui
+++ b/data/gcm-prefs.ui
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <requires lib="gtk+" version="2.20"/>
+  <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkDialog" id="dialog_assign">
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
@@ -202,9 +202,8 @@
                   <object class="GtkVBox" id="vbox3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="spacing">3</property>
                     <child>
-                      <object class="GtkScrolledWindow" id="scrolledwindow1">
+                      <object class="GtkScrolledWindow" id="scrolledwindow_devices">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="shadow_type">in</property>
@@ -226,76 +225,66 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkHButtonBox" id="hbuttonbox1">
+                      <object class="GtkToolbar" id="toolbar_devices">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="spacing">6</property>
-                        <property name="layout_style">start</property>
+                        <property name="show_arrow">False</property>
+                        <property name="icon_size">1</property>
                         <child>
-                          <object class="GtkButton" id="button_device_add">
-                            <property name="label" comments="This is a button to add a virtual device">gtk-add</property>
+                          <object class="GtkToolButton" id="toolbutton_device_add">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="tooltip_text">Add a virtual device</property>
                             <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
-                            <property name="use_stock">True</property>
+                            <property name="icon_name">list-add-symbolic</property>
                           </object>
                           <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
+                            <property name="expand">False</property>
+                            <property name="homogeneous">True</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="button_delete">
-                            <property name="label" comments="This is a button to delete the saved or virtual device">gtk-remove</property>
+                          <object class="GtkToolButton" id="toolbutton_device_remove">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">False</property>
+                            <property name="tooltip_text">Remove a device</property>
                             <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
-                            <property name="use_stock">True</property>
+                            <property name="icon_name">list-remove-symbolic</property>
                           </object>
                           <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
+                            <property name="expand">False</property>
+                            <property name="homogeneous">True</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="button_default">
-                            <property name="label" translatable="yes" comments="This is when the settings are set for all users, unless they have per-user settings themselves">_Set for all users</property>
+                          <object class="GtkToolButton" id="toolbutton_device_default">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="has_tooltip">True</property>
-                            <property name="tooltip_markup" translatable="yes">Save these profiles for all users</property>
-                            <property name="tooltip_text" translatable="yes">Save these profiles for all users</property>
+                            <property name="can_focus">False</property>
+                            <property name="tooltip_text">Set this device for all users on this computer</property>
                             <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
+                            <property name="icon_name">document-save-symbolic</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">2</property>
-                            <property name="secondary">True</property>
+                            <property name="homogeneous">True</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="button_calibrate">
-                            <property name="label" translatable="yes" comments="This is a button to calibrate the device by creating an ICC profile file using a hardware device or a reference image">Calibrate</property>
+                          <object class="GtkToggleToolButton" id="toolbutton_device_calibrate">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="tooltip_text" translatable="yes">Calibrate the device</property>
                             <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
+                            <property name="icon_name">system-run-symbolic</property>
                           </object>
                           <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">3</property>
-                            <property name="secondary">True</property>
+                            <property name="expand">False</property>
+                            <property name="homogeneous">True</property>
                           </packing>
                         </child>
                       </object>
@@ -316,7 +305,6 @@
                   <object class="GtkVBox" id="vbox4">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="spacing">3</property>
                     <child>
                       <object class="GtkScrolledWindow" id="scrolledwindow_assign">
                         <property name="visible">True</property>
@@ -340,54 +328,55 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkHButtonBox" id="hbuttonbox2">
+                      <object class="GtkToolbar" id="toolbar_profiles">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="spacing">6</property>
-                        <property name="layout_style">start</property>
+                        <property name="show_arrow">False</property>
+                        <property name="icon_size">1</property>
                         <child>
-                          <object class="GtkButton" id="button_assign_add">
-                            <property name="label">gtk-add</property>
+                          <object class="GtkToolButton" id="toolbutton_profile_add">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="has_tooltip">True</property>
+                            <property name="tooltip_text">Add a profile for the device</property>
                             <property name="use_action_appearance">False</property>
-                            <property name="use_stock">True</property>
+                            <property name="use_underline">True</property>
+                            <property name="icon_name">list-add-symbolic</property>
                           </object>
                           <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
+                            <property name="expand">False</property>
+                            <property name="homogeneous">True</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="button_assign_remove">
-                            <property name="label">gtk-remove</property>
+                          <object class="GtkToolButton" id="toolbutton_profile_remove">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">False</property>
+                            <property name="has_tooltip">True</property>
+                            <property name="tooltip_text">Remove a profile from the device</property>
                             <property name="use_action_appearance">False</property>
-                            <property name="use_stock">True</property>
+                            <property name="use_underline">True</property>
+                            <property name="icon_name">list-remove-symbolic</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">1</property>
+                            <property name="homogeneous">True</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="button_assign_make_default">
-                            <property name="label" translatable="yes">Set default</property>
+                          <object class="GtkToolButton" id="toolbutton_profile_default">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="has_tooltip">True</property>
+                            <property name="tooltip_text">Makes the profile default for the device</property>
                             <property name="use_action_appearance">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="icon_name">emblem-default-symbolic</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">2</property>
-                            <property name="secondary">True</property>
+                            <property name="homogeneous">True</property>
                           </packing>
                         </child>
                       </object>
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 234a192..ce6833c 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -954,7 +954,7 @@ gcm_prefs_profile_make_default_internal (GcmPrefsPriv *prefs,
 
 	/* set button insensitive */
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_assign_make_default"));
+						     "toolbutton_profile_default"));
 	gtk_widget_set_sensitive (widget, FALSE);
 out:
 	g_object_unref (profile);
@@ -1316,7 +1316,7 @@ gcm_prefs_set_calibrate_button_sensitivity (GcmPrefsPriv *prefs)
 out:
 	/* control the tooltip and sensitivity of the button */
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_calibrate"));
+						     "toolbutton_device_calibrate"));
 	gtk_widget_set_tooltip_text (widget, tooltip);
 	gtk_widget_set_sensitive (widget, ret);
 }
@@ -1373,7 +1373,7 @@ gcm_prefs_devices_treeview_clicked_cb (GtkTreeSelection *selection,
 	/* can we delete this device? */
 	device_mode = cd_device_get_mode (prefs->current_device);
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_delete"));
+						     "toolbutton_device_remove"));
 	gtk_widget_set_sensitive (widget, device_mode == CD_DEVICE_MODE_VIRTUAL);
 
 	/* can this device calibrate */
@@ -1423,10 +1423,10 @@ gcm_prefs_profile_treeview_clicked_cb (GtkTreeSelection *selection,
 	if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
 
 		widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_assign_make_default"));
+						     "toolbutton_profile_default"));
 		gtk_widget_set_sensitive (widget, FALSE);
 		widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_assign_remove"));
+						     "toolbutton_profile_remove"));
 		gtk_widget_set_sensitive (widget, FALSE);
 
 		g_debug ("no row selected");
@@ -1444,12 +1444,12 @@ gcm_prefs_profile_treeview_clicked_cb (GtkTreeSelection *selection,
 
 	/* is the element the first in the list */
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_assign_make_default"));
+						     "toolbutton_profile_default"));
 	gtk_widget_set_sensitive (widget, !is_default);
 
 	/* we can only remove hard relationships */
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_assign_remove"));
+						     "toolbutton_profile_remove"));
 	if (relation == CD_DEVICE_RELATION_HARD) {
 		gtk_widget_set_tooltip_text (widget, "");
 		gtk_widget_set_sensitive (widget, TRUE);
@@ -2357,6 +2357,7 @@ gcm_viewer_startup_cb (GApplication *application, GcmPrefsPriv *prefs)
 	GtkWidget *main_window;
 	GtkWidget *widget;
 	gchar *text = NULL;
+	GtkStyleContext *context;
 
 	prefs->cancellable = g_cancellable_new ();
 
@@ -2390,15 +2391,15 @@ gcm_viewer_startup_cb (GApplication *application, GcmPrefsPriv *prefs)
 
 	/* assign buttons */
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_assign_add"));
+						     "toolbutton_profile_add"));
 	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gcm_prefs_profile_add_cb), prefs);
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_assign_remove"));
+						     "toolbutton_profile_remove"));
 	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gcm_prefs_profile_remove_cb), prefs);
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_assign_make_default"));
+						     "toolbutton_profile_default"));
 	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gcm_prefs_profile_make_default_cb), prefs);
 
@@ -2418,7 +2419,7 @@ gcm_viewer_startup_cb (GApplication *application, GcmPrefsPriv *prefs)
 
 	/* force to be at least 3 rows high */
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "scrolledwindow1"));
+						     "scrolledwindow_devices"));
 	gtk_widget_set_size_request (widget, 450, 36 * 3);
 
 	/* create assign tree view */
@@ -2447,7 +2448,7 @@ gcm_viewer_startup_cb (GApplication *application, GcmPrefsPriv *prefs)
 	gtk_widget_set_size_request (widget, 450, 36 * 3);
 
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_default"));
+						     "toolbutton_device_default"));
 	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gcm_prefs_default_cb), prefs);
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
@@ -2459,19 +2460,43 @@ gcm_viewer_startup_cb (GApplication *application, GcmPrefsPriv *prefs)
 				_("Compare profiles..."));
 	gtk_label_set_markup (GTK_LABEL (widget), text);
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_delete"));
+						     "toolbutton_device_remove"));
 	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gcm_prefs_delete_cb), prefs);
 	gtk_widget_set_sensitive (widget, FALSE);
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_device_add"));
+						     "toolbutton_device_add"));
 	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gcm_prefs_device_add_cb), prefs);
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
-						     "button_calibrate"));
+						     "toolbutton_device_calibrate"));
 	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gcm_prefs_calibrate_cb), prefs);
 
+	/* make devices toolbar sexy */
+	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
+						     "scrolledwindow_devices"));
+	context = gtk_widget_get_style_context (widget);
+	gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
+
+	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
+						     "toolbar_devices"));
+	context = gtk_widget_get_style_context (widget);
+	gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
+	gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
+
+	/* make profiles toolbar sexy */
+	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
+						     "scrolledwindow_assign"));
+	context = gtk_widget_get_style_context (widget);
+	gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
+
+	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
+						     "toolbar_profiles"));
+	context = gtk_widget_get_style_context (widget);
+	gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
+	gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
+
 	/* set up virtual dialog */
 	widget = GTK_WIDGET (gtk_builder_get_object (prefs->builder,
 						     "dialog_virtual"));



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