خرید بک لینک

Vote count: 0

So I have been trying to add an icon to an app indicator menu with no success. And I've been using GtkMenu.

But then I found some code that referenced GMenu and used g_menu_set_icon to display an icon next to the menu label.

What is the difference between these two sets of menu's. Should one be used in favour of the other. GMenu appears to be more full featured. But if I'm supposed to use GtkMenu how would I display an icon?

I have tried this which didn't work. It showed the label text but not the icon.

GtkWidget* NewMenuItemWithIcon(const char* name)
{
  GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
  GtkWidget *icon = gtk_image_new_from_icon_name("status", GTK_ICON_SIZE_MENU);
  GtkWidget *label = gtk_label_new(name);
  GtkWidget *menu_item = gtk_menu_item_new();

  gtk_container_add(GTK_CONTAINER(box), icon);
  gtk_container_add(GTK_CONTAINER(box), label);
  gtk_container_add(GTK_CONTAINER(menu_item), box);
  retu menu_item;
}

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 2 فروردين 1395 ساعت: 5:01

صفحه بندی