[Xfce4-commits] <xfce4-panel:master> Use xfce_panel_pixbuf_from_source in launcher dialogs.
Nick Schermer
noreply at xfce.org
Tue Dec 28 13:10:04 CET 2010
Updating branch refs/heads/master
to 32fcc728f3c902c686c4439d404cafd5241fdd9c (commit)
from 8cc6d8cc0c23798c60f00207602446e22b5aa259 (commit)
commit 32fcc728f3c902c686c4439d404cafd5241fdd9c
Author: Nick Schermer <nick at xfce.org>
Date: Tue Dec 28 13:06:31 2010 +0100
Use xfce_panel_pixbuf_from_source in launcher dialogs.
plugins/launcher/launcher-dialog.c | 22 +++++++++++++++-------
plugins/launcher/launcher-dialog.glade | 8 ++++----
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/plugins/launcher/launcher-dialog.c b/plugins/launcher/launcher-dialog.c
index a6b6b42..80bbc41 100644
--- a/plugins/launcher/launcher-dialog.c
+++ b/plugins/launcher/launcher-dialog.c
@@ -938,6 +938,9 @@ launcher_dialog_items_set_item (GtkTreeModel *model,
{
const gchar *name, *comment;
gchar *markup;
+ GdkPixbuf *icon = NULL;
+ const gchar *icon_name;
+ gint w, h;
panel_return_if_fail (GTK_IS_LIST_STORE (model));
panel_return_if_fail (GARCON_IS_MENU_ITEM (item));
@@ -950,12 +953,21 @@ launcher_dialog_items_set_item (GtkTreeModel *model,
else
markup = g_markup_printf_escaped ("<b>%s</b>", name);
+ icon_name = garcon_menu_item_get_icon_name (item);
+ if (!exo_str_is_empty (icon_name))
+ {
+ if (!gtk_icon_size_lookup (GTK_ICON_SIZE_DND, &w, &h))
+ w = h = 32;
+
+ icon = xfce_panel_pixbuf_from_source (icon_name, NULL, MIN (w, h));
+ }
+
if (dialog != NULL)
g_signal_handlers_block_by_func (G_OBJECT (model),
G_CALLBACK (launcher_dialog_tree_row_changed), dialog);
gtk_list_store_set (GTK_LIST_STORE (model), iter,
- COL_ICON, garcon_menu_item_get_icon_name (item),
+ COL_ICON, icon,
COL_NAME, markup,
COL_ITEM, item,
-1);
@@ -964,6 +976,8 @@ launcher_dialog_items_set_item (GtkTreeModel *model,
g_signal_handlers_unblock_by_func (G_OBJECT (model),
G_CALLBACK (launcher_dialog_tree_row_changed), dialog);
+ if (G_LIKELY (icon != NULL))
+ g_object_unref (G_OBJECT (icon));
g_free (markup);
}
@@ -1144,12 +1158,6 @@ launcher_dialog_show (LauncherPlugin *plugin)
g_signal_connect_swapped (G_OBJECT (item), "changed",
G_CALLBACK (gtk_tree_model_filter_refilter), object);
- /* setup the icon size in the icon renderers */
- object = gtk_builder_get_object (builder, "addrenderericon");
- g_object_set (G_OBJECT (object), "stock-size", GTK_ICON_SIZE_DND, NULL);
- object = gtk_builder_get_object (builder, "itemrenderericon");
- g_object_set (G_OBJECT (object), "stock-size", GTK_ICON_SIZE_DND, NULL);
-
/* load the plugin items */
launcher_dialog_items_load (dialog);
g_signal_connect_swapped (G_OBJECT (plugin), "items-changed",
diff --git a/plugins/launcher/launcher-dialog.glade b/plugins/launcher/launcher-dialog.glade
index 9032e49..79bb184 100644
--- a/plugins/launcher/launcher-dialog.glade
+++ b/plugins/launcher/launcher-dialog.glade
@@ -32,7 +32,7 @@
<object class="GtkListStore" id="add-store">
<columns>
<!-- column-name icon -->
- <column type="gchararray"/>
+ <column type="GdkPixbuf"/>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name item -->
@@ -46,7 +46,7 @@
<object class="GtkListStore" id="item-store">
<columns>
<!-- column-name icon -->
- <column type="gchararray"/>
+ <column type="GdkPixbuf"/>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name item -->
@@ -100,7 +100,7 @@
<child>
<object class="GtkCellRendererPixbuf" id="itemrenderericon"/>
<attributes>
- <attribute name="icon-name">0</attribute>
+ <attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
@@ -484,7 +484,7 @@
<child>
<object class="GtkCellRendererPixbuf" id="addrenderericon"/>
<attributes>
- <attribute name="icon-name">0</attribute>
+ <attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
More information about the Xfce4-commits
mailing list