Browse Source

Use xfce_panel_pixbuf_from_source in launcher dialogs.

upstream/xfce4-panel-4.10.1
Nick Schermer 12 years ago
parent
commit
32fcc728f3
  1. 22
      plugins/launcher/launcher-dialog.c
  2. 8
      plugins/launcher/launcher-dialog.glade

22
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",

8
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>

Loading…
Cancel
Save