[gnome-control-center] printers: Enable use of emblems for printer icons



commit edcd8b1c13cdd6d86bc62163485697a32814b0f2
Author: Marek Kasik <mkasik redhat com>
Date:   Mon Sep 2 14:37:11 2013 +0200

    printers: Enable use of emblems for printer icons
    
    Use GIcon instead of icon names in PpNewPrinterDialog.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=698532

 panels/printers/new-printer-dialog.ui   |    4 ++--
 panels/printers/pp-new-printer-dialog.c |   15 ++++++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/panels/printers/new-printer-dialog.ui b/panels/printers/new-printer-dialog.ui
index f911b6f..8802f80 100644
--- a/panels/printers/new-printer-dialog.ui
+++ b/panels/printers/new-printer-dialog.ui
@@ -3,8 +3,8 @@
   <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkListStore" id="devices-liststore">
     <columns>
-      <!-- column-name device_icon -->
-      <column type="gchararray"/>
+      <!-- column-name device_gicon -->
+      <column type="GIcon"/>
       <!-- column-name device_name -->
       <column type="gchararray"/>
       <!-- column-name device_display_name -->
diff --git a/panels/printers/pp-new-printer-dialog.c b/panels/printers/pp-new-printer-dialog.c
index 20bc3d5..e553f46 100644
--- a/panels/printers/pp-new-printer-dialog.c
+++ b/panels/printers/pp-new-printer-dialog.c
@@ -62,7 +62,7 @@ static void     new_printer_dialog_response_cb (GtkDialog *_dialog,
 
 enum
 {
-  DEVICE_ICON_COLUMN = 0,
+  DEVICE_GICON_COLUMN = 0,
   DEVICE_NAME_COLUMN,
   DEVICE_DISPLAY_NAME_COLUMN,
   DEVICE_N_COLUMNS
@@ -118,6 +118,9 @@ struct _PpNewPrinterDialogPrivate
 
   GtkWidget *dialog;
   GtkWindow *parent;
+
+  GIcon *local_printer_icon;
+  GIcon *remote_printer_icon;
 };
 
 #define PP_NEW_PRINTER_DIALOG_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), 
PP_TYPE_NEW_PRINTER_DIALOG, PpNewPrinterDialogPrivate))
@@ -367,6 +370,9 @@ pp_new_printer_dialog_finalize (GObject *object)
       priv->dests = NULL;
     }
 
+  g_clear_object (&priv->local_printer_icon);
+  g_clear_object (&priv->remote_printer_icon);
+
   G_OBJECT_CLASS (pp_new_printer_dialog_parent_class)->finalize (object);
 }
 
@@ -1434,7 +1440,7 @@ actualize_devices_list (PpNewPrinterDialog *dialog)
 
           gtk_list_store_append (store, &iter);
           gtk_list_store_set (store, &iter,
-                              DEVICE_ICON_COLUMN, device->network_device ? "printer-network" : "printer",
+                              DEVICE_GICON_COLUMN, device->network_device ? priv->remote_printer_icon : 
priv->local_printer_icon,
                               DEVICE_NAME_COLUMN, device->device_name,
                               DEVICE_DISPLAY_NAME_COLUMN, display_string,
                               -1);
@@ -1550,12 +1556,15 @@ populate_devices_list (PpNewPrinterDialog *dialog)
   g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)),
                     "changed", G_CALLBACK (device_selection_changed_cb), dialog);
 
+  priv->local_printer_icon = g_themed_icon_new ("printer");
+  priv->remote_printer_icon = g_themed_icon_new ("printer-network");
+
   priv->icon_renderer = gtk_cell_renderer_pixbuf_new ();
   g_object_set (priv->icon_renderer, "stock-size", GTK_ICON_SIZE_DIALOG, NULL);
   gtk_cell_renderer_set_alignment (priv->icon_renderer, 1.0, 0.5);
   gtk_cell_renderer_set_padding (priv->icon_renderer, 4, 4);
   column = gtk_tree_view_column_new_with_attributes ("Icon", priv->icon_renderer,
-                                                     "icon-name", DEVICE_ICON_COLUMN, NULL);
+                                                     "gicon", DEVICE_GICON_COLUMN, NULL);
   gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
 
 


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