Skip to content

Commit 76c2a2a

Browse files
committed
eel-gtk-extensions: show icons in right-click menus only if "menus-have-icons" set
1 parent b15c076 commit 76c2a2a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

eel/eel-gtk-extensions.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,22 +449,29 @@ eel_image_menu_item_new_from_icon (const gchar *icon_name,
449449
const gchar *label_name)
450450
{
451451
GtkWidget *icon;
452+
GSettings *icon_settings;
452453
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
453454

454-
if (icon_name)
455+
icon_settings = g_settings_new ("org.mate.interface");
456+
if ((icon_name) && (g_settings_get_boolean (icon_settings, "menus-have-icons")))
457+
/*Load the icon if user has icons in menus turned on*/
455458
icon = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
456459
else
460+
/*Load an empty icon to hold the space*/
457461
icon = gtk_image_new ();
458462

459463
GtkWidget *label_menu = gtk_label_new_with_mnemonic (g_strconcat (label_name, " ", NULL));
460464
GtkWidget *menuitem = gtk_menu_item_new ();
461-
465+
462466
gtk_container_add (GTK_CONTAINER (box), icon);
467+
463468
gtk_container_add (GTK_CONTAINER (box), label_menu);
464469

465470
gtk_container_add (GTK_CONTAINER (menuitem), box);
466471
gtk_widget_show_all (menuitem);
467472

473+
g_object_unref(icon_settings);
474+
468475
return menuitem;
469476
}
470477

0 commit comments

Comments
 (0)