annotate src/menu.c @ 1738:808dd5257146

Some systems do not have SA_SIGINFO (siginfo_t), like GNU/Hurd, so just test if defined or not. Patch by Michal iha (Bug ID: 2894271).
author zas_
date Fri, 04 Dec 2009 21:01:11 +0000
parents 24ef7b610ed6
children
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
1284
8b89e3ff286b Add year 2009 to copyright info everywhere.
zas_
parents: 1272
diff changeset
4 * Copyright (C) 2008 - 2009 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"
731
fa8f7d7396cf Introduce an helper function that returns the name of an editor.
zas_
parents: 730
diff changeset
21 #include "editors.h"
586
905688aa2317 split filelist.c to filefilter.c and filedata.c
nadvornik
parents: 571
diff changeset
22 #include "filedata.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
23 #include "img-view.h"
1398
9e7aed6ba6bd Display icons in edit contextual menu.
zas_
parents: 1397
diff changeset
24 #include "pixbuf_util.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
25 #include "preferences.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
26 #include "slideshow.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
27 #include "utilops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
28 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
29 #include "ui_tabcomp.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
30 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
31
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
32 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
33 GtkAccelGroup *accel_group);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
34
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
35 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
36 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
37 * menu utils
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
38 *-----------------------------------------------------------------------------
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 439
diff changeset
39 */
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
40
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
41 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
42 guint accel_key, guint accel_mods, GCallback func, gpointer data)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
43 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
44 GtkWidget *item;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
45
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
46 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
47 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
48 g_signal_connect(G_OBJECT(item), "activate", func, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
49 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
50 gtk_widget_show(item);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
51
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
52 return item;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
53 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
54
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
55 gpointer submenu_item_get_data(GtkWidget *menu)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
56 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
57 if (!menu->parent || !GTK_IS_MENU(menu->parent)) return NULL;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
58
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
59 return g_object_get_data(G_OBJECT(menu->parent), "submenu_data");
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
60 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
61
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
62 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
63 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
64 * edit menu
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
65 *-----------------------------------------------------------------------------
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 439
diff changeset
66 */
1413
3bc4967aaa57 Use dynamic allocation for editor key passed to various callbacks.
zas_
parents: 1400
diff changeset
67 static void edit_item_destroy_cb(GtkWidget *widget, gpointer data)
3bc4967aaa57 Use dynamic allocation for editor key passed to various callbacks.
zas_
parents: 1400
diff changeset
68 {
3bc4967aaa57 Use dynamic allocation for editor key passed to various callbacks.
zas_
parents: 1400
diff changeset
69 g_free(data);
3bc4967aaa57 Use dynamic allocation for editor key passed to various callbacks.
zas_
parents: 1400
diff changeset
70 }
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
71
1397
a0bd58a6535f In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents: 1284
diff changeset
72 static void add_edit_items(GtkWidget *menu, GCallback func, GList *fd_list)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
73 {
1272
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
74 GList *editors_list = editor_list_get();
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
75 GList *work = editors_list;
731
fa8f7d7396cf Introduce an helper function that returns the name of an editor.
zas_
parents: 730
diff changeset
76
1272
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
77 while (work)
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
78 {
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
79 const EditorDescription *editor = work->data;
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
80 work = work->next;
1397
a0bd58a6535f In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents: 1284
diff changeset
81 gboolean active = TRUE;
a0bd58a6535f In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents: 1284
diff changeset
82
1400
67573155210c Add helper macros EDITOR_ERRORS() and EDITOR_ERRORS_BUT_SKIPPED() to clean up the code a bit. Minor tidy up.
zas_
parents: 1398
diff changeset
83 if (fd_list && EDITOR_ERRORS(editor_command_parse(editor, fd_list, NULL)))
67573155210c Add helper macros EDITOR_ERRORS() and EDITOR_ERRORS_BUT_SKIPPED() to clean up the code a bit. Minor tidy up.
zas_
parents: 1398
diff changeset
84 active = FALSE;
1397
a0bd58a6535f In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents: 1284
diff changeset
85
a0bd58a6535f In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents: 1284
diff changeset
86 if (active)
1398
9e7aed6ba6bd Display icons in edit contextual menu.
zas_
parents: 1397
diff changeset
87 {
1413
3bc4967aaa57 Use dynamic allocation for editor key passed to various callbacks.
zas_
parents: 1400
diff changeset
88 GtkWidget *item;
1398
9e7aed6ba6bd Display icons in edit contextual menu.
zas_
parents: 1397
diff changeset
89 const gchar *stock_id = NULL;
1413
3bc4967aaa57 Use dynamic allocation for editor key passed to various callbacks.
zas_
parents: 1400
diff changeset
90 gchar *key = g_strdup(editor->key);
1398
9e7aed6ba6bd Display icons in edit contextual menu.
zas_
parents: 1397
diff changeset
91
1413
3bc4967aaa57 Use dynamic allocation for editor key passed to various callbacks.
zas_
parents: 1400
diff changeset
92 if (editor->icon && register_theme_icon_as_stock(key, editor->icon))
3bc4967aaa57 Use dynamic allocation for editor key passed to various callbacks.
zas_
parents: 1400
diff changeset
93 stock_id = key;
3bc4967aaa57 Use dynamic allocation for editor key passed to various callbacks.
zas_
parents: 1400
diff changeset
94
3bc4967aaa57 Use dynamic allocation for editor key passed to various callbacks.
zas_
parents: 1400
diff changeset
95 item = menu_item_add_stock(menu, editor->name, stock_id, func, key);
3bc4967aaa57 Use dynamic allocation for editor key passed to various callbacks.
zas_
parents: 1400
diff changeset
96 g_signal_connect(G_OBJECT(item), "destroy", G_CALLBACK(edit_item_destroy_cb), key);
1398
9e7aed6ba6bd Display icons in edit contextual menu.
zas_
parents: 1397
diff changeset
97 }
1272
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
98 }
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
99
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
100 g_list_free(editors_list);
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
101 }
731
fa8f7d7396cf Introduce an helper function that returns the name of an editor.
zas_
parents: 730
diff changeset
102
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
103
1397
a0bd58a6535f In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents: 1284
diff changeset
104 GtkWidget *submenu_add_edit(GtkWidget *menu, GtkWidget **menu_item, GCallback func, gpointer data, GList *fd_list)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
105 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
106 GtkWidget *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
107 GtkWidget *submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
108
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
109 item = menu_item_add(menu, _("_Edit"), NULL, NULL);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
110
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
111 submenu = gtk_menu_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
112 g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
1397
a0bd58a6535f In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents: 1284
diff changeset
113 add_edit_items(submenu, func, fd_list);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
114
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
115 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
116
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
117 if (menu_item) *menu_item = item;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
118
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
119 return submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
120 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
121
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
122 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
123 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
124 * sorting
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
125 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
126 */
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
127
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
128 gchar *sort_type_get_text(SortType method)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
129 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
130 switch (method)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
131 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
132 case SORT_SIZE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
133 return _("Sort by size");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
134 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
135 case SORT_TIME:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
136 return _("Sort by date");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
137 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
138 case SORT_NONE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
139 return _("Unsorted");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
140 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
141 case SORT_PATH:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
142 return _("Sort by path");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
143 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
144 case SORT_NUMBER:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
145 return _("Sort by number");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
146 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
147 case SORT_NAME:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
148 default:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
149 return _("Sort by name");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
150 break;
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 return "";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
154 }
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
155
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
156 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
157 GCallback func, SortType type,
1434
b106af9689db More gboolean.
zas_
parents: 1413
diff changeset
158 gboolean show_current, SortType show_type)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
159 {
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
160 GtkWidget *item;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
161
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
162 if (show_current)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
163 {
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
164 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
165 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
166 func, GINT_TO_POINTER((gint)type));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
167 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
168 else
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 item = menu_item_add(menu, sort_type_get_text(type),
120
f0ecfb80be38 fix whitespace
gqview
parents: 113
diff changeset
171 func, GINT_TO_POINTER((gint)type));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
172 }
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
173
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
174 return item;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
175 }
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
176
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
177 GtkWidget *submenu_add_sort(GtkWidget *menu, GCallback func, gpointer data,
1434
b106af9689db More gboolean.
zas_
parents: 1413
diff changeset
178 gboolean include_none, gboolean include_path,
b106af9689db More gboolean.
zas_
parents: 1413
diff changeset
179 gboolean show_current, SortType type)
9
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 *submenu;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
182 GtkWidget *parent;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
183
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
184 submenu = gtk_menu_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
185 g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
186
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
187 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
188 #ifdef HAVE_STRVERSCMP
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
189 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
190 #endif
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 82
diff changeset
191 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
192 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
193 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
194 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
195
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
196 if (menu)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
197 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
198 GtkWidget *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
199
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
200 item = menu_item_add(menu, _("Sort"), NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
201 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
202 return item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
203 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
204
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
205 return submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
206 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
207
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
208 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
209 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
210 * altering
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
211 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
212 */
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
213
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
214 gchar *alter_type_get_text(AlterType type)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
215 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
216 switch (type)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
217 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
218 case ALTER_ROTATE_90:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
219 return _("_Rotate clockwise");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
220 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
221 case ALTER_ROTATE_90_CC:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
222 return _("Rotate _counterclockwise");
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 case ALTER_ROTATE_180:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
225 return _("Rotate _180");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
226 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
227 case ALTER_MIRROR:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
228 return _("_Mirror");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
229 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
230 case ALTER_FLIP:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
231 return _("_Flip");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
232 break;
1580
24ef7b610ed6 Backed out changeset 3d9f5c078521
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1566
diff changeset
233 case ALTER_DESATURATE:
24ef7b610ed6 Backed out changeset 3d9f5c078521
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1566
diff changeset
234 return _("Toggle _grayscale");
24ef7b610ed6 Backed out changeset 3d9f5c078521
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1566
diff changeset
235 break;
439
1cca0b614cba Add a way to restore original state in Adjust menu.
zas_
parents: 398
diff changeset
236 case ALTER_NONE:
1cca0b614cba Add a way to restore original state in Adjust menu.
zas_
parents: 398
diff changeset
237 return _("_Original state");
1cca0b614cba Add a way to restore original state in Adjust menu.
zas_
parents: 398
diff changeset
238 break;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
239 default:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
240 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
241 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
242
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
243 return "";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
244 }
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 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
247 GtkAccelGroup *accel_group, guint accel_key, guint accel_mods)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
248 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
249 if (accel_group)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
250 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
251 add_menu_item(menu, alter_type_get_text(type), accel_group,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
252 accel_key, accel_mods, func, GINT_TO_POINTER((gint)type));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 439
diff changeset
253
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
254 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
255 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
256 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
257 menu_item_add(menu, alter_type_get_text(type), func, GINT_TO_POINTER((gint)type));
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
258 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
259 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
260
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
261 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
262 GtkAccelGroup *accel_group)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
263 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
264 GtkWidget *submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
265
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
266 submenu = gtk_menu_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
267 g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
268
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
269 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
270 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
271 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
272 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
273 submenu_add_alter_item(submenu, func, ALTER_FLIP, accel_group, 'F', GDK_SHIFT_MASK);
1580
24ef7b610ed6 Backed out changeset 3d9f5c078521
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1566
diff changeset
274 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
275 submenu_add_alter_item(submenu, func, ALTER_NONE, accel_group, 'O', GDK_SHIFT_MASK);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
276
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
277 if (menu)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
278 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
279 GtkWidget *item;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
280
1580
24ef7b610ed6 Backed out changeset 3d9f5c078521
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1566
diff changeset
281 item = menu_item_add(menu, _("_Adjust"), NULL, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
282 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
283 return item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
284 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
285
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
286 return submenu;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
287 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
288
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
289 GtkWidget *submenu_add_alter(GtkWidget *menu, GCallback func, gpointer data)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
290 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
291 return real_submenu_add_alter(menu, func, data, NULL);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
292 }
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 731
diff changeset
293 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */