Bug Summary

File:src/eoc-window.c
Warning:line 2474, column 2
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name eoc-window.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/lib/llvm-14/lib/clang/14.0.6 -D HAVE_CONFIG_H -I . -I .. -I . -I .. -I ../jpegutils -I ../cut-n-paste/toolbar-editor -D G_LOG_DOMAIN="EOC" -D EOC_DATA_DIR="/usr/local/share/eoc" -D EOC_LOCALE_DIR="/usr/local/share/locale" -D EOC_PLUGIN_DIR="/usr/local/lib/eoc/plugins" -D LIBDIR="/usr/local/lib" -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/cafe-desktop-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -I /usr/include/ctk-3.0/unix-print -I /usr/local/include/libbean-1.0 -I /usr/include/gobject-introspection-1.0 -I /usr/include/exempi-2.0 -I /usr/include/librsvg-2.0 -D PIC -internal-isystem /usr/lib/llvm-14/lib/clang/14.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2023-06-11-120157-31414-1 -x c eoc-window.c
1/* Eye Of Cafe - Main Window
2 *
3 * Copyright (C) 2000-2008 The Free Software Foundation
4 *
5 * Author: Lucas Rocha <lucasr@gnome.org>
6 *
7 * Based on code by:
8 * - Federico Mena-Quintero <federico@gnu.org>
9 * - Jens Finke <jens@gnome.org>
10 * Based on evince code (shell/ev-window.c) by:
11 * - Martin Kretzschmar <martink@gnome.org>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27
28#ifdef HAVE_CONFIG_H1
29#include "config.h"
30#endif
31
32#include <math.h>
33
34#include "eoc-window.h"
35#include "eoc-scroll-view.h"
36#include "eoc-debug.h"
37#include "eoc-file-chooser.h"
38#include "eoc-thumb-view.h"
39#include "eoc-list-store.h"
40#include "eoc-sidebar.h"
41#include "eoc-statusbar.h"
42#include "eoc-preferences-dialog.h"
43#include "eoc-properties-dialog.h"
44#include "eoc-print.h"
45#include "eoc-error-message-area.h"
46#include "eoc-application.h"
47#include "eoc-application-internal.h"
48#include "eoc-thumb-nav.h"
49#include "eoc-config-keys.h"
50#include "eoc-job-queue.h"
51#include "eoc-jobs.h"
52#include "eoc-util.h"
53#include "eoc-save-as-dialog-helper.h"
54#include "eoc-close-confirmation-dialog.h"
55#include "eoc-clipboard-handler.h"
56#include "eoc-window-activatable.h"
57#include "eoc-metadata-sidebar.h"
58
59#include "eoc-enum-types.h"
60
61#include "egg-toolbar-editor.h"
62#include "egg-editable-toolbar.h"
63#include "egg-toolbars-model.h"
64
65#include <glib.h>
66#include <glib-object.h>
67#include <glib/gi18n.h>
68#include <gio/gio.h>
69#include <cdk/cdkkeysyms.h>
70#include <gio/gdesktopappinfo.h>
71#include <ctk/ctk.h>
72
73#include <libbean/bean-extension-set.h>
74#include <libbean/bean-activatable.h>
75
76#if HAVE_LCMS1
77#include <X11/Xlib.h>
78#include <X11/Xatom.h>
79#ifdef CDK_WINDOWING_X11
80#include <cdk/cdkx.h>
81#endif
82#include <lcms2.h>
83#endif
84
85#define CAFE_DESKTOP_USE_UNSTABLE_API
86#include <libcafe-desktop/cafe-desktop-utils.h>
87
88#define EOC_WINDOW_MIN_WIDTH440 440
89#define EOC_WINDOW_MIN_HEIGHT350 350
90
91#define EOC_WINDOW_DEFAULT_WIDTH540 540
92#define EOC_WINDOW_DEFAULT_HEIGHT450 450
93
94#define EOC_WINDOW_FULLSCREEN_TIMEOUT5 * 1000 5 * 1000
95#define EOC_WINDOW_FULLSCREEN_POPUP_THRESHOLD5 5
96
97#define EOC_RECENT_FILES_GROUP"Graphics" "Graphics"
98#define EOC_RECENT_FILES_APP_NAME"Eye of CAFE Image Viewer" "Eye of CAFE Image Viewer"
99#define EOC_RECENT_FILES_LIMIT5 5
100
101#define EOC_WALLPAPER_FILENAME"eoc-wallpaper" "eoc-wallpaper"
102
103#define is_rtl(ctk_widget_get_default_direction () == CTK_TEXT_DIR_RTL) (ctk_widget_get_default_direction () == CTK_TEXT_DIR_RTL)
104
105typedef enum {
106 EOC_WINDOW_STATUS_UNKNOWN,
107 EOC_WINDOW_STATUS_INIT,
108 EOC_WINDOW_STATUS_NORMAL
109} EocWindowStatus;
110
111enum {
112 PROP_0,
113 PROP_COLLECTION_POS,
114 PROP_COLLECTION_RESIZABLE,
115 PROP_STARTUP_FLAGS
116};
117
118enum {
119 SIGNAL_PREPARED,
120 SIGNAL_LAST
121};
122
123static guint signals[SIGNAL_LAST] = { 0 };
124
125struct _EocWindowPrivate {
126 GSettings *view_settings;
127 GSettings *ui_settings;
128 GSettings *fullscreen_settings;
129 GSettings *lockdown_settings;
130
131 EocListStore *store;
132 EocImage *image;
133 EocWindowMode mode;
134 EocWindowStatus status;
135
136 CtkUIManager *ui_mgr;
137 CtkWidget *box;
138 CtkWidget *layout;
139 CtkWidget *cbox;
140 CtkWidget *view;
141 CtkWidget *sidebar;
142 CtkWidget *thumbview;
143 CtkWidget *statusbar;
144 CtkWidget *nav;
145 CtkWidget *message_area;
146 CtkWidget *toolbar;
147 CtkWidget *properties_dlg;
148
149 CtkActionGroup *actions_window;
150 CtkActionGroup *actions_image;
151 CtkActionGroup *actions_collection;
152 CtkActionGroup *actions_recent;
153
154 CtkWidget *fullscreen_popup;
155 GSource *fullscreen_timeout_source;
156
157 gboolean slideshow_random;
158 gboolean slideshow_loop;
159 gint slideshow_switch_timeout;
160 GSource *slideshow_switch_source;
161
162 guint fullscreen_idle_inhibit_cookie;
163
164 guint recent_menu_id;
165
166 EocJob *load_job;
167 EocJob *transform_job;
168 EocJob *save_job;
169 GFile *last_save_as_folder;
170 EocJob *copy_job;
171
172 guint image_info_message_cid;
173 guint tip_message_cid;
174 guint copy_file_cid;
175
176 EocStartupFlags flags;
177 GSList *file_list;
178
179 EocWindowCollectionPos collection_position;
180 gboolean collection_resizable;
181
182 CtkActionGroup *actions_open_with;
183 guint open_with_menu_id;
184
185 gboolean save_disabled;
186 gboolean needs_reload_confirmation;
187
188 CtkPageSetup *page_setup;
189
190 BeanExtensionSet *extensions;
191
192#if defined(HAVE_LCMS1) && defined(CDK_WINDOWING_X11)
193 cmsHPROFILE *display_profile;
194#endif
195};
196
197G_DEFINE_TYPE_WITH_PRIVATE (EocWindow, eoc_window, CTK_TYPE_APPLICATION_WINDOW)static void eoc_window_init (EocWindow *self); static void eoc_window_class_init
(EocWindowClass *klass); static GType eoc_window_get_type_once
(void); static gpointer eoc_window_parent_class = ((void*)0)
; static gint EocWindow_private_offset; static void eoc_window_class_intern_init
(gpointer klass) { eoc_window_parent_class = g_type_class_peek_parent
(klass); if (EocWindow_private_offset != 0) g_type_class_adjust_private_offset
(klass, &EocWindow_private_offset); eoc_window_class_init
((EocWindowClass*) klass); } __attribute__ ((__unused__)) static
inline gpointer eoc_window_get_instance_private (EocWindow *
self) { return (((gpointer) ((guint8*) (self) + (glong) (EocWindow_private_offset
)))); } GType eoc_window_get_type (void) { static gsize static_g_define_type_id
= 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); (void
) (0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0
)); (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = eoc_window_get_type_once (
); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType eoc_window_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_application_window_get_type ()), g_intern_static_string
("EocWindow"), sizeof (EocWindowClass), (GClassInitFunc)(void
(*)(void)) eoc_window_class_intern_init, sizeof (EocWindow),
(GInstanceInitFunc)(void (*)(void)) eoc_window_init, (GTypeFlags
) 0); { {{ EocWindow_private_offset = g_type_add_instance_private
(g_define_type_id, sizeof (EocWindowPrivate)); };} } return g_define_type_id
; }
;
198
199static void eoc_window_cmd_fullscreen (CtkAction *action, gpointer user_data);
200static void eoc_window_run_fullscreen (EocWindow *window, gboolean slideshow);
201static void eoc_window_cmd_slideshow (CtkAction *action, gpointer user_data);
202static void eoc_window_cmd_pause_slideshow (CtkAction *action, gpointer user_data);
203static void eoc_window_stop_fullscreen (EocWindow *window, gboolean slideshow);
204static void eoc_job_load_cb (EocJobLoad *job, gpointer data);
205static void eoc_job_save_progress_cb (EocJobSave *job, float progress, gpointer data);
206static void eoc_job_progress_cb (EocJobLoad *job, float progress, gpointer data);
207static void eoc_job_transform_cb (EocJobTransform *job, gpointer data);
208static void fullscreen_set_timeout (EocWindow *window);
209static void fullscreen_clear_timeout (EocWindow *window);
210static void update_action_groups_state (EocWindow *window);
211static void open_with_launch_application_cb (CtkAction *action, gpointer callback_data);
212static void eoc_window_update_openwith_menu (EocWindow *window, EocImage *image);
213static void eoc_window_list_store_image_added (CtkTreeModel *tree_model,
214 CtkTreePath *path,
215 CtkTreeIter *iter,
216 gpointer user_data);
217static void eoc_window_list_store_image_removed (CtkTreeModel *tree_model,
218 CtkTreePath *path,
219 gpointer user_data);
220static void eoc_window_set_wallpaper (EocWindow *window, const gchar *filename, const gchar *visible_filename);
221static gboolean eoc_window_save_images (EocWindow *window, GList *images);
222static void disconnect_proxy_cb (CtkUIManager *manager,
223 CtkAction *action,
224 CtkWidget *proxy,
225 EocWindow *window);
226static void eoc_window_finish_saving (EocWindow *window);
227static GAppInfo *get_appinfo_for_editor (EocWindow *window);
228
229static GQuark
230eoc_window_error_quark (void)
231{
232 static GQuark q = 0;
233
234 if (q == 0)
235 q = g_quark_from_static_string ("eoc-window-error-quark");
236
237 return q;
238}
239
240static void
241eoc_window_set_collection_mode (EocWindow *window, EocWindowCollectionPos position, gboolean resizable)
242{
243 EocWindowPrivate *priv;
244 CtkWidget *hpaned;
245 EocThumbNavMode mode = EOC_THUMB_NAV_MODE_ONE_ROW;
246
247 eoc_debug (DEBUG_PREFERENCESEOC_DEBUG_PREFERENCES, "eoc-window.c", 247, ((const char*) (__func__
))
);
248
249 g_return_if_fail (EOC_IS_WINDOW (window))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return; } } while (0)
;
250
251 priv = window->priv;
252
253 if (priv->collection_position == position &&
254 priv->collection_resizable == resizable)
255 return;
256
257 priv->collection_position = position;
258 priv->collection_resizable = resizable;
259
260 hpaned = ctk_widget_get_parent (priv->sidebar);
261
262 g_object_ref (hpaned)((__typeof__ (hpaned)) (g_object_ref) (hpaned));
263 g_object_ref (priv->nav)((__typeof__ (priv->nav)) (g_object_ref) (priv->nav));
264
265 ctk_container_remove (CTK_CONTAINER (priv->layout)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_container_get_type ()))))))
, hpaned);
266 ctk_container_remove (CTK_CONTAINER (priv->layout)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_container_get_type ()))))))
, priv->nav);
267
268 ctk_widget_destroy (priv->layout);
269
270 switch (position) {
271 case EOC_WINDOW_COLLECTION_POS_BOTTOM:
272 case EOC_WINDOW_COLLECTION_POS_TOP:
273 if (resizable) {
274 mode = EOC_THUMB_NAV_MODE_MULTIPLE_ROWS;
275
276 priv->layout = ctk_paned_new (CTK_ORIENTATION_VERTICAL);
277
278 if (position == EOC_WINDOW_COLLECTION_POS_BOTTOM) {
279 ctk_paned_pack1 (CTK_PANED (priv->layout)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_paned_get_type ()))))))
, hpaned, TRUE(!(0)), FALSE(0));
280 ctk_paned_pack2 (CTK_PANED (priv->layout)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_paned_get_type ()))))))
, priv->nav, FALSE(0), TRUE(!(0)));
281 } else {
282 ctk_paned_pack1 (CTK_PANED (priv->layout)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_paned_get_type ()))))))
, priv->nav, FALSE(0), TRUE(!(0)));
283 ctk_paned_pack2 (CTK_PANED (priv->layout)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_paned_get_type ()))))))
, hpaned, TRUE(!(0)), FALSE(0));
284 }
285 } else {
286 mode = EOC_THUMB_NAV_MODE_ONE_ROW;
287
288 priv->layout = ctk_box_new (CTK_ORIENTATION_VERTICAL, 2);
289
290 if (position == EOC_WINDOW_COLLECTION_POS_BOTTOM) {
291 ctk_box_pack_start (CTK_BOX (priv->layout)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_box_get_type ()))))))
, hpaned, TRUE(!(0)), TRUE(!(0)), 0);
292 ctk_box_pack_start (CTK_BOX (priv->layout)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_box_get_type ()))))))
, priv->nav, FALSE(0), FALSE(0), 0);
293 } else {
294 ctk_box_pack_start (CTK_BOX (priv->layout)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_box_get_type ()))))))
, priv->nav, FALSE(0), FALSE(0), 0);
295 ctk_box_pack_start (CTK_BOX (priv->layout)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_box_get_type ()))))))
, hpaned, TRUE(!(0)), TRUE(!(0)), 0);
296 }
297 }
298 break;
299
300 case EOC_WINDOW_COLLECTION_POS_LEFT:
301 case EOC_WINDOW_COLLECTION_POS_RIGHT:
302 if (resizable) {
303 mode = EOC_THUMB_NAV_MODE_MULTIPLE_COLUMNS;
304
305 priv->layout = ctk_paned_new (CTK_ORIENTATION_HORIZONTAL);
306
307 if (position == EOC_WINDOW_COLLECTION_POS_LEFT) {
308 ctk_paned_pack1 (CTK_PANED (priv->layout)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_paned_get_type ()))))))
, priv->nav, FALSE(0), TRUE(!(0)));
309 ctk_paned_pack2 (CTK_PANED (priv->layout)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_paned_get_type ()))))))
, hpaned, TRUE(!(0)), FALSE(0));
310 } else {
311 ctk_paned_pack1 (CTK_PANED (priv->layout)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_paned_get_type ()))))))
, hpaned, TRUE(!(0)), FALSE(0));
312 ctk_paned_pack2 (CTK_PANED (priv->layout)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_paned_get_type ()))))))
, priv->nav, FALSE(0), TRUE(!(0)));
313 }
314 } else {
315 mode = EOC_THUMB_NAV_MODE_ONE_COLUMN;
316
317 priv->layout = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 2);
318
319 if (position == EOC_WINDOW_COLLECTION_POS_LEFT) {
320 ctk_box_pack_start (CTK_BOX (priv->layout)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_box_get_type ()))))))
, priv->nav, FALSE(0), FALSE(0), 0);
321 ctk_box_pack_start (CTK_BOX (priv->layout)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_box_get_type ()))))))
, hpaned, TRUE(!(0)), TRUE(!(0)), 0);
322 } else {
323 ctk_box_pack_start (CTK_BOX (priv->layout)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_box_get_type ()))))))
, hpaned, TRUE(!(0)), TRUE(!(0)), 0);
324 ctk_box_pack_start (CTK_BOX (priv->layout)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_box_get_type ()))))))
, priv->nav, FALSE(0), FALSE(0), 0);
325 }
326 }
327
328 break;
329 }
330
331 ctk_box_pack_end (CTK_BOX (priv->cbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->cbox)), ((ctk_box_get_type ()))))))
, priv->layout, TRUE(!(0)), TRUE(!(0)), 0);
332
333 eoc_thumb_nav_set_mode (EOC_THUMB_NAV (priv->nav)((((EocThumbNav*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->nav)), ((eoc_thumb_nav_get_type ()))))))
, mode);
334
335 if (priv->mode != EOC_WINDOW_MODE_UNKNOWN) {
336 update_action_groups_state (window);
337 }
338}
339
340static void
341eoc_window_can_save_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
342{
343 EocWindowPrivate *priv;
344 EocWindow *window;
345 gboolean save_disabled = FALSE(0);
346 CtkAction *action_save, *action_save_as;
347
348 eoc_debug (DEBUG_PREFERENCESEOC_DEBUG_PREFERENCES, "eoc-window.c", 348, ((const char*) (__func__
))
);
349
350 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
351
352 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
353 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
354
355 save_disabled = g_settings_get_boolean (settings, key);
356
357 priv->save_disabled = save_disabled;
358
359 action_save =
360 ctk_action_group_get_action (priv->actions_image, "ImageSave");
361 action_save_as =
362 ctk_action_group_get_action (priv->actions_image, "ImageSaveAs");
363
364 if (priv->save_disabled) {
365 ctk_action_set_sensitive (action_save, FALSE(0));
366 ctk_action_set_sensitive (action_save_as, FALSE(0));
367 } else {
368 EocImage *image = eoc_window_get_image (window);
369
370 if (EOC_IS_IMAGE (image)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(image)); GType __t = ((eoc_image_get_type ())); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
) {
371 ctk_action_set_sensitive (action_save,
372 eoc_image_is_modified (image));
373
374 ctk_action_set_sensitive (action_save_as, TRUE(!(0)));
375 }
376 }
377}
378
379#if defined(HAVE_LCMS1) && defined(CDK_WINDOWING_X11)
380static cmsHPROFILE *
381eoc_window_get_display_profile (CdkScreen *screen)
382{
383 Display *dpy;
384 Atom icc_atom, type;
385 int format;
386 gulong nitems;
387 gulong bytes_after;
388 gulong length;
389 guchar *str;
390 int result;
391 cmsHPROFILE *profile = NULL((void*)0);
392 char *atom_name;
393
394 if (!CDK_IS_X11_SCREEN (screen)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(screen)); GType __t = ((cdk_x11_screen_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
) {
395 return NULL((void*)0);
396 }
397
398 dpy = CDK_DISPLAY_XDISPLAY (cdk_screen_get_display (screen))(cdk_x11_display_get_xdisplay (cdk_screen_get_display (screen
)))
;
399
400 if (cdk_x11_screen_get_screen_number (screen) > 0)
401 atom_name = g_strdup_printf ("_ICC_PROFILE_%d", cdk_x11_screen_get_screen_number (screen));
402 else
403 atom_name = g_strdup ("_ICC_PROFILE");
404
405 icc_atom = cdk_x11_get_xatom_by_name_for_display (cdk_screen_get_display (screen), atom_name);
406
407 g_free (atom_name);
408
409 result = XGetWindowProperty (dpy,
410 CDK_WINDOW_XID (cdk_screen_get_root_window (screen))(cdk_x11_window_get_xid (cdk_screen_get_root_window (screen))
)
,
411 icc_atom,
412 0,
413 G_MAXLONG9223372036854775807L,
414 False0,
415 XA_CARDINAL((Atom) 6),
416 &type,
417 &format,
418 &nitems,
419 &bytes_after,
420 (guchar **)&str);
421
422 /* TODO: handle bytes_after != 0 */
423
424 if ((result == Success0) && (type == XA_CARDINAL((Atom) 6)) && (nitems > 0)) {
425 switch (format)
426 {
427 case 8:
428 length = nitems;
429 break;
430 case 16:
431 length = sizeof(short) * nitems;
432 break;
433 case 32:
434 length = sizeof(long) * nitems;
435 break;
436 default:
437 eoc_debug_message (DEBUG_LCMSEOC_DEBUG_LCMS, "eoc-window.c", 437, ((const char*) (__func__
))
, "Unable to read profile, not correcting");
438
439 XFree (str);
440 return NULL((void*)0);
441 }
442
443 profile = cmsOpenProfileFromMem (str, length);
444
445 if (G_UNLIKELY (profile == NULL)(profile == ((void*)0))) {
446 eoc_debug_message (DEBUG_LCMSEOC_DEBUG_LCMS, "eoc-window.c", 446, ((const char*) (__func__
))
,
447 "Invalid display profile set, "
448 "not using it");
449 }
450
451 XFree (str);
452 }
453
454 if (profile == NULL((void*)0)) {
455 profile = cmsCreate_sRGBProfile ();
456 eoc_debug_message (DEBUG_LCMSEOC_DEBUG_LCMS, "eoc-window.c", 456, ((const char*) (__func__
))
,
457 "No valid display profile set, assuming sRGB");
458 }
459
460 return profile;
461}
462#endif
463
464static void
465update_image_pos (EocWindow *window)
466{
467 EocWindowPrivate *priv;
468 gint pos = -1, n_images = 0;
469
470 priv = window->priv;
471
472 n_images = eoc_list_store_length (EOC_LIST_STORE (priv->store)((((EocListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->store)), (eoc_list_store_get_type())))))
);
473
474 if (n_images > 0) {
475 pos = eoc_list_store_get_pos_by_image (EOC_LIST_STORE (priv->store)((((EocListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->store)), (eoc_list_store_get_type())))))
,
476 priv->image);
477 }
478 /* Images: (image pos) / (n_total_images) */
479 eoc_statusbar_set_image_number (EOC_STATUSBAR (priv->statusbar)((((EocStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((eoc_statusbar_get_type ()))))))
,
480 pos + 1,
481 n_images);
482
483}
484
485static void
486update_status_bar (EocWindow *window)
487{
488 EocWindowPrivate *priv;
489 char *str = NULL((void*)0);
490
491 g_return_if_fail (EOC_IS_WINDOW (window))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return; } } while (0)
;
492
493 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 493, ((const char*) (__func__
))
);
494
495 priv = window->priv;
496
497 if (priv->image != NULL((void*)0) &&
498 eoc_image_has_data (priv->image, EOC_IMAGE_DATA_DIMENSION)) {
499 int zoom, width, height;
500 goffset bytes = 0;
501
502 zoom = floor (100 * eoc_scroll_view_get_zoom (EOC_SCROLL_VIEW (priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((eoc_scroll_view_get_type ()))))))
) + 0.5);
503
504 eoc_image_get_size (priv->image, &width, &height);
505
506 bytes = eoc_image_get_bytes (priv->image);
507
508 if ((width > 0) && (height > 0)) {
509 char *size_string;
510
511 size_string = g_format_size (bytes);
512
513 /* Translators: This is the string displayed in the statusbar
514 * The tokens are from left to right:
515 * - image width
516 * - image height
517 * - image size in bytes
518 * - zoom in percent */
519 str = g_strdup_printf (ngettext("%i × %i pixel %s %i%%",
520 "%i × %i pixels %s %i%%", height),
521 width,
522 height,
523 size_string,
524 zoom);
525
526 g_free (size_string);
527 }
528
529 update_image_pos (window);
530 }
531
532 ctk_statusbar_pop (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
533 priv->image_info_message_cid);
534
535 ctk_statusbar_push (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
536 priv->image_info_message_cid, str ? str : "");
537
538 g_free (str);
539}
540
541static void
542eoc_window_set_message_area (EocWindow *window,
543 CtkWidget *message_area)
544{
545 if (window->priv->message_area == message_area)
546 return;
547
548 if (window->priv->message_area != NULL((void*)0))
549 ctk_widget_destroy (window->priv->message_area);
550
551 window->priv->message_area = message_area;
552
553 if (message_area == NULL((void*)0)) return;
554
555 ctk_box_pack_start (CTK_BOX (window->priv->cbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->cbox)), ((ctk_box_get_type ()))))))
,
556 window->priv->message_area,
557 FALSE(0),
558 FALSE(0),
559 0);
560
561 g_object_add_weak_pointer (G_OBJECT (window->priv->message_area)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->message_area)), (((GType) ((20) <<
(2))))))))
,
562 (void *) &window->priv->message_area);
563}
564
565static void
566update_action_groups_state (EocWindow *window)
567{
568 EocWindowPrivate *priv;
569 CtkAction *action_collection;
570 CtkAction *action_sidebar;
571 CtkAction *action_fscreen;
572 CtkAction *action_sshow;
573 CtkAction *action_print;
574 gboolean print_disabled = FALSE(0);
575 gboolean show_image_collection = FALSE(0);
576 gint n_images = 0;
577
578 g_return_if_fail (EOC_IS_WINDOW (window))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return; } } while (0)
;
579
580 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 580, ((const char*) (__func__
))
);
581
582 priv = window->priv;
583
584 action_collection =
585 ctk_action_group_get_action (priv->actions_window,
586 "ViewImageCollection");
587
588 action_sidebar =
589 ctk_action_group_get_action (priv->actions_window,
590 "ViewSidebar");
591
592 action_fscreen =
593 ctk_action_group_get_action (priv->actions_image,
594 "ViewFullscreen");
595
596 action_sshow =
597 ctk_action_group_get_action (priv->actions_collection,
598 "ViewSlideshow");
599
600 action_print =
601 ctk_action_group_get_action (priv->actions_image,
602 "ImagePrint");
603
604 g_assert (action_collection != NULL)do { if (action_collection != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 604, ((const char*) (__func__)), "action_collection != NULL"
); } while (0)
;
605 g_assert (action_sidebar != NULL)do { if (action_sidebar != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 605, ((const char*) (__func__)), "action_sidebar != NULL"
); } while (0)
;
606 g_assert (action_fscreen != NULL)do { if (action_fscreen != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 606, ((const char*) (__func__)), "action_fscreen != NULL"
); } while (0)
;
607 g_assert (action_sshow != NULL)do { if (action_sshow != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 607, ((const char*) (__func__)), "action_sshow != NULL"
); } while (0)
;
608 g_assert (action_print != NULL)do { if (action_print != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 608, ((const char*) (__func__)), "action_print != NULL"
); } while (0)
;
609
610 if (priv->store != NULL((void*)0)) {
611 n_images = eoc_list_store_length (EOC_LIST_STORE (priv->store)((((EocListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->store)), (eoc_list_store_get_type())))))
);
612 }
613
614 if (n_images == 0) {
615 ctk_widget_hide (priv->layout);
616
617 ctk_action_group_set_sensitive (priv->actions_window, TRUE(!(0)));
618 ctk_action_group_set_sensitive (priv->actions_image, FALSE(0));
619 ctk_action_group_set_sensitive (priv->actions_collection, FALSE(0));
620
621 ctk_action_set_sensitive (action_fscreen, FALSE(0));
622 ctk_action_set_sensitive (action_sshow, FALSE(0));
623
624 /* If there are no images on model, initialization
625 stops here. */
626 if (priv->status == EOC_WINDOW_STATUS_INIT) {
627 priv->status = EOC_WINDOW_STATUS_NORMAL;
628 }
629 } else {
630 if (priv->flags & EOC_STARTUP_DISABLE_COLLECTION) {
631 g_settings_set_boolean (priv->ui_settings, EOC_CONF_UI_IMAGE_COLLECTION"image-collection", FALSE(0));
632
633 show_image_collection = FALSE(0);
634 } else {
635 show_image_collection =
636 g_settings_get_boolean (priv->ui_settings, EOC_CONF_UI_IMAGE_COLLECTION"image-collection");
637 }
638
639 show_image_collection = show_image_collection &&
640 n_images > 1 &&
641 priv->mode != EOC_WINDOW_MODE_SLIDESHOW;
642
643 ctk_widget_show (priv->layout);
644
645 if (show_image_collection)
646 ctk_widget_show (priv->nav);
647
648 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action_collection)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action_collection)), ((ctk_toggle_action_get_type ()))))
))
,
649 show_image_collection);
650
651 ctk_action_group_set_sensitive (priv->actions_window, TRUE(!(0)));
652 ctk_action_group_set_sensitive (priv->actions_image, TRUE(!(0)));
653
654 ctk_action_set_sensitive (action_fscreen, TRUE(!(0)));
655
656 if (n_images == 1) {
657 ctk_action_group_set_sensitive (priv->actions_collection, FALSE(0));
658 ctk_action_set_sensitive (action_collection, FALSE(0));
659 ctk_action_set_sensitive (action_sshow, FALSE(0));
660 } else {
661 ctk_action_group_set_sensitive (priv->actions_collection, TRUE(!(0)));
662 ctk_action_set_sensitive (action_sshow, TRUE(!(0)));
663 }
664
665 if (show_image_collection)
666 ctk_widget_grab_focus (priv->thumbview);
667 else
668 ctk_widget_grab_focus (priv->view);
669 }
670
671 print_disabled = g_settings_get_boolean (priv->lockdown_settings,
672 EOC_CONF_LOCKDOWN_CAN_PRINT"disable-printing");
673
674 if (print_disabled) {
675 ctk_action_set_sensitive (action_print, FALSE(0));
676 }
677
678 if (eoc_sidebar_is_empty (EOC_SIDEBAR (priv->sidebar)((((EocSidebar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->sidebar)), ((eoc_sidebar_get_type()))))))
)) {
679 ctk_action_set_sensitive (action_sidebar, FALSE(0));
680 ctk_widget_hide (priv->sidebar);
681 }
682}
683
684static void
685update_selection_ui_visibility (EocWindow *window)
686{
687 EocWindowPrivate *priv;
688 CtkAction *wallpaper_action;
689 gint n_selected;
690
691 priv = window->priv;
692
693 n_selected = eoc_thumb_view_get_n_selected (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
);
694
695 wallpaper_action =
696 ctk_action_group_get_action (priv->actions_image,
697 "ImageSetAsWallpaper");
698
699 if (n_selected == 1) {
700 ctk_action_set_sensitive (wallpaper_action, TRUE(!(0)));
701 } else {
702 ctk_action_set_sensitive (wallpaper_action, FALSE(0));
703 }
704}
705
706static gboolean
707add_file_to_recent_files (GFile *file)
708{
709 gchar *text_uri;
710 GFileInfo *file_info;
711 CtkRecentData *recent_data;
712 static gchar *groups[2] = { EOC_RECENT_FILES_GROUP"Graphics" , NULL((void*)0) };
713
714 if (file == NULL((void*)0)) return FALSE(0);
715
716 /* The password gets stripped here because ~/.recently-used.xbel is
717 * readable by everyone (chmod 644). It also makes the workaround
718 * for the bug with ctk_recent_info_get_uri_display() easier
719 * (see the comment in eoc_window_update_recent_files_menu()). */
720 text_uri = g_file_get_uri (file);
721
722 if (text_uri == NULL((void*)0))
723 return FALSE(0);
724
725 file_info = g_file_query_info (file,
726 G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE"standard::content-type",
727 0, NULL((void*)0), NULL((void*)0));
728 if (file_info == NULL((void*)0))
729 return FALSE(0);
730
731 recent_data = g_slice_new (CtkRecentData)((CtkRecentData*) g_slice_alloc (sizeof (CtkRecentData)));
732 recent_data->display_name = NULL((void*)0);
733 recent_data->description = NULL((void*)0);
734 recent_data->mime_type = (gchar *) g_file_info_get_content_type (file_info);
735 recent_data->app_name = EOC_RECENT_FILES_APP_NAME"Eye of CAFE Image Viewer";
736 recent_data->app_exec = g_strjoin(" ", g_get_prgname (), "%u", NULL((void*)0));
737 recent_data->groups = groups;
738 recent_data->is_private = FALSE(0);
739
740 ctk_recent_manager_add_full (ctk_recent_manager_get_default (),
741 text_uri,
742 recent_data);
743
744 g_free (recent_data->app_exec);
745 g_free (text_uri);
746 g_object_unref (file_info);
747
748 g_slice_free (CtkRecentData, recent_data)do { if (1) g_slice_free1 (sizeof (CtkRecentData), (recent_data
)); else (void) ((CtkRecentData*) 0 == (recent_data)); } while
(0)
;
749
750 return FALSE(0);
751}
752
753static void
754image_thumb_changed_cb (EocImage *image, gpointer data)
755{
756 EocWindow *window;
757 EocWindowPrivate *priv;
758 GdkPixbuf *thumb;
759
760 g_return_if_fail (EOC_IS_WINDOW (data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (data)"); return; } } while (0)
;
761
762 window = EOC_WINDOW (data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_window_get_type ()))))))
;
763 priv = window->priv;
764
765 thumb = eoc_image_get_thumbnail (image);
766
767 if (thumb != NULL((void*)0)) {
768 ctk_window_set_icon (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, thumb);
769
770 if (window->priv->properties_dlg != NULL((void*)0)) {
771 eoc_properties_dialog_update (EOC_PROPERTIES_DIALOG (priv->properties_dlg)((((EocPropertiesDialog*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->properties_dlg)), ((eoc_properties_dialog_get_type
()))))))
,
772 image);
773 }
774
775 g_object_unref (thumb);
776 } else if (!ctk_widget_get_visible (window->priv->nav)) {
777 gint img_pos = eoc_list_store_get_pos_by_image (window->priv->store, image);
778 CtkTreePath *path = ctk_tree_path_new_from_indices (img_pos,-1);
779 CtkTreeIter iter;
780
781 ctk_tree_model_get_iter (CTK_TREE_MODEL (window->priv->store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->store)), ((ctk_tree_model_get_type (
)))))))
, &iter, path);
782 eoc_list_store_thumbnail_set (window->priv->store, &iter);
783 ctk_tree_path_free (path);
784 }
785}
786
787static void
788file_changed_info_bar_response (CtkInfoBar *info_bar,
789 gint response,
790 EocWindow *window)
791{
792 if (response == CTK_RESPONSE_YES) {
793 eoc_window_reload_image (window);
794 }
795
796 window->priv->needs_reload_confirmation = TRUE(!(0));
797
798 eoc_window_set_message_area (window, NULL((void*)0));
799}
800static void
801image_file_changed_cb (EocImage *img, EocWindow *window)
802{
803 CtkWidget *info_bar;
804 gchar *text, *markup;
805 CtkWidget *image;
806 CtkWidget *label;
807 CtkWidget *hbox;
808
809 if (window->priv->needs_reload_confirmation == FALSE(0))
810 return;
811
812 if (!eoc_image_is_modified (img)) {
813 /* Auto-reload when image is unmodified */
814 eoc_window_reload_image (window);
815 return;
816 }
817
818 window->priv->needs_reload_confirmation = FALSE(0);
819
820 info_bar = ctk_info_bar_new_with_buttons (_("_Reload")gettext ("_Reload"),
821 CTK_RESPONSE_YES,
822 C_("MessageArea", "Hi_de")g_dpgettext (((void*)0), "MessageArea" "\004" "Hi_de", strlen
("MessageArea") + 1)
,
823 CTK_RESPONSE_NO, NULL((void*)0));
824 ctk_info_bar_set_message_type (CTK_INFO_BAR (info_bar)((((CtkInfoBar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((info_bar)), ((ctk_info_bar_get_type()))))))
,
825 CTK_MESSAGE_QUESTION);
826 image = ctk_image_new_from_icon_name ("dialog-question",
827 CTK_ICON_SIZE_DIALOG);
828 label = ctk_label_new (NULL((void*)0));
829
830 /* The newline character is currently necessary due to a problem
831 * with the automatic line break. */
832 text = g_strdup_printf (_("The image \"%s\" has been modified by an external application."gettext ("The image \"%s\" has been modified by an external application."
"\nWould you like to reload it?")
833 "\nWould you like to reload it?")gettext ("The image \"%s\" has been modified by an external application."
"\nWould you like to reload it?")
, eoc_image_get_caption (img));
834 markup = g_markup_printf_escaped ("<b>%s</b>", text);
835 ctk_label_set_markup (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, markup);
836 g_free (text);
837 g_free (markup);
838
839 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 8);
840 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, image, FALSE(0), FALSE(0), 0);
841 ctk_widget_set_halign (image, CTK_ALIGN_START);
842 ctk_widget_set_valign (image, CTK_ALIGN_END);
843 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, label, TRUE(!(0)), TRUE(!(0)), 0);
844 ctk_label_set_xalign (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, 0.0);
845 ctk_box_pack_start (CTK_BOX (ctk_info_bar_get_content_area (CTK_INFO_BAR (info_bar)))((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_info_bar_get_content_area (((((CtkInfoBar*) (void *)
g_type_check_instance_cast ((GTypeInstance*) ((info_bar)), (
(ctk_info_bar_get_type()))))))))), ((ctk_box_get_type ())))))
)
, hbox, TRUE(!(0)), TRUE(!(0)), 0);
846 ctk_widget_show_all (hbox);
847 ctk_widget_show (info_bar);
848
849 eoc_window_set_message_area (window, info_bar);
850 g_signal_connect (info_bar, "response",g_signal_connect_data ((info_bar), ("response"), (((GCallback
) (file_changed_info_bar_response))), (window), ((void*)0), (
GConnectFlags) 0)
851 G_CALLBACK (file_changed_info_bar_response), window)g_signal_connect_data ((info_bar), ("response"), (((GCallback
) (file_changed_info_bar_response))), (window), ((void*)0), (
GConnectFlags) 0)
;
852}
853
854static void
855eoc_window_display_image (EocWindow *window, EocImage *image)
856{
857 EocWindowPrivate *priv;
858 GFile *file;
859
860 g_return_if_fail (EOC_IS_WINDOW (window))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return; } } while (0)
;
861 g_return_if_fail (EOC_IS_IMAGE (image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((image)); GType __t = ((eoc_image_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_IMAGE (image)"); return; } } while (0)
;
862
863 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 863, ((const char*) (__func__
))
);
864
865 g_assert (eoc_image_has_data (image, EOC_IMAGE_DATA_IMAGE))do { if (eoc_image_has_data (image, EOC_IMAGE_DATA_IMAGE)) ; else
g_assertion_message_expr ("EOC", "eoc-window.c", 865, ((const
char*) (__func__)), "eoc_image_has_data (image, EOC_IMAGE_DATA_IMAGE)"
); } while (0)
;
866
867 priv = window->priv;
868
869 if (image != NULL((void*)0)) {
870 g_signal_connect (image,g_signal_connect_data ((image), ("thumbnail_changed"), (((GCallback
) (image_thumb_changed_cb))), (window), ((void*)0), (GConnectFlags
) 0)
871 "thumbnail_changed",g_signal_connect_data ((image), ("thumbnail_changed"), (((GCallback
) (image_thumb_changed_cb))), (window), ((void*)0), (GConnectFlags
) 0)
872 G_CALLBACK (image_thumb_changed_cb),g_signal_connect_data ((image), ("thumbnail_changed"), (((GCallback
) (image_thumb_changed_cb))), (window), ((void*)0), (GConnectFlags
) 0)
873 window)g_signal_connect_data ((image), ("thumbnail_changed"), (((GCallback
) (image_thumb_changed_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
874 g_signal_connect (image, "file-changed",g_signal_connect_data ((image), ("file-changed"), (((GCallback
) (image_file_changed_cb))), (window), ((void*)0), (GConnectFlags
) 0)
875 G_CALLBACK (image_file_changed_cb),g_signal_connect_data ((image), ("file-changed"), (((GCallback
) (image_file_changed_cb))), (window), ((void*)0), (GConnectFlags
) 0)
876 window)g_signal_connect_data ((image), ("file-changed"), (((GCallback
) (image_file_changed_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
877
878 image_thumb_changed_cb (image, window);
879 }
880
881 priv->needs_reload_confirmation = TRUE(!(0));
882
883 eoc_scroll_view_set_image (EOC_SCROLL_VIEW (priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((eoc_scroll_view_get_type ()))))))
, image);
884
885 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, eoc_image_get_caption (image));
886
887 update_status_bar (window);
888
889 file = eoc_image_get_file (image);
890 g_idle_add_full (G_PRIORITY_LOW300,
891 (GSourceFunc) add_file_to_recent_files,
892 file,
893 (GDestroyNotify) g_object_unref);
894
895 eoc_window_update_openwith_menu (window, image);
896}
897
898static void
899open_with_launch_application_cb (CtkAction *action, gpointer data) {
900 EocImage *image;
901 GAppInfo *app;
902 GFile *file;
903 GList *files = NULL((void*)0);
904
905 image = EOC_IMAGE (data)((((EocImage*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_image_get_type ()))))))
;
906 file = eoc_image_get_file (image);
907
908 app = g_object_get_data (G_OBJECT (action)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), (((GType) ((20) << (2))))))))
, "app");
909 files = g_list_append (files, file);
910 g_app_info_launch (app,
911 files,
912 NULL((void*)0), NULL((void*)0));
913
914 g_object_unref (file);
915 g_list_free (files);
916}
917
918static void
919eoc_window_update_openwith_menu (EocWindow *window, EocImage *image)
920{
921 gboolean edit_button_active;
922 GAppInfo *editor_app;
923 GFile *file;
924 GFileInfo *file_info;
925 GList *iter;
926 gchar *label, *tip;
927 const gchar *mime_type;
928 CtkAction *action;
929 EocWindowPrivate *priv;
930 GList *apps;
931 guint action_id = 0;
932 GIcon *app_icon;
933 char *path;
934 CtkWidget *menuitem;
935
936 priv = window->priv;
937
938 edit_button_active = FALSE(0);
939 editor_app = get_appinfo_for_editor (window);
940
941 file = eoc_image_get_file (image);
942 file_info = g_file_query_info (file,
943 G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE"standard::content-type",
944 0, NULL((void*)0), NULL((void*)0));
945
946 if (file_info == NULL((void*)0))
947 return;
948 else {
949 mime_type = g_file_info_get_content_type (file_info);
950 }
951
952 if (priv->open_with_menu_id != 0) {
953 ctk_ui_manager_remove_ui (priv->ui_mgr, priv->open_with_menu_id);
954 priv->open_with_menu_id = 0;
955 }
956
957 if (priv->actions_open_with != NULL((void*)0)) {
958 ctk_ui_manager_remove_action_group (priv->ui_mgr, priv->actions_open_with);
959 g_object_unref (priv->actions_open_with);
960 priv->actions_open_with = NULL((void*)0);
961 }
962
963 if (mime_type == NULL((void*)0)) {
964 g_object_unref (file_info);
965 return;
966 }
967
968 apps = g_app_info_get_all_for_type (mime_type);
969
970 g_object_unref (file_info);
971
972 if (!apps)
973 return;
974
975 priv->actions_open_with = ctk_action_group_new ("OpenWithActions");
976 ctk_ui_manager_insert_action_group (priv->ui_mgr, priv->actions_open_with, -1);
977
978 priv->open_with_menu_id = ctk_ui_manager_new_merge_id (priv->ui_mgr);
979
980 for (iter = apps; iter; iter = iter->next) {
981 GAppInfo *app = iter->data;
982 gchar name[64];
983
984 if (editor_app != NULL((void*)0) && g_app_info_equal (editor_app, app)) {
985 edit_button_active = TRUE(!(0));
986 }
987
988 /* Do not include eoc itself */
989 if (g_ascii_strcasecmp (g_app_info_get_executable (app),
990 g_get_prgname ()) == 0) {
991 g_object_unref (app);
992 continue;
993 }
994
995 g_snprintf (name, sizeof (name), "OpenWith%u", action_id++);
996
997 label = g_strdup (g_app_info_get_name (app));
998 tip = g_strdup_printf (_("Use \"%s\" to open the selected image")gettext ("Use \"%s\" to open the selected image"), g_app_info_get_name (app));
999
1000 action = ctk_action_new (name, label, tip, NULL((void*)0));
1001
1002 app_icon = g_app_info_get_icon (app);
1003 if (G_LIKELY (app_icon != NULL)(app_icon != ((void*)0))) {
1004 g_object_ref (app_icon)((__typeof__ (app_icon)) (g_object_ref) (app_icon));
1005 ctk_action_set_gicon (action, app_icon);
1006 g_object_unref (app_icon);
1007 }
1008
1009 g_free (label);
1010 g_free (tip);
1011
1012 g_object_set_data_full (G_OBJECT (action)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), (((GType) ((20) << (2))))))))
, "app", app,
1013 (GDestroyNotify) g_object_unref);
1014
1015 g_signal_connect (action,g_signal_connect_data ((action), ("activate"), (((GCallback) (
open_with_launch_application_cb))), (image), ((void*)0), (GConnectFlags
) 0)
1016 "activate",g_signal_connect_data ((action), ("activate"), (((GCallback) (
open_with_launch_application_cb))), (image), ((void*)0), (GConnectFlags
) 0)
1017 G_CALLBACK (open_with_launch_application_cb),g_signal_connect_data ((action), ("activate"), (((GCallback) (
open_with_launch_application_cb))), (image), ((void*)0), (GConnectFlags
) 0)
1018 image)g_signal_connect_data ((action), ("activate"), (((GCallback) (
open_with_launch_application_cb))), (image), ((void*)0), (GConnectFlags
) 0)
;
1019
1020 ctk_action_group_add_action (priv->actions_open_with, action);
1021 g_object_unref (action);
1022
1023 ctk_ui_manager_add_ui (priv->ui_mgr,
1024 priv->open_with_menu_id,
1025 "/MainMenu/Image/ImageOpenWith/Applications Placeholder",
1026 name,
1027 name,
1028 CTK_UI_MANAGER_MENUITEM,
1029 FALSE(0));
1030
1031 ctk_ui_manager_add_ui (priv->ui_mgr,
1032 priv->open_with_menu_id,
1033 "/ThumbnailPopup/ImageOpenWith/Applications Placeholder",
1034 name,
1035 name,
1036 CTK_UI_MANAGER_MENUITEM,
1037 FALSE(0));
1038 ctk_ui_manager_add_ui (priv->ui_mgr,
1039 priv->open_with_menu_id,
1040 "/ViewPopup/ImageOpenWith/Applications Placeholder",
1041 name,
1042 name,
1043 CTK_UI_MANAGER_MENUITEM,
1044 FALSE(0));
1045
1046 path = g_strdup_printf ("/MainMenu/Image/ImageOpenWith/Applications Placeholder/%s", name);
1047
1048 menuitem = ctk_ui_manager_get_widget (priv->ui_mgr, path);
1049
1050 /* Only force displaying the icon if it is an application icon */
1051 ctk_image_menu_item_set_always_show_image (CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, app_icon != NULL((void*)0));
1052
1053 g_free (path);
1054
1055 path = g_strdup_printf ("/ThumbnailPopup/ImageOpenWith/Applications Placeholder/%s", name);
1056
1057 menuitem = ctk_ui_manager_get_widget (priv->ui_mgr, path);
1058
1059 /* Only force displaying the icon if it is an application icon */
1060 ctk_image_menu_item_set_always_show_image (CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, app_icon != NULL((void*)0));
1061
1062 g_free (path);
1063
1064 path = g_strdup_printf ("/ViewPopup/ImageOpenWith/Applications Placeholder/%s", name);
1065
1066 menuitem = ctk_ui_manager_get_widget (priv->ui_mgr, path);
1067
1068 /* Only force displaying the icon if it is an application icon */
1069 ctk_image_menu_item_set_always_show_image (CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, app_icon != NULL((void*)0));
1070
1071 g_free (path);
1072 }
1073
1074 g_list_free (apps);
1075
1076 action = ctk_action_group_get_action (window->priv->actions_image,
1077 "OpenEditor");
1078 if (action != NULL((void*)0)) {
1079 ctk_action_set_sensitive (action, edit_button_active);
1080 }
1081}
1082
1083static void
1084eoc_window_clear_load_job (EocWindow *window)
1085{
1086 EocWindowPrivate *priv = window->priv;
1087
1088 if (priv->load_job != NULL((void*)0)) {
1089 if (!priv->load_job->finished)
1090 eoc_job_queue_remove_job (priv->load_job);
1091
1092 g_signal_handlers_disconnect_by_func (priv->load_job,g_signal_handlers_disconnect_matched ((priv->load_job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_progress_cb), (window))
1093 eoc_job_progress_cb,g_signal_handlers_disconnect_matched ((priv->load_job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_progress_cb), (window))
1094 window)g_signal_handlers_disconnect_matched ((priv->load_job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_progress_cb), (window))
;
1095
1096 g_signal_handlers_disconnect_by_func (priv->load_job,g_signal_handlers_disconnect_matched ((priv->load_job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_load_cb), (window))
1097 eoc_job_load_cb,g_signal_handlers_disconnect_matched ((priv->load_job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_load_cb), (window))
1098 window)g_signal_handlers_disconnect_matched ((priv->load_job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_load_cb), (window))
;
1099
1100 eoc_image_cancel_load (EOC_JOB_LOAD (priv->load_job)((((EocJobLoad*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->load_job)), ((eoc_job_load_get_type()))))))
->image);
1101
1102 g_object_unref (priv->load_job);
1103 priv->load_job = NULL((void*)0);
1104
1105 /* Hide statusbar */
1106 eoc_statusbar_set_progress (EOC_STATUSBAR (priv->statusbar)((((EocStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((eoc_statusbar_get_type ()))))))
, 0);
1107 }
1108}
1109
1110static void
1111eoc_job_progress_cb (EocJobLoad *job, float progress, gpointer user_data)
1112{
1113 EocWindow *window;
1114
1115 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
1116
1117 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
1118
1119 eoc_statusbar_set_progress (EOC_STATUSBAR (window->priv->statusbar)((((EocStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->statusbar)), ((eoc_statusbar_get_type
()))))))
,
1120 progress);
1121}
1122
1123static void
1124eoc_job_save_progress_cb (EocJobSave *job, float progress, gpointer user_data)
1125{
1126 EocWindowPrivate *priv;
1127 EocWindow *window;
1128
1129 static EocImage *image = NULL((void*)0);
1130
1131 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
1132
1133 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
1134 priv = window->priv;
1135
1136 eoc_statusbar_set_progress (EOC_STATUSBAR (priv->statusbar)((((EocStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((eoc_statusbar_get_type ()))))))
,
1137 progress);
1138
1139 if (image != job->current_image) {
1140 gchar *str_image, *status_message;
1141 guint n_images;
1142
1143 image = job->current_image;
1144
1145 n_images = g_list_length (job->images);
1146
1147 str_image = eoc_image_get_uri_for_display (image);
1148
1149 /* Translators: This string is displayed in the statusbar
1150 * while saving images. The tokens are from left to right:
1151 * - the original filename
1152 * - the current image's position in the queue
1153 * - the total number of images queued for saving */
1154 status_message = g_strdup_printf (_("Saving image \"%s\" (%u/%u)")gettext ("Saving image \"%s\" (%u/%u)"),
1155 str_image,
1156 job->current_pos + 1,
1157 n_images);
1158 g_free (str_image);
1159
1160 ctk_statusbar_pop (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
1161 priv->image_info_message_cid);
1162
1163 ctk_statusbar_push (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
1164 priv->image_info_message_cid,
1165 status_message);
1166
1167 g_free (status_message);
1168 }
1169
1170 if (progress == 1.0)
1171 image = NULL((void*)0);
1172}
1173
1174static void
1175eoc_window_obtain_desired_size (EocImage *image,
1176 gint width,
1177 gint height,
1178 EocWindow *window)
1179{
1180 CdkScreen *screen;
1181 CdkDisplay *display;
1182 CdkRectangle monitor;
1183 CtkAllocation allocation;
1184 gint final_width, final_height;
1185 gint screen_width, screen_height;
1186 gint window_width, window_height;
1187 gint img_width, img_height;
1188 gint view_width, view_height;
1189 gint deco_width, deco_height;
1190
1191 update_action_groups_state (window);
1192
1193 img_width = width;
1194 img_height = height;
1195
1196 if (!ctk_widget_get_realized (window->priv->view)) {
1197 ctk_widget_realize (window->priv->view);
1198 }
1199
1200 ctk_widget_get_allocation (window->priv->view, &allocation);
1201 view_width = allocation.width;
1202 view_height = allocation.height;
1203
1204 if (!ctk_widget_get_realized (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
)) {
1205 ctk_widget_realize (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
1206 }
1207
1208 ctk_widget_get_allocation (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
, &allocation);
1209 window_width = allocation.width;
1210 window_height = allocation.height;
1211
1212 screen = ctk_window_get_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
);
1213 display = cdk_screen_get_display (screen);
1214
1215 cdk_monitor_get_geometry (cdk_display_get_monitor_at_window (display,
1216 ctk_widget_get_window (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
)),
1217 &monitor);
1218
1219 screen_width = monitor.width;
1220 screen_height = monitor.height;
1221
1222 deco_width = window_width - view_width;
1223 deco_height = window_height - view_height;
1224
1225 if (img_width > 0 && img_height > 0) {
1226 if ((img_width + deco_width > screen_width) ||
1227 (img_height + deco_height > screen_height))
1228 {
1229 double factor;
1230
1231 if (img_width > img_height) {
1232 factor = (screen_width * 0.75 - deco_width) / (double) img_width;
1233 } else {
1234 factor = (screen_height * 0.75 - deco_height) / (double) img_height;
1235 }
1236
1237 img_width = img_width * factor;
1238 img_height = img_height * factor;
1239 }
1240 }
1241
1242 final_width = MAX (EOC_WINDOW_MIN_WIDTH, img_width + deco_width)(((440) > (img_width + deco_width)) ? (440) : (img_width +
deco_width))
;
1243 final_height = MAX (EOC_WINDOW_MIN_HEIGHT, img_height + deco_height)(((350) > (img_height + deco_height)) ? (350) : (img_height
+ deco_height))
;
1244
1245 eoc_debug_message (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1245, ((const char*) (__func__
))
, "Setting window size: %d x %d", final_width, final_height);
1246
1247 ctk_window_set_default_size (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, final_width, final_height);
1248
1249 g_signal_emit (window, signals[SIGNAL_PREPARED], 0);
1250}
1251
1252static void
1253eoc_window_error_message_area_response (CtkInfoBar *message_area,
1254 gint response_id,
1255 EocWindow *window)
1256{
1257 if (response_id != CTK_RESPONSE_OK) {
1258 eoc_window_set_message_area (window, NULL((void*)0));
1259
1260 return;
1261 }
1262
1263 /* Trigger loading for current image again */
1264 eoc_thumb_view_select_single (EOC_THUMB_VIEW (window->priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->thumbview)), ((eoc_thumb_view_get_type
()))))))
,
1265 EOC_THUMB_VIEW_SELECT_CURRENT);
1266}
1267
1268static void
1269eoc_job_load_cb (EocJobLoad *job, gpointer data)
1270{
1271 EocWindow *window;
1272 EocWindowPrivate *priv;
1273 CtkAction *action_undo, *action_save;
1274
1275 g_return_if_fail (EOC_IS_WINDOW (data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (data)"); return; } } while (0)
;
1276
1277 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1277, ((const char*) (__func__
))
);
1278
1279 window = EOC_WINDOW (data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_window_get_type ()))))))
;
1280 priv = window->priv;
1281
1282 eoc_statusbar_set_progress (EOC_STATUSBAR (priv->statusbar)((((EocStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((eoc_statusbar_get_type ()))))))
, 0.0);
1283
1284 ctk_statusbar_pop (CTK_STATUSBAR (window->priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->statusbar)), ((ctk_statusbar_get_type
()))))))
,
1285 priv->image_info_message_cid);
1286
1287 if (priv->image != NULL((void*)0)) {
1288 g_signal_handlers_disconnect_by_func (priv->image,g_signal_handlers_disconnect_matched ((priv->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (image_thumb_changed_cb), (window))
1289 image_thumb_changed_cb,g_signal_handlers_disconnect_matched ((priv->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (image_thumb_changed_cb), (window))
1290 window)g_signal_handlers_disconnect_matched ((priv->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (image_thumb_changed_cb), (window))
;
1291 g_signal_handlers_disconnect_by_func (priv->image,g_signal_handlers_disconnect_matched ((priv->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (image_file_changed_cb), (window))
1292 image_file_changed_cb,g_signal_handlers_disconnect_matched ((priv->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (image_file_changed_cb), (window))
1293 window)g_signal_handlers_disconnect_matched ((priv->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (image_file_changed_cb), (window))
;
1294
1295 g_object_unref (priv->image);
1296 }
1297
1298 priv->image = g_object_ref (job->image)((__typeof__ (job->image)) (g_object_ref) (job->image));
1299
1300 if (EOC_JOB (job)((((EocJob*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((job)), ((eoc_job_get_type()))))))
->error == NULL((void*)0)) {
1301#if defined(HAVE_LCMS1) && defined(CDK_WINDOWING_X11)
1302 eoc_image_apply_display_profile (job->image,
1303 priv->display_profile);
1304#endif
1305
1306 ctk_action_group_set_sensitive (priv->actions_image, TRUE(!(0)));
1307
1308 eoc_window_display_image (window, job->image);
1309 } else {
1310 CtkWidget *message_area;
1311
1312 message_area = eoc_image_load_error_message_area_new (
1313 eoc_image_get_caption (job->image),
1314 EOC_JOB (job)((((EocJob*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((job)), ((eoc_job_get_type()))))))
->error);
1315
1316 g_signal_connect (message_area,g_signal_connect_data ((message_area), ("response"), (((GCallback
) (eoc_window_error_message_area_response))), (window), ((void
*)0), (GConnectFlags) 0)
1317 "response",g_signal_connect_data ((message_area), ("response"), (((GCallback
) (eoc_window_error_message_area_response))), (window), ((void
*)0), (GConnectFlags) 0)
1318 G_CALLBACK (eoc_window_error_message_area_response),g_signal_connect_data ((message_area), ("response"), (((GCallback
) (eoc_window_error_message_area_response))), (window), ((void
*)0), (GConnectFlags) 0)
1319 window)g_signal_connect_data ((message_area), ("response"), (((GCallback
) (eoc_window_error_message_area_response))), (window), ((void
*)0), (GConnectFlags) 0)
;
1320
1321 ctk_window_set_icon (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, NULL((void*)0));
1322 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
1323 eoc_image_get_caption (job->image));
1324
1325 eoc_window_set_message_area (window, message_area);
1326
1327 ctk_info_bar_set_default_response (CTK_INFO_BAR (message_area)((((CtkInfoBar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((message_area)), ((ctk_info_bar_get_type()))))))
,
1328 CTK_RESPONSE_CANCEL);
1329
1330 ctk_widget_show (message_area);
1331
1332 update_status_bar (window);
1333
1334 eoc_scroll_view_set_image (EOC_SCROLL_VIEW (priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((eoc_scroll_view_get_type ()))))))
, NULL((void*)0));
1335
1336 if (window->priv->status == EOC_WINDOW_STATUS_INIT) {
1337 update_action_groups_state (window);
1338
1339 g_signal_emit (window, signals[SIGNAL_PREPARED], 0);
1340 }
1341
1342 ctk_action_group_set_sensitive (priv->actions_image, FALSE(0));
1343 }
1344
1345 eoc_window_clear_load_job (window);
1346
1347 if (window->priv->status == EOC_WINDOW_STATUS_INIT) {
1348 window->priv->status = EOC_WINDOW_STATUS_NORMAL;
1349
1350 g_signal_handlers_disconnect_by_funcg_signal_handlers_disconnect_matched ((job->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (eoc_window_obtain_desired_size))), (window
))
1351 (job->image,g_signal_handlers_disconnect_matched ((job->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (eoc_window_obtain_desired_size))), (window
))
1352 G_CALLBACK (eoc_window_obtain_desired_size),g_signal_handlers_disconnect_matched ((job->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (eoc_window_obtain_desired_size))), (window
))
1353 window)g_signal_handlers_disconnect_matched ((job->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (eoc_window_obtain_desired_size))), (window
))
;
1354 }
1355
1356 action_save = ctk_action_group_get_action (priv->actions_image, "ImageSave");
1357 action_undo = ctk_action_group_get_action (priv->actions_image, "EditUndo");
1358
1359 /* Set Save and Undo sensitive according to image state.
1360 * Respect lockdown in case of Save.*/
1361 ctk_action_set_sensitive (action_save, (!priv->save_disabled && eoc_image_is_modified (job->image)));
1362 ctk_action_set_sensitive (action_undo, eoc_image_is_modified (job->image));
1363
1364 g_object_unref (job->image);
1365}
1366
1367static void
1368eoc_window_clear_transform_job (EocWindow *window)
1369{
1370 EocWindowPrivate *priv = window->priv;
1371
1372 if (priv->transform_job != NULL((void*)0)) {
1373 if (!priv->transform_job->finished)
1374 eoc_job_queue_remove_job (priv->transform_job);
1375
1376 g_signal_handlers_disconnect_by_func (priv->transform_job,g_signal_handlers_disconnect_matched ((priv->transform_job
), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (eoc_job_transform_cb), (window))
1377 eoc_job_transform_cb,g_signal_handlers_disconnect_matched ((priv->transform_job
), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (eoc_job_transform_cb), (window))
1378 window)g_signal_handlers_disconnect_matched ((priv->transform_job
), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (eoc_job_transform_cb), (window))
;
1379 g_object_unref (priv->transform_job);
1380 priv->transform_job = NULL((void*)0);
1381 }
1382}
1383
1384static void
1385eoc_job_transform_cb (EocJobTransform *job, gpointer data)
1386{
1387 EocWindow *window;
1388 CtkAction *action_undo, *action_save;
1389 EocImage *image;
1390
1391 g_return_if_fail (EOC_IS_WINDOW (data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (data)"); return; } } while (0)
;
1392
1393 window = EOC_WINDOW (data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_window_get_type ()))))))
;
1394
1395 eoc_window_clear_transform_job (window);
1396
1397 action_undo =
1398 ctk_action_group_get_action (window->priv->actions_image, "EditUndo");
1399 action_save =
1400 ctk_action_group_get_action (window->priv->actions_image, "ImageSave");
1401
1402 image = eoc_window_get_image (window);
1403
1404 ctk_action_set_sensitive (action_undo, eoc_image_is_modified (image));
1405
1406 if (!window->priv->save_disabled)
1407 {
1408 ctk_action_set_sensitive (action_save, eoc_image_is_modified (image));
1409 }
1410}
1411
1412static void
1413apply_transformation (EocWindow *window, EocTransform *trans)
1414{
1415 EocWindowPrivate *priv;
1416 GList *images;
1417
1418 g_return_if_fail (EOC_IS_WINDOW (window))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return; } } while (0)
;
1419
1420 priv = window->priv;
1421
1422 images = eoc_thumb_view_get_selected_images (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
);
1423
1424 eoc_window_clear_transform_job (window);
1425
1426 priv->transform_job = eoc_job_transform_new (images, trans);
1427
1428 g_signal_connect (priv->transform_job,g_signal_connect_data ((priv->transform_job), ("finished")
, (((GCallback) (eoc_job_transform_cb))), (window), ((void*)0
), (GConnectFlags) 0)
1429 "finished",g_signal_connect_data ((priv->transform_job), ("finished")
, (((GCallback) (eoc_job_transform_cb))), (window), ((void*)0
), (GConnectFlags) 0)
1430 G_CALLBACK (eoc_job_transform_cb),g_signal_connect_data ((priv->transform_job), ("finished")
, (((GCallback) (eoc_job_transform_cb))), (window), ((void*)0
), (GConnectFlags) 0)
1431 window)g_signal_connect_data ((priv->transform_job), ("finished")
, (((GCallback) (eoc_job_transform_cb))), (window), ((void*)0
), (GConnectFlags) 0)
;
1432
1433 g_signal_connect (priv->transform_job,g_signal_connect_data ((priv->transform_job), ("progress")
, (((GCallback) (eoc_job_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
1434 "progress",g_signal_connect_data ((priv->transform_job), ("progress")
, (((GCallback) (eoc_job_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
1435 G_CALLBACK (eoc_job_progress_cb),g_signal_connect_data ((priv->transform_job), ("progress")
, (((GCallback) (eoc_job_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
1436 window)g_signal_connect_data ((priv->transform_job), ("progress")
, (((GCallback) (eoc_job_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
;
1437
1438 eoc_job_queue_add_job (priv->transform_job);
1439}
1440
1441static void
1442handle_image_selection_changed_cb (EocThumbView *thumbview, EocWindow *window)
1443{
1444 EocWindowPrivate *priv;
1445 EocImage *image;
1446 gchar *status_message;
1447 gchar *str_image;
1448
1449 priv = window->priv;
1450
1451 if (eoc_list_store_length (EOC_LIST_STORE (priv->store)((((EocListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->store)), (eoc_list_store_get_type())))))
) == 0) {
1452 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
1453 g_get_application_name());
1454 ctk_statusbar_remove_all (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
1455 priv->image_info_message_cid);
1456 eoc_scroll_view_set_image (EOC_SCROLL_VIEW (priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((eoc_scroll_view_get_type ()))))))
,
1457 NULL((void*)0));
1458 }
1459
1460 if (eoc_thumb_view_get_n_selected (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
) == 0)
1461 return;
1462
1463 update_selection_ui_visibility (window);
1464
1465 image = eoc_thumb_view_get_first_selected_image (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
);
1466
1467 g_assert (EOC_IS_IMAGE (image))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((image)); GType __t = ((eoc_image_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else
g_assertion_message_expr ("EOC", "eoc-window.c", 1467, ((const
char*) (__func__)), "EOC_IS_IMAGE (image)"); } while (0)
;
1468
1469 eoc_window_clear_load_job (window);
1470
1471 eoc_window_set_message_area (window, NULL((void*)0));
1472
1473 ctk_statusbar_pop (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
1474 priv->image_info_message_cid);
1475
1476 if (image == priv->image) {
1477 update_status_bar (window);
1478 return;
1479 }
1480
1481 if (eoc_image_has_data (image, EOC_IMAGE_DATA_IMAGE)) {
1482 if (priv->image != NULL((void*)0))
1483 g_object_unref (priv->image);
1484
1485 priv->image = image;
1486 eoc_window_display_image (window, image);
1487 return;
1488 }
1489
1490 if (priv->status == EOC_WINDOW_STATUS_INIT) {
1491 g_signal_connect (image,g_signal_connect_data ((image), ("size-prepared"), (((GCallback
) (eoc_window_obtain_desired_size))), (window), ((void*)0), (
GConnectFlags) 0)
1492 "size-prepared",g_signal_connect_data ((image), ("size-prepared"), (((GCallback
) (eoc_window_obtain_desired_size))), (window), ((void*)0), (
GConnectFlags) 0)
1493 G_CALLBACK (eoc_window_obtain_desired_size),g_signal_connect_data ((image), ("size-prepared"), (((GCallback
) (eoc_window_obtain_desired_size))), (window), ((void*)0), (
GConnectFlags) 0)
1494 window)g_signal_connect_data ((image), ("size-prepared"), (((GCallback
) (eoc_window_obtain_desired_size))), (window), ((void*)0), (
GConnectFlags) 0)
;
1495 }
1496
1497 priv->load_job = eoc_job_load_new (image, EOC_IMAGE_DATA_ALL(EOC_IMAGE_DATA_IMAGE | EOC_IMAGE_DATA_DIMENSION | EOC_IMAGE_DATA_EXIF
| EOC_IMAGE_DATA_XMP)
);
1498
1499 g_signal_connect (priv->load_job,g_signal_connect_data ((priv->load_job), ("finished"), (((
GCallback) (eoc_job_load_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1500 "finished",g_signal_connect_data ((priv->load_job), ("finished"), (((
GCallback) (eoc_job_load_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1501 G_CALLBACK (eoc_job_load_cb),g_signal_connect_data ((priv->load_job), ("finished"), (((
GCallback) (eoc_job_load_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1502 window)g_signal_connect_data ((priv->load_job), ("finished"), (((
GCallback) (eoc_job_load_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
1503
1504 g_signal_connect (priv->load_job,g_signal_connect_data ((priv->load_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1505 "progress",g_signal_connect_data ((priv->load_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1506 G_CALLBACK (eoc_job_progress_cb),g_signal_connect_data ((priv->load_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1507 window)g_signal_connect_data ((priv->load_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
1508
1509 eoc_job_queue_add_job (priv->load_job);
1510
1511 str_image = eoc_image_get_uri_for_display (image);
1512
1513 status_message = g_strdup_printf (_("Opening image \"%s\"")gettext ("Opening image \"%s\""),
1514 str_image);
1515
1516 g_free (str_image);
1517
1518 ctk_statusbar_push (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
1519 priv->image_info_message_cid, status_message);
1520
1521 g_free (status_message);
1522}
1523
1524static void
1525view_zoom_changed_cb (CtkWidget *widget, double zoom, gpointer user_data)
1526{
1527 EocWindow *window;
1528 CtkAction *action_zoom_in;
1529 CtkAction *action_zoom_out;
1530
1531 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
1532
1533 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
1534
1535 update_status_bar (window);
1536
1537 action_zoom_in =
1538 ctk_action_group_get_action (window->priv->actions_image,
1539 "ViewZoomIn");
1540
1541 action_zoom_out =
1542 ctk_action_group_get_action (window->priv->actions_image,
1543 "ViewZoomOut");
1544
1545 ctk_action_set_sensitive (action_zoom_in,
1546 !eoc_scroll_view_get_zoom_is_max (EOC_SCROLL_VIEW (window->priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->view)), ((eoc_scroll_view_get_type (
)))))))
));
1547 ctk_action_set_sensitive (action_zoom_out,
1548 !eoc_scroll_view_get_zoom_is_min (EOC_SCROLL_VIEW (window->priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->view)), ((eoc_scroll_view_get_type (
)))))))
));
1549}
1550
1551static void
1552eoc_window_open_recent_cb (CtkAction *action, EocWindow *window)
1553{
1554 CtkRecentInfo *info;
1555 const gchar *uri;
1556 GSList *list = NULL((void*)0);
1557
1558 info = g_object_get_data (G_OBJECT (action)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), (((GType) ((20) << (2))))))))
, "ctk-recent-info");
1559 g_return_if_fail (info != NULL)do { if ((info != ((void*)0))) { } else { g_return_if_fail_warning
("EOC", ((const char*) (__func__)), "info != NULL"); return;
} } while (0)
;
1560
1561 uri = ctk_recent_info_get_uri (info);
1562 list = g_slist_prepend (list, g_strdup (uri));
1563
1564 eoc_application_open_uri_list (EOC_APP(eoc_application_get_instance ()),
1565 list,
1566 CDK_CURRENT_TIME0L,
1567 0,
1568 NULL((void*)0));
1569
1570 g_slist_foreach (list, (GFunc) g_free, NULL((void*)0));
1571 g_slist_free (list);
1572}
1573
1574static void
1575file_open_dialog_response_cb (CtkWidget *chooser,
1576 gint response_id,
1577 EocWindow *ev_window)
1578{
1579 if (response_id == CTK_RESPONSE_OK) {
1580 GSList *uris;
1581
1582 uris = ctk_file_chooser_get_uris (CTK_FILE_CHOOSER (chooser)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((chooser)), ((ctk_file_chooser_get_type ()))))))
);
1583
1584 eoc_application_open_uri_list (EOC_APP(eoc_application_get_instance ()),
1585 uris,
1586 CDK_CURRENT_TIME0L,
1587 0,
1588 NULL((void*)0));
1589
1590 g_slist_foreach (uris, (GFunc) g_free, NULL((void*)0));
1591 g_slist_free (uris);
1592 }
1593
1594 ctk_widget_destroy (chooser);
1595}
1596
1597static void
1598eoc_window_update_fullscreen_action (EocWindow *window)
1599{
1600 CtkAction *action;
1601
1602 action = ctk_action_group_get_action (window->priv->actions_image,
1603 "ViewFullscreen");
1604
1605 g_signal_handlers_block_by_funcg_signal_handlers_block_matched ((action), (GSignalMatchType)
(G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)0
), (((GCallback) (eoc_window_cmd_fullscreen))), (window))
1606 (action, G_CALLBACK (eoc_window_cmd_fullscreen), window)g_signal_handlers_block_matched ((action), (GSignalMatchType)
(G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)0
), (((GCallback) (eoc_window_cmd_fullscreen))), (window))
;
1607
1608 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
,
1609 window->priv->mode == EOC_WINDOW_MODE_FULLSCREEN);
1610
1611 g_signal_handlers_unblock_by_funcg_signal_handlers_unblock_matched ((action), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (eoc_window_cmd_fullscreen))), (window))
1612 (action, G_CALLBACK (eoc_window_cmd_fullscreen), window)g_signal_handlers_unblock_matched ((action), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (eoc_window_cmd_fullscreen))), (window))
;
1613}
1614
1615static void
1616eoc_window_update_slideshow_action (EocWindow *window)
1617{
1618 CtkAction *action;
1619
1620 action = ctk_action_group_get_action (window->priv->actions_collection,
1621 "ViewSlideshow");
1622
1623 g_signal_handlers_block_by_funcg_signal_handlers_block_matched ((action), (GSignalMatchType)
(G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)0
), (((GCallback) (eoc_window_cmd_slideshow))), (window))
1624 (action, G_CALLBACK (eoc_window_cmd_slideshow), window)g_signal_handlers_block_matched ((action), (GSignalMatchType)
(G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)0
), (((GCallback) (eoc_window_cmd_slideshow))), (window))
;
1625
1626 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
,
1627 window->priv->mode == EOC_WINDOW_MODE_SLIDESHOW);
1628
1629 g_signal_handlers_unblock_by_funcg_signal_handlers_unblock_matched ((action), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (eoc_window_cmd_slideshow))), (window))
1630 (action, G_CALLBACK (eoc_window_cmd_slideshow), window)g_signal_handlers_unblock_matched ((action), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (eoc_window_cmd_slideshow))), (window))
;
1631}
1632
1633static void
1634eoc_window_update_pause_slideshow_action (EocWindow *window)
1635{
1636 CtkAction *action;
1637
1638 action = ctk_action_group_get_action (window->priv->actions_image,
1639 "PauseSlideshow");
1640
1641 g_signal_handlers_block_by_funcg_signal_handlers_block_matched ((action), (GSignalMatchType)
(G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)0
), (((GCallback) (eoc_window_cmd_pause_slideshow))), (window)
)
1642 (action, G_CALLBACK (eoc_window_cmd_pause_slideshow), window)g_signal_handlers_block_matched ((action), (GSignalMatchType)
(G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)0
), (((GCallback) (eoc_window_cmd_pause_slideshow))), (window)
)
;
1643
1644 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
,
1645 window->priv->mode != EOC_WINDOW_MODE_SLIDESHOW);
1646
1647 g_signal_handlers_unblock_by_funcg_signal_handlers_unblock_matched ((action), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (eoc_window_cmd_pause_slideshow))), (window
))
1648 (action, G_CALLBACK (eoc_window_cmd_pause_slideshow), window)g_signal_handlers_unblock_matched ((action), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (eoc_window_cmd_pause_slideshow))), (window
))
;
1649}
1650
1651static void
1652eoc_window_update_fullscreen_popup (EocWindow *window)
1653{
1654 CtkWidget *popup = window->priv->fullscreen_popup;
1655 CdkRectangle screen_rect;
1656 CdkScreen *screen;
1657 CdkDisplay *display;
1658
1659 g_return_if_fail (popup != NULL)do { if ((popup != ((void*)0))) { } else { g_return_if_fail_warning
("EOC", ((const char*) (__func__)), "popup != NULL"); return
; } } while (0)
;
1660
1661 if (ctk_widget_get_window (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
) == NULL((void*)0)) return;
1662
1663 screen = ctk_widget_get_screen (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
1664 display = cdk_screen_get_display (screen);
1665
1666 cdk_monitor_get_geometry (cdk_display_get_monitor_at_window (display,
1667 ctk_widget_get_window (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
)),
1668 &screen_rect);
1669
1670 ctk_widget_set_size_request (popup,
1671 screen_rect.width,
1672 -1);
1673
1674 ctk_window_move (CTK_WINDOW (popup)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((popup)), ((ctk_window_get_type ()))))))
, screen_rect.x, screen_rect.y);
1675}
1676
1677static void
1678screen_size_changed_cb (CdkScreen *screen, EocWindow *window)
1679{
1680 eoc_window_update_fullscreen_popup (window);
1681}
1682
1683static gboolean
1684fullscreen_timeout_cb (gpointer data)
1685{
1686 EocWindow *window = EOC_WINDOW (data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_window_get_type ()))))))
;
1687
1688 ctk_widget_hide (window->priv->fullscreen_popup);
1689
1690 eoc_scroll_view_hide_cursor (EOC_SCROLL_VIEW (window->priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->view)), ((eoc_scroll_view_get_type (
)))))))
);
1691
1692 fullscreen_clear_timeout (window);
1693
1694 return FALSE(0);
1695}
1696
1697static gboolean
1698slideshow_is_loop_end (EocWindow *window)
1699{
1700 EocWindowPrivate *priv = window->priv;
1701 EocImage *image = NULL((void*)0);
1702 gint pos;
1703
1704 image = eoc_thumb_view_get_first_selected_image (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
);
1705
1706 pos = eoc_list_store_get_pos_by_image (priv->store, image);
1707
1708 return (pos == (eoc_list_store_length (priv->store) - 1));
1709}
1710
1711static gboolean
1712slideshow_switch_cb (gpointer data)
1713{
1714 EocWindow *window = EOC_WINDOW (data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_window_get_type ()))))))
;
1715 EocWindowPrivate *priv = window->priv;
1716
1717 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1717, ((const char*) (__func__
))
);
1718
1719 if (priv->slideshow_random) {
1720 eoc_thumb_view_select_single (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
,
1721 EOC_THUMB_VIEW_SELECT_RANDOM);
1722 return TRUE(!(0));
1723 }
1724
1725 if (!priv->slideshow_loop && slideshow_is_loop_end (window)) {
1726 eoc_window_stop_fullscreen (window, TRUE(!(0)));
1727 return FALSE(0);
1728 }
1729
1730 eoc_thumb_view_select_single (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
,
1731 EOC_THUMB_VIEW_SELECT_RIGHT);
1732
1733 return TRUE(!(0));
1734}
1735
1736static void
1737fullscreen_clear_timeout (EocWindow *window)
1738{
1739 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1739, ((const char*) (__func__
))
);
1740
1741 if (window->priv->fullscreen_timeout_source != NULL((void*)0)) {
1742 g_source_unref (window->priv->fullscreen_timeout_source);
1743 g_source_destroy (window->priv->fullscreen_timeout_source);
1744 }
1745
1746 window->priv->fullscreen_timeout_source = NULL((void*)0);
1747}
1748
1749static void
1750fullscreen_set_timeout (EocWindow *window)
1751{
1752 GSource *source;
1753
1754 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1754, ((const char*) (__func__
))
);
1755
1756 fullscreen_clear_timeout (window);
1757
1758 source = g_timeout_source_new (EOC_WINDOW_FULLSCREEN_TIMEOUT5 * 1000);
1759 g_source_set_callback (source, fullscreen_timeout_cb, window, NULL((void*)0));
1760
1761 g_source_attach (source, NULL((void*)0));
1762
1763 window->priv->fullscreen_timeout_source = source;
1764
1765 eoc_scroll_view_show_cursor (EOC_SCROLL_VIEW (window->priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->view)), ((eoc_scroll_view_get_type (
)))))))
);
1766}
1767
1768static void
1769slideshow_clear_timeout (EocWindow *window)
1770{
1771 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1771, ((const char*) (__func__
))
);
1772
1773 if (window->priv->slideshow_switch_source != NULL((void*)0)) {
1774 g_source_unref (window->priv->slideshow_switch_source);
1775 g_source_destroy (window->priv->slideshow_switch_source);
1776 }
1777
1778 window->priv->slideshow_switch_source = NULL((void*)0);
1779}
1780
1781static void
1782slideshow_set_timeout (EocWindow *window)
1783{
1784 GSource *source;
1785
1786 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1786, ((const char*) (__func__
))
);
1787
1788 slideshow_clear_timeout (window);
1789
1790 if (window->priv->slideshow_switch_timeout <= 0)
1791 return;
1792
1793 source = g_timeout_source_new (window->priv->slideshow_switch_timeout * 1000);
1794 g_source_set_callback (source, slideshow_switch_cb, window, NULL((void*)0));
1795
1796 g_source_attach (source, NULL((void*)0));
1797
1798 window->priv->slideshow_switch_source = source;
1799}
1800
1801static void
1802show_fullscreen_popup (EocWindow *window)
1803{
1804 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1804, ((const char*) (__func__
))
);
1805
1806 if (!ctk_widget_get_visible (window->priv->fullscreen_popup)) {
1807 ctk_widget_show_all (CTK_WIDGET (window->priv->fullscreen_popup)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->fullscreen_popup)), ((ctk_widget_get_type
()))))))
);
1808 }
1809
1810 fullscreen_set_timeout (window);
1811}
1812
1813static gboolean
1814fullscreen_motion_notify_cb (CtkWidget *widget,
1815 CdkEventMotion *event,
1816 gpointer user_data)
1817{
1818 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
1819
1820 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1820, ((const char*) (__func__
))
);
1821
1822 if (event->y < EOC_WINDOW_FULLSCREEN_POPUP_THRESHOLD5) {
1823 show_fullscreen_popup (window);
1824 } else {
1825 fullscreen_set_timeout (window);
1826 }
1827
1828 return FALSE(0);
1829}
1830
1831static gboolean
1832fullscreen_leave_notify_cb (CtkWidget *widget,
1833 CdkEventCrossing *event,
1834 gpointer user_data)
1835{
1836 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
1837
1838 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1838, ((const char*) (__func__
))
);
1839
1840 fullscreen_clear_timeout (window);
1841
1842 return FALSE(0);
1843}
1844
1845static void
1846exit_fullscreen_button_clicked_cb (CtkWidget *button, EocWindow *window)
1847{
1848 CtkAction *action;
1849
1850 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1850, ((const char*) (__func__
))
);
1851
1852 if (window->priv->mode == EOC_WINDOW_MODE_SLIDESHOW) {
1853 action = ctk_action_group_get_action (window->priv->actions_collection,
1854 "ViewSlideshow");
1855 } else {
1856 action = ctk_action_group_get_action (window->priv->actions_image,
1857 "ViewFullscreen");
1858 }
1859 g_return_if_fail (action != NULL)do { if ((action != ((void*)0))) { } else { g_return_if_fail_warning
("EOC", ((const char*) (__func__)), "action != NULL"); return
; } } while (0)
;
1860
1861 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
, FALSE(0));
1862}
1863
1864static CtkWidget *
1865eoc_window_get_exit_fullscreen_button (EocWindow *window)
1866{
1867 CtkWidget *button;
1868
1869 button = ctk_button_new_with_mnemonic (_("Leave Fullscreen")gettext ("Leave Fullscreen"));
1870 ctk_button_set_image (CTK_BUTTON (button)((((CtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_button_get_type ()))))))
, ctk_image_new_from_icon_name ("view-restore", CTK_ICON_SIZE_BUTTON));
1871
1872 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
exit_fullscreen_button_clicked_cb))), (window), ((void*)0), (
GConnectFlags) 0)
1873 G_CALLBACK (exit_fullscreen_button_clicked_cb),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
exit_fullscreen_button_clicked_cb))), (window), ((void*)0), (
GConnectFlags) 0)
1874 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
exit_fullscreen_button_clicked_cb))), (window), ((void*)0), (
GConnectFlags) 0)
;
1875
1876 return button;
1877}
1878
1879static CtkWidget *
1880eoc_window_create_fullscreen_popup (EocWindow *window)
1881{
1882 CtkWidget *popup;
1883 CtkWidget *hbox;
1884 CtkWidget *button;
1885 CtkWidget *toolbar;
1886 CdkScreen *screen;
1887
1888 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1888, ((const char*) (__func__
))
);
1889
1890 popup = ctk_window_new (CTK_WINDOW_POPUP);
1891
1892 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
1893 ctk_container_add (CTK_CONTAINER (popup)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((popup)), ((ctk_container_get_type ()))))))
, hbox);
1894
1895 toolbar = ctk_ui_manager_get_widget (window->priv->ui_mgr,
1896 "/FullscreenToolbar");
1897 g_assert (CTK_IS_WIDGET (toolbar))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((toolbar)); GType __t = ((ctk_widget_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else
g_assertion_message_expr ("EOC", "eoc-window.c", 1897, ((const
char*) (__func__)), "CTK_IS_WIDGET (toolbar)"); } while (0)
;
1898 ctk_toolbar_set_style (CTK_TOOLBAR (toolbar)((((CtkToolbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toolbar)), ((ctk_toolbar_get_type ()))))))
, CTK_TOOLBAR_ICONS);
1899 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, toolbar, TRUE(!(0)), TRUE(!(0)), 0);
1900
1901 button = eoc_window_get_exit_fullscreen_button (window);
1902 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
1903
1904 ctk_window_set_resizable (CTK_WINDOW (popup)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((popup)), ((ctk_window_get_type ()))))))
, FALSE(0));
1905
1906 screen = ctk_widget_get_screen (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
1907
1908 g_signal_connect_object (screen, "size-changed",
1909 G_CALLBACK (screen_size_changed_cb)((GCallback) (screen_size_changed_cb)),
1910 window, 0);
1911
1912 g_signal_connect (popup,g_signal_connect_data ((popup), ("enter-notify-event"), (((GCallback
) (fullscreen_leave_notify_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1913 "enter-notify-event",g_signal_connect_data ((popup), ("enter-notify-event"), (((GCallback
) (fullscreen_leave_notify_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1914 G_CALLBACK (fullscreen_leave_notify_cb),g_signal_connect_data ((popup), ("enter-notify-event"), (((GCallback
) (fullscreen_leave_notify_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1915 window)g_signal_connect_data ((popup), ("enter-notify-event"), (((GCallback
) (fullscreen_leave_notify_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
1916
1917 ctk_window_set_screen (CTK_WINDOW (popup)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((popup)), ((ctk_window_get_type ()))))))
, screen);
1918
1919 return popup;
1920}
1921
1922static void
1923update_ui_visibility (EocWindow *window)
1924{
1925 EocWindowPrivate *priv;
1926
1927 CtkAction *action;
1928 CtkWidget *menubar;
1929
1930 gboolean fullscreen_mode, visible;
1931
1932 g_return_if_fail (EOC_IS_WINDOW (window))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return; } } while (0)
;
1933
1934 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1934, ((const char*) (__func__
))
);
1935
1936 priv = window->priv;
1937
1938 fullscreen_mode = priv->mode == EOC_WINDOW_MODE_FULLSCREEN ||
1939 priv->mode == EOC_WINDOW_MODE_SLIDESHOW;
1940
1941 menubar = ctk_ui_manager_get_widget (priv->ui_mgr, "/MainMenu");
1942 g_assert (CTK_IS_WIDGET (menubar))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((menubar)); GType __t = ((ctk_widget_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else
g_assertion_message_expr ("EOC", "eoc-window.c", 1942, ((const
char*) (__func__)), "CTK_IS_WIDGET (menubar)"); } while (0)
;
1943
1944 visible = g_settings_get_boolean (priv->ui_settings, EOC_CONF_UI_TOOLBAR"toolbar");
1945 visible = visible && !fullscreen_mode;
1946
1947 action = ctk_ui_manager_get_action (priv->ui_mgr, "/MainMenu/View/ToolbarToggle");
1948 g_assert (action != NULL)do { if (action != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 1948, ((const char*) (__func__)), "action != NULL"
); } while (0)
;
1949 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
, visible);
1950 g_object_set (G_OBJECT (priv->toolbar)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->toolbar)), (((GType) ((20) << (2))))))))
, "visible", visible, NULL((void*)0));
1951
1952 visible = g_settings_get_boolean (priv->ui_settings, EOC_CONF_UI_STATUSBAR"statusbar");
1953 visible = visible && !fullscreen_mode;
1954
1955 action = ctk_ui_manager_get_action (priv->ui_mgr, "/MainMenu/View/StatusbarToggle");
1956 g_assert (action != NULL)do { if (action != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 1956, ((const char*) (__func__)), "action != NULL"
); } while (0)
;
1957 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
, visible);
1958 g_object_set (G_OBJECT (priv->statusbar)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), (((GType) ((20) << (2)))))))
)
, "visible", visible, NULL((void*)0));
1959
1960 if (priv->status != EOC_WINDOW_STATUS_INIT) {
1961 visible = g_settings_get_boolean (priv->ui_settings, EOC_CONF_UI_IMAGE_COLLECTION"image-collection");
1962 visible = visible && priv->mode != EOC_WINDOW_MODE_SLIDESHOW;
1963 action = ctk_ui_manager_get_action (priv->ui_mgr, "/MainMenu/View/ImageCollectionToggle");
1964 g_assert (action != NULL)do { if (action != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 1964, ((const char*) (__func__)), "action != NULL"
); } while (0)
;
1965 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
, visible);
1966 if (visible) {
1967 ctk_widget_show (priv->nav);
1968 } else {
1969 ctk_widget_hide (priv->nav);
1970 }
1971 }
1972
1973 visible = g_settings_get_boolean (priv->ui_settings, EOC_CONF_UI_SIDEBAR"sidebar");
1974 visible = visible && !fullscreen_mode;
1975 action = ctk_ui_manager_get_action (priv->ui_mgr, "/MainMenu/View/SidebarToggle");
1976 g_assert (action != NULL)do { if (action != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 1976, ((const char*) (__func__)), "action != NULL"
); } while (0)
;
1977 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
, visible);
1978 if (visible) {
1979 ctk_widget_show (priv->sidebar);
1980 } else {
1981 ctk_widget_hide (priv->sidebar);
1982 }
1983
1984 if (priv->fullscreen_popup != NULL((void*)0)) {
1985 ctk_widget_hide (priv->fullscreen_popup);
1986 }
1987}
1988
1989static void
1990eoc_window_inhibit_screensaver (EocWindow *window)
1991{
1992 EocWindowPrivate *priv = window->priv;
1993
1994 g_return_if_fail (priv->fullscreen_idle_inhibit_cookie == 0)do { if ((priv->fullscreen_idle_inhibit_cookie == 0)) { } else
{ g_return_if_fail_warning ("EOC", ((const char*) (__func__)
), "priv->fullscreen_idle_inhibit_cookie == 0"); return; }
} while (0)
;
1995
1996 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1996, ((const char*) (__func__
))
);
1997
1998 window->priv->fullscreen_idle_inhibit_cookie =
1999 ctk_application_inhibit (CTK_APPLICATION (EOC_APP)((((CtkApplication*) (void *) g_type_check_instance_cast ((GTypeInstance
*) (((eoc_application_get_instance ()))), ((ctk_application_get_type
()))))))
,
2000 CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2001 CTK_APPLICATION_INHIBIT_IDLE,
2002 _("Viewing a slideshow")gettext ("Viewing a slideshow"));
2003}
2004
2005static void
2006eoc_window_uninhibit_screensaver (EocWindow *window)
2007{
2008 EocWindowPrivate *priv = window->priv;
2009
2010 if (G_UNLIKELY (priv->fullscreen_idle_inhibit_cookie == 0)(priv->fullscreen_idle_inhibit_cookie == 0))
2011 return;
2012
2013 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 2013, ((const char*) (__func__
))
);
2014
2015 ctk_application_uninhibit (CTK_APPLICATION (EOC_APP)((((CtkApplication*) (void *) g_type_check_instance_cast ((GTypeInstance
*) (((eoc_application_get_instance ()))), ((ctk_application_get_type
()))))))
,
2016 priv->fullscreen_idle_inhibit_cookie);
2017 priv->fullscreen_idle_inhibit_cookie = 0;
2018}
2019
2020static void
2021eoc_window_run_fullscreen (EocWindow *window, gboolean slideshow)
2022{
2023 static const CdkRGBA black = { 0., 0., 0., 1.};
2024
2025 EocWindowPrivate *priv;
2026 CtkWidget *menubar;
2027 gboolean upscale;
2028
2029 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 2029, ((const char*) (__func__
))
);
2030
2031 priv = window->priv;
2032
2033 if (slideshow) {
2034 priv->mode = EOC_WINDOW_MODE_SLIDESHOW;
2035 } else {
2036 /* Stop the timer if we come from slideshowing */
2037 if (priv->mode == EOC_WINDOW_MODE_SLIDESHOW)
2038 slideshow_clear_timeout (window);
2039
2040 priv->mode = EOC_WINDOW_MODE_FULLSCREEN;
2041 }
2042
2043 if (window->priv->fullscreen_popup == NULL((void*)0))
2044 priv->fullscreen_popup
2045 = eoc_window_create_fullscreen_popup (window);
2046
2047 update_ui_visibility (window);
2048
2049 menubar = ctk_ui_manager_get_widget (priv->ui_mgr, "/MainMenu");
2050 g_assert (CTK_IS_WIDGET (menubar))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((menubar)); GType __t = ((ctk_widget_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else
g_assertion_message_expr ("EOC", "eoc-window.c", 2050, ((const
char*) (__func__)), "CTK_IS_WIDGET (menubar)"); } while (0)
;
2051 ctk_widget_hide (menubar);
2052
2053 g_signal_connect (priv->view,g_signal_connect_data ((priv->view), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
2054 "motion-notify-event",g_signal_connect_data ((priv->view), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
2055 G_CALLBACK (fullscreen_motion_notify_cb),g_signal_connect_data ((priv->view), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
2056 window)g_signal_connect_data ((priv->view), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
;
2057
2058 g_signal_connect (priv->view,g_signal_connect_data ((priv->view), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
2059 "leave-notify-event",g_signal_connect_data ((priv->view), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
2060 G_CALLBACK (fullscreen_leave_notify_cb),g_signal_connect_data ((priv->view), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
2061 window)g_signal_connect_data ((priv->view), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
;
2062
2063 g_signal_connect (priv->thumbview,g_signal_connect_data ((priv->thumbview), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
2064 "motion-notify-event",g_signal_connect_data ((priv->thumbview), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
2065 G_CALLBACK (fullscreen_motion_notify_cb),g_signal_connect_data ((priv->thumbview), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
2066 window)g_signal_connect_data ((priv->thumbview), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
;
2067
2068 g_signal_connect (priv->thumbview,g_signal_connect_data ((priv->thumbview), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
2069 "leave-notify-event",g_signal_connect_data ((priv->thumbview), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
2070 G_CALLBACK (fullscreen_leave_notify_cb),g_signal_connect_data ((priv->thumbview), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
2071 window)g_signal_connect_data ((priv->thumbview), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
;
2072
2073 fullscreen_set_timeout (window);
2074
2075 if (slideshow) {
2076 priv->slideshow_random =
2077 g_settings_get_boolean (priv->fullscreen_settings,
2078 EOC_CONF_FULLSCREEN_RANDOM"random");
2079
2080 priv->slideshow_loop =
2081 g_settings_get_boolean (priv->fullscreen_settings,
2082 EOC_CONF_FULLSCREEN_LOOP"loop");
2083
2084 priv->slideshow_switch_timeout =
2085 g_settings_get_int (priv->fullscreen_settings,
2086 EOC_CONF_FULLSCREEN_SECONDS"seconds");
2087
2088 slideshow_set_timeout (window);
2089 }
2090
2091 upscale = g_settings_get_boolean (priv->fullscreen_settings,
2092 EOC_CONF_FULLSCREEN_UPSCALE"upscale");
2093
2094 eoc_scroll_view_set_zoom_upscale (EOC_SCROLL_VIEW (priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((eoc_scroll_view_get_type ()))))))
,
2095 upscale);
2096
2097 ctk_widget_grab_focus (priv->view);
2098
2099 eoc_scroll_view_override_bg_color (EOC_SCROLL_VIEW (window->priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->view)), ((eoc_scroll_view_get_type (
)))))))
,
2100 &black);
2101
2102 ctk_window_fullscreen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
);
2103 eoc_window_update_fullscreen_popup (window);
2104
2105 eoc_window_inhibit_screensaver (window);
2106
2107 /* Update both actions as we could've already been in one those modes */
2108 eoc_window_update_slideshow_action (window);
2109 eoc_window_update_fullscreen_action (window);
2110 eoc_window_update_pause_slideshow_action (window);
2111}
2112
2113static void
2114eoc_window_stop_fullscreen (EocWindow *window, gboolean slideshow)
2115{
2116 EocWindowPrivate *priv;
2117 CtkWidget *menubar;
2118
2119 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 2119, ((const char*) (__func__
))
);
2120
2121 priv = window->priv;
2122
2123 if (priv->mode != EOC_WINDOW_MODE_SLIDESHOW &&
2124 priv->mode != EOC_WINDOW_MODE_FULLSCREEN) return;
2125
2126 priv->mode = EOC_WINDOW_MODE_NORMAL;
2127
2128 fullscreen_clear_timeout (window);
2129
2130 if (slideshow) {
2131 slideshow_clear_timeout (window);
2132 }
2133
2134 g_signal_handlers_disconnect_by_func (priv->view,g_signal_handlers_disconnect_matched ((priv->view), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), ((gpointer) fullscreen_motion_notify_cb), (window))
2135 (gpointer) fullscreen_motion_notify_cb,g_signal_handlers_disconnect_matched ((priv->view), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), ((gpointer) fullscreen_motion_notify_cb), (window))
2136 window)g_signal_handlers_disconnect_matched ((priv->view), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), ((gpointer) fullscreen_motion_notify_cb), (window))
;
2137
2138 g_signal_handlers_disconnect_by_func (priv->view,g_signal_handlers_disconnect_matched ((priv->view), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), ((gpointer) fullscreen_leave_notify_cb), (window))
2139 (gpointer) fullscreen_leave_notify_cb,g_signal_handlers_disconnect_matched ((priv->view), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), ((gpointer) fullscreen_leave_notify_cb), (window))
2140 window)g_signal_handlers_disconnect_matched ((priv->view), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), ((gpointer) fullscreen_leave_notify_cb), (window))
;
2141
2142 g_signal_handlers_disconnect_by_func (priv->thumbview,g_signal_handlers_disconnect_matched ((priv->thumbview), (
GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA)
, 0, 0, ((void*)0), ((gpointer) fullscreen_motion_notify_cb),
(window))
2143 (gpointer) fullscreen_motion_notify_cb,g_signal_handlers_disconnect_matched ((priv->thumbview), (
GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA)
, 0, 0, ((void*)0), ((gpointer) fullscreen_motion_notify_cb),
(window))
2144 window)g_signal_handlers_disconnect_matched ((priv->thumbview), (
GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA)
, 0, 0, ((void*)0), ((gpointer) fullscreen_motion_notify_cb),
(window))
;
2145
2146 g_signal_handlers_disconnect_by_func (priv->thumbview,g_signal_handlers_disconnect_matched ((priv->thumbview), (
GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA)
, 0, 0, ((void*)0), ((gpointer) fullscreen_leave_notify_cb), (
window))
2147 (gpointer) fullscreen_leave_notify_cb,g_signal_handlers_disconnect_matched ((priv->thumbview), (
GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA)
, 0, 0, ((void*)0), ((gpointer) fullscreen_leave_notify_cb), (
window))
2148 window)g_signal_handlers_disconnect_matched ((priv->thumbview), (
GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA)
, 0, 0, ((void*)0), ((gpointer) fullscreen_leave_notify_cb), (
window))
;
2149
2150 update_ui_visibility (window);
2151
2152 menubar = ctk_ui_manager_get_widget (priv->ui_mgr, "/MainMenu");
2153 g_assert (CTK_IS_WIDGET (menubar))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((menubar)); GType __t = ((ctk_widget_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else
g_assertion_message_expr ("EOC", "eoc-window.c", 2153, ((const
char*) (__func__)), "CTK_IS_WIDGET (menubar)"); } while (0)
;
2154 ctk_widget_show (menubar);
2155
2156 eoc_scroll_view_set_zoom_upscale (EOC_SCROLL_VIEW (priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((eoc_scroll_view_get_type ()))))))
, FALSE(0));
2157
2158 eoc_scroll_view_override_bg_color (EOC_SCROLL_VIEW (window->priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->view)), ((eoc_scroll_view_get_type (
)))))))
,
2159 NULL((void*)0));
2160 ctk_window_unfullscreen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
);
2161
2162 if (slideshow) {
2163 eoc_window_update_slideshow_action (window);
2164 } else {
2165 eoc_window_update_fullscreen_action (window);
2166 }
2167
2168 eoc_scroll_view_show_cursor (EOC_SCROLL_VIEW (priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((eoc_scroll_view_get_type ()))))))
);
2169
2170 eoc_window_uninhibit_screensaver (window);
2171}
2172
2173static void
2174eoc_window_print (EocWindow *window)
2175{
2176 CtkWidget *dialog;
2177 GError *error = NULL((void*)0);
2178 CtkPrintOperation *print;
2179 CtkPrintOperationResult res;
2180 CtkPageSetup *page_setup;
2181 CtkPrintSettings *print_settings;
2182 gboolean page_setup_disabled = FALSE(0);
2183
2184 eoc_debug (DEBUG_PRINTINGEOC_DEBUG_PRINTING, "eoc-window.c", 2184, ((const char*) (__func__
))
);
2185
2186 print_settings = eoc_print_get_print_settings ();
2187
2188 /* Make sure the window stays valid while printing */
2189 g_object_ref (window)((__typeof__ (window)) (g_object_ref) (window));
2190
2191 if (window->priv->page_setup != NULL((void*)0))
2192 page_setup = g_object_ref (window->priv->page_setup)((__typeof__ (window->priv->page_setup)) (g_object_ref)
(window->priv->page_setup))
;
2193 else
2194 page_setup = eoc_print_get_page_setup ();
2195
2196 print = eoc_print_operation_new (window->priv->image,
2197 print_settings,
2198 page_setup);
2199
2200 // Disable page setup options if they are locked down
2201 page_setup_disabled = g_settings_get_boolean (window->priv->lockdown_settings,
2202 EOC_CONF_LOCKDOWN_CAN_SETUP_PAGE"disable-print-setup");
2203 if (page_setup_disabled)
2204 ctk_print_operation_set_embed_page_setup (print, FALSE(0));
2205
2206 res = ctk_print_operation_run (print,
2207 CTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
2208 CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, &error);
2209
2210 if (res == CTK_PRINT_OPERATION_RESULT_ERROR) {
2211 dialog = ctk_message_dialog_new (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2212 CTK_DIALOG_DESTROY_WITH_PARENT,
2213 CTK_MESSAGE_ERROR,
2214 CTK_BUTTONS_CLOSE,
2215 _("Error printing file:\n%s")gettext ("Error printing file:\n%s"),
2216 error->message);
2217 g_signal_connect (dialog, "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
2218 G_CALLBACK (ctk_widget_destroy), NULL)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
2219 ctk_widget_show (dialog);
2220 g_error_free (error);
2221 } else if (res == CTK_PRINT_OPERATION_RESULT_APPLY) {
2222 CtkPageSetup *new_page_setup;
2223 eoc_print_set_print_settings (ctk_print_operation_get_print_settings (print));
2224 new_page_setup = ctk_print_operation_get_default_page_setup (print);
2225 if (window->priv->page_setup != NULL((void*)0))
2226 g_object_unref (window->priv->page_setup);
2227 window->priv->page_setup = g_object_ref (new_page_setup)((__typeof__ (new_page_setup)) (g_object_ref) (new_page_setup
))
;
2228 eoc_print_set_page_setup (window->priv->page_setup);
2229 }
2230
2231 if (page_setup != NULL((void*)0))
2232 g_object_unref (page_setup);
2233 g_object_unref (print_settings);
2234 g_object_unref (window);
2235}
2236
2237static void
2238eoc_window_cmd_file_open (CtkAction *action, gpointer user_data)
2239{
2240 EocWindow *window;
2241 EocWindowPrivate *priv;
2242 EocImage *current;
2243 CtkWidget *dlg;
2244
2245 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
2246
2247 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2248
2249 priv = window->priv;
2250
2251 dlg = eoc_file_chooser_new (CTK_FILE_CHOOSER_ACTION_OPEN);
2252 ctk_window_set_transient_for (CTK_WINDOW (dlg)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_window_get_type ()))))))
, CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
);
2253
2254 current = eoc_thumb_view_get_first_selected_image (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
);
2255
2256 if (current != NULL((void*)0)) {
2257 gchar *dir_uri, *file_uri;
2258
2259 file_uri = eoc_image_get_uri_for_display (current);
2260 dir_uri = g_path_get_dirname (file_uri);
2261
2262 ctk_file_chooser_set_current_folder_uri (CTK_FILE_CHOOSER (dlg)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_file_chooser_get_type ()))))))
,
2263 dir_uri);
2264 g_free (file_uri);
2265 g_free (dir_uri);
2266 g_object_unref (current);
2267 } else {
2268 /* If desired by the user,
2269 fallback to the XDG_PICTURES_DIR (if available) */
2270 const gchar *pics_dir;
2271 gboolean use_fallback;
2272
2273 use_fallback = g_settings_get_boolean (priv->ui_settings,
2274 EOC_CONF_UI_FILECHOOSER_XDG_FALLBACK"filechooser-xdg-fallback");
2275 pics_dir = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
2276 if (use_fallback && pics_dir) {
2277 ctk_file_chooser_set_current_folder (CTK_FILE_CHOOSER (dlg)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_file_chooser_get_type ()))))))
,
2278 pics_dir);
2279 }
2280 }
2281
2282 g_signal_connect (dlg, "response",g_signal_connect_data ((dlg), ("response"), (((GCallback) (file_open_dialog_response_cb
))), (window), ((void*)0), (GConnectFlags) 0)
2283 G_CALLBACK (file_open_dialog_response_cb),g_signal_connect_data ((dlg), ("response"), (((GCallback) (file_open_dialog_response_cb
))), (window), ((void*)0), (GConnectFlags) 0)
2284 window)g_signal_connect_data ((dlg), ("response"), (((GCallback) (file_open_dialog_response_cb
))), (window), ((void*)0), (GConnectFlags) 0)
;
2285
2286 ctk_widget_show_all (dlg);
2287}
2288
2289static void
2290eoc_job_close_save_cb (EocJobSave *job, gpointer user_data)
2291{
2292 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2293
2294 g_signal_handlers_disconnect_by_func (job,g_signal_handlers_disconnect_matched ((job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_close_save_cb), (window))
2295 eoc_job_close_save_cb,g_signal_handlers_disconnect_matched ((job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_close_save_cb), (window))
2296 window)g_signal_handlers_disconnect_matched ((job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_close_save_cb), (window))
;
2297
2298 ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
2299}
2300
2301static void
2302close_confirmation_dialog_response_handler (EocCloseConfirmationDialog *dlg,
2303 gint response_id,
2304 EocWindow *window)
2305{
2306 GList *selected_images;
2307 EocWindowPrivate *priv;
2308
2309 priv = window->priv;
2310
2311 switch (response_id)
2312 {
2313 case CTK_RESPONSE_YES:
2314 /* save selected images */
2315 selected_images = eoc_close_confirmation_dialog_get_selected_images (dlg);
2316 if (eoc_window_save_images (window, selected_images)) {
2317 g_signal_connect (priv->save_job,g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_close_save_cb))), (window), ((void*)0), (
GConnectFlags) 0)
2318 "finished",g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_close_save_cb))), (window), ((void*)0), (
GConnectFlags) 0)
2319 G_CALLBACK (eoc_job_close_save_cb),g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_close_save_cb))), (window), ((void*)0), (
GConnectFlags) 0)
2320 window)g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_close_save_cb))), (window), ((void*)0), (
GConnectFlags) 0)
;
2321
2322 eoc_job_queue_add_job (priv->save_job);
2323 }
2324
2325 break;
2326
2327 case CTK_RESPONSE_NO:
2328 /* dont save */
2329 ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
2330 break;
2331
2332 default:
2333 /* Cancel */
2334 ctk_widget_destroy (CTK_WIDGET (dlg)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_widget_get_type ()))))))
);
2335 break;
2336 }
2337}
2338
2339static gboolean
2340eoc_window_unsaved_images_confirm (EocWindow *window)
2341{
2342 EocWindowPrivate *priv;
2343 gboolean disabled;
2344 CtkWidget *dialog;
2345 GList *list;
2346 EocImage *image;
2347 CtkTreeIter iter;
2348
2349 priv = window->priv;
2350
2351 disabled = g_settings_get_boolean(priv->ui_settings,
2352 EOC_CONF_UI_DISABLE_CLOSE_CONFIRMATION"disable-close-confirmation");
2353 disabled |= window->priv->save_disabled;
2354 if (disabled || !priv->store) {
2355 return FALSE(0);
2356 }
2357
2358 list = NULL((void*)0);
2359 if (ctk_tree_model_get_iter_first (CTK_TREE_MODEL (priv->store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->store)), ((ctk_tree_model_get_type ()))))))
, &iter)) {
2360 do {
2361 ctk_tree_model_get (CTK_TREE_MODEL (priv->store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->store)), ((ctk_tree_model_get_type ()))))))
, &iter,
2362 EOC_LIST_STORE_EOC_IMAGE, &image,
2363 -1);
2364 if (!image)
2365 continue;
2366
2367 if (eoc_image_is_modified (image)) {
2368 list = g_list_prepend (list, image);
2369 }
2370 } while (ctk_tree_model_iter_next (CTK_TREE_MODEL (priv->store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->store)), ((ctk_tree_model_get_type ()))))))
, &iter));
2371 }
2372
2373 if (list) {
2374 list = g_list_reverse (list);
2375 dialog = eoc_close_confirmation_dialog_new (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2376 list);
2377
2378 g_list_free (list);
2379 g_signal_connect (dialog,g_signal_connect_data ((dialog), ("response"), (((GCallback) (
close_confirmation_dialog_response_handler))), (window), ((void
*)0), (GConnectFlags) 0)
2380 "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
close_confirmation_dialog_response_handler))), (window), ((void
*)0), (GConnectFlags) 0)
2381 G_CALLBACK (close_confirmation_dialog_response_handler),g_signal_connect_data ((dialog), ("response"), (((GCallback) (
close_confirmation_dialog_response_handler))), (window), ((void
*)0), (GConnectFlags) 0)
2382 window)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
close_confirmation_dialog_response_handler))), (window), ((void
*)0), (GConnectFlags) 0)
;
2383 ctk_window_set_destroy_with_parent (CTK_WINDOW (dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_window_get_type ()))))))
, TRUE(!(0)));
2384
2385 ctk_widget_show (dialog);
2386 return TRUE(!(0));
2387
2388 }
2389 return FALSE(0);
2390}
2391
2392static void
2393eoc_window_cmd_close_window (CtkAction *action, gpointer user_data)
2394{
2395 EocWindow *window;
2396 EocWindowPrivate *priv;
2397
2398 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
2399
2400 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2401 priv = window->priv;
2402
2403 if (priv->save_job != NULL((void*)0)) {
2404 eoc_window_finish_saving (window);
2405 }
2406
2407 if (!eoc_window_unsaved_images_confirm (window)) {
2408 ctk_widget_destroy (CTK_WIDGET (user_data)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((ctk_widget_get_type ()))))))
);
2409 }
2410}
2411
2412static void
2413eoc_window_cmd_preferences (CtkAction *action, gpointer user_data)
2414{
2415 EocWindow *window;
2416 CtkWidget *pref_dlg;
2417
2418 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
2419
2420 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2421
2422 pref_dlg = eoc_preferences_dialog_get_instance (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
);
2423
2424 ctk_widget_show (pref_dlg);
2425}
2426
2427#define EOC_TB_EDITOR_DLG_RESET_RESPONSE128 128
2428
2429static void
2430eoc_window_cmd_edit_toolbar_cb (CtkDialog *dialog, gint response, gpointer data)
2431{
2432 EocWindow *window = EOC_WINDOW (data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_window_get_type ()))))))
;
2433
2434 if (response == EOC_TB_EDITOR_DLG_RESET_RESPONSE128) {
2435 EggToolbarsModel *model;
2436 EggToolbarEditor *editor;
2437
2438 editor = g_object_get_data (G_OBJECT (dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), (((GType) ((20) << (2))))))))
,
2439 "EggToolbarEditor");
2440
2441 g_return_if_fail (editor != NULL)do { if ((editor != ((void*)0))) { } else { g_return_if_fail_warning
("EOC", ((const char*) (__func__)), "editor != NULL"); return
; } } while (0)
;
2442
2443 egg_editable_toolbar_set_edit_mode
2444 (EGG_EDITABLE_TOOLBAR (window->priv->toolbar)((((EggEditableToolbar*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((window->priv->toolbar)), ((egg_editable_toolbar_get_type
()))))))
, FALSE(0));
2445
2446 eoc_application_reset_toolbars_model (EOC_APP(eoc_application_get_instance ()));
2447 model = eoc_application_get_toolbars_model (EOC_APP(eoc_application_get_instance ()));
2448 egg_editable_toolbar_set_model
2449 (EGG_EDITABLE_TOOLBAR (window->priv->toolbar)((((EggEditableToolbar*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((window->priv->toolbar)), ((egg_editable_toolbar_get_type
()))))))
, model);
2450 egg_toolbar_editor_set_model (editor, model);
2451
2452 /* Toolbar would be uneditable now otherwise */
2453 egg_editable_toolbar_set_edit_mode
2454 (EGG_EDITABLE_TOOLBAR (window->priv->toolbar)((((EggEditableToolbar*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((window->priv->toolbar)), ((egg_editable_toolbar_get_type
()))))))
, TRUE(!(0)));
2455 } else if (response == CTK_RESPONSE_HELP) {
2456 eoc_util_show_help ("eoc-toolbareditor", NULL((void*)0));
2457 } else {
2458 egg_editable_toolbar_set_edit_mode
2459 (EGG_EDITABLE_TOOLBAR (window->priv->toolbar)((((EggEditableToolbar*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((window->priv->toolbar)), ((egg_editable_toolbar_get_type
()))))))
, FALSE(0));
2460
2461 eoc_application_save_toolbars_model (EOC_APP(eoc_application_get_instance ()));
2462
2463 ctk_widget_destroy (CTK_WIDGET (dialog)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_widget_get_type ()))))))
);
2464 }
2465}
2466
2467static void
2468eoc_window_cmd_edit_toolbar (CtkAction *action, gpointer *user_data)
2469{
2470 EocWindow *window;
2471 CtkWidget *dialog;
2472 CtkWidget *editor;
2473
2474 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
2475
2476 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2477
2478 dialog = ctk_dialog_new_with_buttons (_("Toolbar Editor")gettext ("Toolbar Editor"),
2479 CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2480 CTK_DIALOG_DESTROY_WITH_PARENT,
2481 _("_Reset to Default")gettext ("_Reset to Default"),
2482 EOC_TB_EDITOR_DLG_RESET_RESPONSE128,
2483 "ctk-close",
2484 CTK_RESPONSE_CLOSE,
2485 "ctk-help",
2486 CTK_RESPONSE_HELP,
2487 NULL((void*)0));
2488
2489 ctk_dialog_set_default_response (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_dialog_get_type ()))))))
,
2490 CTK_RESPONSE_CLOSE);
2491
2492 ctk_container_set_border_width (CTK_CONTAINER (dialog)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_container_get_type ()))))))
, 5);
2493
2494 ctk_box_set_spacing (CTK_BOX (ctk_dialog_get_content_area (CTK_DIALOG (dialog)))((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_dialog_get_content_area (((((CtkDialog*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((dialog)), ((ctk_dialog_get_type ()))))))
))), ((ctk_box_get_type ()))))))
, 2);
2495
2496 ctk_window_set_default_size (CTK_WINDOW (dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_window_get_type ()))))))
, 500, 400);
2497
2498 editor = egg_toolbar_editor_new (window->priv->ui_mgr,
2499 eoc_application_get_toolbars_model (EOC_APP(eoc_application_get_instance ())));
2500
2501 ctk_container_set_border_width (CTK_CONTAINER (editor)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((editor)), ((ctk_container_get_type ()))))))
, 5);
2502
2503 // Use as much vertical space as available
2504 ctk_widget_set_vexpand (CTK_WIDGET (editor)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((editor)), ((ctk_widget_get_type ()))))))
, TRUE(!(0)));
2505
2506 ctk_box_set_spacing (CTK_BOX (EGG_TOOLBAR_EDITOR (editor))((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((EggToolbarEditor*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((editor)), ((egg_toolbar_editor_get_type (
))))))))), ((ctk_box_get_type ()))))))
, 5);
2507
2508 ctk_container_add (CTK_CONTAINER (ctk_dialog_get_content_area (CTK_DIALOG (dialog)))((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_dialog_get_content_area (((((CtkDialog*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((dialog)), ((ctk_dialog_get_type ()))))))
))), ((ctk_container_get_type ()))))))
, editor);
2509
2510 egg_editable_toolbar_set_edit_mode
2511 (EGG_EDITABLE_TOOLBAR (window->priv->toolbar)((((EggEditableToolbar*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((window->priv->toolbar)), ((egg_editable_toolbar_get_type
()))))))
, TRUE(!(0)));
2512
2513 g_object_set_data (G_OBJECT (dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), (((GType) ((20) << (2))))))))
, "EggToolbarEditor", editor);
2514
2515 g_signal_connect (dialog,g_signal_connect_data ((dialog), ("response"), (((GCallback) (
eoc_window_cmd_edit_toolbar_cb))), (window), ((void*)0), (GConnectFlags
) 0)
2516 "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
eoc_window_cmd_edit_toolbar_cb))), (window), ((void*)0), (GConnectFlags
) 0)
2517 G_CALLBACK (eoc_window_cmd_edit_toolbar_cb),g_signal_connect_data ((dialog), ("response"), (((GCallback) (
eoc_window_cmd_edit_toolbar_cb))), (window), ((void*)0), (GConnectFlags
) 0)
2518 window)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
eoc_window_cmd_edit_toolbar_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
2519
2520 ctk_widget_show_all (dialog);
2521}
2522
2523static void
2524eoc_window_cmd_help (CtkAction *action, gpointer user_data)
2525{
2526 EocWindow *window;
2527
2528 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
2529
2530 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2531
2532 eoc_util_show_help (NULL((void*)0), CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
);
2533}
2534
2535#define ABOUT_GROUP"About" "About"
2536#define EMAILIFY(string)(g_strdelimit ((string), "%", '@')) (g_strdelimit ((string), "%", '@'))
2537
2538static void
2539eoc_window_cmd_about (CtkAction *action, gpointer user_data)
2540{
2541 EocWindow *window;
2542
2543 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
2544
2545 const char *license[] = {
2546 N_("This program is free software; you can redistribute it and/or modify "("This program is free software; you can redistribute it and/or modify "
"it under the terms of the GNU General Public License as published by "
"the Free Software Foundation; either version 2 of the License, or "
"(at your option) any later version.\n")
2547 "it under the terms of the GNU General Public License as published by "("This program is free software; you can redistribute it and/or modify "
"it under the terms of the GNU General Public License as published by "
"the Free Software Foundation; either version 2 of the License, or "
"(at your option) any later version.\n")
2548 "the Free Software Foundation; either version 2 of the License, or "("This program is free software; you can redistribute it and/or modify "
"it under the terms of the GNU General Public License as published by "
"the Free Software Foundation; either version 2 of the License, or "
"(at your option) any later version.\n")
2549 "(at your option) any later version.\n")("This program is free software; you can redistribute it and/or modify "
"it under the terms of the GNU General Public License as published by "
"the Free Software Foundation; either version 2 of the License, or "
"(at your option) any later version.\n")
,
2550 N_("This program is distributed in the hope that it will be useful, "("This program is distributed in the hope that it will be useful, "
"but WITHOUT ANY WARRANTY; without even the implied warranty of "
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
"GNU General Public License for more details.\n")
2551 "but WITHOUT ANY WARRANTY; without even the implied warranty of "("This program is distributed in the hope that it will be useful, "
"but WITHOUT ANY WARRANTY; without even the implied warranty of "
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
"GNU General Public License for more details.\n")
2552 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "("This program is distributed in the hope that it will be useful, "
"but WITHOUT ANY WARRANTY; without even the implied warranty of "
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
"GNU General Public License for more details.\n")
2553 "GNU General Public License for more details.\n")("This program is distributed in the hope that it will be useful, "
"but WITHOUT ANY WARRANTY; without even the implied warranty of "
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
"GNU General Public License for more details.\n")
,
2554 N_("You should have received a copy of the GNU General Public License "("You should have received a copy of the GNU General Public License "
"along with this program; if not, write to the Free Software "
"Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA."
)
2555 "along with this program; if not, write to the Free Software "("You should have received a copy of the GNU General Public License "
"along with this program; if not, write to the Free Software "
"Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA."
)
2556 "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.")("You should have received a copy of the GNU General Public License "
"along with this program; if not, write to the Free Software "
"Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA."
)
2557 };
2558
2559 char *license_trans;
2560 GKeyFile *key_file;
2561 GBytes *bytes;
2562 const guint8 *data;
2563 gsize data_len;
2564 GError *error = NULL((void*)0);
2565 char **authors, **documenters;
2566 gsize n_authors = 0, n_documenters = 0 , i;
2567
2568 bytes = g_resources_lookup_data ("/org/cafe/eoc/ui/eoc.about", G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
2569 g_assert_no_error (error)do { if (error) g_assertion_message_error ("EOC", "eoc-window.c"
, 2569, ((const char*) (__func__)), "error", error, 0, 0); } while
(0)
;
2570
2571 data = g_bytes_get_data (bytes, &data_len);
2572 key_file = g_key_file_new ();
2573 g_key_file_load_from_data (key_file, (const char *) data, data_len, 0, &error);
2574 g_assert_no_error (error)do { if (error) g_assertion_message_error ("EOC", "eoc-window.c"
, 2574, ((const char*) (__func__)), "error", error, 0, 0); } while
(0)
;
2575
2576 authors = g_key_file_get_string_list (key_file, ABOUT_GROUP"About", "Authors", &n_authors, NULL((void*)0));
2577 documenters = g_key_file_get_string_list (key_file, ABOUT_GROUP"About", "Documenters", &n_documenters, NULL((void*)0));
2578
2579 g_key_file_free (key_file);
2580 g_bytes_unref (bytes);
2581
2582 for (i = 0; i < n_authors; ++i)
2583 authors[i] = EMAILIFY (authors[i])(g_strdelimit ((authors[i]), "%", '@'));
2584 for (i = 0; i < n_documenters; ++i)
2585 documenters[i] = EMAILIFY (documenters[i])(g_strdelimit ((documenters[i]), "%", '@'));
2586
2587 license_trans = g_strconcat (_(license[0])gettext (license[0]), "\n", _(license[1])gettext (license[1]), "\n", _(license[2])gettext (license[2]), "\n", NULL((void*)0));
2588
2589 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2590
2591 ctk_show_about_dialog (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2592 "program-name", _("Eye of CAFE")gettext ("Eye of CAFE"),
2593 "title", _("About Eye of CAFE")gettext ("About Eye of CAFE"),
2594 "version", VERSION"1.25.0",
2595 "copyright", _("Copyright \xc2\xa9 2000-2010 Free Software Foundation, Inc.\n"gettext ("Copyright \xc2\xa9 2000-2010 Free Software Foundation, Inc.\n"
"Copyright \xc2\xa9 2011 Perberos\n" "Copyright \xc2\xa9 2012-2020 MATE developers\n"
"Copyright \xc2\xa9 2023 Pablo Barciela")
2596 "Copyright \xc2\xa9 2011 Perberos\n"gettext ("Copyright \xc2\xa9 2000-2010 Free Software Foundation, Inc.\n"
"Copyright \xc2\xa9 2011 Perberos\n" "Copyright \xc2\xa9 2012-2020 MATE developers\n"
"Copyright \xc2\xa9 2023 Pablo Barciela")
2597 "Copyright \xc2\xa9 2012-2020 MATE developers\n"gettext ("Copyright \xc2\xa9 2000-2010 Free Software Foundation, Inc.\n"
"Copyright \xc2\xa9 2011 Perberos\n" "Copyright \xc2\xa9 2012-2020 MATE developers\n"
"Copyright \xc2\xa9 2023 Pablo Barciela")
2598 "Copyright \xc2\xa9 2023 Pablo Barciela")gettext ("Copyright \xc2\xa9 2000-2010 Free Software Foundation, Inc.\n"
"Copyright \xc2\xa9 2011 Perberos\n" "Copyright \xc2\xa9 2012-2020 MATE developers\n"
"Copyright \xc2\xa9 2023 Pablo Barciela")
,
2599 "comments",_("The CAFE image viewer.")gettext ("The CAFE image viewer."),
2600 "authors", authors,
2601 "documenters", documenters,
2602 "translator-credits", _("translator-credits")gettext ("translator-credits"),
2603 "website", "http://www.cafe-desktop.org/",
2604 "logo-icon-name", "eoc",
2605 "wrap-license", TRUE(!(0)),
2606 "license", license_trans,
2607 NULL((void*)0));
2608
2609 g_strfreev (authors);
2610 g_strfreev (documenters);
2611 g_free (license_trans);
2612}
2613
2614static void
2615eoc_window_cmd_show_hide_bar (CtkAction *action, gpointer user_data)
2616{
2617 EocWindow *window;
2618 EocWindowPrivate *priv;
2619 gboolean visible;
2620 const gchar *action_name;
2621
2622 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
2623
2624 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2625 priv = window->priv;
2626
2627 if (priv->mode != EOC_WINDOW_MODE_NORMAL &&
2628 priv->mode != EOC_WINDOW_MODE_FULLSCREEN) return;
2629
2630 visible = ctk_toggle_action_get_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
);
2631 action_name = ctk_action_get_name (action);
2632
2633 if (g_ascii_strcasecmp (action_name, "ViewToolbar") == 0) {
2634 g_object_set (G_OBJECT (priv->toolbar)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->toolbar)), (((GType) ((20) << (2))))))))
, "visible", visible, NULL((void*)0));
2635
2636 if (priv->mode == EOC_WINDOW_MODE_NORMAL)
2637 g_settings_set_boolean (priv->ui_settings, EOC_CONF_UI_TOOLBAR"toolbar", visible);
2638
2639 } else if (g_ascii_strcasecmp (action_name, "ViewStatusbar") == 0) {
2640 g_object_set (G_OBJECT (priv->statusbar)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), (((GType) ((20) << (2)))))))
)
, "visible", visible, NULL((void*)0));
2641
2642 if (priv->mode == EOC_WINDOW_MODE_NORMAL)
2643 g_settings_set_boolean (priv->ui_settings, EOC_CONF_UI_STATUSBAR"statusbar", visible);
2644
2645 } else if (g_ascii_strcasecmp (action_name, "ViewImageCollection") == 0) {
2646 if (visible) {
2647 /* Make sure the focus widget is realized to
2648 * avoid warnings on keypress events */
2649 if (!ctk_widget_get_realized (window->priv->thumbview))
2650 ctk_widget_realize (window->priv->thumbview);
2651
2652 ctk_widget_show (priv->nav);
2653 ctk_widget_grab_focus (priv->thumbview);
2654 } else {
2655 /* Make sure the focus widget is realized to
2656 * avoid warnings on keypress events.
2657 * Don't do it during init phase or the view
2658 * will get a bogus allocation. */
2659 if (!ctk_widget_get_realized (priv->view)
2660 && priv->status == EOC_WINDOW_STATUS_NORMAL)
2661 ctk_widget_realize (priv->view);
2662
2663 ctk_widget_hide (priv->nav);
2664
2665 if (ctk_widget_get_realized (priv->view))
2666 ctk_widget_grab_focus (priv->view);
2667 }
2668 g_settings_set_boolean (priv->ui_settings, EOC_CONF_UI_IMAGE_COLLECTION"image-collection", visible);
2669
2670 } else if (g_ascii_strcasecmp (action_name, "ViewSidebar") == 0) {
2671 if (visible) {
2672 ctk_widget_show (priv->sidebar);
2673 } else {
2674 ctk_widget_hide (priv->sidebar);
2675 }
2676 g_settings_set_boolean (priv->ui_settings, EOC_CONF_UI_SIDEBAR"sidebar", visible);
2677 }
2678}
2679
2680static void
2681wallpaper_info_bar_response (CtkInfoBar *bar, gint response, EocWindow *window)
2682{
2683 if (response == CTK_RESPONSE_YES) {
2684 GAppInfo *app_info;
2685 GError *error = NULL((void*)0);
2686
2687 app_info = g_app_info_create_from_commandline ("cafe-appearance-properties --show-page=background",
2688 "cafe-appearance-properties",
2689 G_APP_INFO_CREATE_NONE,
2690 &error);
2691
2692 if (error != NULL((void*)0)) {
2693 g_warning ("%s%s", _("Error launching appearance preferences dialog: ")gettext ("Error launching appearance preferences dialog: "),
2694 error->message);
2695 g_error_free (error);
2696 error = NULL((void*)0);
2697 }
2698
2699 if (app_info != NULL((void*)0)) {
2700 CdkAppLaunchContext *context;
2701 CdkDisplay *display;
2702
2703 display = ctk_widget_get_display (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
2704 context = cdk_display_get_app_launch_context (display);
2705 g_app_info_launch (app_info, NULL((void*)0), G_APP_LAUNCH_CONTEXT (context)((((GAppLaunchContext*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((context)), ((g_app_launch_context_get_type
()))))))
, &error);
2706
2707 if (error != NULL((void*)0)) {
2708 g_warning ("%s%s", _("Error launching appearance preferences dialog: ")gettext ("Error launching appearance preferences dialog: "),
2709 error->message);
2710 g_error_free (error);
2711 error = NULL((void*)0);
2712 }
2713
2714 g_object_unref (context);
2715 g_object_unref (app_info);
2716 }
2717 }
2718
2719 /* Close message area on every response */
2720 eoc_window_set_message_area (window, NULL((void*)0));
2721}
2722
2723static void
2724eoc_window_set_wallpaper (EocWindow *window, const gchar *filename, const gchar *visible_filename)
2725{
2726 CtkWidget *info_bar;
2727 CtkWidget *image;
2728 CtkWidget *label;
2729 CtkWidget *hbox;
2730 gchar *markup;
2731 gchar *text;
2732 gchar *basename;
2733 GSettings *wallpaper_settings;
2734
2735 wallpaper_settings = g_settings_new (EOC_CONF_BACKGROUND_SCHEMA"org.cafe.background");
2736 g_settings_set_string (wallpaper_settings,
2737 EOC_CONF_BACKGROUND_FILE"picture-filename",
2738 filename);
2739 g_object_unref (wallpaper_settings);
2740
2741 /* I18N: When setting mnemonics for these strings, watch out to not
2742 clash with mnemonics from eoc's menubar */
2743 info_bar = ctk_info_bar_new_with_buttons (_("_Open Background Preferences")gettext ("_Open Background Preferences"),
2744 CTK_RESPONSE_YES,
2745 C_("MessageArea","Hi_de")g_dpgettext (((void*)0), "MessageArea" "\004" "Hi_de", strlen
("MessageArea") + 1)
,
2746 CTK_RESPONSE_NO, NULL((void*)0));
2747 ctk_info_bar_set_message_type (CTK_INFO_BAR (info_bar)((((CtkInfoBar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((info_bar)), ((ctk_info_bar_get_type()))))))
,
2748 CTK_MESSAGE_QUESTION);
2749
2750 image = ctk_image_new_from_icon_name ("dialog-question",
2751 CTK_ICON_SIZE_DIALOG);
2752 label = ctk_label_new (NULL((void*)0));
2753
2754 if (!visible_filename)
2755 basename = g_path_get_basename (filename);
2756
2757 /* The newline character is currently necessary due to a problem
2758 * with the automatic line break. */
2759 text = g_strdup_printf (_("The image \"%s\" has been set as Desktop Background."gettext ("The image \"%s\" has been set as Desktop Background."
"\nWould you like to modify its appearance?")
2760 "\nWould you like to modify its appearance?")gettext ("The image \"%s\" has been set as Desktop Background."
"\nWould you like to modify its appearance?")
,
2761 visible_filename ? visible_filename : basename);
2762 markup = g_markup_printf_escaped ("<b>%s</b>", text);
2763 ctk_label_set_markup (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, markup);
2764 g_free (markup);
2765 g_free (text);
2766 if (!visible_filename)
2767 g_free (basename);
2768
2769 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 8);
2770 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, image, FALSE(0), FALSE(0), 0);
2771 ctk_widget_set_halign (image, CTK_ALIGN_START);
2772 ctk_widget_set_valign (image, CTK_ALIGN_END);
2773 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, label, TRUE(!(0)), TRUE(!(0)), 0);
2774 ctk_label_set_xalign (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, 0.0);
2775 ctk_box_pack_start (CTK_BOX (ctk_info_bar_get_content_area (CTK_INFO_BAR (info_bar)))((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_info_bar_get_content_area (((((CtkInfoBar*) (void *)
g_type_check_instance_cast ((GTypeInstance*) ((info_bar)), (
(ctk_info_bar_get_type()))))))))), ((ctk_box_get_type ())))))
)
, hbox, TRUE(!(0)), TRUE(!(0)), 0);
2776 ctk_widget_show_all (hbox);
2777 ctk_widget_show (info_bar);
2778
2779
2780 eoc_window_set_message_area (window, info_bar);
2781 ctk_info_bar_set_default_response (CTK_INFO_BAR (info_bar)((((CtkInfoBar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((info_bar)), ((ctk_info_bar_get_type()))))))
,
2782 CTK_RESPONSE_YES);
2783 g_signal_connect (info_bar, "response",g_signal_connect_data ((info_bar), ("response"), (((GCallback
) (wallpaper_info_bar_response))), (window), ((void*)0), (GConnectFlags
) 0)
2784 G_CALLBACK (wallpaper_info_bar_response), window)g_signal_connect_data ((info_bar), ("response"), (((GCallback
) (wallpaper_info_bar_response))), (window), ((void*)0), (GConnectFlags
) 0)
;
2785}
2786
2787static void
2788eoc_job_save_cb (EocJobSave *job, gpointer user_data)
2789{
2790 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2791 CtkAction *action_save;
2792
2793 g_signal_handlers_disconnect_by_func (job,g_signal_handlers_disconnect_matched ((job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_save_cb), (window))
2794 eoc_job_save_cb,g_signal_handlers_disconnect_matched ((job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_save_cb), (window))
2795 window)g_signal_handlers_disconnect_matched ((job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_save_cb), (window))
;
2796
2797 g_signal_handlers_disconnect_by_func (job,g_signal_handlers_disconnect_matched ((job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_save_progress_cb), (window))
2798 eoc_job_save_progress_cb,g_signal_handlers_disconnect_matched ((job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_save_progress_cb), (window))
2799 window)g_signal_handlers_disconnect_matched ((job), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_job_save_progress_cb), (window))
;
2800
2801 g_object_unref (window->priv->save_job);
2802 window->priv->save_job = NULL((void*)0);
2803
2804 update_status_bar (window);
2805 action_save = ctk_action_group_get_action (window->priv->actions_image,
2806 "ImageSave");
2807 ctk_action_set_sensitive (action_save, FALSE(0));
2808}
2809
2810static void
2811eoc_job_copy_cb (EocJobCopy *job, gpointer user_data)
2812{
2813 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2814 gchar *filepath, *basename, *filename, *extension;
2815 CtkAction *action;
2816 GFile *source_file, *dest_file;
2817
2818 /* Create source GFile */
2819 basename = g_file_get_basename (job->images->data);
2820 filepath = g_build_filename (job->dest, basename, NULL((void*)0));
2821 source_file = g_file_new_for_path (filepath);
2822 g_free (filepath);
2823
2824 /* Create destination GFile */
2825 extension = eoc_util_filename_get_extension (basename);
2826 filename = g_strdup_printf ("%s.%s", EOC_WALLPAPER_FILENAME"eoc-wallpaper", extension);
2827 filepath = g_build_filename (job->dest, filename, NULL((void*)0));
2828 dest_file = g_file_new_for_path (filepath);
2829 g_free (filename);
2830 g_free (extension);
2831
2832 /* Move the file */
2833 g_file_move (source_file, dest_file, G_FILE_COPY_OVERWRITE,
2834 NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0));
2835
2836 /* Set the wallpaper */
2837 eoc_window_set_wallpaper (window, filepath, basename);
2838 g_free (basename);
2839 g_free (filepath);
2840
2841 ctk_statusbar_pop (CTK_STATUSBAR (window->priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->statusbar)), ((ctk_statusbar_get_type
()))))))
,
2842 window->priv->copy_file_cid);
2843 action = ctk_action_group_get_action (window->priv->actions_image,
2844 "ImageSetAsWallpaper");
2845 ctk_action_set_sensitive (action, TRUE(!(0)));
2846
2847 window->priv->copy_job = NULL((void*)0);
2848
2849 g_object_unref (source_file);
2850 g_object_unref (dest_file);
2851 g_object_unref (G_OBJECT (job->images->data)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((job->images->data)), (((GType) ((20) << (2))
))))))
);
2852 g_list_free (job->images);
2853 g_object_unref (job);
2854}
2855
2856static gboolean
2857eoc_window_save_images (EocWindow *window, GList *images)
2858{
2859 EocWindowPrivate *priv;
2860
2861 priv = window->priv;
2862
2863 if (window->priv->save_job != NULL((void*)0))
2864 return FALSE(0);
2865
2866 priv->save_job = eoc_job_save_new (images);
2867
2868 g_signal_connect (priv->save_job,g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
2869 "finished",g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
2870 G_CALLBACK (eoc_job_save_cb),g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
2871 window)g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
2872
2873 g_signal_connect (priv->save_job,g_signal_connect_data ((priv->save_job), ("progress"), (((
GCallback) (eoc_job_save_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
2874 "progress",g_signal_connect_data ((priv->save_job), ("progress"), (((
GCallback) (eoc_job_save_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
2875 G_CALLBACK (eoc_job_save_progress_cb),g_signal_connect_data ((priv->save_job), ("progress"), (((
GCallback) (eoc_job_save_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
2876 window)g_signal_connect_data ((priv->save_job), ("progress"), (((
GCallback) (eoc_job_save_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
;
2877
2878 return TRUE(!(0));
2879}
2880
2881static void
2882eoc_window_cmd_save (CtkAction *action, gpointer user_data)
2883{
2884 EocWindowPrivate *priv;
2885 EocWindow *window;
2886 GList *images;
2887
2888 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2889 priv = window->priv;
2890
2891 if (window->priv->save_job != NULL((void*)0))
2892 return;
2893
2894 images = eoc_thumb_view_get_selected_images (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
);
2895
2896 if (eoc_window_save_images (window, images)) {
2897 eoc_job_queue_add_job (priv->save_job);
2898 }
2899}
2900
2901static GFile*
2902eoc_window_retrieve_save_as_file (EocWindow *window, EocImage *image)
2903{
2904 CtkWidget *dialog;
2905 GFile *save_file = NULL((void*)0);
2906 GFile *last_dest_folder;
2907 gint response;
2908
2909 g_assert (image != NULL)do { if (image != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 2909, ((const char*) (__func__)), "image != NULL"
); } while (0)
;
2910
2911 dialog = eoc_file_chooser_new (CTK_FILE_CHOOSER_ACTION_SAVE);
2912
2913 last_dest_folder = window->priv->last_save_as_folder;
2914
2915 if (last_dest_folder && g_file_query_exists (last_dest_folder, NULL((void*)0))) {
2916 ctk_file_chooser_set_current_folder_file (CTK_FILE_CHOOSER (dialog)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_file_chooser_get_type ()))))))
, last_dest_folder, NULL((void*)0));
2917 ctk_file_chooser_set_current_name (CTK_FILE_CHOOSER (dialog)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_file_chooser_get_type ()))))))
,
2918 eoc_image_get_caption (image));
2919 } else {
2920 GFile *image_file;
2921
2922 image_file = eoc_image_get_file (image);
2923 /* Setting the file will also navigate to its parent folder */
2924 ctk_file_chooser_set_file (CTK_FILE_CHOOSER (dialog)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_file_chooser_get_type ()))))))
,
2925 image_file, NULL((void*)0));
2926 g_object_unref (image_file);
2927 }
2928
2929 response = ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_dialog_get_type ()))))))
);
2930 ctk_widget_hide (dialog);
2931
2932 if (response == CTK_RESPONSE_OK) {
2933 save_file = ctk_file_chooser_get_file (CTK_FILE_CHOOSER (dialog)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_file_chooser_get_type ()))))))
);
2934 if (window->priv->last_save_as_folder)
2935 g_object_unref (window->priv->last_save_as_folder);
2936 window->priv->last_save_as_folder = g_file_get_parent (save_file);
2937 }
2938 ctk_widget_destroy (dialog);
2939
2940 return save_file;
2941}
2942
2943static void
2944eoc_window_cmd_save_as (CtkAction *action, gpointer user_data)
2945{
2946 EocWindowPrivate *priv;
2947 EocWindow *window;
2948 GList *images;
2949 guint n_images;
2950
2951 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2952 priv = window->priv;
2953
2954 if (window->priv->save_job != NULL((void*)0))
2955 return;
2956
2957 images = eoc_thumb_view_get_selected_images (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
);
2958 n_images = g_list_length (images);
2959
2960 if (n_images == 1) {
2961 GFile *file;
2962
2963 file = eoc_window_retrieve_save_as_file (window, images->data);
2964
2965 if (!file) {
2966 g_list_free (images);
2967 return;
2968 }
2969
2970 priv->save_job = eoc_job_save_as_new (images, NULL((void*)0), file);
2971
2972 g_object_unref (file);
2973 } else if (n_images > 1) {
2974 GFile *base_file;
2975 CtkWidget *dialog;
2976 gchar *basedir;
2977 EocURIConverter *converter;
2978
2979 basedir = g_get_current_dir ();
2980 base_file = g_file_new_for_path (basedir);
2981 g_free (basedir);
2982
2983 dialog = eoc_save_as_dialog_new (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2984 images,
2985 base_file);
2986
2987 ctk_widget_show_all (dialog);
2988
2989 if (ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_dialog_get_type ()))))))
) != CTK_RESPONSE_OK) {
2990 g_object_unref (base_file);
2991 g_list_free (images);
2992 ctk_widget_destroy (dialog);
2993
2994 return;
2995 }
2996
2997 converter = eoc_save_as_dialog_get_converter (dialog);
2998
2999 g_assert (converter != NULL)do { if (converter != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 2999, ((const char*) (__func__)), "converter != NULL"
); } while (0)
;
3000
3001 priv->save_job = eoc_job_save_as_new (images, converter, NULL((void*)0));
3002
3003 ctk_widget_destroy (dialog);
3004
3005 g_object_unref (converter);
3006 g_object_unref (base_file);
3007 } else {
3008 /* n_images = 0 -- No Image selected */
3009 return;
3010 }
3011
3012 g_signal_connect (priv->save_job,g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3013 "finished",g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3014 G_CALLBACK (eoc_job_save_cb),g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3015 window)g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
3016
3017 g_signal_connect (priv->save_job,g_signal_connect_data ((priv->save_job), ("progress"), (((
GCallback) (eoc_job_save_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
3018 "progress",g_signal_connect_data ((priv->save_job), ("progress"), (((
GCallback) (eoc_job_save_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
3019 G_CALLBACK (eoc_job_save_progress_cb),g_signal_connect_data ((priv->save_job), ("progress"), (((
GCallback) (eoc_job_save_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
3020 window)g_signal_connect_data ((priv->save_job), ("progress"), (((
GCallback) (eoc_job_save_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
;
3021
3022 eoc_job_queue_add_job (priv->save_job);
3023}
3024
3025static void
3026eoc_window_cmd_open_containing_folder (CtkAction *action, gpointer user_data)
3027{
3028 EocWindowPrivate *priv;
3029
3030 GFile *file;
3031 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3032
3033 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3034
3035 g_return_if_fail (priv->image != NULL)do { if ((priv->image != ((void*)0))) { } else { g_return_if_fail_warning
("EOC", ((const char*) (__func__)), "priv->image != NULL"
); return; } } while (0)
;
3036
3037 file = eoc_image_get_file (priv->image);
3038
3039 g_return_if_fail (file != NULL)do { if ((file != ((void*)0))) { } else { g_return_if_fail_warning
("EOC", ((const char*) (__func__)), "file != NULL"); return;
} } while (0)
;
3040
3041 eoc_util_show_file_in_filemanager (file,
3042 CTK_WINDOW (user_data)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((ctk_window_get_type ()))))))
);
3043}
3044
3045static void
3046eoc_window_cmd_print (CtkAction *action, gpointer user_data)
3047{
3048 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3049
3050 eoc_window_print (window);
3051}
3052
3053/**
3054 * eoc_window_get_properties_dialog:
3055 * @window: a #EocWindow
3056 *
3057 * Gets the @window property dialog. The widget will be built on the first call to this function.
3058 *
3059 * Returns: (transfer none): a #CtkDialog.
3060 */
3061
3062CtkWidget*
3063eoc_window_get_properties_dialog (EocWindow *window)
3064{
3065 EocWindowPrivate *priv;
3066
3067 g_return_val_if_fail (EOC_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return (((void*)0)); } } while
(0)
;
3068
3069 priv = window->priv;
3070
3071 if (priv->properties_dlg == NULL((void*)0)) {
3072 CtkAction *next_image_action, *previous_image_action;
3073
3074 next_image_action =
3075 ctk_action_group_get_action (priv->actions_collection,
3076 "GoNext");
3077
3078 previous_image_action =
3079 ctk_action_group_get_action (priv->actions_collection,
3080 "GoPrevious");
3081 priv->properties_dlg =
3082 eoc_properties_dialog_new (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
3083 EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
,
3084 next_image_action,
3085 previous_image_action);
3086
3087 eoc_properties_dialog_update (EOC_PROPERTIES_DIALOG (priv->properties_dlg)((((EocPropertiesDialog*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->properties_dlg)), ((eoc_properties_dialog_get_type
()))))))
,
3088 priv->image);
3089 g_settings_bind (priv->ui_settings,
3090 EOC_CONF_UI_PROPSDIALOG_NETBOOK_MODE"propsdialog-netbook-mode",
3091 priv->properties_dlg, "netbook-mode",
3092 G_SETTINGS_BIND_GET);
3093 }
3094
3095 return priv->properties_dlg;
3096}
3097
3098static void
3099eoc_window_cmd_properties (CtkAction *action, gpointer user_data)
3100{
3101 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3102 CtkWidget *dialog;
3103
3104 dialog = eoc_window_get_properties_dialog (window);
3105 ctk_widget_show (dialog);
3106}
3107
3108static void
3109eoc_window_cmd_undo (CtkAction *action, gpointer user_data)
3110{
3111 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3112
3113 apply_transformation (EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
, NULL((void*)0));
3114}
3115
3116static void
3117eoc_window_cmd_flip_horizontal (CtkAction *action, gpointer user_data)
3118{
3119 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3120
3121 apply_transformation (EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
,
3122 eoc_transform_flip_new (EOC_TRANSFORM_FLIP_HORIZONTAL));
3123}
3124
3125static void
3126eoc_window_cmd_flip_vertical (CtkAction *action, gpointer user_data)
3127{
3128 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3129
3130 apply_transformation (EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
,
3131 eoc_transform_flip_new (EOC_TRANSFORM_FLIP_VERTICAL));
3132}
3133
3134static void
3135eoc_window_cmd_rotate_90 (CtkAction *action, gpointer user_data)
3136{
3137 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3138
3139 apply_transformation (EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
,
3140 eoc_transform_rotate_new (90));
3141}
3142
3143static void
3144eoc_window_cmd_rotate_270 (CtkAction *action, gpointer user_data)
3145{
3146 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3147
3148 apply_transformation (EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
,
3149 eoc_transform_rotate_new (270));
3150}
3151
3152static void
3153eoc_window_cmd_wallpaper (CtkAction *action, gpointer user_data)
3154{
3155 EocWindow *window;
3156 EocWindowPrivate *priv;
3157 EocImage *image;
3158 GFile *file;
3159 char *filename = NULL((void*)0);
3160
3161 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3162
3163 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3164 priv = window->priv;
3165
3166 /* If currently copying an image to set it as wallpaper, return. */
3167 if (priv->copy_job != NULL((void*)0))
3168 return;
3169
3170 image = eoc_thumb_view_get_first_selected_image (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
);
3171
3172 g_return_if_fail (EOC_IS_IMAGE (image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((image)); GType __t = ((eoc_image_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_IMAGE (image)"); return; } } while (0)
;
3173
3174 file = eoc_image_get_file (image);
3175
3176 filename = g_file_get_path (file);
3177
3178 /* Currently only local files can be set as wallpaper */
3179 if (filename == NULL((void*)0) || !eoc_util_file_is_persistent (file))
3180 {
3181 GList *files = NULL((void*)0);
3182 CtkAction *action;
3183
3184 action = ctk_action_group_get_action (window->priv->actions_image,
3185 "ImageSetAsWallpaper");
3186 ctk_action_set_sensitive (action, FALSE(0));
3187
3188 priv->copy_file_cid = ctk_statusbar_get_context_id (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
3189 "copy_file_cid");
3190 ctk_statusbar_push (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
3191 priv->copy_file_cid,
3192 _("Saving image locally…")gettext ("Saving image locally…"));
3193
3194 files = g_list_append (files, eoc_image_get_file (image));
3195 priv->copy_job = eoc_job_copy_new (files, g_get_user_data_dir ());
3196 g_signal_connect (priv->copy_job,g_signal_connect_data ((priv->copy_job), ("finished"), (((
GCallback) (eoc_job_copy_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3197 "finished",g_signal_connect_data ((priv->copy_job), ("finished"), (((
GCallback) (eoc_job_copy_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3198 G_CALLBACK (eoc_job_copy_cb),g_signal_connect_data ((priv->copy_job), ("finished"), (((
GCallback) (eoc_job_copy_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3199 window)g_signal_connect_data ((priv->copy_job), ("finished"), (((
GCallback) (eoc_job_copy_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
3200 g_signal_connect (priv->copy_job,g_signal_connect_data ((priv->copy_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3201 "progress",g_signal_connect_data ((priv->copy_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3202 G_CALLBACK (eoc_job_progress_cb),g_signal_connect_data ((priv->copy_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3203 window)g_signal_connect_data ((priv->copy_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
3204 eoc_job_queue_add_job (priv->copy_job);
3205
3206 g_object_unref (file);
3207 g_free (filename);
3208 return;
3209 }
3210
3211 g_object_unref (file);
3212
3213 eoc_window_set_wallpaper (window, filename, NULL((void*)0));
3214
3215 g_free (filename);
3216}
3217
3218static gboolean
3219eoc_window_all_images_trasheable (GList *images)
3220{
3221 GFile *file;
3222 GFileInfo *file_info;
3223 GList *iter;
3224 EocImage *image;
3225 gboolean can_trash = TRUE(!(0));
3226
3227 for (iter = images; iter != NULL((void*)0); iter = g_list_next (iter)((iter) ? (((GList *)(iter))->next) : ((void*)0))) {
3228 image = (EocImage *) iter->data;
3229 file = eoc_image_get_file (image);
3230 file_info = g_file_query_info (file,
3231 G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH"access::can-trash",
3232 0, NULL((void*)0), NULL((void*)0));
3233 can_trash = g_file_info_get_attribute_boolean (file_info,
3234 G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH"access::can-trash");
3235
3236 g_object_unref (file_info);
3237 g_object_unref (file);
3238
3239 if (can_trash == FALSE(0))
3240 break;
3241 }
3242
3243 return can_trash;
3244}
3245
3246static int
3247show_move_to_trash_confirm_dialog (EocWindow *window, GList *images, gboolean can_trash)
3248{
3249 CtkWidget *dlg;
3250 char *prompt;
3251 int response;
3252 int n_images;
3253 EocImage *image;
3254 static gboolean dontaskagain = FALSE(0);
3255 gboolean neverask = FALSE(0);
3256 CtkWidget* dontask_cbutton = NULL((void*)0);
3257
3258 /* Check if the user never wants to be bugged. */
3259 neverask = g_settings_get_boolean (window->priv->ui_settings,
3260 EOC_CONF_UI_DISABLE_TRASH_CONFIRMATION"disable-trash-confirmation");
3261
3262 /* Assume agreement, if the user doesn't want to be
3263 * asked and the trash is available */
3264 if (can_trash && (dontaskagain || neverask))
3265 return CTK_RESPONSE_OK;
3266
3267 n_images = g_list_length (images);
3268
3269 if (n_images == 1) {
3270 image = EOC_IMAGE (images->data)((((EocImage*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((images->data)), ((eoc_image_get_type ()))))))
;
3271 if (can_trash) {
3272 prompt = g_strdup_printf (_("Are you sure you want to move\n\"%s\" to the trash?")gettext ("Are you sure you want to move\n\"%s\" to the trash?"
)
,
3273 eoc_image_get_caption (image));
3274 } else {
3275 prompt = g_strdup_printf (_("A trash for \"%s\" couldn't be found. Do you want to remove "gettext ("A trash for \"%s\" couldn't be found. Do you want to remove "
"this image permanently?")
3276 "this image permanently?")gettext ("A trash for \"%s\" couldn't be found. Do you want to remove "
"this image permanently?")
, eoc_image_get_caption (image));
3277 }
3278 } else {
3279 if (can_trash) {
3280 prompt = g_strdup_printf (ngettext("Are you sure you want to move\n"
3281 "the %d selected image to the trash?",
3282 "Are you sure you want to move\n"
3283 "the %d selected images to the trash?", n_images), n_images);
3284 } else {
3285 prompt = g_strdup (_("Some of the selected images can't be moved to the trash "gettext ("Some of the selected images can't be moved to the trash "
"and will be removed permanently. Are you sure you want " "to proceed?"
)
3286 "and will be removed permanently. Are you sure you want "gettext ("Some of the selected images can't be moved to the trash "
"and will be removed permanently. Are you sure you want " "to proceed?"
)
3287 "to proceed?")gettext ("Some of the selected images can't be moved to the trash "
"and will be removed permanently. Are you sure you want " "to proceed?"
)
);
3288 }
3289 }
3290
3291 dlg = ctk_message_dialog_new_with_markup (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
3292 CTK_DIALOG_MODAL | CTK_DIALOG_DESTROY_WITH_PARENT,
3293 CTK_MESSAGE_WARNING,
3294 CTK_BUTTONS_NONE,
3295 "<span weight=\"bold\" size=\"larger\">%s</span>",
3296 prompt);
3297 g_free (prompt);
3298
3299 ctk_dialog_add_button (CTK_DIALOG (dlg)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_dialog_get_type ()))))))
, "ctk-cancel", CTK_RESPONSE_CANCEL);
3300
3301 if (can_trash) {
3302 ctk_dialog_add_button (CTK_DIALOG (dlg)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_dialog_get_type ()))))))
, _("Move to _Trash")gettext ("Move to _Trash"), CTK_RESPONSE_OK);
3303
3304 dontask_cbutton = ctk_check_button_new_with_mnemonic (_("_Do not ask again during this session")gettext ("_Do not ask again during this session"));
3305 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (dontask_cbutton)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dontask_cbutton)), ((ctk_toggle_button_get_type ()))))))
, FALSE(0));
3306
3307 ctk_box_pack_end (CTK_BOX (ctk_dialog_get_content_area (CTK_DIALOG (dlg)))((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_dialog_get_content_area (((((CtkDialog*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((dlg)), ((ctk_dialog_get_type ())))))))))
, ((ctk_box_get_type ()))))))
, dontask_cbutton, TRUE(!(0)), TRUE(!(0)), 0);
3308 } else {
3309 if (n_images == 1) {
3310 ctk_dialog_add_button (CTK_DIALOG (dlg)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_dialog_get_type ()))))))
, "ctk-delete", CTK_RESPONSE_OK);
3311 } else {
3312 ctk_dialog_add_button (CTK_DIALOG (dlg)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_dialog_get_type ()))))))
, "ctk-yes", CTK_RESPONSE_OK);
3313 }
3314 }
3315
3316 ctk_dialog_set_default_response (CTK_DIALOG (dlg)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_dialog_get_type ()))))))
, CTK_RESPONSE_OK);
3317 ctk_window_set_title (CTK_WINDOW (dlg)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_window_get_type ()))))))
, "");
3318 ctk_widget_show_all (dlg);
3319
3320 response = ctk_dialog_run (CTK_DIALOG (dlg)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_dialog_get_type ()))))))
);
3321
3322 /* Only update the property if the user has accepted */
3323 if (can_trash && response == CTK_RESPONSE_OK)
3324 dontaskagain = ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (dontask_cbutton)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dontask_cbutton)), ((ctk_toggle_button_get_type ()))))))
);
3325
3326 /* The checkbutton is destroyed together with the dialog */
3327 ctk_widget_destroy (dlg);
3328
3329 return response;
3330}
3331
3332static gboolean
3333move_to_trash_real (EocImage *image, GError **error)
3334{
3335 GFile *file;
3336 GFileInfo *file_info;
3337 gboolean can_trash, result;
3338
3339 g_return_val_if_fail (EOC_IS_IMAGE (image), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((image)); GType __t = ((eoc_image_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_IMAGE (image)"); return ((0)); } } while (0)
;
3340
3341 file = eoc_image_get_file (image);
3342 file_info = g_file_query_info (file,
3343 G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH"access::can-trash",
3344 0, NULL((void*)0), NULL((void*)0));
3345 if (file_info == NULL((void*)0)) {
3346 g_set_error (error,
3347 EOC_WINDOW_ERROR(eoc_window_error_quark ()),
3348 EOC_WINDOW_ERROR_TRASH_NOT_FOUND,
3349 _("Couldn't access trash.")gettext ("Couldn't access trash."));
3350 return FALSE(0);
3351 }
3352
3353 can_trash = g_file_info_get_attribute_boolean (file_info,
3354 G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH"access::can-trash");
3355 g_object_unref (file_info);
3356 if (can_trash)
3357 {
3358 result = g_file_trash (file, NULL((void*)0), NULL((void*)0));
3359 if (result == FALSE(0)) {
3360 g_set_error (error,
3361 EOC_WINDOW_ERROR(eoc_window_error_quark ()),
3362 EOC_WINDOW_ERROR_TRASH_NOT_FOUND,
3363 _("Couldn't access trash.")gettext ("Couldn't access trash."));
3364 }
3365 } else {
3366 result = g_file_delete (file, NULL((void*)0), NULL((void*)0));
3367 if (result == FALSE(0)) {
3368 g_set_error (error,
3369 EOC_WINDOW_ERROR(eoc_window_error_quark ()),
3370 EOC_WINDOW_ERROR_IO,
3371 _("Couldn't delete file")gettext ("Couldn't delete file"));
3372 }
3373 }
3374
3375 g_object_unref (file);
3376
3377 return result;
3378}
3379
3380static void
3381eoc_window_cmd_copy_image (CtkAction *action, gpointer user_data)
3382{
3383 CtkClipboard *clipboard;
3384 EocWindow *window;
3385 EocWindowPrivate *priv;
3386 EocImage *image;
3387 EocClipboardHandler *cbhandler;
3388
3389 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3390
3391 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3392 priv = window->priv;
3393
3394 image = eoc_thumb_view_get_first_selected_image (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
);
3395
3396 g_return_if_fail (EOC_IS_IMAGE (image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((image)); GType __t = ((eoc_image_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_IMAGE (image)"); return; } } while (0)
;
3397
3398 clipboard = ctk_clipboard_get (CDK_SELECTION_CLIPBOARD((CdkAtom)((gpointer) (gulong) (69))));
3399
3400 cbhandler = eoc_clipboard_handler_new (image);
3401 // cbhandler will self-destruct when it's not needed anymore
3402 eoc_clipboard_handler_copy_to_clipboard (cbhandler, clipboard);
3403
3404}
3405
3406static void
3407eoc_window_cmd_move_to_trash (CtkAction *action, gpointer user_data)
3408{
3409 GList *images;
3410 GList *it;
3411 EocWindowPrivate *priv;
3412 EocListStore *list;
3413 int pos;
3414 EocImage *img;
3415 EocWindow *window;
3416 int response;
3417 int n_images;
3418 gboolean success;
3419 gboolean can_trash;
3420 const gchar *action_name;
3421
3422 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3423
3424 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3425 priv = window->priv;
3426 list = priv->store;
3427
3428 n_images = eoc_thumb_view_get_n_selected (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
);
3429
3430 if (n_images < 1) return;
3431
3432 /* save position of selected image after the deletion */
3433 images = eoc_thumb_view_get_selected_images (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
);
3434
3435 g_assert (images != NULL)do { if (images != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 3435, ((const char*) (__func__)), "images != NULL"
); } while (0)
;
3436
3437 /* HACK: eoc_list_store_get_n_selected return list in reverse order */
3438 images = g_list_reverse (images);
3439
3440 can_trash = eoc_window_all_images_trasheable (images);
3441
3442 action_name = ctk_action_get_name (action);
3443
3444 if (g_ascii_strcasecmp (action_name, "Delete") == 0 ||
3445 can_trash == FALSE(0)) {
3446 response = show_move_to_trash_confirm_dialog (window, images, can_trash);
3447
3448 if (response != CTK_RESPONSE_OK) return;
3449 }
3450
3451 pos = eoc_list_store_get_pos_by_image (list, EOC_IMAGE (images->data)((((EocImage*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((images->data)), ((eoc_image_get_type ()))))))
);
3452
3453 /* FIXME: make a nice progress dialog */
3454 /* Do the work actually. First try to delete the image from the disk. If this
3455 * is successful, remove it from the screen. Otherwise show error dialog.
3456 */
3457 for (it = images; it != NULL((void*)0); it = it->next) {
3458 GError *error = NULL((void*)0);
3459 EocImage *image;
3460
3461 image = EOC_IMAGE (it->data)((((EocImage*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((it->data)), ((eoc_image_get_type ()))))))
;
3462
3463 success = move_to_trash_real (image, &error);
3464
3465 if (success) {
3466 eoc_list_store_remove_image (list, image);
3467 } else {
3468 char *header;
3469 CtkWidget *dlg;
3470
3471 header = g_strdup_printf (_("Error on deleting image %s")gettext ("Error on deleting image %s"),
3472 eoc_image_get_caption (image));
3473
3474 dlg = ctk_message_dialog_new (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
3475 CTK_DIALOG_MODAL | CTK_DIALOG_DESTROY_WITH_PARENT,
3476 CTK_MESSAGE_ERROR,
3477 CTK_BUTTONS_OK,
3478 "%s", header);
3479
3480 ctk_message_dialog_format_secondary_text (CTK_MESSAGE_DIALOG (dlg)((((CtkMessageDialog*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((dlg)), ((ctk_message_dialog_get_type ()))))
))
,
3481 "%s", error->message);
3482
3483 ctk_dialog_run (CTK_DIALOG (dlg)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_dialog_get_type ()))))))
);
3484
3485 ctk_widget_destroy (dlg);
3486
3487 g_free (header);
3488 }
3489 }
3490
3491 /* free list */
3492 g_list_foreach (images, (GFunc) g_object_unref, NULL((void*)0));
3493 g_list_free (images);
3494
3495 /* select image at previously saved position */
3496 pos = MIN (pos, eoc_list_store_length (list) - 1)(((pos) < (eoc_list_store_length (list) - 1)) ? (pos) : (eoc_list_store_length
(list) - 1))
;
3497
3498 if (pos >= 0) {
3499 img = eoc_list_store_get_image_by_pos (list, pos);
3500
3501 eoc_thumb_view_set_current_image (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
,
3502 img,
3503 TRUE(!(0)));
3504
3505 if (img != NULL((void*)0)) {
3506 g_object_unref (img);
3507 }
3508 }
3509}
3510
3511static void
3512eoc_window_cmd_fullscreen (CtkAction *action, gpointer user_data)
3513{
3514 EocWindow *window;
3515 gboolean fullscreen;
3516
3517 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3518
3519 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3519, ((const char*) (__func__
))
);
3520
3521 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3522
3523 fullscreen = ctk_toggle_action_get_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
);
3524
3525 if (fullscreen) {
3526 eoc_window_run_fullscreen (window, FALSE(0));
3527 } else {
3528 eoc_window_stop_fullscreen (window, FALSE(0));
3529 }
3530}
3531
3532static void
3533eoc_window_cmd_slideshow (CtkAction *action, gpointer user_data)
3534{
3535 EocWindow *window;
3536 gboolean slideshow;
3537
3538 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3539
3540 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3540, ((const char*) (__func__
))
);
3541
3542 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3543
3544 slideshow = ctk_toggle_action_get_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
);
3545
3546 if (slideshow) {
3547 eoc_window_run_fullscreen (window, TRUE(!(0)));
3548 } else {
3549 eoc_window_stop_fullscreen (window, TRUE(!(0)));
3550 }
3551}
3552
3553static void
3554eoc_window_cmd_pause_slideshow (CtkAction *action, gpointer user_data)
3555{
3556 EocWindow *window;
3557 gboolean slideshow;
3558
3559 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3560
3561 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3561, ((const char*) (__func__
))
);
3562
3563 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3564
3565 slideshow = window->priv->mode == EOC_WINDOW_MODE_SLIDESHOW;
3566
3567 if (!slideshow && window->priv->mode != EOC_WINDOW_MODE_FULLSCREEN)
3568 return;
3569
3570 eoc_window_run_fullscreen (window, !slideshow);
3571}
3572
3573static void
3574eoc_window_cmd_zoom_in (CtkAction *action, gpointer user_data)
3575{
3576 EocWindowPrivate *priv;
3577
3578 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3579
3580 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3580, ((const char*) (__func__
))
);
3581
3582 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3583
3584 if (priv->view) {
3585 eoc_scroll_view_zoom_in (EOC_SCROLL_VIEW (priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((eoc_scroll_view_get_type ()))))))
, FALSE(0));
3586 }
3587}
3588
3589static void
3590eoc_window_cmd_zoom_out (CtkAction *action, gpointer user_data)
3591{
3592 EocWindowPrivate *priv;
3593
3594 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3595
3596 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3596, ((const char*) (__func__
))
);
3597
3598 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3599
3600 if (priv->view) {
3601 eoc_scroll_view_zoom_out (EOC_SCROLL_VIEW (priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((eoc_scroll_view_get_type ()))))))
, FALSE(0));
3602 }
3603}
3604
3605static void
3606eoc_window_cmd_zoom_normal (CtkAction *action, gpointer user_data)
3607{
3608 EocWindowPrivate *priv;
3609
3610 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3611
3612 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3612, ((const char*) (__func__
))
);
3613
3614 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3615
3616 if (priv->view) {
3617 eoc_scroll_view_set_zoom (EOC_SCROLL_VIEW (priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((eoc_scroll_view_get_type ()))))))
, 1.0);
3618 }
3619}
3620
3621static void
3622eoc_window_cmd_zoom_fit (CtkAction *action, gpointer user_data)
3623{
3624 EocWindowPrivate *priv;
3625
3626 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3627
3628 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3628, ((const char*) (__func__
))
);
3629
3630 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3631
3632 if (priv->view) {
3633 eoc_scroll_view_zoom_fit (EOC_SCROLL_VIEW (priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((eoc_scroll_view_get_type ()))))))
);
3634 }
3635}
3636
3637static void
3638eoc_window_cmd_go_prev (CtkAction *action, gpointer user_data)
3639{
3640 EocWindowPrivate *priv;
3641
3642 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3643
3644 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3644, ((const char*) (__func__
))
);
3645
3646 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3647
3648 eoc_thumb_view_select_single (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
,
3649 EOC_THUMB_VIEW_SELECT_LEFT);
3650}
3651
3652static void
3653eoc_window_cmd_go_next (CtkAction *action, gpointer user_data)
3654{
3655 EocWindowPrivate *priv;
3656
3657 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3658
3659 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3659, ((const char*) (__func__
))
);
3660
3661 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3662
3663 eoc_thumb_view_select_single (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
,
3664 EOC_THUMB_VIEW_SELECT_RIGHT);
3665}
3666
3667static void
3668eoc_window_cmd_go_first (CtkAction *action, gpointer user_data)
3669{
3670 EocWindowPrivate *priv;
3671
3672 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3673
3674 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3674, ((const char*) (__func__
))
);
3675
3676 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3677
3678 eoc_thumb_view_select_single (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
,
3679 EOC_THUMB_VIEW_SELECT_FIRST);
3680}
3681
3682static void
3683eoc_window_cmd_go_last (CtkAction *action, gpointer user_data)
3684{
3685 EocWindowPrivate *priv;
3686
3687 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3688
3689 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3689, ((const char*) (__func__
))
);
3690
3691 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3692
3693 eoc_thumb_view_select_single (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
,
3694 EOC_THUMB_VIEW_SELECT_LAST);
3695}
3696
3697static void
3698eoc_window_cmd_go_random (CtkAction *action, gpointer user_data)
3699{
3700 EocWindowPrivate *priv;
3701
3702 g_return_if_fail (EOC_IS_WINDOW (user_data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((user_data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (user_data)"); return; } } while (0)
;
3703
3704 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3704, ((const char*) (__func__
))
);
3705
3706 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3707
3708 eoc_thumb_view_select_single (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
,
3709 EOC_THUMB_VIEW_SELECT_RANDOM);
3710}
3711
3712static const CtkActionEntry action_entries_window[] = {
3713 { "Image", NULL((void*)0), N_("_Image")("_Image") },
3714 { "Edit", NULL((void*)0), N_("_Edit")("_Edit") },
3715 { "View", NULL((void*)0), N_("_View")("_View") },
3716 { "Go", NULL((void*)0), N_("_Go")("_Go") },
3717 { "Tools", NULL((void*)0), N_("_Tools")("_Tools") },
3718 { "Help", NULL((void*)0), N_("_Help")("_Help") },
3719
3720 { "ImageOpen", "document-open", N_("_Open…")("_Open…"), "<control>O",
3721 N_("Open a file")("Open a file"),
3722 G_CALLBACK (eoc_window_cmd_file_open)((GCallback) (eoc_window_cmd_file_open)) },
3723 { "ImageClose", "window-close", N_("_Close")("_Close"), "<control>W",
3724 N_("Close window")("Close window"),
3725 G_CALLBACK (eoc_window_cmd_close_window)((GCallback) (eoc_window_cmd_close_window)) },
3726 { "EditToolbar", NULL((void*)0), N_("T_oolbar")("T_oolbar"), NULL((void*)0),
3727 N_("Edit the application toolbar")("Edit the application toolbar"),
3728 G_CALLBACK (eoc_window_cmd_edit_toolbar)((GCallback) (eoc_window_cmd_edit_toolbar)) },
3729 { "EditPreferences", "preferences-desktop", N_("Prefere_nces")("Prefere_nces"), NULL((void*)0),
3730 N_("Preferences for Eye of CAFE")("Preferences for Eye of CAFE"),
3731 G_CALLBACK (eoc_window_cmd_preferences)((GCallback) (eoc_window_cmd_preferences)) },
3732 { "HelpManual", "help-browser", N_("_Contents")("_Contents"), "F1",
3733 N_("Help on this application")("Help on this application"),
3734 G_CALLBACK (eoc_window_cmd_help)((GCallback) (eoc_window_cmd_help)) },
3735 { "HelpAbout", "help-about", N_("_About")("_About"), NULL((void*)0),
3736 N_("About this application")("About this application"),
3737 G_CALLBACK (eoc_window_cmd_about)((GCallback) (eoc_window_cmd_about)) }
3738};
3739
3740static const CtkToggleActionEntry toggle_entries_window[] = {
3741 { "ViewToolbar", NULL((void*)0), N_("_Toolbar")("_Toolbar"), NULL((void*)0),
3742 N_("Changes the visibility of the toolbar in the current window")("Changes the visibility of the toolbar in the current window"
)
,
3743 G_CALLBACK (eoc_window_cmd_show_hide_bar)((GCallback) (eoc_window_cmd_show_hide_bar)), TRUE(!(0)) },
3744 { "ViewStatusbar", NULL((void*)0), N_("_Statusbar")("_Statusbar"), NULL((void*)0),
3745 N_("Changes the visibility of the statusbar in the current window")("Changes the visibility of the statusbar in the current window"
)
,
3746 G_CALLBACK (eoc_window_cmd_show_hide_bar)((GCallback) (eoc_window_cmd_show_hide_bar)), TRUE(!(0)) },
3747 { "ViewImageCollection", "eoc-image-collection", N_("_Image Collection")("_Image Collection"), "<control>F9",
3748 N_("Changes the visibility of the image collection pane in the current window")("Changes the visibility of the image collection pane in the current window"
)
,
3749 G_CALLBACK (eoc_window_cmd_show_hide_bar)((GCallback) (eoc_window_cmd_show_hide_bar)), TRUE(!(0)) },
3750 { "ViewSidebar", NULL((void*)0), N_("Side _Pane")("Side _Pane"), "F9",
3751 N_("Changes the visibility of the side pane in the current window")("Changes the visibility of the side pane in the current window"
)
,
3752 G_CALLBACK (eoc_window_cmd_show_hide_bar)((GCallback) (eoc_window_cmd_show_hide_bar)), TRUE(!(0)) },
3753};
3754
3755static const CtkActionEntry action_entries_image[] = {
3756 { "ImageSave", "document-save", N_("_Save")("_Save"), "<control>s",
3757 N_("Save changes in currently selected images")("Save changes in currently selected images"),
3758 G_CALLBACK (eoc_window_cmd_save)((GCallback) (eoc_window_cmd_save)) },
3759 { "ImageOpenWith", NULL((void*)0), N_("Open _with")("Open _with"), NULL((void*)0),
3760 N_("Open the selected image with a different application")("Open the selected image with a different application"),
3761 NULL((void*)0)},
3762 { "ImageSaveAs", "document-save-as", N_("Save _As…")("Save _As…"), "<control><shift>s",
3763 N_("Save the selected images with a different name")("Save the selected images with a different name"),
3764 G_CALLBACK (eoc_window_cmd_save_as)((GCallback) (eoc_window_cmd_save_as)) },
3765 { "ImageOpenContainingFolder", "folder", N_("Open Containing _Folder")("Open Containing _Folder"), NULL((void*)0),
3766 N_("Show the folder which contains this file in the file manager")("Show the folder which contains this file in the file manager"
)
,
3767 G_CALLBACK (eoc_window_cmd_open_containing_folder)((GCallback) (eoc_window_cmd_open_containing_folder)) },
3768 { "ImagePrint", "document-print", N_("_Print…")("_Print…"), "<control>p",
3769 N_("Print the selected image")("Print the selected image"),
3770 G_CALLBACK (eoc_window_cmd_print)((GCallback) (eoc_window_cmd_print)) },
3771 { "ImageProperties", "document-properties", N_("Prope_rties")("Prope_rties"), "<alt>Return",
3772 N_("Show the properties and metadata of the selected image")("Show the properties and metadata of the selected image"),
3773 G_CALLBACK (eoc_window_cmd_properties)((GCallback) (eoc_window_cmd_properties)) },
3774 { "EditUndo", "edit-undo", N_("_Undo")("_Undo"), "<control>z",
3775 N_("Undo the last change in the image")("Undo the last change in the image"),
3776 G_CALLBACK (eoc_window_cmd_undo)((GCallback) (eoc_window_cmd_undo)) },
3777 { "EditFlipHorizontal", "object-flip-horizontal", N_("Flip _Horizontal")("Flip _Horizontal"), NULL((void*)0),
3778 N_("Mirror the image horizontally")("Mirror the image horizontally"),
3779 G_CALLBACK (eoc_window_cmd_flip_horizontal)((GCallback) (eoc_window_cmd_flip_horizontal)) },
3780 { "EditFlipVertical", "object-flip-vertical", N_("Flip _Vertical")("Flip _Vertical"), NULL((void*)0),
3781 N_("Mirror the image vertically")("Mirror the image vertically"),
3782 G_CALLBACK (eoc_window_cmd_flip_vertical)((GCallback) (eoc_window_cmd_flip_vertical)) },
3783 { "EditRotate90", "object-rotate-right", N_("_Rotate Clockwise")("_Rotate Clockwise"), "<control>r",
3784 N_("Rotate the image 90 degrees to the right")("Rotate the image 90 degrees to the right"),
3785 G_CALLBACK (eoc_window_cmd_rotate_90)((GCallback) (eoc_window_cmd_rotate_90)) },
3786 { "EditRotate270", "object-rotate-left", N_("Rotate Counterc_lockwise")("Rotate Counterc_lockwise"), "<ctrl><shift>r",
3787 N_("Rotate the image 90 degrees to the left")("Rotate the image 90 degrees to the left"),
3788 G_CALLBACK (eoc_window_cmd_rotate_270)((GCallback) (eoc_window_cmd_rotate_270)) },
3789 { "ImageSetAsWallpaper", NULL((void*)0), N_("Set as _Desktop Background")("Set as _Desktop Background"),
3790 "<control>F8", N_("Set the selected image as the desktop background")("Set the selected image as the desktop background"),
3791 G_CALLBACK (eoc_window_cmd_wallpaper)((GCallback) (eoc_window_cmd_wallpaper)) },
3792 { "EditMoveToTrash", "user-trash", N_("Move to _Trash")("Move to _Trash"), NULL((void*)0),
3793 N_("Move the selected image to the trash folder")("Move the selected image to the trash folder"),
3794 G_CALLBACK (eoc_window_cmd_move_to_trash)((GCallback) (eoc_window_cmd_move_to_trash)) },
3795 { "EditCopyImage", "edit-copy", N_("_Copy")("_Copy"), "<control>C",
3796 N_("Copy the selected image to the clipboard")("Copy the selected image to the clipboard"),
3797 G_CALLBACK (eoc_window_cmd_copy_image)((GCallback) (eoc_window_cmd_copy_image)) },
3798 { "ViewZoomIn", "zoom-in", N_("_Zoom In")("_Zoom In"), "<control>plus",
3799 N_("Enlarge the image")("Enlarge the image"),
3800 G_CALLBACK (eoc_window_cmd_zoom_in)((GCallback) (eoc_window_cmd_zoom_in)) },
3801 { "ViewZoomOut", "zoom-out", N_("Zoom _Out")("Zoom _Out"), "<control>minus",
3802 N_("Shrink the image")("Shrink the image"),
3803 G_CALLBACK (eoc_window_cmd_zoom_out)((GCallback) (eoc_window_cmd_zoom_out)) },
3804 { "ViewZoomNormal", "zoom-original", N_("_Normal Size")("_Normal Size"), "<control>0",
3805 N_("Show the image at its normal size")("Show the image at its normal size"),
3806 G_CALLBACK (eoc_window_cmd_zoom_normal)((GCallback) (eoc_window_cmd_zoom_normal)) },
3807 { "ViewZoomFit", "zoom-fit-best", N_("_Best Fit")("_Best Fit"), "F",
3808 N_("Fit the image to the window")("Fit the image to the window"),
3809 G_CALLBACK (eoc_window_cmd_zoom_fit)((GCallback) (eoc_window_cmd_zoom_fit)) },
3810 { "ControlEqual", "zoom-in", N_("_Zoom In")("_Zoom In"), "<control>equal",
3811 N_("Enlarge the image")("Enlarge the image"),
3812 G_CALLBACK (eoc_window_cmd_zoom_in)((GCallback) (eoc_window_cmd_zoom_in)) },
3813 { "ControlKpAdd", "zoom-in", N_("_Zoom In")("_Zoom In"), "<control>KP_Add",
3814 N_("Shrink the image")("Shrink the image"),
3815 G_CALLBACK (eoc_window_cmd_zoom_in)((GCallback) (eoc_window_cmd_zoom_in)) },
3816 { "ControlKpSub", "zoom-out", N_("Zoom _Out")("Zoom _Out"), "<control>KP_Subtract",
3817 N_("Shrink the image")("Shrink the image"),
3818 G_CALLBACK (eoc_window_cmd_zoom_out)((GCallback) (eoc_window_cmd_zoom_out)) },
3819 { "Delete", NULL((void*)0), N_("Move to _Trash")("Move to _Trash"), "Delete",
3820 NULL((void*)0),
3821 G_CALLBACK (eoc_window_cmd_move_to_trash)((GCallback) (eoc_window_cmd_move_to_trash)) },
3822};
3823
3824static const CtkToggleActionEntry toggle_entries_image[] = {
3825 { "ViewFullscreen", "view-fullscreen", N_("_Fullscreen")("_Fullscreen"), "F11",
3826 N_("Show the current image in fullscreen mode")("Show the current image in fullscreen mode"),
3827 G_CALLBACK (eoc_window_cmd_fullscreen)((GCallback) (eoc_window_cmd_fullscreen)), FALSE(0) },
3828 { "PauseSlideshow", "media-playback-pause", N_("Pause Slideshow")("Pause Slideshow"),
3829 NULL((void*)0), N_("Pause or resume the slideshow")("Pause or resume the slideshow"),
3830 G_CALLBACK (eoc_window_cmd_pause_slideshow)((GCallback) (eoc_window_cmd_pause_slideshow)), FALSE(0) },
3831};
3832
3833static const CtkActionEntry action_entries_collection[] = {
3834 { "GoPrevious", "go-previous", N_("_Previous Image")("_Previous Image"), "<Alt>Left",
3835 N_("Go to the previous image of the collection")("Go to the previous image of the collection"),
3836 G_CALLBACK (eoc_window_cmd_go_prev)((GCallback) (eoc_window_cmd_go_prev)) },
3837 { "GoNext", "go-next", N_("_Next Image")("_Next Image"), "<Alt>Right",
3838 N_("Go to the next image of the collection")("Go to the next image of the collection"),
3839 G_CALLBACK (eoc_window_cmd_go_next)((GCallback) (eoc_window_cmd_go_next)) },
3840 { "GoFirst", "go-first", N_("_First Image")("_First Image"), "<Alt>Home",
3841 N_("Go to the first image of the collection")("Go to the first image of the collection"),
3842 G_CALLBACK (eoc_window_cmd_go_first)((GCallback) (eoc_window_cmd_go_first)) },
3843 { "GoLast", "go-last", N_("_Last Image")("_Last Image"), "<Alt>End",
3844 N_("Go to the last image of the collection")("Go to the last image of the collection"),
3845 G_CALLBACK (eoc_window_cmd_go_last)((GCallback) (eoc_window_cmd_go_last)) },
3846 { "GoRandom", NULL((void*)0), N_("_Random Image")("_Random Image"), "<control>M",
3847 N_("Go to a random image of the collection")("Go to a random image of the collection"),
3848 G_CALLBACK (eoc_window_cmd_go_random)((GCallback) (eoc_window_cmd_go_random)) },
3849 { "BackSpace", NULL((void*)0), N_("_Previous Image")("_Previous Image"), "BackSpace",
3850 NULL((void*)0),
3851 G_CALLBACK (eoc_window_cmd_go_prev)((GCallback) (eoc_window_cmd_go_prev)) },
3852 { "Home", NULL((void*)0), N_("_First Image")("_First Image"), "Home",
3853 NULL((void*)0),
3854 G_CALLBACK (eoc_window_cmd_go_first)((GCallback) (eoc_window_cmd_go_first)) },
3855 { "End", NULL((void*)0), N_("_Last Image")("_Last Image"), "End",
3856 NULL((void*)0),
3857 G_CALLBACK (eoc_window_cmd_go_last)((GCallback) (eoc_window_cmd_go_last)) },
3858};
3859
3860static const CtkToggleActionEntry toggle_entries_collection[] = {
3861 { "ViewSlideshow", "slideshow-play", N_("S_lideshow")("S_lideshow"), "F5",
3862 N_("Start a slideshow view of the images")("Start a slideshow view of the images"),
3863 G_CALLBACK (eoc_window_cmd_slideshow)((GCallback) (eoc_window_cmd_slideshow)), FALSE(0) },
3864};
3865
3866static void
3867menu_item_select_cb (CtkMenuItem *proxy, EocWindow *window)
3868{
3869 CtkAction *action;
3870 char *message;
3871
3872 action = ctk_activatable_get_related_action (CTK_ACTIVATABLE (proxy)((((CtkActivatable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((proxy)), ((ctk_activatable_get_type ()))))))
);
3873
3874 g_return_if_fail (action != NULL)do { if ((action != ((void*)0))) { } else { g_return_if_fail_warning
("EOC", ((const char*) (__func__)), "action != NULL"); return
; } } while (0)
;
3875
3876 g_object_get (G_OBJECT (action)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), (((GType) ((20) << (2))))))))
, "tooltip", &message, NULL((void*)0));
3877
3878 if (message) {
3879 ctk_statusbar_push (CTK_STATUSBAR (window->priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->statusbar)), ((ctk_statusbar_get_type
()))))))
,
3880 window->priv->tip_message_cid, message);
3881 g_free (message);
3882 }
3883}
3884
3885static void
3886menu_item_deselect_cb (CtkMenuItem *proxy, EocWindow *window)
3887{
3888 ctk_statusbar_pop (CTK_STATUSBAR (window->priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->statusbar)), ((ctk_statusbar_get_type
()))))))
,
3889 window->priv->tip_message_cid);
3890}
3891
3892static void
3893connect_proxy_cb (CtkUIManager *manager,
3894 CtkAction *action,
3895 CtkWidget *proxy,
3896 EocWindow *window)
3897{
3898 if (CTK_IS_MENU_ITEM (proxy)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(proxy)); GType __t = ((ctk_menu_item_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
) {
3899 disconnect_proxy_cb (manager, action, proxy, window);
3900 g_signal_connect (proxy, "select",g_signal_connect_data ((proxy), ("select"), (((GCallback) (menu_item_select_cb
))), (window), ((void*)0), (GConnectFlags) 0)
3901 G_CALLBACK (menu_item_select_cb), window)g_signal_connect_data ((proxy), ("select"), (((GCallback) (menu_item_select_cb
))), (window), ((void*)0), (GConnectFlags) 0)
;
3902 g_signal_connect (proxy, "deselect",g_signal_connect_data ((proxy), ("deselect"), (((GCallback) (
menu_item_deselect_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3903 G_CALLBACK (menu_item_deselect_cb), window)g_signal_connect_data ((proxy), ("deselect"), (((GCallback) (
menu_item_deselect_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
3904 }
3905}
3906
3907static void
3908disconnect_proxy_cb (CtkUIManager *manager,
3909 CtkAction *action,
3910 CtkWidget *proxy,
3911 EocWindow *window)
3912{
3913 if (CTK_IS_MENU_ITEM (proxy)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(proxy)); GType __t = ((ctk_menu_item_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
) {
3914 g_signal_handlers_disconnect_by_funcg_signal_handlers_disconnect_matched ((proxy), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (menu_item_select_cb))), (window))
3915 (proxy, G_CALLBACK (menu_item_select_cb), window)g_signal_handlers_disconnect_matched ((proxy), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (menu_item_select_cb))), (window))
;
3916 g_signal_handlers_disconnect_by_funcg_signal_handlers_disconnect_matched ((proxy), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (menu_item_deselect_cb))), (window))
3917 (proxy, G_CALLBACK (menu_item_deselect_cb), window)g_signal_handlers_disconnect_matched ((proxy), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (menu_item_deselect_cb))), (window))
;
3918 }
3919}
3920
3921static void
3922set_action_properties (CtkActionGroup *window_group,
3923 CtkActionGroup *image_group,
3924 CtkActionGroup *collection_group)
3925{
3926 CtkAction *action;
3927
3928 action = ctk_action_group_get_action (collection_group, "GoPrevious");
3929 g_object_set (action, "short_label", _("Previous")gettext ("Previous"), NULL((void*)0));
3930 g_object_set (action, "is-important", TRUE(!(0)), NULL((void*)0));
3931
3932 action = ctk_action_group_get_action (collection_group, "GoNext");
3933 g_object_set (action, "short_label", _("Next")gettext ("Next"), NULL((void*)0));
3934 g_object_set (action, "is-important", TRUE(!(0)), NULL((void*)0));
3935
3936 action = ctk_action_group_get_action (image_group, "EditRotate90");
3937 g_object_set (action, "short_label", _("Right")gettext ("Right"), NULL((void*)0));
3938
3939 action = ctk_action_group_get_action (image_group, "EditRotate270");
3940 g_object_set (action, "short_label", _("Left")gettext ("Left"), NULL((void*)0));
3941
3942 action = ctk_action_group_get_action (image_group, "ImageOpenContainingFolder");
3943 g_object_set (action, "short_label", _("Open Folder")gettext ("Open Folder"), NULL((void*)0));
3944
3945 action = ctk_action_group_get_action (image_group, "ViewZoomIn");
3946 g_object_set (action, "short_label", _("In")gettext ("In"), NULL((void*)0));
3947
3948 action = ctk_action_group_get_action (image_group, "ViewZoomOut");
3949 g_object_set (action, "short_label", _("Out")gettext ("Out"), NULL((void*)0));
3950
3951 action = ctk_action_group_get_action (image_group, "ViewZoomNormal");
3952 g_object_set (action, "short_label", _("Normal")gettext ("Normal"), NULL((void*)0));
3953
3954 action = ctk_action_group_get_action (image_group, "ViewZoomFit");
3955 g_object_set (action, "short_label", _("Fit")gettext ("Fit"), NULL((void*)0));
3956
3957 action = ctk_action_group_get_action (window_group, "ViewImageCollection");
3958 g_object_set (action, "short_label", _("Collection")gettext ("Collection"), NULL((void*)0));
3959
3960 action = ctk_action_group_get_action (image_group, "EditMoveToTrash");
3961 g_object_set (action, "short_label", C_("action (to trash)", "Trash")g_dpgettext (((void*)0), "action (to trash)" "\004" "Trash", strlen
("action (to trash)") + 1)
, NULL((void*)0));
3962}
3963
3964static gint
3965sort_recents_mru (CtkRecentInfo *a, CtkRecentInfo *b)
3966{
3967 gboolean has_eoc_a, has_eoc_b;
3968
3969 /* We need to check this first as ctk_recent_info_get_application_info
3970 * will treat it as a non-fatal error when the CtkRecentInfo doesn't
3971 * have the application registered. */
3972 has_eoc_a = ctk_recent_info_has_application (a,
3973 EOC_RECENT_FILES_APP_NAME"Eye of CAFE Image Viewer");
3974 has_eoc_b = ctk_recent_info_has_application (b,
3975 EOC_RECENT_FILES_APP_NAME"Eye of CAFE Image Viewer");
3976 if (has_eoc_a && has_eoc_b) {
3977 GDateTime *time_a = NULL((void*)0);
3978 GDateTime *time_b = NULL((void*)0);
3979
3980 /* These should not fail as we already checked that
3981 * the application is registered with the info objects */
3982 ctk_recent_info_get_application_info (a,
3983 EOC_RECENT_FILES_APP_NAME"Eye of CAFE Image Viewer",
3984 NULL((void*)0),
3985 NULL((void*)0),
3986 &time_a);
3987 ctk_recent_info_get_application_info (b,
3988 EOC_RECENT_FILES_APP_NAME"Eye of CAFE Image Viewer",
3989 NULL((void*)0),
3990 NULL((void*)0),
3991 &time_b);
3992
3993 return (g_date_time_to_unix (time_b) - g_date_time_to_unix (time_a));
3994 } else if (has_eoc_a) {
3995 return -1;
3996 } else if (has_eoc_b) {
3997 return 1;
3998 }
3999
4000 return 0;
4001}
4002
4003static void
4004eoc_window_update_recent_files_menu (EocWindow *window)
4005{
4006 EocWindowPrivate *priv;
4007 GList *actions = NULL((void*)0), *li = NULL((void*)0), *items = NULL((void*)0);
4008 guint count_recent = 0;
4009
4010 priv = window->priv;
4011
4012 if (priv->recent_menu_id != 0)
4013 ctk_ui_manager_remove_ui (priv->ui_mgr, priv->recent_menu_id);
4014
4015 actions = ctk_action_group_list_actions (priv->actions_recent);
4016
4017 for (li = actions; li != NULL((void*)0); li = li->next) {
4018 g_signal_handlers_disconnect_by_func (CTK_ACTION (li->data),g_signal_handlers_disconnect_matched ((((((CtkAction*) (void *
) g_type_check_instance_cast ((GTypeInstance*) ((li->data)
), ((ctk_action_get_type ()))))))), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC
| G_SIGNAL_MATCH_DATA), 0, 0, ((void*)0), (((GCallback) (eoc_window_open_recent_cb
))), (window))
4019 G_CALLBACK(eoc_window_open_recent_cb),g_signal_handlers_disconnect_matched ((((((CtkAction*) (void *
) g_type_check_instance_cast ((GTypeInstance*) ((li->data)
), ((ctk_action_get_type ()))))))), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC
| G_SIGNAL_MATCH_DATA), 0, 0, ((void*)0), (((GCallback) (eoc_window_open_recent_cb
))), (window))
4020 window)g_signal_handlers_disconnect_matched ((((((CtkAction*) (void *
) g_type_check_instance_cast ((GTypeInstance*) ((li->data)
), ((ctk_action_get_type ()))))))), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC
| G_SIGNAL_MATCH_DATA), 0, 0, ((void*)0), (((GCallback) (eoc_window_open_recent_cb
))), (window))
;
4021
4022 ctk_action_group_remove_action (priv->actions_recent,
4023 CTK_ACTION (li->data)((((CtkAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((li->data)), ((ctk_action_get_type ()))))))
);
4024 }
4025
4026 g_list_free (actions);
4027
4028 priv->recent_menu_id = ctk_ui_manager_new_merge_id (priv->ui_mgr);
4029 items = ctk_recent_manager_get_items (ctk_recent_manager_get_default());
4030 items = g_list_sort (items, (GCompareFunc) sort_recents_mru);
4031
4032 for (li = items; li != NULL((void*)0) && count_recent < EOC_RECENT_FILES_LIMIT5; li = li->next) {
4033 gchar *action_name;
4034 gchar *label;
4035 gchar *tip;
4036 gchar **display_name;
4037 gchar *label_filename;
4038 CtkAction *action;
4039 CtkRecentInfo *info = li->data;
4040
4041 /* Sorting moves non-EOC files to the end of the list.
4042 * So no file of interest will follow if this test fails */
4043 if (!ctk_recent_info_has_application (info, EOC_RECENT_FILES_APP_NAME"Eye of CAFE Image Viewer"))
4044 break;
4045
4046 count_recent++;
4047
4048 action_name = g_strdup_printf ("recent-info-%d", count_recent);
4049 display_name = g_strsplit (ctk_recent_info_get_display_name (info), "_", -1);
4050 label_filename = g_strjoinv ("__", display_name);
4051 label = g_strdup_printf ("%s_%d. %s",
4052 (is_rtl(ctk_widget_get_default_direction () == CTK_TEXT_DIR_RTL) ? "\xE2\x80\x8F" : ""), count_recent, label_filename);
4053 g_free (label_filename);
4054 g_strfreev (display_name);
4055
4056 tip = ctk_recent_info_get_uri_display (info);
4057
4058 /* This is a workaround for a bug (#351945) regarding
4059 * ctk_recent_info_get_uri_display() and remote URIs.
4060 * cafe_vfs_format_uri_for_display is sufficient here
4061 * since the password gets stripped when adding the
4062 * file to the recently used list. */
4063 if (tip == NULL((void*)0))
4064 tip = g_uri_unescape_string (ctk_recent_info_get_uri (info), NULL((void*)0));
4065
4066 action = ctk_action_new (action_name, label, tip, NULL((void*)0));
4067 ctk_action_set_always_show_image (action, TRUE(!(0)));
4068
4069 g_object_set_data_full (G_OBJECT (action)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), (((GType) ((20) << (2))))))))
, "ctk-recent-info",
4070 ctk_recent_info_ref (info),
4071 (GDestroyNotify) ctk_recent_info_unref);
4072
4073 g_object_set (G_OBJECT (action)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), (((GType) ((20) << (2))))))))
, "icon-name", "image-x-generic", NULL((void*)0));
4074
4075 g_signal_connect (action, "activate",g_signal_connect_data ((action), ("activate"), (((GCallback) (
eoc_window_open_recent_cb))), (window), ((void*)0), (GConnectFlags
) 0)
4076 G_CALLBACK (eoc_window_open_recent_cb),g_signal_connect_data ((action), ("activate"), (((GCallback) (
eoc_window_open_recent_cb))), (window), ((void*)0), (GConnectFlags
) 0)
4077 window)g_signal_connect_data ((action), ("activate"), (((GCallback) (
eoc_window_open_recent_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
4078
4079 ctk_action_group_add_action (priv->actions_recent, action);
4080
4081 g_object_unref (action);
4082
4083 ctk_ui_manager_add_ui (priv->ui_mgr, priv->recent_menu_id,
4084 "/MainMenu/Image/RecentDocuments",
4085 action_name, action_name,
4086 CTK_UI_MANAGER_AUTO, FALSE(0));
4087
4088 g_free (action_name);
4089 g_free (label);
4090 g_free (tip);
4091 }
4092
4093 g_list_foreach (items, (GFunc) ctk_recent_info_unref, NULL((void*)0));
4094 g_list_free (items);
4095}
4096
4097static void
4098eoc_window_recent_manager_changed_cb (CtkRecentManager *manager, EocWindow *window)
4099{
4100 eoc_window_update_recent_files_menu (window);
4101}
4102
4103static void
4104eoc_window_drag_data_received (CtkWidget *widget,
4105 CdkDragContext *context,
4106 gint x, gint y,
4107 CtkSelectionData *selection_data,
4108 guint info, guint time)
4109{
4110 GSList *file_list;
4111 EocWindow *window;
4112 CdkAtom target;
4113 CtkWidget *src;
4114
4115 target = ctk_selection_data_get_target (selection_data);
4116
4117 if (!ctk_targets_include_uri (&target, 1))
4118 return;
4119
4120 /* if the request is from another process this will return NULL */
4121 src = ctk_drag_get_source_widget (context);
4122
4123 /* if the drag request originates from the current eoc instance, ignore
4124 the request if the source window is the same as the dest window */
4125 if (src &&
4126 ctk_widget_get_toplevel (src) == ctk_widget_get_toplevel (widget))
4127 {
4128 cdk_drag_status (context, 0, time);
4129 return;
4130 }
4131
4132 if (cdk_drag_context_get_suggested_action (context) == CDK_ACTION_COPY) {
4133 window = EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
;
4134
4135 file_list = eoc_util_parse_uri_string_list_to_file_list ((const gchar *) ctk_selection_data_get_data (selection_data));
4136
4137 eoc_window_open_file_list (window, file_list);
4138 }
4139}
4140
4141static void
4142eoc_window_set_drag_dest (EocWindow *window)
4143{
4144 ctk_drag_dest_set (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
,
4145 CTK_DEST_DEFAULT_MOTION | CTK_DEST_DEFAULT_DROP,
4146 NULL((void*)0), 0,
4147 CDK_ACTION_COPY | CDK_ACTION_ASK);
4148 ctk_drag_dest_add_uri_targets (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
4149}
4150
4151static void
4152eoc_window_sidebar_visibility_changed (CtkWidget *widget, EocWindow *window)
4153{
4154 CtkAction *action;
4155 gboolean visible;
4156
4157 visible = ctk_widget_get_visible (window->priv->sidebar);
4158
4159 action = ctk_action_group_get_action (window->priv->actions_window,
4160 "ViewSidebar");
4161
4162 if (ctk_toggle_action_get_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
) != visible)
4163 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
, visible);
4164
4165 /* Focus the image */
4166 if (!visible && window->priv->image != NULL((void*)0))
4167 ctk_widget_grab_focus (window->priv->view);
4168}
4169
4170static void
4171eoc_window_sidebar_page_added (EocSidebar *sidebar,
4172 CtkWidget *main_widget,
4173 EocWindow *window)
4174{
4175 if (eoc_sidebar_get_n_pages (sidebar) == 1) {
4176 CtkAction *action;
4177 gboolean show;
4178
4179 action = ctk_action_group_get_action (window->priv->actions_window,
4180 "ViewSidebar");
4181
4182 ctk_action_set_sensitive (action, TRUE(!(0)));
4183
4184 show = ctk_toggle_action_get_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
);
4185
4186 if (show)
4187 ctk_widget_show (CTK_WIDGET (sidebar)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sidebar)), ((ctk_widget_get_type ()))))))
);
4188 }
4189}
4190static void
4191eoc_window_sidebar_page_removed (EocSidebar *sidebar,
4192 CtkWidget *main_widget,
4193 EocWindow *window)
4194{
4195 if (eoc_sidebar_is_empty (sidebar)) {
4196 CtkAction *action;
4197
4198 ctk_widget_hide (CTK_WIDGET (sidebar)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sidebar)), ((ctk_widget_get_type ()))))))
);
4199
4200 action = ctk_action_group_get_action (window->priv->actions_window,
4201 "ViewSidebar");
4202
4203 ctk_action_set_sensitive (action, FALSE(0));
4204 }
4205}
4206
4207static void
4208eoc_window_finish_saving (EocWindow *window)
4209{
4210 EocWindowPrivate *priv = window->priv;
4211
4212 ctk_widget_set_sensitive (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
, FALSE(0));
4213
4214 do {
4215 ctk_main_iteration ();
4216 } while (priv->save_job != NULL((void*)0));
4217}
4218
4219static GAppInfo *
4220get_appinfo_for_editor (EocWindow *window)
4221{
4222 /* We want this function to always return the same thing, not
4223 * just for performance reasons, but because if someone edits
4224 * GConf while eoc is running, the application could get into an
4225 * inconsistent state. If the editor exists once, it gets added
4226 * to the "available" list of the EggToolbarsModel (for which
4227 * there is no API to remove it). If later the editor no longer
4228 * existed when constructing a new window, we'd be unable to
4229 * construct a CtkAction for the editor for that window, causing
4230 * assertion failures when viewing the "Edit Toolbars" dialog
4231 * (item is available, but can't find the CtkAction for it).
4232 *
4233 * By ensuring we keep the GAppInfo around, we avoid the
4234 * possibility of that situation occurring.
4235 */
4236 static GDesktopAppInfo *app_info = NULL((void*)0);
4237 static gboolean initialised;
4238
4239 if (!initialised) {
4240 gchar *editor;
4241
4242 editor = g_settings_get_string (window->priv->ui_settings,
4243 EOC_CONF_UI_EXTERNAL_EDITOR"external-editor");
4244
4245 if (editor != NULL((void*)0)) {
4246 app_info = g_desktop_app_info_new (editor);
4247 }
4248
4249 initialised = TRUE(!(0));
4250 g_free (editor);
4251 }
4252
4253 return (GAppInfo *) app_info;
4254}
4255
4256static void
4257eoc_window_open_editor (CtkAction *action,
4258 EocWindow *window)
4259{
4260 CdkAppLaunchContext *context;
4261 GAppInfo *app_info;
4262 GList files;
4263
4264 app_info = get_appinfo_for_editor (window);
4265
4266 if (app_info == NULL((void*)0))
4267 return;
4268
4269 context = cdk_display_get_app_launch_context (
4270 ctk_widget_get_display (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
));
4271 cdk_app_launch_context_set_screen (context,
4272 ctk_widget_get_screen (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
));
4273 cdk_app_launch_context_set_icon (context,
4274 g_app_info_get_icon (app_info));
4275 cdk_app_launch_context_set_timestamp (context,
4276 ctk_get_current_event_time ());
4277
4278 {
4279 GList f = { eoc_image_get_file (window->priv->image) };
4280 files = f;
4281 }
4282
4283 g_app_info_launch (app_info, &files,
4284 G_APP_LAUNCH_CONTEXT (context)((((GAppLaunchContext*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((context)), ((g_app_launch_context_get_type
()))))))
, NULL((void*)0));
4285
4286 g_object_unref (files.data);
4287 g_object_unref (context);
4288}
4289
4290static void
4291eoc_window_add_open_editor_action (EocWindow *window)
4292{
4293 EggToolbarsModel *model;
4294 GAppInfo *app_info;
4295 CtkAction *action;
4296 gchar *tooltip;
4297
4298 app_info = get_appinfo_for_editor (window);
4299
4300 if (app_info == NULL((void*)0))
4301 return;
4302
4303 model = eoc_application_get_toolbars_model (EOC_APP(eoc_application_get_instance ()));
4304 egg_toolbars_model_set_name_flags (model, "OpenEditor",
4305 EGG_TB_MODEL_NAME_KNOWN);
4306
4307 tooltip = g_strdup_printf (_("Edit the current image using %s")gettext ("Edit the current image using %s"),
4308 g_app_info_get_name (app_info));
4309 action = ctk_action_new ("OpenEditor", _("Edit Image")gettext ("Edit Image"), tooltip, NULL((void*)0));
4310 ctk_action_set_gicon (action, g_app_info_get_icon (app_info));
4311 ctk_action_set_is_important (action, TRUE(!(0)));
4312
4313 g_signal_connect (action, "activate",g_signal_connect_data ((action), ("activate"), (((GCallback) (
eoc_window_open_editor))), (window), ((void*)0), (GConnectFlags
) 0)
4314 G_CALLBACK (eoc_window_open_editor), window)g_signal_connect_data ((action), ("activate"), (((GCallback) (
eoc_window_open_editor))), (window), ((void*)0), (GConnectFlags
) 0)
;
4315
4316 ctk_action_group_add_action (window->priv->actions_image, action);
4317
4318 g_object_unref (action);
4319 g_free (tooltip);
4320}
4321
4322static void
4323eoc_window_construct_ui (EocWindow *window)
4324{
4325 EocWindowPrivate *priv;
4326
4327 GError *error = NULL((void*)0);
4328
4329 CtkWidget *menubar;
4330 CtkWidget *thumb_popup;
4331 CtkWidget *view_popup;
4332 CtkWidget *hpaned;
4333 CtkWidget *menuitem;
4334
4335 g_return_if_fail (EOC_IS_WINDOW (window))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return; } } while (0)
;
4336
4337 priv = window->priv;
4338
4339 priv->box = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4340 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, priv->box);
4341 ctk_widget_show (priv->box);
4342
4343 priv->ui_mgr = ctk_ui_manager_new ();
4344
4345 priv->actions_window = ctk_action_group_new ("MenuActionsWindow");
4346
4347 ctk_action_group_set_translation_domain (priv->actions_window,
4348 GETTEXT_PACKAGE"eoc");
4349
4350 ctk_action_group_add_actions (priv->actions_window,
4351 action_entries_window,
4352 G_N_ELEMENTS (action_entries_window)(sizeof (action_entries_window) / sizeof ((action_entries_window
)[0]))
,
4353 window);
4354
4355 ctk_action_group_add_toggle_actions (priv->actions_window,
4356 toggle_entries_window,
4357 G_N_ELEMENTS (toggle_entries_window)(sizeof (toggle_entries_window) / sizeof ((toggle_entries_window
)[0]))
,
4358 window);
4359
4360 ctk_ui_manager_insert_action_group (priv->ui_mgr, priv->actions_window, 0);
4361
4362 priv->actions_image = ctk_action_group_new ("MenuActionsImage");
4363 ctk_action_group_set_translation_domain (priv->actions_image,
4364 GETTEXT_PACKAGE"eoc");
4365
4366 ctk_action_group_add_actions (priv->actions_image,
4367 action_entries_image,
4368 G_N_ELEMENTS (action_entries_image)(sizeof (action_entries_image) / sizeof ((action_entries_image
)[0]))
,
4369 window);
4370
4371 eoc_window_add_open_editor_action (window);
4372
4373 ctk_action_group_add_toggle_actions (priv->actions_image,
4374 toggle_entries_image,
4375 G_N_ELEMENTS (toggle_entries_image)(sizeof (toggle_entries_image) / sizeof ((toggle_entries_image
)[0]))
,
4376 window);
4377
4378 ctk_ui_manager_insert_action_group (priv->ui_mgr, priv->actions_image, 0);
4379
4380 priv->actions_collection = ctk_action_group_new ("MenuActionsCollection");
4381 ctk_action_group_set_translation_domain (priv->actions_collection,
4382 GETTEXT_PACKAGE"eoc");
4383
4384 ctk_action_group_add_actions (priv->actions_collection,
4385 action_entries_collection,
4386 G_N_ELEMENTS (action_entries_collection)(sizeof (action_entries_collection) / sizeof ((action_entries_collection
)[0]))
,
4387 window);
4388
4389 ctk_action_group_add_toggle_actions (priv->actions_collection,
4390 toggle_entries_collection,
4391 G_N_ELEMENTS (toggle_entries_collection)(sizeof (toggle_entries_collection) / sizeof ((toggle_entries_collection
)[0]))
,
4392 window);
4393
4394 set_action_properties (priv->actions_window,
4395 priv->actions_image,
4396 priv->actions_collection);
4397
4398 ctk_ui_manager_insert_action_group (priv->ui_mgr, priv->actions_collection, 0);
4399
4400 if (!ctk_ui_manager_add_ui_from_resource (priv->ui_mgr,
4401 "/org/cafe/eoc/ui/eoc-ui.xml",
4402 &error)) {
4403 g_warning ("building menus failed: %s", error->message);
4404 g_error_free (error);
4405 }
4406
4407 g_signal_connect (priv->ui_mgr, "connect_proxy",g_signal_connect_data ((priv->ui_mgr), ("connect_proxy"), (
((GCallback) (connect_proxy_cb))), (window), ((void*)0), (GConnectFlags
) 0)
4408 G_CALLBACK (connect_proxy_cb), window)g_signal_connect_data ((priv->ui_mgr), ("connect_proxy"), (
((GCallback) (connect_proxy_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
4409 g_signal_connect (priv->ui_mgr, "disconnect_proxy",g_signal_connect_data ((priv->ui_mgr), ("disconnect_proxy"
), (((GCallback) (disconnect_proxy_cb))), (window), ((void*)0
), (GConnectFlags) 0)
4410 G_CALLBACK (disconnect_proxy_cb), window)g_signal_connect_data ((priv->ui_mgr), ("disconnect_proxy"
), (((GCallback) (disconnect_proxy_cb))), (window), ((void*)0
), (GConnectFlags) 0)
;
4411
4412 menubar = ctk_ui_manager_get_widget (priv->ui_mgr, "/MainMenu");
4413 g_assert (CTK_IS_WIDGET (menubar))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((menubar)); GType __t = ((ctk_widget_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else
g_assertion_message_expr ("EOC", "eoc-window.c", 4413, ((const
char*) (__func__)), "CTK_IS_WIDGET (menubar)"); } while (0)
;
4414 ctk_box_pack_start (CTK_BOX (priv->box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->box)), ((ctk_box_get_type ()))))))
, menubar, FALSE(0), FALSE(0), 0);
4415 ctk_widget_show (menubar);
4416
4417 menuitem = ctk_ui_manager_get_widget (priv->ui_mgr,
4418 "/MainMenu/Edit/EditFlipHorizontal");
4419 ctk_image_menu_item_set_always_show_image (
4420 CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, TRUE(!(0)));
4421
4422 menuitem = ctk_ui_manager_get_widget (priv->ui_mgr,
4423 "/MainMenu/Edit/EditFlipVertical");
4424 ctk_image_menu_item_set_always_show_image (
4425 CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, TRUE(!(0)));
4426
4427 menuitem = ctk_ui_manager_get_widget (priv->ui_mgr,
4428 "/MainMenu/Edit/EditRotate90");
4429 ctk_image_menu_item_set_always_show_image (
4430 CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, TRUE(!(0)));
4431
4432 menuitem = ctk_ui_manager_get_widget (priv->ui_mgr,
4433 "/MainMenu/Edit/EditRotate270");
4434 ctk_image_menu_item_set_always_show_image (
4435 CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, TRUE(!(0)));
4436
4437 priv->toolbar = CTK_WIDGET((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((egg_editable_toolbar_get_type ()), "ui-manager"
, priv->ui_mgr, "popup-path", "/ToolbarPopup", "model", eoc_application_get_toolbars_model
((eoc_application_get_instance ())), ((void*)0)))), ((ctk_widget_get_type
()))))))
4438 (g_object_new (EGG_TYPE_EDITABLE_TOOLBAR,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((egg_editable_toolbar_get_type ()), "ui-manager"
, priv->ui_mgr, "popup-path", "/ToolbarPopup", "model", eoc_application_get_toolbars_model
((eoc_application_get_instance ())), ((void*)0)))), ((ctk_widget_get_type
()))))))
4439 "ui-manager", priv->ui_mgr,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((egg_editable_toolbar_get_type ()), "ui-manager"
, priv->ui_mgr, "popup-path", "/ToolbarPopup", "model", eoc_application_get_toolbars_model
((eoc_application_get_instance ())), ((void*)0)))), ((ctk_widget_get_type
()))))))
4440 "popup-path", "/ToolbarPopup",((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((egg_editable_toolbar_get_type ()), "ui-manager"
, priv->ui_mgr, "popup-path", "/ToolbarPopup", "model", eoc_application_get_toolbars_model
((eoc_application_get_instance ())), ((void*)0)))), ((ctk_widget_get_type
()))))))
4441 "model", eoc_application_get_toolbars_model (EOC_APP),((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((egg_editable_toolbar_get_type ()), "ui-manager"
, priv->ui_mgr, "popup-path", "/ToolbarPopup", "model", eoc_application_get_toolbars_model
((eoc_application_get_instance ())), ((void*)0)))), ((ctk_widget_get_type
()))))))
4442 NULL))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((egg_editable_toolbar_get_type ()), "ui-manager"
, priv->ui_mgr, "popup-path", "/ToolbarPopup", "model", eoc_application_get_toolbars_model
((eoc_application_get_instance ())), ((void*)0)))), ((ctk_widget_get_type
()))))))
;
4443
4444 ctk_style_context_add_class (ctk_widget_get_style_context (CTK_WIDGET (priv->toolbar)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->toolbar)), ((ctk_widget_get_type ()))))))
),
4445 CTK_STYLE_CLASS_PRIMARY_TOOLBAR"primary-toolbar");
4446
4447 egg_editable_toolbar_show (EGG_EDITABLE_TOOLBAR (priv->toolbar)((((EggEditableToolbar*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((priv->toolbar)), ((egg_editable_toolbar_get_type
()))))))
,
4448 "Toolbar");
4449
4450 ctk_box_pack_start (CTK_BOX (priv->box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->box)), ((ctk_box_get_type ()))))))
,
4451 priv->toolbar,
4452 FALSE(0),
4453 FALSE(0),
4454 0);
4455
4456 ctk_widget_show (priv->toolbar);
4457
4458 ctk_window_add_accel_group (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
4459 ctk_ui_manager_get_accel_group (priv->ui_mgr));
4460
4461 priv->actions_recent = ctk_action_group_new ("RecentFilesActions");
4462 ctk_action_group_set_translation_domain (priv->actions_recent,
4463 GETTEXT_PACKAGE"eoc");
4464
4465 g_signal_connect (ctk_recent_manager_get_default (), "changed",g_signal_connect_data ((ctk_recent_manager_get_default ()), (
"changed"), (((GCallback) (eoc_window_recent_manager_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
4466 G_CALLBACK (eoc_window_recent_manager_changed_cb),g_signal_connect_data ((ctk_recent_manager_get_default ()), (
"changed"), (((GCallback) (eoc_window_recent_manager_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
4467 window)g_signal_connect_data ((ctk_recent_manager_get_default ()), (
"changed"), (((GCallback) (eoc_window_recent_manager_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
;
4468
4469 eoc_window_update_recent_files_menu (window);
4470
4471 ctk_ui_manager_insert_action_group (priv->ui_mgr, priv->actions_recent, 0);
4472
4473 priv->cbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4474 ctk_box_pack_start (CTK_BOX (priv->box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->box)), ((ctk_box_get_type ()))))))
, priv->cbox, TRUE(!(0)), TRUE(!(0)), 0);
4475 ctk_widget_show (priv->cbox);
4476
4477 priv->statusbar = eoc_statusbar_new ();
4478 ctk_box_pack_end (CTK_BOX (priv->box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->box)), ((ctk_box_get_type ()))))))
,
4479 CTK_WIDGET (priv->statusbar)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_widget_get_type ()))))))
,
4480 FALSE(0), FALSE(0), 0);
4481 ctk_widget_show (priv->statusbar);
4482
4483 priv->image_info_message_cid =
4484 ctk_statusbar_get_context_id (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
4485 "image_info_message");
4486 priv->tip_message_cid =
4487 ctk_statusbar_get_context_id (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
4488 "tip_message");
4489
4490 priv->layout = ctk_box_new (CTK_ORIENTATION_VERTICAL, 2);
4491
4492 hpaned = ctk_paned_new (CTK_ORIENTATION_HORIZONTAL);
4493
4494 priv->sidebar = eoc_sidebar_new ();
4495 /* The sidebar shouldn't be shown automatically on show_all(),
4496 but only when the user actually wants it. */
4497 ctk_widget_set_no_show_all (priv->sidebar, TRUE(!(0)));
4498
4499 ctk_widget_set_size_request (priv->sidebar, 210, -1);
4500
4501 g_signal_connect_after (priv->sidebar,g_signal_connect_data ((priv->sidebar), ("show"), (((GCallback
) (eoc_window_sidebar_visibility_changed))), (window), ((void
*)0), G_CONNECT_AFTER)
4502 "show",g_signal_connect_data ((priv->sidebar), ("show"), (((GCallback
) (eoc_window_sidebar_visibility_changed))), (window), ((void
*)0), G_CONNECT_AFTER)
4503 G_CALLBACK (eoc_window_sidebar_visibility_changed),g_signal_connect_data ((priv->sidebar), ("show"), (((GCallback
) (eoc_window_sidebar_visibility_changed))), (window), ((void
*)0), G_CONNECT_AFTER)
4504 window)g_signal_connect_data ((priv->sidebar), ("show"), (((GCallback
) (eoc_window_sidebar_visibility_changed))), (window), ((void
*)0), G_CONNECT_AFTER)
;
4505
4506 g_signal_connect_after (priv->sidebar,g_signal_connect_data ((priv->sidebar), ("hide"), (((GCallback
) (eoc_window_sidebar_visibility_changed))), (window), ((void
*)0), G_CONNECT_AFTER)
4507 "hide",g_signal_connect_data ((priv->sidebar), ("hide"), (((GCallback
) (eoc_window_sidebar_visibility_changed))), (window), ((void
*)0), G_CONNECT_AFTER)
4508 G_CALLBACK (eoc_window_sidebar_visibility_changed),g_signal_connect_data ((priv->sidebar), ("hide"), (((GCallback
) (eoc_window_sidebar_visibility_changed))), (window), ((void
*)0), G_CONNECT_AFTER)
4509 window)g_signal_connect_data ((priv->sidebar), ("hide"), (((GCallback
) (eoc_window_sidebar_visibility_changed))), (window), ((void
*)0), G_CONNECT_AFTER)
;
4510
4511 g_signal_connect_after (priv->sidebar,g_signal_connect_data ((priv->sidebar), ("page-added"), ((
(GCallback) (eoc_window_sidebar_page_added))), (window), ((void
*)0), G_CONNECT_AFTER)
4512 "page-added",g_signal_connect_data ((priv->sidebar), ("page-added"), ((
(GCallback) (eoc_window_sidebar_page_added))), (window), ((void
*)0), G_CONNECT_AFTER)
4513 G_CALLBACK (eoc_window_sidebar_page_added),g_signal_connect_data ((priv->sidebar), ("page-added"), ((
(GCallback) (eoc_window_sidebar_page_added))), (window), ((void
*)0), G_CONNECT_AFTER)
4514 window)g_signal_connect_data ((priv->sidebar), ("page-added"), ((
(GCallback) (eoc_window_sidebar_page_added))), (window), ((void
*)0), G_CONNECT_AFTER)
;
4515
4516 g_signal_connect_after (priv->sidebar,g_signal_connect_data ((priv->sidebar), ("page-removed"), (
((GCallback) (eoc_window_sidebar_page_removed))), (window), (
(void*)0), G_CONNECT_AFTER)
4517 "page-removed",g_signal_connect_data ((priv->sidebar), ("page-removed"), (
((GCallback) (eoc_window_sidebar_page_removed))), (window), (
(void*)0), G_CONNECT_AFTER)
4518 G_CALLBACK (eoc_window_sidebar_page_removed),g_signal_connect_data ((priv->sidebar), ("page-removed"), (
((GCallback) (eoc_window_sidebar_page_removed))), (window), (
(void*)0), G_CONNECT_AFTER)
4519 window)g_signal_connect_data ((priv->sidebar), ("page-removed"), (
((GCallback) (eoc_window_sidebar_page_removed))), (window), (
(void*)0), G_CONNECT_AFTER)
;
4520
4521 priv->view = eoc_scroll_view_new ();
4522
4523 eoc_sidebar_add_page (EOC_SIDEBAR (priv->sidebar)((((EocSidebar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->sidebar)), ((eoc_sidebar_get_type()))))))
,
4524 _("Properties")gettext ("Properties"),
4525 CTK_WIDGET (eoc_metadata_sidebar_new (window))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((eoc_metadata_sidebar_new (window))), ((ctk_widget_get_type
()))))))
);
4526
4527 ctk_widget_set_size_request (CTK_WIDGET (priv->view)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((ctk_widget_get_type ()))))))
, 100, 100);
4528 g_signal_connect (G_OBJECT (priv->view),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->view)), (((GType) ((20) <<
(2))))))))), ("zoom_changed"), (((GCallback) (view_zoom_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
4529 "zoom_changed",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->view)), (((GType) ((20) <<
(2))))))))), ("zoom_changed"), (((GCallback) (view_zoom_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
4530 G_CALLBACK (view_zoom_changed_cb),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->view)), (((GType) ((20) <<
(2))))))))), ("zoom_changed"), (((GCallback) (view_zoom_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
4531 window)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->view)), (((GType) ((20) <<
(2))))))))), ("zoom_changed"), (((GCallback) (view_zoom_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
;
4532
4533 g_settings_bind (priv->view_settings, EOC_CONF_VIEW_SCROLL_WHEEL_ZOOM"scroll-wheel-zoom",
4534 priv->view, "scrollwheel-zoom", G_SETTINGS_BIND_GET);
4535 g_settings_bind (priv->view_settings, EOC_CONF_VIEW_ZOOM_MULTIPLIER"zoom-multiplier",
4536 priv->view, "zoom-multiplier", G_SETTINGS_BIND_GET);
4537
4538 view_popup = ctk_ui_manager_get_widget (priv->ui_mgr, "/ViewPopup");
4539 eoc_scroll_view_set_popup (EOC_SCROLL_VIEW (priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((eoc_scroll_view_get_type ()))))))
,
4540 CTK_MENU (view_popup)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((view_popup)), ((ctk_menu_get_type ()))))))
);
4541
4542 ctk_paned_pack1 (CTK_PANED (hpaned)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned)), ((ctk_paned_get_type ()))))))
,
4543 priv->sidebar,
4544 FALSE(0),
4545 FALSE(0));
4546
4547 ctk_paned_pack2 (CTK_PANED (hpaned)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned)), ((ctk_paned_get_type ()))))))
,
4548 priv->view,
4549 TRUE(!(0)),
4550 FALSE(0));
4551
4552 ctk_widget_show_all (hpaned);
4553
4554 ctk_box_pack_start (CTK_BOX (priv->layout)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_box_get_type ()))))))
, hpaned, TRUE(!(0)), TRUE(!(0)), 0);
4555
4556 priv->thumbview = g_object_ref (eoc_thumb_view_new ())((__typeof__ (eoc_thumb_view_new ())) (g_object_ref) (eoc_thumb_view_new
()))
;
4557
4558 /* giving shape to the view */
4559 ctk_icon_view_set_margin (CTK_ICON_VIEW (priv->thumbview)((((CtkIconView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((ctk_icon_view_get_type ()))))))
, 4);
4560 ctk_icon_view_set_row_spacing (CTK_ICON_VIEW (priv->thumbview)((((CtkIconView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((ctk_icon_view_get_type ()))))))
, 0);
4561
4562 g_signal_connect (G_OBJECT (priv->thumbview), "selection_changed",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->thumbview)), (((GType) ((20) <<
(2))))))))), ("selection_changed"), (((GCallback) (handle_image_selection_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
4563 G_CALLBACK (handle_image_selection_changed_cb), window)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->thumbview)), (((GType) ((20) <<
(2))))))))), ("selection_changed"), (((GCallback) (handle_image_selection_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
;
4564
4565 priv->nav = eoc_thumb_nav_new (priv->thumbview,
4566 EOC_THUMB_NAV_MODE_ONE_ROW,
4567 g_settings_get_boolean (priv->ui_settings,
4568 EOC_CONF_UI_SCROLL_BUTTONS"scroll-buttons"));
4569
4570 // Bind the scroll buttons to their GSettings key
4571 g_settings_bind (priv->ui_settings, EOC_CONF_UI_SCROLL_BUTTONS"scroll-buttons",
4572 priv->nav, "show-buttons", G_SETTINGS_BIND_GET);
4573
4574 thumb_popup = ctk_ui_manager_get_widget (priv->ui_mgr, "/ThumbnailPopup");
4575 eoc_thumb_view_set_thumbnail_popup (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
,
4576 CTK_MENU (thumb_popup)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((thumb_popup)), ((ctk_menu_get_type ()))))))
);
4577
4578 ctk_box_pack_start (CTK_BOX (priv->layout)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->layout)), ((ctk_box_get_type ()))))))
, priv->nav, FALSE(0), FALSE(0), 0);
4579
4580 ctk_box_pack_end (CTK_BOX (priv->cbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->cbox)), ((ctk_box_get_type ()))))))
, priv->layout, TRUE(!(0)), TRUE(!(0)), 0);
4581
4582 eoc_window_can_save_changed_cb (priv->lockdown_settings,
4583 EOC_CONF_LOCKDOWN_CAN_SAVE"disable-save-to-disk",
4584 window);
4585 g_settings_bind (priv->ui_settings, EOC_CONF_UI_IMAGE_COLLECTION_POSITION"image-collection-position",
4586 window, "collection-position", G_SETTINGS_BIND_GET);
4587 g_settings_bind (priv->ui_settings, EOC_CONF_UI_IMAGE_COLLECTION_RESIZABLE"image-collection-resizable",
4588 window, "collection-resizable", G_SETTINGS_BIND_GET);
4589
4590 update_action_groups_state (window);
4591
4592 if ((priv->flags & EOC_STARTUP_FULLSCREEN) ||
4593 (priv->flags & EOC_STARTUP_SLIDE_SHOW)) {
4594 eoc_window_run_fullscreen (window, (priv->flags & EOC_STARTUP_SLIDE_SHOW));
4595 } else {
4596 priv->mode = EOC_WINDOW_MODE_NORMAL;
4597 update_ui_visibility (window);
4598 }
4599
4600 eoc_window_set_drag_dest (window);
4601}
4602
4603static void
4604eoc_window_init (EocWindow *window)
4605{
4606 CdkGeometry hints;
4607 CdkScreen *screen;
4608 EocWindowPrivate *priv;
4609
4610 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 4610, ((const char*) (__func__
))
);
4611
4612 CtkStyleContext *context;
4613
4614 context = ctk_widget_get_style_context (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
4615 ctk_style_context_add_class (context, "eoc-window");
4616
4617 hints.min_width = EOC_WINDOW_MIN_WIDTH440;
4618 hints.min_height = EOC_WINDOW_MIN_HEIGHT350;
4619
4620 screen = ctk_widget_get_screen (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
4621
4622 priv = window->priv = eoc_window_get_instance_private (window);
4623
4624 priv->view_settings = g_settings_new (EOC_CONF_VIEW"org.cafe.eoc"".view");
4625 priv->ui_settings = g_settings_new (EOC_CONF_UI"org.cafe.eoc"".ui");
4626 priv->fullscreen_settings = g_settings_new (EOC_CONF_FULLSCREEN"org.cafe.eoc"".full-screen");
4627 priv->lockdown_settings = g_settings_new (EOC_CONF_LOCKDOWN_SCHEMA"org.cafe.lockdown");
4628
4629 g_signal_connect (priv->lockdown_settings,g_signal_connect_data ((priv->lockdown_settings), ("changed::"
"disable-save-to-disk"), (((GCallback) (eoc_window_can_save_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
4630 "changed::" EOC_CONF_LOCKDOWN_CAN_SAVE,g_signal_connect_data ((priv->lockdown_settings), ("changed::"
"disable-save-to-disk"), (((GCallback) (eoc_window_can_save_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
4631 G_CALLBACK (eoc_window_can_save_changed_cb),g_signal_connect_data ((priv->lockdown_settings), ("changed::"
"disable-save-to-disk"), (((GCallback) (eoc_window_can_save_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
4632 window)g_signal_connect_data ((priv->lockdown_settings), ("changed::"
"disable-save-to-disk"), (((GCallback) (eoc_window_can_save_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
;
4633
4634 window->priv->store = NULL((void*)0);
4635 window->priv->image = NULL((void*)0);
4636
4637 window->priv->fullscreen_popup = NULL((void*)0);
4638 window->priv->fullscreen_timeout_source = NULL((void*)0);
4639 window->priv->slideshow_random = FALSE(0);
4640 window->priv->slideshow_loop = FALSE(0);
4641 window->priv->slideshow_switch_timeout = 0;
4642 window->priv->slideshow_switch_source = NULL((void*)0);
4643 window->priv->fullscreen_idle_inhibit_cookie = 0;
4644
4645 ctk_window_set_geometry_hints (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
4646 CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
,
4647 &hints,
4648 CDK_HINT_MIN_SIZE);
4649
4650 ctk_window_set_default_size (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
4651 EOC_WINDOW_DEFAULT_WIDTH540,
4652 EOC_WINDOW_DEFAULT_HEIGHT450);
4653
4654 ctk_window_set_position (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, CTK_WIN_POS_CENTER);
4655
4656 window->priv->mode = EOC_WINDOW_MODE_UNKNOWN;
4657 window->priv->status = EOC_WINDOW_STATUS_UNKNOWN;
4658
4659#if defined(HAVE_LCMS1) && defined(CDK_WINDOWING_X11)
4660 window->priv->display_profile =
4661 eoc_window_get_display_profile (screen);
4662#endif
4663
4664 window->priv->recent_menu_id = 0;
4665
4666 window->priv->collection_position = 0;
4667 window->priv->collection_resizable = FALSE(0);
4668
4669 window->priv->save_disabled = FALSE(0);
4670
4671 window->priv->page_setup = NULL((void*)0);
4672
4673 ctk_window_set_application (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, CTK_APPLICATION (EOC_APP)((((CtkApplication*) (void *) g_type_check_instance_cast ((GTypeInstance
*) (((eoc_application_get_instance ()))), ((ctk_application_get_type
()))))))
);
4674}
4675
4676static void
4677eoc_window_dispose (GObject *object)
4678{
4679 EocWindow *window;
4680 EocWindowPrivate *priv;
4681
4682 g_return_if_fail (object != NULL)do { if ((object != ((void*)0))) { } else { g_return_if_fail_warning
("EOC", ((const char*) (__func__)), "object != NULL"); return
; } } while (0)
;
4683 g_return_if_fail (EOC_IS_WINDOW (object))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((object)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (object)"); return; } } while (0)
;
4684
4685 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 4685, ((const char*) (__func__
))
);
4686
4687 window = EOC_WINDOW (object)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((eoc_window_get_type ()))))))
;
4688 priv = window->priv;
4689
4690 bean_engine_garbage_collect (BEAN_ENGINE (EOC_APP->priv->plugin_engine)((((BeanEngine*) (void *) g_type_check_instance_cast ((GTypeInstance
*) (((eoc_application_get_instance ())->priv->plugin_engine
)), ((bean_engine_get_type ()))))))
);
4691
4692 if (priv->extensions != NULL((void*)0)) {
4693 g_object_unref (priv->extensions);
4694 priv->extensions = NULL((void*)0);
4695 bean_engine_garbage_collect (BEAN_ENGINE (EOC_APP->priv->plugin_engine)((((BeanEngine*) (void *) g_type_check_instance_cast ((GTypeInstance
*) (((eoc_application_get_instance ())->priv->plugin_engine
)), ((bean_engine_get_type ()))))))
);
4696 }
4697
4698 if (priv->page_setup != NULL((void*)0)) {
4699 g_object_unref (priv->page_setup);
4700 priv->page_setup = NULL((void*)0);
4701 }
4702
4703 if (priv->thumbview)
4704 {
4705 /* Disconnect so we don't get any unwanted callbacks
4706 * when the thumb view is disposed. */
4707 g_signal_handlers_disconnect_by_func (priv->thumbview,g_signal_handlers_disconnect_matched ((priv->thumbview), (
GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA)
, 0, 0, ((void*)0), (((GCallback) (handle_image_selection_changed_cb
))), (window))
4708 G_CALLBACK (handle_image_selection_changed_cb),g_signal_handlers_disconnect_matched ((priv->thumbview), (
GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA)
, 0, 0, ((void*)0), (((GCallback) (handle_image_selection_changed_cb
))), (window))
4709 window)g_signal_handlers_disconnect_matched ((priv->thumbview), (
GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA)
, 0, 0, ((void*)0), (((GCallback) (handle_image_selection_changed_cb
))), (window))
;
4710 g_clear_object (&priv->thumbview)do { _Static_assert (sizeof *((&priv->thumbview)) == sizeof
(gpointer), "Expression evaluates to false"); __typeof__ (((
&priv->thumbview))) _pp = ((&priv->thumbview));
__typeof__ (*((&priv->thumbview))) _ptr = *_pp; *_pp =
((void*)0); if (_ptr) (g_object_unref) (_ptr); } while (0)
;
4711 }
4712
4713 if (priv->store != NULL((void*)0)) {
4714 g_signal_handlers_disconnect_by_func (priv->store,g_signal_handlers_disconnect_matched ((priv->store), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_window_list_store_image_added), (window))
4715 eoc_window_list_store_image_added,g_signal_handlers_disconnect_matched ((priv->store), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_window_list_store_image_added), (window))
4716 window)g_signal_handlers_disconnect_matched ((priv->store), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_window_list_store_image_added), (window))
;
4717 g_signal_handlers_disconnect_by_func (priv->store,g_signal_handlers_disconnect_matched ((priv->store), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_window_list_store_image_removed), (window))
4718 eoc_window_list_store_image_removed,g_signal_handlers_disconnect_matched ((priv->store), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_window_list_store_image_removed), (window))
4719 window)g_signal_handlers_disconnect_matched ((priv->store), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (eoc_window_list_store_image_removed), (window))
;
4720 g_object_unref (priv->store);
4721 priv->store = NULL((void*)0);
4722 }
4723
4724 if (priv->image != NULL((void*)0)) {
4725 g_signal_handlers_disconnect_by_func (priv->image,g_signal_handlers_disconnect_matched ((priv->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (image_thumb_changed_cb), (window))
4726 image_thumb_changed_cb,g_signal_handlers_disconnect_matched ((priv->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (image_thumb_changed_cb), (window))
4727 window)g_signal_handlers_disconnect_matched ((priv->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (image_thumb_changed_cb), (window))
;
4728 g_signal_handlers_disconnect_by_func (priv->image,g_signal_handlers_disconnect_matched ((priv->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (image_file_changed_cb), (window))
4729 image_file_changed_cb,g_signal_handlers_disconnect_matched ((priv->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (image_file_changed_cb), (window))
4730 window)g_signal_handlers_disconnect_matched ((priv->image), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (image_file_changed_cb), (window))
;
4731 g_object_unref (priv->image);
4732 priv->image = NULL((void*)0);
4733 }
4734
4735 if (priv->actions_window != NULL((void*)0)) {
4736 g_object_unref (priv->actions_window);
4737 priv->actions_window = NULL((void*)0);
4738 }
4739
4740 if (priv->actions_image != NULL((void*)0)) {
4741 g_object_unref (priv->actions_image);
4742 priv->actions_image = NULL((void*)0);
4743 }
4744
4745 if (priv->actions_collection != NULL((void*)0)) {
4746 g_object_unref (priv->actions_collection);
4747 priv->actions_collection = NULL((void*)0);
4748 }
4749
4750 if (priv->actions_recent != NULL((void*)0)) {
4751 g_object_unref (priv->actions_recent);
4752 priv->actions_recent = NULL((void*)0);
4753 }
4754
4755 if (priv->actions_open_with != NULL((void*)0)) {
4756 g_object_unref (priv->actions_open_with);
4757 priv->actions_open_with = NULL((void*)0);
4758 }
4759
4760 fullscreen_clear_timeout (window);
4761
4762 if (window->priv->fullscreen_popup != NULL((void*)0)) {
4763 ctk_widget_destroy (priv->fullscreen_popup);
4764 priv->fullscreen_popup = NULL((void*)0);
4765 }
4766
4767 slideshow_clear_timeout (window);
4768 eoc_window_uninhibit_screensaver (window);
4769
4770 g_signal_handlers_disconnect_by_func (ctk_recent_manager_get_default (),g_signal_handlers_disconnect_matched ((ctk_recent_manager_get_default
()), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (eoc_window_recent_manager_changed_cb
))), (window))
4771 G_CALLBACK (eoc_window_recent_manager_changed_cb),g_signal_handlers_disconnect_matched ((ctk_recent_manager_get_default
()), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (eoc_window_recent_manager_changed_cb
))), (window))
4772 window)g_signal_handlers_disconnect_matched ((ctk_recent_manager_get_default
()), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA
), 0, 0, ((void*)0), (((GCallback) (eoc_window_recent_manager_changed_cb
))), (window))
;
4773
4774 priv->recent_menu_id = 0;
4775
4776 eoc_window_clear_load_job (window);
4777
4778 eoc_window_clear_transform_job (window);
4779
4780 if (priv->view_settings) {
4781 g_object_unref (priv->view_settings);
4782 priv->view_settings = NULL((void*)0);
4783 }
4784 if (priv->ui_settings) {
4785 g_object_unref (priv->ui_settings);
4786 priv->ui_settings = NULL((void*)0);
4787 }
4788 if (priv->fullscreen_settings) {
4789 g_object_unref (priv->fullscreen_settings);
4790 priv->fullscreen_settings = NULL((void*)0);
4791 }
4792 if (priv->lockdown_settings) {
4793 g_object_unref (priv->lockdown_settings);
4794 priv->lockdown_settings = NULL((void*)0);
4795 }
4796
4797 if (priv->file_list != NULL((void*)0)) {
4798 g_slist_foreach (priv->file_list, (GFunc) g_object_unref, NULL((void*)0));
4799 g_slist_free (priv->file_list);
4800 priv->file_list = NULL((void*)0);
4801 }
4802
4803#if defined(HAVE_LCMS1) && defined(CDK_WINDOWING_X11)
4804 if (priv->display_profile != NULL((void*)0)) {
4805 cmsCloseProfile (priv->display_profile);
4806 priv->display_profile = NULL((void*)0);
4807 }
4808#endif
4809
4810 if (priv->last_save_as_folder != NULL((void*)0)) {
4811 g_object_unref (priv->last_save_as_folder);
4812 priv->last_save_as_folder = NULL((void*)0);
4813 }
4814
4815 bean_engine_garbage_collect (BEAN_ENGINE (EOC_APP->priv->plugin_engine)((((BeanEngine*) (void *) g_type_check_instance_cast ((GTypeInstance
*) (((eoc_application_get_instance ())->priv->plugin_engine
)), ((bean_engine_get_type ()))))))
);
4816
4817 G_OBJECT_CLASS (eoc_window_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((eoc_window_parent_class)), (((GType) ((20) << (2))
))))))
->dispose (object);
4818}
4819
4820static gint
4821eoc_window_delete (CtkWidget *widget, CdkEventAny *event)
4822{
4823 EocWindow *window;
4824 EocWindowPrivate *priv;
4825
4826 g_return_val_if_fail (EOC_IS_WINDOW (widget), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((widget)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (widget)"); return ((0)); } } while (0)
;
4827
4828 window = EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
;
4829 priv = window->priv;
4830
4831 if (priv->save_job != NULL((void*)0)) {
4832 eoc_window_finish_saving (window);
4833 }
4834
4835 if (eoc_window_unsaved_images_confirm (window)) {
4836 return TRUE(!(0));
4837 }
4838
4839 ctk_widget_destroy (widget);
4840
4841 return TRUE(!(0));
4842}
4843
4844static gint
4845eoc_window_key_press (CtkWidget *widget, CdkEventKey *event)
4846{
4847 CtkContainer *tbcontainer = CTK_CONTAINER ((EOC_WINDOW (widget)->priv->toolbar))((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) (((((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))->priv->toolbar
))), ((ctk_container_get_type ()))))))
;
4848 gint result = FALSE(0);
4849 gboolean handle_selection = FALSE(0);
4850
4851 switch (event->keyval) {
4852 case CDK_KEY_space0x020:
4853 if (event->state & CDK_CONTROL_MASK) {
4854 handle_selection = TRUE(!(0));
4855 break;
4856 }
4857 case CDK_KEY_Return0xff0d:
4858 if (ctk_container_get_focus_child (tbcontainer) == NULL((void*)0)) {
4859 /* Image properties dialog case */
4860 if (event->state & CDK_MOD1_MASK) {
4861 result = FALSE(0);
4862 break;
4863 }
4864
4865 if (event->state & CDK_SHIFT_MASK) {
4866 eoc_window_cmd_go_prev (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4867 } else {
4868 eoc_window_cmd_go_next (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4869 }
4870 result = TRUE(!(0));
4871 }
4872 break;
4873 case CDK_KEY_p0x070:
4874 case CDK_KEY_P0x050:
4875 if (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->mode == EOC_WINDOW_MODE_FULLSCREEN || EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->mode == EOC_WINDOW_MODE_SLIDESHOW) {
4876 gboolean slideshow;
4877
4878 slideshow = EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->mode == EOC_WINDOW_MODE_SLIDESHOW;
4879 eoc_window_run_fullscreen (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
, !slideshow);
4880 }
4881 break;
4882 case CDK_KEY_Q0x051:
4883 case CDK_KEY_q0x071:
4884 case CDK_KEY_Escape0xff1b:
4885 if (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->mode == EOC_WINDOW_MODE_FULLSCREEN) {
4886 eoc_window_stop_fullscreen (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
, FALSE(0));
4887 } else if (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->mode == EOC_WINDOW_MODE_SLIDESHOW) {
4888 eoc_window_stop_fullscreen (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
, TRUE(!(0)));
4889 } else {
4890 eoc_window_cmd_close_window (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4891 return TRUE(!(0));
4892 }
4893 break;
4894 case CDK_KEY_Left0xff51:
4895 if (event->state & CDK_MOD1_MASK) {
4896 /* Alt+Left moves to previous image */
4897 if (is_rtl(ctk_widget_get_default_direction () == CTK_TEXT_DIR_RTL)) { /* move to next in RTL mode */
4898 eoc_window_cmd_go_next (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4899 } else {
4900 eoc_window_cmd_go_prev (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4901 }
4902 result = TRUE(!(0));
4903 break;
4904 } /* else fall-trough is intended */
4905 case CDK_KEY_Up0xff52:
4906 if (eoc_scroll_view_scrollbars_visible (EOC_SCROLL_VIEW (EOC_WINDOW (widget)->priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))->priv->view
)), ((eoc_scroll_view_get_type ()))))))
)) {
4907 /* break to let scrollview handle the key */
4908 break;
4909 }
4910 if (ctk_container_get_focus_child (tbcontainer) != NULL((void*)0))
4911 break;
4912 if (!ctk_widget_get_visible (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->nav)) {
4913 if (is_rtl(ctk_widget_get_default_direction () == CTK_TEXT_DIR_RTL) && event->keyval == CDK_KEY_Left0xff51) {
4914 /* handle RTL fall-through,
4915 * need to behave like CDK_Down then */
4916 eoc_window_cmd_go_next (NULL((void*)0),
4917 EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4918 } else {
4919 eoc_window_cmd_go_prev (NULL((void*)0),
4920 EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4921 }
4922 result = TRUE(!(0));
4923 break;
4924 }
4925 case CDK_KEY_Right0xff53:
4926 if (event->state & CDK_MOD1_MASK) {
4927 /* Alt+Right moves to next image */
4928 if (is_rtl(ctk_widget_get_default_direction () == CTK_TEXT_DIR_RTL)) { /* move to previous in RTL mode */
4929 eoc_window_cmd_go_prev (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4930 } else {
4931 eoc_window_cmd_go_next (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4932 }
4933 result = TRUE(!(0));
4934 break;
4935 } /* else fall-trough is intended */
4936 case CDK_KEY_Down0xff54:
4937 if (eoc_scroll_view_scrollbars_visible (EOC_SCROLL_VIEW (EOC_WINDOW (widget)->priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))->priv->view
)), ((eoc_scroll_view_get_type ()))))))
)) {
4938 /* break to let scrollview handle the key */
4939 break;
4940 }
4941 if (ctk_container_get_focus_child (tbcontainer) != NULL((void*)0))
4942 break;
4943 if (!ctk_widget_get_visible (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->nav)) {
4944 if (is_rtl(ctk_widget_get_default_direction () == CTK_TEXT_DIR_RTL) && event->keyval == CDK_KEY_Right0xff53) {
4945 /* handle RTL fall-through,
4946 * need to behave like CDK_Up then */
4947 eoc_window_cmd_go_prev (NULL((void*)0),
4948 EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4949 } else {
4950 eoc_window_cmd_go_next (NULL((void*)0),
4951 EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4952 }
4953 result = TRUE(!(0));
4954 break;
4955 }
4956 case CDK_KEY_Page_Up0xff55:
4957 if (!eoc_scroll_view_scrollbars_visible (EOC_SCROLL_VIEW (EOC_WINDOW (widget)->priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))->priv->view
)), ((eoc_scroll_view_get_type ()))))))
)) {
4958 if (!ctk_widget_get_visible (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->nav)) {
4959 /* If the iconview is not visible skip to the
4960 * previous image manually as it won't handle
4961 * the keypress then. */
4962 eoc_window_cmd_go_prev (NULL((void*)0),
4963 EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4964 result = TRUE(!(0));
4965 } else
4966 handle_selection = TRUE(!(0));
4967 }
4968 break;
4969 case CDK_KEY_Page_Down0xff56:
4970 if (!eoc_scroll_view_scrollbars_visible (EOC_SCROLL_VIEW (EOC_WINDOW (widget)->priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))->priv->view
)), ((eoc_scroll_view_get_type ()))))))
)) {
4971 if (!ctk_widget_get_visible (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->nav)) {
4972 /* If the iconview is not visible skip to the
4973 * next image manually as it won't handle
4974 * the keypress then. */
4975 eoc_window_cmd_go_next (NULL((void*)0),
4976 EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4977 result = TRUE(!(0));
4978 } else
4979 handle_selection = TRUE(!(0));
4980 }
4981 break;
4982 }
4983
4984 /* Update slideshow timeout */
4985 if (result && (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->mode == EOC_WINDOW_MODE_SLIDESHOW)) {
4986 slideshow_set_timeout (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4987 }
4988
4989 if (handle_selection == TRUE(!(0)) && result == FALSE(0)) {
4990 ctk_widget_grab_focus (CTK_WIDGET (EOC_WINDOW (widget)->priv->thumbview)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))->priv->thumbview
)), ((ctk_widget_get_type ()))))))
);
4991
4992 result = ctk_widget_event (CTK_WIDGET (EOC_WINDOW (widget)->priv->thumbview)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))->priv->thumbview
)), ((ctk_widget_get_type ()))))))
,
4993 (CdkEvent *) event);
4994 }
4995
4996 /* If the focus is not in the toolbar and we still haven't handled the
4997 event, give the scrollview a chance to do it. */
4998 if (!ctk_container_get_focus_child (tbcontainer) && result == FALSE(0) &&
4999 ctk_widget_get_realized (CTK_WIDGET (EOC_WINDOW (widget)->priv->view)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))->priv->view
)), ((ctk_widget_get_type ()))))))
)) {
5000 result = ctk_widget_event (CTK_WIDGET (EOC_WINDOW (widget)->priv->view)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))->priv->view
)), ((ctk_widget_get_type ()))))))
,
5001 (CdkEvent *) event);
5002 }
5003
5004 if (result == FALSE(0) && CTK_WIDGET_CLASS (eoc_window_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((eoc_window_parent_class)), ((ctk_widget_get_type ())))))
)
->key_press_event) {
5005 result = (* CTK_WIDGET_CLASS (eoc_window_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((eoc_window_parent_class)), ((ctk_widget_get_type ())))))
)
->key_press_event) (widget, event);
5006 }
5007
5008 return result;
5009}
5010
5011static gint
5012eoc_window_button_press (CtkWidget *widget, CdkEventButton *event)
5013{
5014 EocWindow *window = EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
;
5015 gint result = FALSE(0);
5016
5017 if (event->type == CDK_BUTTON_PRESS) {
5018 switch (event->button) {
5019 case 6:
5020 eoc_thumb_view_select_single (EOC_THUMB_VIEW (window->priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->thumbview)), ((eoc_thumb_view_get_type
()))))))
,
5021 EOC_THUMB_VIEW_SELECT_LEFT);
5022 result = TRUE(!(0));
5023 break;
5024 case 7:
5025 eoc_thumb_view_select_single (EOC_THUMB_VIEW (window->priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->thumbview)), ((eoc_thumb_view_get_type
()))))))
,
5026 EOC_THUMB_VIEW_SELECT_RIGHT);
5027 result = TRUE(!(0));
5028 break;
5029 }
5030 }
5031
5032 if (result == FALSE(0) && CTK_WIDGET_CLASS (eoc_window_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((eoc_window_parent_class)), ((ctk_widget_get_type ())))))
)
->button_press_event) {
5033 result = (* CTK_WIDGET_CLASS (eoc_window_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((eoc_window_parent_class)), ((ctk_widget_get_type ())))))
)
->button_press_event) (widget, event);
5034 }
5035
5036 return result;
5037}
5038
5039static gboolean
5040eoc_window_focus_out_event (CtkWidget *widget, CdkEventFocus *event)
5041{
5042 EocWindow *window = EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
;
5043 EocWindowPrivate *priv = window->priv;
5044 gboolean fullscreen;
5045
5046 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 5046, ((const char*) (__func__
))
);
5047
5048 fullscreen = priv->mode == EOC_WINDOW_MODE_FULLSCREEN ||
5049 priv->mode == EOC_WINDOW_MODE_SLIDESHOW;
5050
5051 if (fullscreen) {
5052 ctk_widget_hide (priv->fullscreen_popup);
5053 }
5054
5055 return CTK_WIDGET_CLASS (eoc_window_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((eoc_window_parent_class)), ((ctk_widget_get_type ())))))
)
->focus_out_event (widget, event);
5056}
5057
5058static void
5059eoc_window_set_property (GObject *object,
5060 guint property_id,
5061 const GValue *value,
5062 GParamSpec *pspec)
5063{
5064 EocWindow *window;
5065 EocWindowPrivate *priv;
5066
5067 g_return_if_fail (EOC_IS_WINDOW (object))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((object)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (object)"); return; } } while (0)
;
5068
5069 window = EOC_WINDOW (object)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((eoc_window_get_type ()))))))
;
5070 priv = window->priv;
5071
5072 switch (property_id) {
5073 case PROP_COLLECTION_POS:
5074 eoc_window_set_collection_mode (window, g_value_get_enum (value),
5075 priv->collection_resizable);
5076 break;
5077 case PROP_COLLECTION_RESIZABLE:
5078 eoc_window_set_collection_mode (window, priv->collection_position,
5079 g_value_get_boolean (value));
5080 break;
5081 case PROP_STARTUP_FLAGS:
5082 priv->flags = g_value_get_flags (value);
5083 break;
5084
5085 default:
5086 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((property_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "eoc-window.c", 5086, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
5087 }
5088}
5089
5090static void
5091eoc_window_get_property (GObject *object,
5092 guint property_id,
5093 GValue *value,
5094 GParamSpec *pspec)
5095{
5096 EocWindow *window;
5097 EocWindowPrivate *priv;
5098
5099 g_return_if_fail (EOC_IS_WINDOW (object))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((object)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (object)"); return; } } while (0)
;
5100
5101 window = EOC_WINDOW (object)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((eoc_window_get_type ()))))))
;
5102 priv = window->priv;
5103
5104 switch (property_id) {
5105 case PROP_COLLECTION_POS:
5106 g_value_set_enum (value, priv->collection_position);
5107 break;
5108 case PROP_COLLECTION_RESIZABLE:
5109 g_value_set_boolean (value, priv->collection_resizable);
5110 break;
5111 case PROP_STARTUP_FLAGS:
5112 g_value_set_flags (value, priv->flags);
5113 break;
5114
5115 default:
5116 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((property_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "eoc-window.c", 5116, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
5117 }
5118}
5119
5120static void
5121on_extension_added (BeanExtensionSet *set,
5122 BeanPluginInfo *info,
5123 BeanExtension *exten,
5124 CtkWindow *window)
5125{
5126 bean_extension_call (exten, "activate", window);
5127}
5128
5129static void
5130on_extension_removed (BeanExtensionSet *set,
5131 BeanPluginInfo *info,
5132 BeanExtension *exten,
5133 CtkWindow *window)
5134{
5135 bean_extension_call (exten, "deactivate", window);
5136}
5137
5138static GObject *
5139eoc_window_constructor (GType type,
5140 guint n_construct_properties,
5141 GObjectConstructParam *construct_params)
5142{
5143 GObject *object;
5144 EocWindowPrivate *priv;
5145
5146 object = G_OBJECT_CLASS (eoc_window_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((eoc_window_parent_class)), (((GType) ((20) << (2))
))))))
->constructor
5147 (type, n_construct_properties, construct_params);
5148
5149 priv = EOC_WINDOW (object)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((eoc_window_get_type ()))))))
->priv;
5150
5151 eoc_window_construct_ui (EOC_WINDOW (object)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((eoc_window_get_type ()))))))
);
5152
5153 priv->extensions = bean_extension_set_new (BEAN_ENGINE (EOC_APP->priv->plugin_engine)((((BeanEngine*) (void *) g_type_check_instance_cast ((GTypeInstance
*) (((eoc_application_get_instance ())->priv->plugin_engine
)), ((bean_engine_get_type ()))))))
,
5154 EOC_TYPE_WINDOW_ACTIVATABLE(eoc_window_activatable_get_type ()),
5155 "window",
5156 EOC_WINDOW (object)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((eoc_window_get_type ()))))))
, NULL((void*)0));
5157
5158 bean_extension_set_call (priv->extensions, "activate");
5159
5160 g_signal_connect (priv->extensions, "extension-added",g_signal_connect_data ((priv->extensions), ("extension-added"
), (((GCallback) (on_extension_added))), (object), ((void*)0)
, (GConnectFlags) 0)
5161 G_CALLBACK (on_extension_added), object)g_signal_connect_data ((priv->extensions), ("extension-added"
), (((GCallback) (on_extension_added))), (object), ((void*)0)
, (GConnectFlags) 0)
;
5162 g_signal_connect (priv->extensions, "extension-removed",g_signal_connect_data ((priv->extensions), ("extension-removed"
), (((GCallback) (on_extension_removed))), (object), ((void*)
0), (GConnectFlags) 0)
5163 G_CALLBACK (on_extension_removed), object)g_signal_connect_data ((priv->extensions), ("extension-removed"
), (((GCallback) (on_extension_removed))), (object), ((void*)
0), (GConnectFlags) 0)
;
5164
5165 return object;
5166}
5167
5168static void
5169eoc_window_class_init (EocWindowClass *class)
5170{
5171 GObjectClass *g_object_class = (GObjectClass *) class;
5172 CtkWidgetClass *widget_class = (CtkWidgetClass *) class;
5173
5174 g_object_class->constructor = eoc_window_constructor;
5175 g_object_class->dispose = eoc_window_dispose;
5176 g_object_class->set_property = eoc_window_set_property;
5177 g_object_class->get_property = eoc_window_get_property;
5178
5179 widget_class->delete_event = eoc_window_delete;
5180 widget_class->key_press_event = eoc_window_key_press;
5181 widget_class->button_press_event = eoc_window_button_press;
5182 widget_class->drag_data_received = eoc_window_drag_data_received;
5183 widget_class->focus_out_event = eoc_window_focus_out_event;
5184
5185/**
5186 * EocWindow:collection-position:
5187 *
5188 * Determines the position of the image collection in the window
5189 * relative to the image.
5190 */
5191 g_object_class_install_property (
5192 g_object_class, PROP_COLLECTION_POS,
5193 g_param_spec_enum ("collection-position", NULL((void*)0), NULL((void*)0),
5194 EOC_TYPE_WINDOW_COLLECTION_POS(eoc_window_collection_pos_get_type()),
5195 EOC_WINDOW_COLLECTION_POS_BOTTOM,
5196 G_PARAM_READWRITE | G_PARAM_STATIC_NAME));
5197
5198/**
5199 * EocWindow:collection-resizable:
5200 *
5201 * If %TRUE the collection will be resizable by the user otherwise it will be
5202 * in single column/row mode.
5203 */
5204 g_object_class_install_property (
5205 g_object_class, PROP_COLLECTION_RESIZABLE,
5206 g_param_spec_boolean ("collection-resizable", NULL((void*)0), NULL((void*)0), FALSE(0),
5207 G_PARAM_READWRITE | G_PARAM_STATIC_NAME));
5208
5209/**
5210 * EocWindow:startup-flags:
5211 *
5212 * A bitwise OR of #EocStartupFlags elements, indicating how the window
5213 * should behave upon creation.
5214 */
5215 g_object_class_install_property (g_object_class,
5216 PROP_STARTUP_FLAGS,
5217 g_param_spec_flags ("startup-flags",
5218 NULL((void*)0),
5219 NULL((void*)0),
5220 EOC_TYPE_STARTUP_FLAGS(eoc_startup_flags_get_type()),
5221 0,
5222 G_PARAM_READWRITE |
5223 G_PARAM_CONSTRUCT_ONLY));
5224
5225/**
5226 * EocWindow::prepared:
5227 * @window: the object which received the signal.
5228 *
5229 * The #EocWindow::prepared signal is emitted when the @window is ready
5230 * to be shown.
5231 */
5232 signals [SIGNAL_PREPARED] =
5233 g_signal_new ("prepared",
5234 EOC_TYPE_WINDOW(eoc_window_get_type ()),
5235 G_SIGNAL_RUN_LAST,
5236 G_STRUCT_OFFSET (EocWindowClass, prepared)((glong) __builtin_offsetof(EocWindowClass, prepared)),
5237 NULL((void*)0), NULL((void*)0),
5238 g_cclosure_marshal_VOID__VOID,
5239 G_TYPE_NONE((GType) ((1) << (2))), 0);
5240}
5241
5242/**
5243 * eoc_window_new:
5244 * @flags: the initialization parameters for the new window.
5245 *
5246 *
5247 * Creates a new and empty #EocWindow. Use @flags to indicate
5248 * if the window should be initialized fullscreen, in slideshow mode,
5249 * and/or without the thumbnails collection visible. See #EocStartupFlags.
5250 *
5251 * Returns: a newly created #EocWindow.
5252 **/
5253CtkWidget*
5254eoc_window_new (EocStartupFlags flags)
5255{
5256 EocWindow *window;
5257
5258 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 5258, ((const char*) (__func__
))
);
5259
5260 window = EOC_WINDOW (g_object_new (EOC_TYPE_WINDOW,((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((eoc_window_get_type ()), "type", CTK_WINDOW_TOPLEVEL
, "application", (eoc_application_get_instance ()), "show-menubar"
, (0), "startup-flags", flags, ((void*)0)))), ((eoc_window_get_type
()))))))
5261 "type", CTK_WINDOW_TOPLEVEL,((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((eoc_window_get_type ()), "type", CTK_WINDOW_TOPLEVEL
, "application", (eoc_application_get_instance ()), "show-menubar"
, (0), "startup-flags", flags, ((void*)0)))), ((eoc_window_get_type
()))))))
5262 "application", EOC_APP,((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((eoc_window_get_type ()), "type", CTK_WINDOW_TOPLEVEL
, "application", (eoc_application_get_instance ()), "show-menubar"
, (0), "startup-flags", flags, ((void*)0)))), ((eoc_window_get_type
()))))))
5263 "show-menubar", FALSE,((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((eoc_window_get_type ()), "type", CTK_WINDOW_TOPLEVEL
, "application", (eoc_application_get_instance ()), "show-menubar"
, (0), "startup-flags", flags, ((void*)0)))), ((eoc_window_get_type
()))))))
5264 "startup-flags", flags,((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((eoc_window_get_type ()), "type", CTK_WINDOW_TOPLEVEL
, "application", (eoc_application_get_instance ()), "show-menubar"
, (0), "startup-flags", flags, ((void*)0)))), ((eoc_window_get_type
()))))))
5265 NULL))((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((eoc_window_get_type ()), "type", CTK_WINDOW_TOPLEVEL
, "application", (eoc_application_get_instance ()), "show-menubar"
, (0), "startup-flags", flags, ((void*)0)))), ((eoc_window_get_type
()))))))
;
5266
5267 return CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
;
5268}
5269
5270static void
5271eoc_window_list_store_image_added (CtkTreeModel *tree_model,
5272 CtkTreePath *path,
5273 CtkTreeIter *iter,
5274 gpointer user_data)
5275{
5276 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
5277
5278 update_image_pos (window);
5279 update_action_groups_state (window);
5280}
5281
5282static void
5283eoc_window_list_store_image_removed (CtkTreeModel *tree_model,
5284 CtkTreePath *path,
5285 gpointer user_data)
5286{
5287 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
5288
5289 update_image_pos (window);
5290 update_action_groups_state (window);
5291}
5292
5293static void
5294eoc_job_model_cb (EocJobModel *job, gpointer data)
5295{
5296 EocWindow *window;
5297 EocWindowPrivate *priv;
5298 gint n_images;
5299
5300 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 5300, ((const char*) (__func__
))
);
5301
5302#ifdef HAVE_EXIF1
5303 int i;
5304 EocImage *image;
5305#endif
5306
5307 g_return_if_fail (EOC_IS_WINDOW (data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((data)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (data)"); return; } } while (0)
;
5308
5309 window = EOC_WINDOW (data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_window_get_type ()))))))
;
5310 priv = window->priv;
5311
5312 if (priv->store != NULL((void*)0)) {
5313 g_object_unref (priv->store);
5314 priv->store = NULL((void*)0);
5315 }
5316
5317 priv->store = g_object_ref (job->store)((__typeof__ (job->store)) (g_object_ref) (job->store));
5318
5319 n_images = eoc_list_store_length (EOC_LIST_STORE (priv->store)((((EocListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->store)), (eoc_list_store_get_type())))))
);
5320
5321#ifdef HAVE_EXIF1
5322 if (g_settings_get_boolean (priv->view_settings, EOC_CONF_VIEW_AUTOROTATE"autorotate")) {
5323 for (i = 0; i < n_images; i++) {
5324 image = eoc_list_store_get_image_by_pos (priv->store, i);
5325 eoc_image_autorotate (image);
5326 g_object_unref (image);
5327 }
5328 }
5329#endif
5330
5331 eoc_thumb_view_set_model (EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
, priv->store);
5332
5333 g_signal_connect (G_OBJECT (priv->store),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->store)), (((GType) ((20) <<
(2))))))))), ("row-inserted"), (((GCallback) (eoc_window_list_store_image_added
))), (window), ((void*)0), (GConnectFlags) 0)
5334 "row-inserted",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->store)), (((GType) ((20) <<
(2))))))))), ("row-inserted"), (((GCallback) (eoc_window_list_store_image_added
))), (window), ((void*)0), (GConnectFlags) 0)
5335 G_CALLBACK (eoc_window_list_store_image_added),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->store)), (((GType) ((20) <<
(2))))))))), ("row-inserted"), (((GCallback) (eoc_window_list_store_image_added
))), (window), ((void*)0), (GConnectFlags) 0)
5336 window)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->store)), (((GType) ((20) <<
(2))))))))), ("row-inserted"), (((GCallback) (eoc_window_list_store_image_added
))), (window), ((void*)0), (GConnectFlags) 0)
;
5337
5338 g_signal_connect (G_OBJECT (priv->store),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->store)), (((GType) ((20) <<
(2))))))))), ("row-deleted"), (((GCallback) (eoc_window_list_store_image_removed
))), (window), ((void*)0), (GConnectFlags) 0)
5339 "row-deleted",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->store)), (((GType) ((20) <<
(2))))))))), ("row-deleted"), (((GCallback) (eoc_window_list_store_image_removed
))), (window), ((void*)0), (GConnectFlags) 0)
5340 G_CALLBACK (eoc_window_list_store_image_removed),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->store)), (((GType) ((20) <<
(2))))))))), ("row-deleted"), (((GCallback) (eoc_window_list_store_image_removed
))), (window), ((void*)0), (GConnectFlags) 0)
5341 window)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->store)), (((GType) ((20) <<
(2))))))))), ("row-deleted"), (((GCallback) (eoc_window_list_store_image_removed
))), (window), ((void*)0), (GConnectFlags) 0)
;
5342
5343 if (n_images == 0) {
5344 gint n_files;
5345
5346 priv->status = EOC_WINDOW_STATUS_NORMAL;
5347 update_action_groups_state (window);
5348
5349 n_files = g_slist_length (priv->file_list);
5350
5351 if (n_files > 0) {
5352 CtkWidget *message_area;
5353 GFile *file = NULL((void*)0);
5354
5355 if (n_files == 1) {
5356 file = (GFile *) priv->file_list->data;
5357 }
5358
5359 message_area = eoc_no_images_error_message_area_new (file);
5360
5361 eoc_window_set_message_area (window, message_area);
5362
5363 ctk_widget_show (message_area);
5364 }
5365
5366 g_signal_emit (window, signals[SIGNAL_PREPARED], 0);
5367 }
5368}
5369
5370/**
5371 * eoc_window_open_file_list:
5372 * @window: An #EocWindow.
5373 * @file_list: (element-type GFile): A %NULL-terminated list of #GFile's.
5374 *
5375 * Opens a list of files, adding them to the collection in @window.
5376 * Files will be checked to be readable and later filtered according
5377 * with eoc_list_store_add_files().
5378 **/
5379void
5380eoc_window_open_file_list (EocWindow *window, GSList *file_list)
5381{
5382 EocJob *job;
5383
5384 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 5384, ((const char*) (__func__
))
);
5385
5386 window->priv->status = EOC_WINDOW_STATUS_INIT;
5387
5388 g_slist_foreach (file_list, (GFunc) g_object_ref, NULL((void*)0));
5389 window->priv->file_list = file_list;
5390
5391 job = eoc_job_model_new (file_list);
5392
5393 g_signal_connect (job,g_signal_connect_data ((job), ("finished"), (((GCallback) (eoc_job_model_cb
))), (window), ((void*)0), (GConnectFlags) 0)
5394 "finished",g_signal_connect_data ((job), ("finished"), (((GCallback) (eoc_job_model_cb
))), (window), ((void*)0), (GConnectFlags) 0)
5395 G_CALLBACK (eoc_job_model_cb),g_signal_connect_data ((job), ("finished"), (((GCallback) (eoc_job_model_cb
))), (window), ((void*)0), (GConnectFlags) 0)
5396 window)g_signal_connect_data ((job), ("finished"), (((GCallback) (eoc_job_model_cb
))), (window), ((void*)0), (GConnectFlags) 0)
;
5397
5398 eoc_job_queue_add_job (job);
5399 g_object_unref (job);
5400}
5401
5402/**
5403 * eoc_window_get_ui_manager:
5404 * @window: An #EocWindow.
5405 *
5406 * Gets the #CtkUIManager that describes the UI of @window.
5407 *
5408 * Returns: (transfer none): A #CtkUIManager.
5409 **/
5410CtkUIManager *
5411eoc_window_get_ui_manager (EocWindow *window)
5412{
5413 g_return_val_if_fail (EOC_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return (((void*)0)); } } while
(0)
;
5414
5415 return window->priv->ui_mgr;
5416}
5417
5418/**
5419 * eoc_window_get_mode:
5420 * @window: An #EocWindow.
5421 *
5422 * Gets the mode of @window. See #EocWindowMode for details.
5423 *
5424 * Returns: An #EocWindowMode.
5425 **/
5426EocWindowMode
5427eoc_window_get_mode (EocWindow *window)
5428{
5429 g_return_val_if_fail (EOC_IS_WINDOW (window), EOC_WINDOW_MODE_UNKNOWN)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return (EOC_WINDOW_MODE_UNKNOWN
); } } while (0)
;
5430
5431 return window->priv->mode;
5432}
5433
5434/**
5435 * eoc_window_set_mode:
5436 * @window: an #EocWindow.
5437 * @mode: an #EocWindowMode value.
5438 *
5439 * Changes the mode of @window to normal, fullscreen, or slideshow.
5440 * See #EocWindowMode for details.
5441 **/
5442void
5443eoc_window_set_mode (EocWindow *window, EocWindowMode mode)
5444{
5445 g_return_if_fail (EOC_IS_WINDOW (window))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return; } } while (0)
;
5446
5447 if (window->priv->mode == mode)
5448 return;
5449
5450 switch (mode) {
5451 case EOC_WINDOW_MODE_NORMAL:
5452 eoc_window_stop_fullscreen (window,
5453 window->priv->mode == EOC_WINDOW_MODE_SLIDESHOW);
5454 break;
5455 case EOC_WINDOW_MODE_FULLSCREEN:
5456 eoc_window_run_fullscreen (window, FALSE(0));
5457 break;
5458 case EOC_WINDOW_MODE_SLIDESHOW:
5459 eoc_window_run_fullscreen (window, TRUE(!(0)));
5460 break;
5461 case EOC_WINDOW_MODE_UNKNOWN:
5462 break;
5463 }
5464}
5465
5466/**
5467 * eoc_window_get_store:
5468 * @window: An #EocWindow.
5469 *
5470 * Gets the #EocListStore that contains the images in the collection
5471 * of @window.
5472 *
5473 * Returns: (transfer none): an #EocListStore.
5474 **/
5475EocListStore *
5476eoc_window_get_store (EocWindow *window)
5477{
5478 g_return_val_if_fail (EOC_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return (((void*)0)); } } while
(0)
;
5479
5480 return EOC_LIST_STORE (window->priv->store)((((EocListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->store)), (eoc_list_store_get_type())
))))
;
5481}
5482
5483/**
5484 * eoc_window_get_view:
5485 * @window: An #EocWindow.
5486 *
5487 * Gets the #EocScrollView in the window.
5488 *
5489 * Returns: (transfer none): the #EocScrollView.
5490 **/
5491CtkWidget *
5492eoc_window_get_view (EocWindow *window)
5493{
5494 g_return_val_if_fail (EOC_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return (((void*)0)); } } while
(0)
;
5495
5496 return window->priv->view;
5497}
5498
5499/**
5500 * eoc_window_get_sidebar:
5501 * @window: An #EocWindow.
5502 *
5503 * Gets the sidebar widget of @window.
5504 *
5505 * Returns: (transfer none): the #EocSidebar.
5506 **/
5507CtkWidget *
5508eoc_window_get_sidebar (EocWindow *window)
5509{
5510 g_return_val_if_fail (EOC_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return (((void*)0)); } } while
(0)
;
5511
5512 return window->priv->sidebar;
5513}
5514
5515/**
5516 * eoc_window_get_thumb_view:
5517 * @window: an #EocWindow.
5518 *
5519 * Gets the thumbnails view in @window.
5520 *
5521 * Returns: (transfer none): an #EocThumbView.
5522 **/
5523CtkWidget *
5524eoc_window_get_thumb_view (EocWindow *window)
5525{
5526 g_return_val_if_fail (EOC_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return (((void*)0)); } } while
(0)
;
5527
5528 return window->priv->thumbview;
5529}
5530
5531/**
5532 * eoc_window_get_thumb_nav:
5533 * @window: an #EocWindow.
5534 *
5535 * Gets the thumbnails navigation pane in @window.
5536 *
5537 * Returns: (transfer none): an #EocThumbNav.
5538 **/
5539CtkWidget *
5540eoc_window_get_thumb_nav (EocWindow *window)
5541{
5542 g_return_val_if_fail (EOC_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return (((void*)0)); } } while
(0)
;
5543
5544 return window->priv->nav;
5545}
5546
5547/**
5548 * eoc_window_get_statusbar:
5549 * @window: an #EocWindow.
5550 *
5551 * Gets the statusbar in @window.
5552 *
5553 * Returns: (transfer none): a #EocStatusBar.
5554 **/
5555CtkWidget *
5556eoc_window_get_statusbar (EocWindow *window)
5557{
5558 g_return_val_if_fail (EOC_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return (((void*)0)); } } while
(0)
;
5559
5560 return window->priv->statusbar;
5561}
5562
5563/**
5564 * eoc_window_get_image:
5565 * @window: an #EocWindow.
5566 *
5567 * Gets the image currently displayed in @window or %NULL if
5568 * no image is being displayed.
5569 *
5570 * Returns: (transfer none): an #EocImage.
5571 **/
5572EocImage *
5573eoc_window_get_image (EocWindow *window)
5574{
5575 g_return_val_if_fail (EOC_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return (((void*)0)); } } while
(0)
;
5576
5577 return window->priv->image;
5578}
5579
5580/**
5581 * eoc_window_is_empty:
5582 * @window: an #EocWindow.
5583 *
5584 * Tells whether @window is currently empty or not.
5585 *
5586 * Returns: %TRUE if @window has no images, %FALSE otherwise.
5587 **/
5588gboolean
5589eoc_window_is_empty (EocWindow *window)
5590{
5591 EocWindowPrivate *priv;
5592 gboolean empty = TRUE(!(0));
5593
5594 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 5594, ((const char*) (__func__
))
);
5595
5596 g_return_val_if_fail (EOC_IS_WINDOW (window), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return ((0)); } } while (0)
;
5597
5598 priv = window->priv;
5599
5600 if (priv->store != NULL((void*)0)) {
5601 empty = (eoc_list_store_length (EOC_LIST_STORE (priv->store)((((EocListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->store)), (eoc_list_store_get_type())))))
) == 0);
5602 }
5603
5604 return empty;
5605}
5606
5607void
5608eoc_window_reload_image (EocWindow *window)
5609{
5610 CtkWidget *view;
5611
5612 g_return_if_fail (EOC_IS_WINDOW (window))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((eoc_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("EOC", ((const char*) (__func__
)), "EOC_IS_WINDOW (window)"); return; } } while (0)
;
5613
5614 if (window->priv->image == NULL((void*)0))
5615 return;
5616
5617 g_object_unref (window->priv->image);
5618 window->priv->image = NULL((void*)0);
5619
5620 view = eoc_window_get_view (window);
5621 eoc_scroll_view_set_image (EOC_SCROLL_VIEW (view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((view)), ((eoc_scroll_view_get_type ()))))))
, NULL((void*)0));
5622
5623 eoc_thumb_view_select_single (EOC_THUMB_VIEW (window->priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->thumbview)), ((eoc_thumb_view_get_type
()))))))
,
5624 EOC_THUMB_VIEW_SELECT_CURRENT);
5625}