[gnome-control-center] printers: Place buttons adding/removing allowed users to toolbar



commit 107e4db2f8fba28a68fad36999c5ea5e5e454d4e
Author: Marek Kasik <mkasik redhat com>
Date:   Tue Jan 25 15:24:07 2011 +0100

    printers: Place buttons adding/removing allowed users to toolbar

 panels/printers/cc-printers-panel.c |   41 +++++++++++++++++++++++++++++++---
 panels/printers/printers.ui         |   37 +++++++++----------------------
 2 files changed, 48 insertions(+), 30 deletions(-)
---
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index 396e2d8..3d91331 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -1337,8 +1337,8 @@ supply_levels_draw_cb (GtkWidget *widget,
 }
 
 static void
-allowed_user_remove_cb (GtkButton *button,
-                        gpointer   user_data)
+allowed_user_remove_cb (GtkToolButton *button,
+                        gpointer       user_data)
 {
   CcPrintersPanelPrivate *priv;
   CcPrintersPanel        *self = (CcPrintersPanel*) user_data;
@@ -1470,8 +1470,8 @@ allowed_user_add_cb (GtkCellRendererText *renderer,
 }
 
 static void
-allowed_user_add_button_cb (GtkButton *button,
-                            gpointer   user_data)
+allowed_user_add_button_cb (GtkToolButton *button,
+                            gpointer       user_data)
 {
   CcPrintersPanelPrivate *priv;
   GtkTreeViewColumn      *column;
@@ -1674,6 +1674,35 @@ printer_maintenance_cb (GtkButton *button,
 }
 
 static void
+set_widget_style (GtkWidget *widget, gchar *style_data)
+{
+  GtkStyleProvider *provider;
+  GtkStyleContext  *context;
+
+  if (widget)
+    {
+      context = gtk_widget_get_style_context (widget);
+      provider = g_object_get_data (G_OBJECT (widget), "provider");
+
+      if (provider == NULL)
+        {
+          provider = (GtkStyleProvider *)gtk_css_provider_new ();
+          g_object_set_data (G_OBJECT (widget), "provider", provider);
+          gtk_style_context_add_provider (context,
+                                          GTK_STYLE_PROVIDER (provider),
+                                          GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+          gtk_css_provider_load_from_data ((GtkCssProvider *)provider,
+                                           style_data, -1, NULL);
+          g_object_unref (provider);
+        }
+      else
+        gtk_css_provider_load_from_data ((GtkCssProvider *)provider,
+                                         style_data, -1, NULL);
+      gtk_style_context_invalidate (context);
+    }
+}
+
+static void
 cc_printers_panel_init (CcPrintersPanel *self)
 {
   CcPrintersPanelPrivate *priv;
@@ -1755,6 +1784,10 @@ cc_printers_panel_init (CcPrintersPanel *self)
     gtk_builder_get_object (priv->builder, "clean-print-heads-button");
   g_signal_connect (widget, "clicked", G_CALLBACK (printer_maintenance_cb), self);
 
+  widget = (GtkWidget*)
+    gtk_builder_get_object (priv->builder, "allowed-users-toolbar");
+  set_widget_style (widget, "GtkToolbar { border-style: none }");
+
   gtk_style_context_get_background_color (gtk_widget_get_style_context (top_widget),
                                           GTK_STATE_FLAG_NORMAL,
                                           &priv->background_color);
diff --git a/panels/printers/printers.ui b/panels/printers/printers.ui
index cfca1be..0ebfff3 100644
--- a/panels/printers/printers.ui
+++ b/panels/printers/printers.ui
@@ -80,50 +80,35 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkHBox" id="hbox6">
+                  <object class="GtkToolbar" id="allowed-users-toolbar">
                     <property name="visible">True</property>
                     <child>
-                      <object class="GtkButton" id="allowed-user-add-button">
+                      <object class="GtkToolButton" id="allowed-user-add-button">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="relief">none</property>
-                        <child>
-                          <object class="GtkImage" id="image4">
-                            <property name="visible">True</property>
-                            <property name="icon_name">list-add</property>
-                          </object>
-                        </child>
+                        <property name="label" translatable="yes">toolbutton1</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">list-add</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">0</property>
+                        <property name="homogeneous">True</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="allowed-user-remove-button">
+                      <object class="GtkToolButton" id="allowed-user-remove-button">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="relief">none</property>
-                        <child>
-                          <object class="GtkImage" id="image5">
-                            <property name="visible">True</property>
-                            <property name="icon_name">list-remove</property>
-                          </object>
-                        </child>
+                        <property name="label" translatable="yes">toolbutton2</property>
+                        <property name="use_underline">True</property>
+                        <property name="icon_name">list-remove</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>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
                     <property name="position">1</property>
                   </packing>
                 </child>



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