annotate src/menu.c @ 78:b192a0efe080

Sun Oct 15 12:36:06 2006 John Ellis <johne@verizon.net> * pan-view.c: For now, also display the full size image under the thumbnail's information bubble. Make clicking the info box close it.
author gqview
date Sun, 15 Oct 2006 16:39:19 +0000
parents d907d608745f
children a4c1b7014e6e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
1 /*
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
2 * GQview
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
3 * (C) 2004 John Ellis
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
4 *
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
5 * Author: John Ellis
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
6 *
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
7 * 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
8 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
10 */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
11
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
12
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
13 #include "gqview.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
14 #include "menu.h"
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
15
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
16 #include "cache_maint.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
17 #include "collect.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
18 #include "collect-dlg.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
19 #include "dupe.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
20 #include "filelist.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
21 #include "img-view.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
22 #include "preferences.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
23 #include "slideshow.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
24 #include "utilops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
25 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
26 #include "ui_tabcomp.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
27 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
28
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
29 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
30 GtkAccelGroup *accel_group);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
31
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
32 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
33 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
34 * menu utils
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
35 *-----------------------------------------------------------------------------
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
36 */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
37
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
38 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
39 guint accel_key, guint accel_mods, GCallback func, gpointer data)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
40 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
41 GtkWidget *item;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
42
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
43 item = gtk_menu_item_new_with_label(label);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
44 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
45 g_signal_connect(G_OBJECT(item), "activate", func, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
46 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
47 gtk_widget_show(item);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
48
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
49 return item;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
50 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
51
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
52 gpointer submenu_item_get_data(GtkWidget *menu)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
53 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
54 if (!menu->parent || !GTK_IS_MENU(menu->parent)) return NULL;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
55
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
56 return g_object_get_data(G_OBJECT(menu->parent), "submenu_data");
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
57 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
58
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
59 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
60 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
61 * edit menu
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
62 *-----------------------------------------------------------------------------
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
63 */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
64
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
65 static void add_edit_items(GtkWidget *menu, GCallback func, GtkAccelGroup *accel_grp)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
66 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
67 gint i;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
68 for (i = 0; i < GQVIEW_EDITOR_SLOTS; i++)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
69 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
70 if (editor_command[i] && strlen(editor_command[i]) > 0)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
71 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
72 gchar *text;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
73 if (editor_name[i] && strlen(editor_name[i]) > 0)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
74 text = g_strdup_printf(_("in %s..."), editor_name[i]);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
75 else
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
76 text = g_strdup(_("in (unknown)..."));
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
77 if (accel_grp)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
78 add_menu_item(menu, text, accel_grp, i + 49, GDK_CONTROL_MASK, func, GINT_TO_POINTER(i));
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
79 else
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
80 menu_item_add_simple(menu, text, func, GINT_TO_POINTER(i));
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
81 g_free(text);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
82 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
83 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
84 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
85
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
86 GtkWidget *submenu_add_edit(GtkWidget *menu, GtkWidget **menu_item, GCallback func, gpointer data)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
87 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
88 GtkWidget *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
89 GtkWidget *submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
90
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
91 item = menu_item_add(menu, _("_Edit"), NULL, NULL);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
92
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
93 submenu = gtk_menu_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
94 g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
95 add_edit_items(submenu, func, NULL);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
96
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
97 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
98
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
99 if (menu_item) *menu_item = item;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
100
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
101 return submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
102 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
103
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
104 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
105 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
106 * sorting
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
107 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
108 */
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
109
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
110 gchar *sort_type_get_text(SortType method)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
111 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
112 switch (method)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
113 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
114 case SORT_SIZE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
115 return _("Sort by size");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
116 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
117 case SORT_TIME:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
118 return _("Sort by date");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
119 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
120 case SORT_NONE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
121 return _("Unsorted");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
122 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
123 case SORT_PATH:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
124 return _("Sort by path");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
125 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
126 case SORT_NUMBER:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
127 return _("Sort by number");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
128 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
129 case SORT_NAME:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
130 default:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
131 return _("Sort by name");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
132 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
133 }
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
134
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
135 return "";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
136 }
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
137
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
138 static void submenu_add_sort_item(GtkWidget *menu, GCallback func, SortType type,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
139 gint show_current, SortType show_type)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
140 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
141 if (show_current)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
142 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
143 menu_item_add_check(menu, sort_type_get_text(type), (type == show_type),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
144 func, GINT_TO_POINTER((gint)type));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
145 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
146 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
147 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
148 menu_item_add(menu, sort_type_get_text(type),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
149 func, GINT_TO_POINTER((gint)type));
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 }
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
152
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
153 GtkWidget *submenu_add_sort(GtkWidget *menu, GCallback func, gpointer data,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
154 gint include_none, gint include_path,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
155 gint show_current, SortType type)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
156 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
157 GtkWidget *submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
158
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
159 submenu = gtk_menu_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
160 g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
161
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
162 submenu_add_sort_item(submenu, func, SORT_NAME, show_current, type);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
163 #ifdef HAVE_STRVERSCMP
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
164 submenu_add_sort_item(submenu, func, SORT_NUMBER, show_current, type);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
165 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
166 submenu_add_sort_item(submenu, func, SORT_TIME, show_current, type);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
167 submenu_add_sort_item(submenu, func, SORT_SIZE, show_current, type);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
168 if (include_path) submenu_add_sort_item(submenu, func, SORT_PATH, show_current, type);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
169 if (include_none) submenu_add_sort_item(submenu, func, SORT_NONE, show_current, type);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
170
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
171 if (menu)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
172 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
173 GtkWidget *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
174
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
175 item = menu_item_add(menu, _("Sort"), NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
176 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
177 return item;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
180 return submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
181 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
182
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
183 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
184 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
185 * altering
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
186 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
187 */
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
188
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
189 gchar *alter_type_get_text(AlterType type)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
190 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
191 switch (type)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
192 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
193 case ALTER_ROTATE_90:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
194 return _("_Rotate clockwise");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
195 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
196 case ALTER_ROTATE_90_CC:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
197 return _("Rotate _counterclockwise");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
198 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
199 case ALTER_ROTATE_180:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
200 return _("Rotate _180");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
201 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
202 case ALTER_MIRROR:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
203 return _("_Mirror");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
204 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
205 case ALTER_FLIP:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
206 return _("_Flip");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
207 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
208 default:
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 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
211
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
212 return "";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
213 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
214
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
215 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
216 GtkAccelGroup *accel_group, guint accel_key, guint accel_mods)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
217 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
218 if (accel_group)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
219 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
220 add_menu_item(menu, alter_type_get_text(type), accel_group,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
221 accel_key, accel_mods, func, GINT_TO_POINTER((gint)type));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
222
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
223 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
224 else
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 menu_item_add(menu, alter_type_get_text(type), func, GINT_TO_POINTER((gint)type));
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
227 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
228 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
229
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
230 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
231 GtkAccelGroup *accel_group)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
232 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
233 GtkWidget *submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
234
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
235 submenu = gtk_menu_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
236 g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
237
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
238 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
239 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
240 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
241 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
242 submenu_add_alter_item(submenu, func, ALTER_FLIP, accel_group, 'F', GDK_SHIFT_MASK);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
243
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
244 if (menu)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
245 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
246 GtkWidget *item;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
247
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
248 item = menu_item_add(menu, _("_Adjust"), NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
249 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
250 return item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
251 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
252
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
253 return submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
254 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
255
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
256 GtkWidget *submenu_add_alter(GtkWidget *menu, GCallback func, gpointer data)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
257 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
258 return real_submenu_add_alter(menu, func, data, NULL);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
259 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
260
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
261