[gnome-control-center] printers: Add GtkLabel with printer model name



commit 38958903eea61d3216ae3e0d702b27bcc0b7996b
Author: Marek Kasik <mkasik redhat com>
Date:   Tue Nov 25 11:21:41 2014 +0100

    printers: Add GtkLabel with printer model name
    
    Place a custom GtkLabel with name of printer model
    into "printer-model-button". This is needed for us to be
    able to align the text and keep the button filling all available
    horizontal space.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739737

 panels/printers/cc-printers-panel.c |   16 +++++++---------
 panels/printers/printers.ui         |   11 ++++++++++-
 2 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index 7967f84..f9eea09 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -544,7 +544,7 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
   cups_ptype_t            type = 0;
   GtkTreeIter             iter;
   GtkWidget              *widget;
-  GtkWidget              *model_button;
+  GtkWidget              *model_button_label;
   GtkWidget              *model_label;
   gboolean                is_accepting_jobs = TRUE;
   GValue                  value = G_VALUE_INIT;
@@ -856,21 +856,20 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
         cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), EMPTY_TEXT);
 
 
-      model_button = (GtkWidget*)
-        gtk_builder_get_object (priv->builder, "printer-model-button");
+      model_button_label = GTK_WIDGET (gtk_builder_get_object (priv->builder, "printer-model-button-label"));
 
       model_label = (GtkWidget*)
         gtk_builder_get_object (priv->builder, "printer-model-label");
 
       if (printer_model)
         {
-          gtk_button_set_label (GTK_BUTTON (model_button), printer_model);
+          gtk_label_set_text (GTK_LABEL (model_button_label), printer_model);
           gtk_label_set_text (GTK_LABEL (model_label), printer_model);
           g_free (printer_model);
         }
       else
         {
-          gtk_button_set_label (GTK_BUTTON (model_button), EMPTY_TEXT);
+          gtk_label_set_text (GTK_LABEL (model_button_label), EMPTY_TEXT);
           gtk_label_set_text (GTK_LABEL (model_label), EMPTY_TEXT);
         }
 
@@ -999,21 +998,20 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
         cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), EMPTY_TEXT);
 
 
-      model_button = (GtkWidget*)
-        gtk_builder_get_object (priv->builder, "printer-model-button");
+      model_button_label = GTK_WIDGET (gtk_builder_get_object (priv->builder, "printer-model-button-label"));
 
       model_label = (GtkWidget*)
         gtk_builder_get_object (priv->builder, "printer-model-label");
 
       if (printer_model)
         {
-          gtk_button_set_label (GTK_BUTTON (model_button), printer_model);
+          gtk_label_set_text (GTK_LABEL (model_button_label), printer_model);
           gtk_label_set_text (GTK_LABEL (model_label), printer_model);
           g_free (printer_model);
         }
       else
         {
-          gtk_button_set_label (GTK_BUTTON (model_button), EMPTY_TEXT);
+          gtk_label_set_text (GTK_LABEL (model_button_label), EMPTY_TEXT);
           gtk_label_set_text (GTK_LABEL (model_label), EMPTY_TEXT);
         }
 
diff --git a/panels/printers/printers.ui b/panels/printers/printers.ui
index ecb545f..3f056de 100644
--- a/panels/printers/printers.ui
+++ b/panels/printers/printers.ui
@@ -340,7 +340,16 @@
                             <property name="receives_default">True</property>
                             <property name="use_action_appearance">False</property>
                             <property name="relief">none</property>
-                            <property name="xalign">0</property>
+                            <property name="halign">fill</property>
+                            <child>
+                              <object class="GtkLabel" id="printer-model-button-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="margin-start">8</property>
+                                <property name="label" translatable="no">label</property>
+                              </object>
+                            </child>
                             <accessibility>
                               <relation type="labelled-by" target="label14"/>
                             </accessibility>


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