Commit 0851a16d authored by Matthias Clasen's avatar Matthias Clasen

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.
parent ee25d35c
......@@ -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);
......
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment