summaryrefslogtreecommitdiffstats
path: root/info.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-08-17 10:57:24 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-08-17 10:57:24 -0700
commitd0e27c6c533005b5fd161286f68f1325bdabe8e3 (patch)
tree37d7fe231cd6c9e8d4acc7bba243b9fd456f70c1 /info.c
parent589589c707262920a4c9ffc258704e30fa62b8fa (diff)
parent549708c6eaab2d0592c3e520e0debd82d64619b4 (diff)
downloadsubsurface-d0e27c6c533005b5fd161286f68f1325bdabe8e3.tar.gz
Merge branch 'misc-fixes' of git://github.com/DataBeaver/subsurface
Pull miscellaneous fixes, mostly UI stuff from Mikko Rasa. Both this and the pull from Pierre-Yves Chibon created a "Save As" menu entry and logic. As a result, there were a fair number of conflicts, but I tried to make the end result somewhat reasonable. I might have missed some semantic conflict, though. Series-acked-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> * 'misc-fixes' of git://github.com/DataBeaver/subsurface: Add a separate "Save as" entry to the menu Changes to menu icons Improved depth info for dives without samples Divide the panes evenly in view_three
Diffstat (limited to 'info.c')
-rw-r--r--info.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/info.c b/info.c
index 0ee401488..38776487b 100644
--- a/info.c
+++ b/info.c
@@ -175,9 +175,17 @@ static void info_menu_delete_cb(GtkMenuItem *menuitem, gpointer user_data)
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);
@@ -185,8 +193,8 @@ static void add_menu_item(GtkMenu *menu, const char *label, void (*cb)(GtkMenuIt
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)