Mercurial > geeqie.yaz
changeset 1624:b70603e03eb6
do not display menus ("FileMenu" etc.) in accelerator configuration
improved tooltip texts
author | nadvornik |
---|---|
date | Sun, 31 May 2009 13:32:09 +0000 |
parents | 66d4bd637fd7 |
children | 922d7508febd |
files | src/layout_util.c src/preferences.c |
diffstat | 2 files changed, 32 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/layout_util.c Thu Jun 04 21:07:03 2009 +0000 +++ b/src/layout_util.c Sun May 31 13:32:09 2009 +0000 @@ -1497,20 +1497,28 @@ } static void layout_actions_setup_mark(LayoutWindow *lw, gint mark, gchar *name_tmpl, - gchar *label_tmpl, gchar *accel_tmpl, GCallback cb) + gchar *label_tmpl, gchar *accel_tmpl, gchar *tooltip_tmpl, GCallback cb) { gchar name[50]; gchar label[100]; gchar accel[50]; - GtkActionEntry entry = { name, NULL, label, accel, NULL, cb }; + gchar tooltip[100]; + GtkActionEntry entry = { name, NULL, label, accel, tooltip, cb }; GtkAction *action; g_snprintf(name, sizeof(name), name_tmpl, mark); g_snprintf(label, sizeof(label), label_tmpl, mark); + if (accel_tmpl) g_snprintf(accel, sizeof(accel), accel_tmpl, mark % 10); else - accel[0] = 0; + entry.accelerator = NULL; + + if (tooltip_tmpl) + g_snprintf(tooltip, sizeof(tooltip), tooltip_tmpl, mark); + else + entry.tooltip = NULL; + gtk_action_group_add_actions(lw->action_group, &entry, 1, lw); action = gtk_action_group_get_action(lw->action_group, name); g_object_set_data(G_OBJECT(action), "mark_num", GINT_TO_POINTER(mark)); @@ -1527,16 +1535,16 @@ for (mark = 1; mark <= FILEDATA_MARKS_SIZE; mark++) { - layout_actions_setup_mark(lw, mark, "Mark%d", _("Mark _%d"), NULL, NULL); - layout_actions_setup_mark(lw, mark, "SetMark%d", _("_Set mark %d"), NULL, G_CALLBACK(layout_menu_set_mark_sel_cb)); - layout_actions_setup_mark(lw, mark, "ResetMark%d", _("_Reset mark %d"), NULL, G_CALLBACK(layout_menu_res_mark_sel_cb)); - layout_actions_setup_mark(lw, mark, "ToggleMark%d", _("_Toggle mark %d"), "%d", G_CALLBACK(layout_menu_toggle_mark_sel_cb)); - layout_actions_setup_mark(lw, mark, "ToggleMark%dAlt1", _("_Toggle mark %d"), "KP_%d", G_CALLBACK(layout_menu_toggle_mark_sel_cb)); - layout_actions_setup_mark(lw, mark, "SelectMark%d", _("_Select mark %d"), "<control>%d", G_CALLBACK(layout_menu_sel_mark_cb)); - layout_actions_setup_mark(lw, mark, "SelectMark%dAlt1", _("_Select mark %d"), "<control>KP_%d", G_CALLBACK(layout_menu_sel_mark_cb)); - layout_actions_setup_mark(lw, mark, "AddMark%d", _("_Add mark %d"), NULL, G_CALLBACK(layout_menu_sel_mark_or_cb)); - layout_actions_setup_mark(lw, mark, "IntMark%d", _("_Intersection with mark %d"), NULL, G_CALLBACK(layout_menu_sel_mark_and_cb)); - layout_actions_setup_mark(lw, mark, "UnselMark%d", _("_Unselect mark %d"), NULL, G_CALLBACK(layout_menu_sel_mark_minus_cb)); + layout_actions_setup_mark(lw, mark, "Mark%d", _("Mark _%d"), NULL, NULL, NULL); + layout_actions_setup_mark(lw, mark, "SetMark%d", _("_Set mark %d"), NULL, _("Set mark %d"), G_CALLBACK(layout_menu_set_mark_sel_cb)); + layout_actions_setup_mark(lw, mark, "ResetMark%d", _("_Reset mark %d"), NULL, _("Reset mark %d"), G_CALLBACK(layout_menu_res_mark_sel_cb)); + layout_actions_setup_mark(lw, mark, "ToggleMark%d", _("_Toggle mark %d"), "%d", _("Toggle mark %d"), G_CALLBACK(layout_menu_toggle_mark_sel_cb)); + layout_actions_setup_mark(lw, mark, "ToggleMark%dAlt1", _("_Toggle mark %d"), "KP_%d", _("Toggle mark %d"), G_CALLBACK(layout_menu_toggle_mark_sel_cb)); + layout_actions_setup_mark(lw, mark, "SelectMark%d", _("_Select mark %d"), "<control>%d", _("Select mark %d"), G_CALLBACK(layout_menu_sel_mark_cb)); + layout_actions_setup_mark(lw, mark, "SelectMark%dAlt1", _("_Select mark %d"), "<control>KP_%d", _("Select mark %d"), G_CALLBACK(layout_menu_sel_mark_cb)); + layout_actions_setup_mark(lw, mark, "AddMark%d", _("_Add mark %d"), NULL, _("Add mark %d"), G_CALLBACK(layout_menu_sel_mark_or_cb)); + layout_actions_setup_mark(lw, mark, "IntMark%d", _("_Intersection with mark %d"), NULL, _("Intersection with mark %d"), G_CALLBACK(layout_menu_sel_mark_and_cb)); + layout_actions_setup_mark(lw, mark, "UnselMark%d", _("_Unselect mark %d"), NULL, _("Unselect mark %d"), G_CALLBACK(layout_menu_sel_mark_minus_cb)); g_string_append_printf(desc, " <menu action='Mark%d'>"
--- a/src/preferences.c Thu Jun 04 21:07:03 2009 +0000 +++ b/src/preferences.c Sun May 31 13:32:09 2009 +0000 @@ -936,13 +936,17 @@ } accel = gtk_accelerator_name(key.accel_key, key.accel_mods); - gtk_tree_store_append(accel_store, &iter, NULL); - gtk_tree_store_set(accel_store, &iter, - AE_ACTION, label, - AE_KEY, accel, - AE_TOOLTIP, tooltip ? tooltip : "", - AE_ACCEL, accel_path, - -1); + + if (tooltip) + { + gtk_tree_store_append(accel_store, &iter, NULL); + gtk_tree_store_set(accel_store, &iter, + AE_ACTION, label, + AE_KEY, accel, + AE_TOOLTIP, tooltip ? tooltip : "", + AE_ACCEL, accel_path, + -1); + } g_free(accel); g_free(label);