annotate src/menu.c @ 545:e421326e8b43

Remove unused checksum_simple() function.
author zas_
date Fri, 02 May 2008 20:56:59 +0000
parents f9bf33be53ff
children 0da87187d5fb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
1 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 120
diff changeset
2 * Geeqie
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
3 * (C) 2004 John Ellis
475
48c8e49b571c updated copyright in source files
nadvornik
parents: 455
diff changeset
4 * Copyright (C) 2008 The Geeqie Team
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
5 *
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
6 * Author: John Ellis
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
7 *
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
9 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
11 */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
12
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
13
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 196
diff changeset
14 #include "main.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
15 #include "menu.h"
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
16
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
17 #include "cache_maint.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
18 #include "collect.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
19 #include "collect-dlg.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
20 #include "dupe.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
21 #include "filelist.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
22 #include "img-view.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
23 #include "preferences.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
24 #include "slideshow.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
25 #include "utilops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
26 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
27 #include "ui_tabcomp.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
28 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
29
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
30 static GtkWidget *real_submenu_add_alter(GtkWidget *menu, GCallback func, gpointer data,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
31 GtkAccelGroup *accel_group);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
32
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
33 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
34 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
35 * menu utils
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
36 *-----------------------------------------------------------------------------
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 439
diff changeset
37 */
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
38
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
39 static GtkWidget *add_menu_item(GtkWidget *menu, gchar *label, GtkAccelGroup *accel_group,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
40 guint accel_key, guint accel_mods, GCallback func, gpointer data)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
41 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
42 GtkWidget *item;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
43
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
44 item = gtk_menu_item_new_with_label(label);
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 475
diff changeset
45 gtk_widget_add_accelerator(item, "activate", accel_group, accel_key, accel_mods, GTK_ACCEL_VISIBLE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
46 g_signal_connect(G_OBJECT(item), "activate", func, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
47 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
48 gtk_widget_show(item);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
49
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
50 return item;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
51 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
52
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
53 gpointer submenu_item_get_data(GtkWidget *menu)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
54 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
55 if (!menu->parent || !GTK_IS_MENU(menu->parent)) return NULL;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
56
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
57 return g_object_get_data(G_OBJECT(menu->parent), "submenu_data");
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
58 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
59
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
60 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
61 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
62 * edit menu
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
63 *-----------------------------------------------------------------------------
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 439
diff changeset
64 */
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
65
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
66 static void add_edit_items(GtkWidget *menu, GCallback func, GtkAccelGroup *accel_grp)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
67 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
68 gint i;
283
e213fb025621 GQVIEW_* -> GQ_*
zas_
parents: 281
diff changeset
69 for (i = 0; i < GQ_EDITOR_SLOTS; i++)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
70 {
318
b16b9b8979e5 Add a new struct ConfOptions to handle options.
zas_
parents: 283
diff changeset
71 if (options->editor_command[i] && strlen(options->editor_command[i]) > 0)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
72 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
73 gchar *text;
318
b16b9b8979e5 Add a new struct ConfOptions to handle options.
zas_
parents: 283
diff changeset
74 if (options->editor_name[i] && strlen(options->editor_name[i]) > 0)
455
0ef1a94ee4c5 Add number mnemonics to image view editors submenu.
zas_
parents: 446
diff changeset
75 text = g_strdup_printf(_("_%d in %s..."), i, options->editor_name[i]);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
76 else
455
0ef1a94ee4c5 Add number mnemonics to image view editors submenu.
zas_
parents: 446
diff changeset
77 text = g_strdup_printf(_("_%d in (unknown)..."), i);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
78 if (accel_grp)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
79 add_menu_item(menu, text, accel_grp, i + 49, GDK_CONTROL_MASK, func, GINT_TO_POINTER(i));
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
80 else
455
0ef1a94ee4c5 Add number mnemonics to image view editors submenu.
zas_
parents: 446
diff changeset
81 menu_item_add(menu, text, func, GINT_TO_POINTER(i));
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
82 g_free(text);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
83 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
84 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
85 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
86
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
87 GtkWidget *submenu_add_edit(GtkWidget *menu, GtkWidget **menu_item, GCallback func, gpointer data)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
88 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
89 GtkWidget *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
90 GtkWidget *submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
91
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
92 item = menu_item_add(menu, _("_Edit"), NULL, NULL);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
93
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
94 submenu = gtk_menu_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
95 g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
96 add_edit_items(submenu, func, NULL);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
97
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
98 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
99
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
100 if (menu_item) *menu_item = item;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
101
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
102 return submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
103 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
104
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
105 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
106 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
107 * sorting
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
108 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
109 */
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
110
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
111 gchar *sort_type_get_text(SortType method)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
112 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
113 switch (method)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
114 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
115 case SORT_SIZE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
116 return _("Sort by size");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
117 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
118 case SORT_TIME:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
119 return _("Sort by date");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
120 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
121 case SORT_NONE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
122 return _("Unsorted");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
123 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
124 case SORT_PATH:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
125 return _("Sort by path");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
126 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
127 case SORT_NUMBER:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
128 return _("Sort by number");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
129 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
130 case SORT_NAME:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
131 default:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
132 return _("Sort by name");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
133 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
134 }
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
135
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
136 return "";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
137 }
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
138
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
139 static GtkWidget *submenu_add_sort_item(GtkWidget *menu, GtkWidget *parent,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
140 GCallback func, SortType type,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
141 gint show_current, SortType show_type)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
142 {
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
143 GtkWidget *item;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
144
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
145 if (show_current)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
146 {
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
147 item = menu_item_add_radio(menu, parent,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
148 sort_type_get_text(type), (type == show_type),
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
149 func, GINT_TO_POINTER((gint)type));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
150 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
151 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
152 {
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
153 item = menu_item_add(menu, sort_type_get_text(type),
120
f0ecfb80be38 fix whitespace
gqview
parents: 113
diff changeset
154 func, GINT_TO_POINTER((gint)type));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
155 }
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
156
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
157 return item;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
158 }
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
159
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
160 GtkWidget *submenu_add_sort(GtkWidget *menu, GCallback func, gpointer data,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
161 gint include_none, gint include_path,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
162 gint show_current, SortType type)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
163 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
164 GtkWidget *submenu;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
165 GtkWidget *parent;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
166
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
167 submenu = gtk_menu_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
168 g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
169
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
170 parent = submenu_add_sort_item(submenu, NULL, func, SORT_NAME, show_current, type);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
171 #ifdef HAVE_STRVERSCMP
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
172 submenu_add_sort_item(submenu, parent, func, SORT_NUMBER, show_current, type);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
173 #endif
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
174 submenu_add_sort_item(submenu, parent, func, SORT_TIME, show_current, type);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
175 submenu_add_sort_item(submenu, parent, func, SORT_SIZE, show_current, type);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
176 if (include_path) submenu_add_sort_item(submenu, parent, func, SORT_PATH, show_current, type);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
177 if (include_none) submenu_add_sort_item(submenu, parent, func, SORT_NONE, show_current, type);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
178
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
179 if (menu)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
180 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
181 GtkWidget *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
182
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
183 item = menu_item_add(menu, _("Sort"), NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
184 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
185 return item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
186 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
187
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
188 return submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
189 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
190
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
191 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
192 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
193 * altering
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
194 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
195 */
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
196
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
197 gchar *alter_type_get_text(AlterType type)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
198 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
199 switch (type)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
200 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
201 case ALTER_ROTATE_90:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
202 return _("_Rotate clockwise");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
203 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
204 case ALTER_ROTATE_90_CC:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
205 return _("Rotate _counterclockwise");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
206 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
207 case ALTER_ROTATE_180:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
208 return _("Rotate _180");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
209 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
210 case ALTER_MIRROR:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
211 return _("_Mirror");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
212 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
213 case ALTER_FLIP:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
214 return _("_Flip");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
215 break;
82
a4c1b7014e6e Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
216 case ALTER_DESATURATE:
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 318
diff changeset
217 return _("Toggle _grayscale");
82
a4c1b7014e6e Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
218 break;
439
1cca0b614cba Add a way to restore original state in Adjust menu.
zas_
parents: 398
diff changeset
219 case ALTER_NONE:
1cca0b614cba Add a way to restore original state in Adjust menu.
zas_
parents: 398
diff changeset
220 return _("_Original state");
1cca0b614cba Add a way to restore original state in Adjust menu.
zas_
parents: 398
diff changeset
221 break;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
222 default:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
223 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
224 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
225
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
226 return "";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
227 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
228
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
229 static void submenu_add_alter_item(GtkWidget *menu, GCallback func, AlterType type,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
230 GtkAccelGroup *accel_group, guint accel_key, guint accel_mods)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
231 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
232 if (accel_group)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
233 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
234 add_menu_item(menu, alter_type_get_text(type), accel_group,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
235 accel_key, accel_mods, func, GINT_TO_POINTER((gint)type));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 439
diff changeset
236
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
237 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
238 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
239 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
240 menu_item_add(menu, alter_type_get_text(type), func, GINT_TO_POINTER((gint)type));
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
241 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
242 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
243
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
244 static GtkWidget *real_submenu_add_alter(GtkWidget *menu, GCallback func, gpointer data,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
245 GtkAccelGroup *accel_group)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
246 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
247 GtkWidget *submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
248
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
249 submenu = gtk_menu_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
250 g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
251
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
252 submenu_add_alter_item(submenu, func, ALTER_ROTATE_90, accel_group, ']', 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
253 submenu_add_alter_item(submenu, func, ALTER_ROTATE_90_CC, accel_group, '[', 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
254 submenu_add_alter_item(submenu, func, ALTER_ROTATE_180, accel_group, 'R', GDK_SHIFT_MASK);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
255 submenu_add_alter_item(submenu, func, ALTER_MIRROR, accel_group, 'M', GDK_SHIFT_MASK);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
256 submenu_add_alter_item(submenu, func, ALTER_FLIP, accel_group, 'F', GDK_SHIFT_MASK);
82
a4c1b7014e6e Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
257 submenu_add_alter_item(submenu, func, ALTER_DESATURATE, accel_group, 'G', GDK_SHIFT_MASK);
439
1cca0b614cba Add a way to restore original state in Adjust menu.
zas_
parents: 398
diff changeset
258 submenu_add_alter_item(submenu, func, ALTER_NONE, accel_group, 'O', GDK_SHIFT_MASK);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
259
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
260 if (menu)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
261 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
262 GtkWidget *item;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
263
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
264 item = menu_item_add(menu, _("_Adjust"), NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
265 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
266 return item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
267 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
268
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
269 return submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
270 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
271
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
272 GtkWidget *submenu_add_alter(GtkWidget *menu, GCallback func, gpointer data)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
273 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
274 return real_submenu_add_alter(menu, func, data, NULL);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
275 }