static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int button)
{
- GtkWidget *menu, *menuitem;
+ GtkWidget *menu, *menuitem, *image;
menu = gtk_menu_new();
- menuitem = gtk_menu_item_new_with_label("Add dive");
+ menuitem = gtk_image_menu_item_new_with_label("Add dive");
+ image = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
g_signal_connect(menuitem, "activate", G_CALLBACK(add_dive_cb), model);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_show_all(menu);
}
static GtkActionEntry menu_items[] = {
- { "FileMenuAction", GTK_STOCK_FILE, "File", NULL, NULL, NULL},
- { "LogMenuAction", GTK_STOCK_FILE, "Log", NULL, NULL, NULL},
- { "ViewMenuAction", GTK_STOCK_FILE, "View", NULL, NULL, NULL},
- { "FilterMenuAction", GTK_STOCK_FILE, "Filter", NULL, NULL, NULL},
- { "HelpMenuAction", GTK_STOCK_HELP, "Help", NULL, NULL, NULL},
+ { "FileMenuAction", NULL, "File", NULL, NULL, NULL},
+ { "LogMenuAction", NULL, "Log", NULL, NULL, NULL},
+ { "ViewMenuAction", NULL, "View", NULL, NULL, NULL},
+ { "FilterMenuAction", NULL, "Filter", NULL, NULL, NULL},
+ { "HelpMenuAction", NULL, "Help", NULL, NULL, NULL},
{ "OpenFile", GTK_STOCK_OPEN, NULL, CTRLCHAR "O", NULL, G_CALLBACK(file_open) },
{ "SaveFile", GTK_STOCK_SAVE, NULL, CTRLCHAR "S", NULL, G_CALLBACK(file_save) },
{ "Print", GTK_STOCK_PRINT, NULL, CTRLCHAR "P", NULL, G_CALLBACK(do_print) },
{ "Import", NULL, "Import", NULL, NULL, G_CALLBACK(import_dialog) },
- { "AddDive", NULL, "Add Dive", NULL, NULL, G_CALLBACK(add_dive_cb) },
- { "Preferences", NULL, "Preferences", PREFERENCE_ACCEL, NULL, G_CALLBACK(preferences_dialog) },
+ { "AddDive", GTK_STOCK_ADD, "Add Dive", NULL, NULL, G_CALLBACK(add_dive_cb) },
+ { "Preferences", GTK_STOCK_PREFERENCES, "Preferences", PREFERENCE_ACCEL, NULL, G_CALLBACK(preferences_dialog) },
{ "Renumber", NULL, "Renumber", NULL, NULL, G_CALLBACK(renumber_dialog) },
{ "SelectEvents", NULL, "SelectEvents", NULL, NULL, G_CALLBACK(selectevents_dialog) },
{ "Quit", GTK_STOCK_QUIT, NULL, CTRLCHAR "Q", NULL, G_CALLBACK(quit) },
delete_dive_info(current_dive);
}
-static void add_menu_item(GtkMenu *menu, const char *label, void (*cb)(GtkMenuItem *, gpointer))
+static void add_menu_item(GtkMenu *menu, const char *label, const char *icon, void (*cb)(GtkMenuItem *, gpointer))
{
- GtkWidget *item = gtk_menu_item_new_with_label(label);
+ GtkWidget *item;
+ if (icon) {
+ GtkWidget *image;
+ item = gtk_image_menu_item_new_with_label(label);
+ image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU);
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image);
+ } else {
+ item = gtk_menu_item_new_with_label(label);
+ }
g_signal_connect(item, "activate", G_CALLBACK(cb), NULL);
gtk_widget_show(item); /* Yes, really */
gtk_menu_prepend(menu, item);
static void populate_popup_cb(GtkTextView *entry, GtkMenu *menu, gpointer user_data)
{
- add_menu_item(menu, "Delete", info_menu_delete_cb);
- add_menu_item(menu, "Edit", info_menu_edit_cb);
+ add_menu_item(menu, "Delete", GTK_STOCK_DELETE, info_menu_delete_cb);
+ add_menu_item(menu, "Edit", GTK_STOCK_EDIT, info_menu_edit_cb);
}
static GtkEntry *text_value(GtkWidget *box, const char *label)