[gtk+/gtk-3-14] printing: Avoid missing icons
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-14] printing: Avoid missing icons
- Date: Sat, 4 Oct 2014 16:22:35 +0000 (UTC)
commit 0851a16d9061834cbc9171c4465653c8768d42ab
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Oct 4 12:10:04 2014 -0400
printing: Avoid missing icons
I've noticed a missing image show up in my print dialog, where
the printer reported "printer-paused" as icon. Rearrange things
so we always fall back to "printer" for printer icons.
gtk/gtkprintunixdialog.c | 12 ++++++++++--
gtk/resources/ui/gtkprintunixdialog.ui | 4 ++--
2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 402e26a..c7af21e 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -967,15 +967,19 @@ printer_status_cb (GtkPrintBackend *backend,
GtkPrintUnixDialogPrivate *priv = dialog->priv;
GtkTreeIter *iter;
GtkTreeSelection *selection;
+ GIcon *icon;
iter = g_object_get_data (G_OBJECT (printer), "gtk-print-tree-iter");
+ icon = g_themed_icon_new ("printer");
+ g_themed_icon_prepend_name (G_THEMED_ICON (icon), gtk_printer_get_icon_name (printer));
gtk_list_store_set (GTK_LIST_STORE (priv->printer_list), iter,
- PRINTER_LIST_COL_ICON, gtk_printer_get_icon_name (printer),
+ PRINTER_LIST_COL_ICON, icon,
PRINTER_LIST_COL_STATE, gtk_printer_get_state_message (printer),
PRINTER_LIST_COL_JOBS, gtk_printer_get_job_count (printer),
PRINTER_LIST_COL_LOCATION, gtk_printer_get_location (printer),
-1);
+ g_object_unref (icon);
/* When the pause state change then we need to update sensitive property
* of GTK_RESPONSE_OK button inside of selected_printer_changed function.
@@ -1000,6 +1004,7 @@ printer_added_cb (GtkPrintBackend *backend,
GtkTreeIter iter, filter_iter;
GtkTreeSelection *selection;
GtkTreePath *path;
+ GIcon *icon;
gtk_list_store_append (GTK_LIST_STORE (priv->printer_list), &iter);
@@ -1008,14 +1013,17 @@ printer_added_cb (GtkPrintBackend *backend,
gtk_tree_iter_copy (&iter),
(GDestroyNotify) gtk_tree_iter_free);
+ icon = g_themed_icon_new ("printer");
+ g_themed_icon_prepend_name (G_THEMED_ICON (icon), gtk_printer_get_icon_name (printer));
gtk_list_store_set (GTK_LIST_STORE (priv->printer_list), &iter,
- PRINTER_LIST_COL_ICON, gtk_printer_get_icon_name (printer),
+ PRINTER_LIST_COL_ICON, icon,
PRINTER_LIST_COL_NAME, gtk_printer_get_name (printer),
PRINTER_LIST_COL_STATE, gtk_printer_get_state_message (printer),
PRINTER_LIST_COL_JOBS, gtk_printer_get_job_count (printer),
PRINTER_LIST_COL_LOCATION, gtk_printer_get_location (printer),
PRINTER_LIST_COL_PRINTER_OBJ, printer,
-1);
+ g_object_unref (icon);
gtk_tree_model_filter_convert_child_iter_to_iter (priv->printer_list_filter,
&filter_iter, &iter);
diff --git a/gtk/resources/ui/gtkprintunixdialog.ui b/gtk/resources/ui/gtkprintunixdialog.ui
index 2d38c4f..7c1d46d 100644
--- a/gtk/resources/ui/gtkprintunixdialog.ui
+++ b/gtk/resources/ui/gtkprintunixdialog.ui
@@ -25,7 +25,7 @@
<object class="GtkListStore" id="printer_list">
<columns>
<!-- column-name icon -->
- <column type="gchararray"/>
+ <column type="GIcon"/>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name state -->
@@ -114,7 +114,7 @@
<child>
<object class="GtkCellRendererPixbuf" id="printer_icon_renderer"/>
<attributes>
- <attribute name="icon-name">0</attribute>
+ <attribute name="gicon">0</attribute>
</attributes>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]