Bug Summary

File:src/eoc-window.c
Warning:line 2487, 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-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 -fdebug-compilation-dir=/rootdir/src -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/lib/llvm-19/lib/clang/19 -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/share/eoc" -D EOC_LOCALE_DIR="/usr/share/locale" -D EOC_PLUGIN_DIR="/usr/lib/eoc/plugins" -D LIBDIR="/usr/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/sysprof-6 -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/webp -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-2.0 -I /usr/include/gobject-introspection-1.0 -I /usr/include/exempi-2.0 -I /usr/include/librsvg-2.0 -I /usr/include/libxml2 -D PIC -internal-isystem /usr/lib/llvm-19/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -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.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/2025-07-17-100108-31381-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 GType 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_pointer (
&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_pointer
((&static_g_define_type_id), (gpointer) (guintptr) (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")g_strdup_inline ("_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 G_GNUC_UNUSED__attribute__ ((__unused__)),
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))g_strdup_inline (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 G_GNUC_UNUSED__attribute__ ((__unused__)),
1112 float progress,
1113 gpointer user_data)
1114{
1115 EocWindow *window;
1116
1117 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)
;
1118
1119 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
1120
1121 eoc_statusbar_set_progress (EOC_STATUSBAR (window->priv->statusbar)((((EocStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->statusbar)), ((eoc_statusbar_get_type
()))))))
,
1122 progress);
1123}
1124
1125static void
1126eoc_job_save_progress_cb (EocJobSave *job, float progress, gpointer user_data)
1127{
1128 EocWindowPrivate *priv;
1129 EocWindow *window;
1130
1131 static EocImage *image = NULL((void*)0);
1132
1133 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)
;
1134
1135 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
1136 priv = window->priv;
1137
1138 eoc_statusbar_set_progress (EOC_STATUSBAR (priv->statusbar)((((EocStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((eoc_statusbar_get_type ()))))))
,
1139 progress);
1140
1141 if (image != job->current_image) {
1142 gchar *str_image, *status_message;
1143 guint n_images;
1144
1145 image = job->current_image;
1146
1147 n_images = g_list_length (job->images);
1148
1149 str_image = eoc_image_get_uri_for_display (image);
1150
1151 /* Translators: This string is displayed in the statusbar
1152 * while saving images. The tokens are from left to right:
1153 * - the original filename
1154 * - the current image's position in the queue
1155 * - the total number of images queued for saving */
1156 status_message = g_strdup_printf (_("Saving image \"%s\" (%u/%u)")gettext ("Saving image \"%s\" (%u/%u)"),
1157 str_image,
1158 job->current_pos + 1,
1159 n_images);
1160 g_free (str_image);
1161
1162 ctk_statusbar_pop (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
1163 priv->image_info_message_cid);
1164
1165 ctk_statusbar_push (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
1166 priv->image_info_message_cid,
1167 status_message);
1168
1169 g_free (status_message);
1170 }
1171
1172 if (progress == 1.0)
1173 image = NULL((void*)0);
1174}
1175
1176static void
1177eoc_window_obtain_desired_size (EocImage *image G_GNUC_UNUSED__attribute__ ((__unused__)),
1178 gint width,
1179 gint height,
1180 EocWindow *window)
1181{
1182 CdkScreen *screen;
1183 CdkDisplay *display;
1184 CdkRectangle monitor;
1185 CtkAllocation allocation;
1186 gint final_width, final_height;
1187 gint screen_width, screen_height;
1188 gint window_width, window_height;
1189 gint img_width, img_height;
1190 gint view_width, view_height;
1191 gint deco_width, deco_height;
1192
1193 update_action_groups_state (window);
1194
1195 img_width = width;
1196 img_height = height;
1197
1198 if (!ctk_widget_get_realized (window->priv->view)) {
1199 ctk_widget_realize (window->priv->view);
1200 }
1201
1202 ctk_widget_get_allocation (window->priv->view, &allocation);
1203 view_width = allocation.width;
1204 view_height = allocation.height;
1205
1206 if (!ctk_widget_get_realized (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
)) {
1207 ctk_widget_realize (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
1208 }
1209
1210 ctk_widget_get_allocation (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
, &allocation);
1211 window_width = allocation.width;
1212 window_height = allocation.height;
1213
1214 screen = ctk_window_get_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
);
1215 display = cdk_screen_get_display (screen);
1216
1217 cdk_monitor_get_geometry (cdk_display_get_monitor_at_window (display,
1218 ctk_widget_get_window (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
)),
1219 &monitor);
1220
1221 screen_width = monitor.width;
1222 screen_height = monitor.height;
1223
1224 deco_width = window_width - view_width;
1225 deco_height = window_height - view_height;
1226
1227 if (img_width > 0 && img_height > 0) {
1228 if ((img_width + deco_width > screen_width) ||
1229 (img_height + deco_height > screen_height))
1230 {
1231 double factor;
1232
1233 if (img_width > img_height) {
1234 factor = (screen_width * 0.75 - deco_width) / (double) img_width;
1235 } else {
1236 factor = (screen_height * 0.75 - deco_height) / (double) img_height;
1237 }
1238
1239 img_width = img_width * factor;
1240 img_height = img_height * factor;
1241 }
1242 }
1243
1244 final_width = MAX (EOC_WINDOW_MIN_WIDTH, img_width + deco_width)(((440) > (img_width + deco_width)) ? (440) : (img_width +
deco_width))
;
1245 final_height = MAX (EOC_WINDOW_MIN_HEIGHT, img_height + deco_height)(((350) > (img_height + deco_height)) ? (350) : (img_height
+ deco_height))
;
1246
1247 eoc_debug_message (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1247, ((const char*) (__func__
))
, "Setting window size: %d x %d", final_width, final_height);
1248
1249 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);
1250
1251 g_signal_emit (window, signals[SIGNAL_PREPARED], 0);
1252}
1253
1254static void
1255eoc_window_error_message_area_response (CtkInfoBar *message_area G_GNUC_UNUSED__attribute__ ((__unused__)),
1256 gint response_id,
1257 EocWindow *window)
1258{
1259 if (response_id != CTK_RESPONSE_OK) {
1260 eoc_window_set_message_area (window, NULL((void*)0));
1261
1262 return;
1263 }
1264
1265 /* Trigger loading for current image again */
1266 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
()))))))
,
1267 EOC_THUMB_VIEW_SELECT_CURRENT);
1268}
1269
1270static void
1271eoc_job_load_cb (EocJobLoad *job, gpointer data)
1272{
1273 EocWindow *window;
1274 EocWindowPrivate *priv;
1275 CtkAction *action_undo, *action_save;
1276
1277 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)
;
1278
1279 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1279, ((const char*) (__func__
))
);
1280
1281 window = EOC_WINDOW (data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_window_get_type ()))))))
;
1282 priv = window->priv;
1283
1284 eoc_statusbar_set_progress (EOC_STATUSBAR (priv->statusbar)((((EocStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((eoc_statusbar_get_type ()))))))
, 0.0);
1285
1286 ctk_statusbar_pop (CTK_STATUSBAR (window->priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->statusbar)), ((ctk_statusbar_get_type
()))))))
,
1287 priv->image_info_message_cid);
1288
1289 if (priv->image != NULL((void*)0)) {
1290 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))
1291 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))
1292 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))
;
1293 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))
1294 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))
1295 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))
;
1296
1297 g_object_unref (priv->image);
1298 }
1299
1300 priv->image = g_object_ref (job->image)((__typeof__ (job->image)) (g_object_ref) (job->image));
1301
1302 if (EOC_JOB (job)((((EocJob*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((job)), ((eoc_job_get_type()))))))
->error == NULL((void*)0)) {
1303#if defined(HAVE_LCMS1) && defined(CDK_WINDOWING_X11)
1304 eoc_image_apply_display_profile (job->image,
1305 priv->display_profile);
1306#endif
1307
1308 ctk_action_group_set_sensitive (priv->actions_image, TRUE(!(0)));
1309
1310 eoc_window_display_image (window, job->image);
1311 } else {
1312 CtkWidget *message_area;
1313
1314 message_area = eoc_image_load_error_message_area_new (
1315 eoc_image_get_caption (job->image),
1316 EOC_JOB (job)((((EocJob*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((job)), ((eoc_job_get_type()))))))
->error);
1317
1318 g_signal_connect (message_area,g_signal_connect_data ((message_area), ("response"), (((GCallback
) (eoc_window_error_message_area_response))), (window), ((void
*)0), (GConnectFlags) 0)
1319 "response",g_signal_connect_data ((message_area), ("response"), (((GCallback
) (eoc_window_error_message_area_response))), (window), ((void
*)0), (GConnectFlags) 0)
1320 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)
1321 window)g_signal_connect_data ((message_area), ("response"), (((GCallback
) (eoc_window_error_message_area_response))), (window), ((void
*)0), (GConnectFlags) 0)
;
1322
1323 ctk_window_set_icon (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, NULL((void*)0));
1324 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
1325 eoc_image_get_caption (job->image));
1326
1327 eoc_window_set_message_area (window, message_area);
1328
1329 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()))))))
,
1330 CTK_RESPONSE_CANCEL);
1331
1332 ctk_widget_show (message_area);
1333
1334 update_status_bar (window);
1335
1336 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));
1337
1338 if (window->priv->status == EOC_WINDOW_STATUS_INIT) {
1339 update_action_groups_state (window);
1340
1341 g_signal_emit (window, signals[SIGNAL_PREPARED], 0);
1342 }
1343
1344 ctk_action_group_set_sensitive (priv->actions_image, FALSE(0));
1345 }
1346
1347 eoc_window_clear_load_job (window);
1348
1349 if (window->priv->status == EOC_WINDOW_STATUS_INIT) {
1350 window->priv->status = EOC_WINDOW_STATUS_NORMAL;
1351
1352 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
))
1353 (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
))
1354 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
))
1355 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
))
;
1356 }
1357
1358 action_save = ctk_action_group_get_action (priv->actions_image, "ImageSave");
1359 action_undo = ctk_action_group_get_action (priv->actions_image, "EditUndo");
1360
1361 /* Set Save and Undo sensitive according to image state.
1362 * Respect lockdown in case of Save.*/
1363 ctk_action_set_sensitive (action_save, (!priv->save_disabled && eoc_image_is_modified (job->image)));
1364 ctk_action_set_sensitive (action_undo, eoc_image_is_modified (job->image));
1365
1366 g_object_unref (job->image);
1367}
1368
1369static void
1370eoc_window_clear_transform_job (EocWindow *window)
1371{
1372 EocWindowPrivate *priv = window->priv;
1373
1374 if (priv->transform_job != NULL((void*)0)) {
1375 if (!priv->transform_job->finished)
1376 eoc_job_queue_remove_job (priv->transform_job);
1377
1378 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))
1379 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))
1380 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))
;
1381 g_object_unref (priv->transform_job);
1382 priv->transform_job = NULL((void*)0);
1383 }
1384}
1385
1386static void
1387eoc_job_transform_cb (EocJobTransform *job G_GNUC_UNUSED__attribute__ ((__unused__)),
1388 gpointer data)
1389{
1390 EocWindow *window;
1391 CtkAction *action_undo, *action_save;
1392 EocImage *image;
1393
1394 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)
;
1395
1396 window = EOC_WINDOW (data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_window_get_type ()))))))
;
1397
1398 eoc_window_clear_transform_job (window);
1399
1400 action_undo =
1401 ctk_action_group_get_action (window->priv->actions_image, "EditUndo");
1402 action_save =
1403 ctk_action_group_get_action (window->priv->actions_image, "ImageSave");
1404
1405 image = eoc_window_get_image (window);
1406
1407 ctk_action_set_sensitive (action_undo, eoc_image_is_modified (image));
1408
1409 if (!window->priv->save_disabled)
1410 {
1411 ctk_action_set_sensitive (action_save, eoc_image_is_modified (image));
1412 }
1413}
1414
1415static void
1416apply_transformation (EocWindow *window, EocTransform *trans)
1417{
1418 EocWindowPrivate *priv;
1419 GList *images;
1420
1421 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)
;
1422
1423 priv = window->priv;
1424
1425 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 ()))))))
);
1426
1427 eoc_window_clear_transform_job (window);
1428
1429 priv->transform_job = eoc_job_transform_new (images, trans);
1430
1431 g_signal_connect (priv->transform_job,g_signal_connect_data ((priv->transform_job), ("finished")
, (((GCallback) (eoc_job_transform_cb))), (window), ((void*)0
), (GConnectFlags) 0)
1432 "finished",g_signal_connect_data ((priv->transform_job), ("finished")
, (((GCallback) (eoc_job_transform_cb))), (window), ((void*)0
), (GConnectFlags) 0)
1433 G_CALLBACK (eoc_job_transform_cb),g_signal_connect_data ((priv->transform_job), ("finished")
, (((GCallback) (eoc_job_transform_cb))), (window), ((void*)0
), (GConnectFlags) 0)
1434 window)g_signal_connect_data ((priv->transform_job), ("finished")
, (((GCallback) (eoc_job_transform_cb))), (window), ((void*)0
), (GConnectFlags) 0)
;
1435
1436 g_signal_connect (priv->transform_job,g_signal_connect_data ((priv->transform_job), ("progress")
, (((GCallback) (eoc_job_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
1437 "progress",g_signal_connect_data ((priv->transform_job), ("progress")
, (((GCallback) (eoc_job_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
1438 G_CALLBACK (eoc_job_progress_cb),g_signal_connect_data ((priv->transform_job), ("progress")
, (((GCallback) (eoc_job_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
1439 window)g_signal_connect_data ((priv->transform_job), ("progress")
, (((GCallback) (eoc_job_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
;
1440
1441 eoc_job_queue_add_job (priv->transform_job);
1442}
1443
1444static void
1445handle_image_selection_changed_cb (EocThumbView *thumbview G_GNUC_UNUSED__attribute__ ((__unused__)),
1446 EocWindow *window)
1447{
1448 EocWindowPrivate *priv;
1449 EocImage *image;
1450 gchar *status_message;
1451 gchar *str_image;
1452
1453 priv = window->priv;
1454
1455 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) {
1456 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
1457 g_get_application_name());
1458 ctk_statusbar_remove_all (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
1459 priv->image_info_message_cid);
1460 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 ()))))))
,
1461 NULL((void*)0));
1462 }
1463
1464 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)
1465 return;
1466
1467 update_selection_ui_visibility (window);
1468
1469 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 ()))))))
);
1470
1471 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", 1471, ((const
char*) (__func__)), "EOC_IS_IMAGE (image)"); } while (0)
;
1472
1473 eoc_window_clear_load_job (window);
1474
1475 eoc_window_set_message_area (window, NULL((void*)0));
1476
1477 ctk_statusbar_pop (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
1478 priv->image_info_message_cid);
1479
1480 if (image == priv->image) {
1481 update_status_bar (window);
1482 return;
1483 }
1484
1485 if (eoc_image_has_data (image, EOC_IMAGE_DATA_IMAGE)) {
1486 if (priv->image != NULL((void*)0))
1487 g_object_unref (priv->image);
1488
1489 priv->image = image;
1490 eoc_window_display_image (window, image);
1491 return;
1492 }
1493
1494 if (priv->status == EOC_WINDOW_STATUS_INIT) {
1495 g_signal_connect (image,g_signal_connect_data ((image), ("size-prepared"), (((GCallback
) (eoc_window_obtain_desired_size))), (window), ((void*)0), (
GConnectFlags) 0)
1496 "size-prepared",g_signal_connect_data ((image), ("size-prepared"), (((GCallback
) (eoc_window_obtain_desired_size))), (window), ((void*)0), (
GConnectFlags) 0)
1497 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)
1498 window)g_signal_connect_data ((image), ("size-prepared"), (((GCallback
) (eoc_window_obtain_desired_size))), (window), ((void*)0), (
GConnectFlags) 0)
;
1499 }
1500
1501 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)
);
1502
1503 g_signal_connect (priv->load_job,g_signal_connect_data ((priv->load_job), ("finished"), (((
GCallback) (eoc_job_load_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1504 "finished",g_signal_connect_data ((priv->load_job), ("finished"), (((
GCallback) (eoc_job_load_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1505 G_CALLBACK (eoc_job_load_cb),g_signal_connect_data ((priv->load_job), ("finished"), (((
GCallback) (eoc_job_load_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1506 window)g_signal_connect_data ((priv->load_job), ("finished"), (((
GCallback) (eoc_job_load_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
1507
1508 g_signal_connect (priv->load_job,g_signal_connect_data ((priv->load_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1509 "progress",g_signal_connect_data ((priv->load_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1510 G_CALLBACK (eoc_job_progress_cb),g_signal_connect_data ((priv->load_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1511 window)g_signal_connect_data ((priv->load_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
1512
1513 eoc_job_queue_add_job (priv->load_job);
1514
1515 str_image = eoc_image_get_uri_for_display (image);
1516
1517 status_message = g_strdup_printf (_("Opening image \"%s\"")gettext ("Opening image \"%s\""),
1518 str_image);
1519
1520 g_free (str_image);
1521
1522 ctk_statusbar_push (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
1523 priv->image_info_message_cid, status_message);
1524
1525 g_free (status_message);
1526}
1527
1528static void
1529view_zoom_changed_cb (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
1530 double zoom G_GNUC_UNUSED__attribute__ ((__unused__)),
1531 gpointer user_data)
1532{
1533 EocWindow *window;
1534 CtkAction *action_zoom_in;
1535 CtkAction *action_zoom_out;
1536
1537 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)
;
1538
1539 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
1540
1541 update_status_bar (window);
1542
1543 action_zoom_in =
1544 ctk_action_group_get_action (window->priv->actions_image,
1545 "ViewZoomIn");
1546
1547 action_zoom_out =
1548 ctk_action_group_get_action (window->priv->actions_image,
1549 "ViewZoomOut");
1550
1551 ctk_action_set_sensitive (action_zoom_in,
1552 !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 (
)))))))
));
1553 ctk_action_set_sensitive (action_zoom_out,
1554 !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 (
)))))))
));
1555}
1556
1557static void
1558eoc_window_open_recent_cb (CtkAction *action,
1559 EocWindow *window G_GNUC_UNUSED__attribute__ ((__unused__)))
1560{
1561 CtkRecentInfo *info;
1562 const gchar *uri;
1563 GSList *list = NULL((void*)0);
1564
1565 info = g_object_get_data (G_OBJECT (action)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), (((GType) ((20) << (2))))))))
, "ctk-recent-info");
1566 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)
;
1567
1568 uri = ctk_recent_info_get_uri (info);
1569 list = g_slist_prepend (list, g_strdup (uri)g_strdup_inline (uri));
1570
1571 eoc_application_open_uri_list (EOC_APP(eoc_application_get_instance ()),
1572 list,
1573 CDK_CURRENT_TIME0L,
1574 0,
1575 NULL((void*)0));
1576
1577 g_slist_foreach (list, (GFunc) g_free, NULL((void*)0));
1578 g_slist_free (list);
1579}
1580
1581static void
1582file_open_dialog_response_cb (CtkWidget *chooser,
1583 gint response_id,
1584 EocWindow *ev_window G_GNUC_UNUSED__attribute__ ((__unused__)))
1585{
1586 if (response_id == CTK_RESPONSE_OK) {
1587 GSList *uris;
1588
1589 uris = ctk_file_chooser_get_uris (CTK_FILE_CHOOSER (chooser)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((chooser)), ((ctk_file_chooser_get_type ()))))))
);
1590
1591 eoc_application_open_uri_list (EOC_APP(eoc_application_get_instance ()),
1592 uris,
1593 CDK_CURRENT_TIME0L,
1594 0,
1595 NULL((void*)0));
1596
1597 g_slist_foreach (uris, (GFunc) g_free, NULL((void*)0));
1598 g_slist_free (uris);
1599 }
1600
1601 ctk_widget_destroy (chooser);
1602}
1603
1604static void
1605eoc_window_update_fullscreen_action (EocWindow *window)
1606{
1607 CtkAction *action;
1608
1609 action = ctk_action_group_get_action (window->priv->actions_image,
1610 "ViewFullscreen");
1611
1612 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))
1613 (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))
;
1614
1615 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
,
1616 window->priv->mode == EOC_WINDOW_MODE_FULLSCREEN);
1617
1618 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))
1619 (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))
;
1620}
1621
1622static void
1623eoc_window_update_slideshow_action (EocWindow *window)
1624{
1625 CtkAction *action;
1626
1627 action = ctk_action_group_get_action (window->priv->actions_collection,
1628 "ViewSlideshow");
1629
1630 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))
1631 (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))
;
1632
1633 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
,
1634 window->priv->mode == EOC_WINDOW_MODE_SLIDESHOW);
1635
1636 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))
1637 (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))
;
1638}
1639
1640static void
1641eoc_window_update_pause_slideshow_action (EocWindow *window)
1642{
1643 CtkAction *action;
1644
1645 action = ctk_action_group_get_action (window->priv->actions_image,
1646 "PauseSlideshow");
1647
1648 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)
)
1649 (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)
)
;
1650
1651 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
,
1652 window->priv->mode != EOC_WINDOW_MODE_SLIDESHOW);
1653
1654 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
))
1655 (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
))
;
1656}
1657
1658static void
1659eoc_window_update_fullscreen_popup (EocWindow *window)
1660{
1661 CtkWidget *popup = window->priv->fullscreen_popup;
1662 CdkRectangle screen_rect;
1663 CdkScreen *screen;
1664 CdkDisplay *display;
1665
1666 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)
;
1667
1668 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;
1669
1670 screen = ctk_widget_get_screen (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
1671 display = cdk_screen_get_display (screen);
1672
1673 cdk_monitor_get_geometry (cdk_display_get_monitor_at_window (display,
1674 ctk_widget_get_window (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
)),
1675 &screen_rect);
1676
1677 ctk_widget_set_size_request (popup,
1678 screen_rect.width,
1679 -1);
1680
1681 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);
1682}
1683
1684static void
1685screen_size_changed_cb (CdkScreen *screen G_GNUC_UNUSED__attribute__ ((__unused__)),
1686 EocWindow *window)
1687{
1688 eoc_window_update_fullscreen_popup (window);
1689}
1690
1691static gboolean
1692fullscreen_timeout_cb (gpointer data)
1693{
1694 EocWindow *window = EOC_WINDOW (data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_window_get_type ()))))))
;
1695
1696 ctk_widget_hide (window->priv->fullscreen_popup);
1697
1698 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 (
)))))))
);
1699
1700 fullscreen_clear_timeout (window);
1701
1702 return FALSE(0);
1703}
1704
1705static gboolean
1706slideshow_is_loop_end (EocWindow *window)
1707{
1708 EocWindowPrivate *priv = window->priv;
1709 EocImage *image = NULL((void*)0);
1710 gint pos;
1711
1712 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 ()))))))
);
1713
1714 pos = eoc_list_store_get_pos_by_image (priv->store, image);
1715
1716 return (pos == (eoc_list_store_length (priv->store) - 1));
1717}
1718
1719static gboolean
1720slideshow_switch_cb (gpointer data)
1721{
1722 EocWindow *window = EOC_WINDOW (data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_window_get_type ()))))))
;
1723 EocWindowPrivate *priv = window->priv;
1724
1725 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1725, ((const char*) (__func__
))
);
1726
1727 if (priv->slideshow_random) {
1728 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 ()))))))
,
1729 EOC_THUMB_VIEW_SELECT_RANDOM);
1730 return TRUE(!(0));
1731 }
1732
1733 if (!priv->slideshow_loop && slideshow_is_loop_end (window)) {
1734 eoc_window_stop_fullscreen (window, TRUE(!(0)));
1735 return FALSE(0);
1736 }
1737
1738 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 ()))))))
,
1739 EOC_THUMB_VIEW_SELECT_RIGHT);
1740
1741 return TRUE(!(0));
1742}
1743
1744static void
1745fullscreen_clear_timeout (EocWindow *window)
1746{
1747 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1747, ((const char*) (__func__
))
);
1748
1749 if (window->priv->fullscreen_timeout_source != NULL((void*)0)) {
1750 g_source_unref (window->priv->fullscreen_timeout_source);
1751 g_source_destroy (window->priv->fullscreen_timeout_source);
1752 }
1753
1754 window->priv->fullscreen_timeout_source = NULL((void*)0);
1755}
1756
1757static void
1758fullscreen_set_timeout (EocWindow *window)
1759{
1760 GSource *source;
1761
1762 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1762, ((const char*) (__func__
))
);
1763
1764 fullscreen_clear_timeout (window);
1765
1766 source = g_timeout_source_new (EOC_WINDOW_FULLSCREEN_TIMEOUT5 * 1000);
1767 g_source_set_callback (source, fullscreen_timeout_cb, window, NULL((void*)0));
1768
1769 g_source_attach (source, NULL((void*)0));
1770
1771 window->priv->fullscreen_timeout_source = source;
1772
1773 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 (
)))))))
);
1774}
1775
1776static void
1777slideshow_clear_timeout (EocWindow *window)
1778{
1779 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1779, ((const char*) (__func__
))
);
1780
1781 if (window->priv->slideshow_switch_source != NULL((void*)0)) {
1782 g_source_unref (window->priv->slideshow_switch_source);
1783 g_source_destroy (window->priv->slideshow_switch_source);
1784 }
1785
1786 window->priv->slideshow_switch_source = NULL((void*)0);
1787}
1788
1789static void
1790slideshow_set_timeout (EocWindow *window)
1791{
1792 GSource *source;
1793
1794 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1794, ((const char*) (__func__
))
);
1795
1796 slideshow_clear_timeout (window);
1797
1798 if (window->priv->slideshow_switch_timeout <= 0)
1799 return;
1800
1801 source = g_timeout_source_new (window->priv->slideshow_switch_timeout * 1000);
1802 g_source_set_callback (source, slideshow_switch_cb, window, NULL((void*)0));
1803
1804 g_source_attach (source, NULL((void*)0));
1805
1806 window->priv->slideshow_switch_source = source;
1807}
1808
1809static void
1810show_fullscreen_popup (EocWindow *window)
1811{
1812 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1812, ((const char*) (__func__
))
);
1813
1814 if (!ctk_widget_get_visible (window->priv->fullscreen_popup)) {
1815 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
()))))))
);
1816 }
1817
1818 fullscreen_set_timeout (window);
1819}
1820
1821static gboolean
1822fullscreen_motion_notify_cb (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
1823 CdkEventMotion *event,
1824 gpointer user_data)
1825{
1826 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
1827
1828 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1828, ((const char*) (__func__
))
);
1829
1830 if (event->y < EOC_WINDOW_FULLSCREEN_POPUP_THRESHOLD5) {
1831 show_fullscreen_popup (window);
1832 } else {
1833 fullscreen_set_timeout (window);
1834 }
1835
1836 return FALSE(0);
1837}
1838
1839static gboolean
1840fullscreen_leave_notify_cb (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
1841 CdkEventCrossing *event G_GNUC_UNUSED__attribute__ ((__unused__)),
1842 gpointer user_data)
1843{
1844 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
1845
1846 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1846, ((const char*) (__func__
))
);
1847
1848 fullscreen_clear_timeout (window);
1849
1850 return FALSE(0);
1851}
1852
1853static void
1854exit_fullscreen_button_clicked_cb (CtkWidget *button G_GNUC_UNUSED__attribute__ ((__unused__)),
1855 EocWindow *window)
1856{
1857 CtkAction *action;
1858
1859 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1859, ((const char*) (__func__
))
);
1860
1861 if (window->priv->mode == EOC_WINDOW_MODE_SLIDESHOW) {
1862 action = ctk_action_group_get_action (window->priv->actions_collection,
1863 "ViewSlideshow");
1864 } else {
1865 action = ctk_action_group_get_action (window->priv->actions_image,
1866 "ViewFullscreen");
1867 }
1868 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)
;
1869
1870 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));
1871}
1872
1873static CtkWidget *
1874eoc_window_get_exit_fullscreen_button (EocWindow *window)
1875{
1876 CtkWidget *button;
1877
1878 button = ctk_button_new_with_mnemonic (_("Leave Fullscreen")gettext ("Leave Fullscreen"));
1879 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));
1880
1881 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
exit_fullscreen_button_clicked_cb))), (window), ((void*)0), (
GConnectFlags) 0)
1882 G_CALLBACK (exit_fullscreen_button_clicked_cb),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
exit_fullscreen_button_clicked_cb))), (window), ((void*)0), (
GConnectFlags) 0)
1883 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
exit_fullscreen_button_clicked_cb))), (window), ((void*)0), (
GConnectFlags) 0)
;
1884
1885 return button;
1886}
1887
1888static CtkWidget *
1889eoc_window_create_fullscreen_popup (EocWindow *window)
1890{
1891 CtkWidget *popup;
1892 CtkWidget *hbox;
1893 CtkWidget *button;
1894 CtkWidget *toolbar;
1895 CdkScreen *screen;
1896
1897 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1897, ((const char*) (__func__
))
);
1898
1899 popup = ctk_window_new (CTK_WINDOW_POPUP);
1900
1901 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
1902 ctk_container_add (CTK_CONTAINER (popup)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((popup)), ((ctk_container_get_type ()))))))
, hbox);
1903
1904 toolbar = ctk_ui_manager_get_widget (window->priv->ui_mgr,
1905 "/FullscreenToolbar");
1906 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", 1906, ((const
char*) (__func__)), "CTK_IS_WIDGET (toolbar)"); } while (0)
;
1907 ctk_toolbar_set_style (CTK_TOOLBAR (toolbar)((((CtkToolbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toolbar)), ((ctk_toolbar_get_type ()))))))
, CTK_TOOLBAR_ICONS);
1908 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);
1909
1910 button = eoc_window_get_exit_fullscreen_button (window);
1911 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);
1912
1913 ctk_window_set_resizable (CTK_WINDOW (popup)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((popup)), ((ctk_window_get_type ()))))))
, FALSE(0));
1914
1915 screen = ctk_widget_get_screen (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
1916
1917 g_signal_connect_object (screen, "size-changed",
1918 G_CALLBACK (screen_size_changed_cb)((GCallback) (screen_size_changed_cb)),
1919 window, 0);
1920
1921 g_signal_connect (popup,g_signal_connect_data ((popup), ("enter-notify-event"), (((GCallback
) (fullscreen_leave_notify_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1922 "enter-notify-event",g_signal_connect_data ((popup), ("enter-notify-event"), (((GCallback
) (fullscreen_leave_notify_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1923 G_CALLBACK (fullscreen_leave_notify_cb),g_signal_connect_data ((popup), ("enter-notify-event"), (((GCallback
) (fullscreen_leave_notify_cb))), (window), ((void*)0), (GConnectFlags
) 0)
1924 window)g_signal_connect_data ((popup), ("enter-notify-event"), (((GCallback
) (fullscreen_leave_notify_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
1925
1926 ctk_window_set_screen (CTK_WINDOW (popup)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((popup)), ((ctk_window_get_type ()))))))
, screen);
1927
1928 return popup;
1929}
1930
1931static void
1932update_ui_visibility (EocWindow *window)
1933{
1934 EocWindowPrivate *priv;
1935
1936 CtkAction *action;
1937 CtkWidget *menubar;
1938
1939 gboolean fullscreen_mode, visible;
1940
1941 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)
;
1942
1943 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 1943, ((const char*) (__func__
))
);
1944
1945 priv = window->priv;
1946
1947 fullscreen_mode = priv->mode == EOC_WINDOW_MODE_FULLSCREEN ||
1948 priv->mode == EOC_WINDOW_MODE_SLIDESHOW;
1949
1950 menubar = ctk_ui_manager_get_widget (priv->ui_mgr, "/MainMenu");
1951 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", 1951, ((const
char*) (__func__)), "CTK_IS_WIDGET (menubar)"); } while (0)
;
1952
1953 visible = g_settings_get_boolean (priv->ui_settings, EOC_CONF_UI_TOOLBAR"toolbar");
1954 visible = visible && !fullscreen_mode;
1955
1956 action = ctk_ui_manager_get_action (priv->ui_mgr, "/MainMenu/View/ToolbarToggle");
1957 g_assert (action != NULL)do { if (action != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 1957, ((const char*) (__func__)), "action != NULL"
); } while (0)
;
1958 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
, visible);
1959 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));
1960
1961 visible = g_settings_get_boolean (priv->ui_settings, EOC_CONF_UI_STATUSBAR"statusbar");
1962 visible = visible && !fullscreen_mode;
1963
1964 action = ctk_ui_manager_get_action (priv->ui_mgr, "/MainMenu/View/StatusbarToggle");
1965 g_assert (action != NULL)do { if (action != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 1965, ((const char*) (__func__)), "action != NULL"
); } while (0)
;
1966 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
, visible);
1967 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));
1968
1969 if (priv->status != EOC_WINDOW_STATUS_INIT) {
1970 visible = g_settings_get_boolean (priv->ui_settings, EOC_CONF_UI_IMAGE_COLLECTION"image-collection");
1971 visible = visible && priv->mode != EOC_WINDOW_MODE_SLIDESHOW;
1972 action = ctk_ui_manager_get_action (priv->ui_mgr, "/MainMenu/View/ImageCollectionToggle");
1973 g_assert (action != NULL)do { if (action != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 1973, ((const char*) (__func__)), "action != NULL"
); } while (0)
;
1974 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
, visible);
1975 if (visible) {
1976 ctk_widget_show (priv->nav);
1977 } else {
1978 ctk_widget_hide (priv->nav);
1979 }
1980 }
1981
1982 visible = g_settings_get_boolean (priv->ui_settings, EOC_CONF_UI_SIDEBAR"sidebar");
1983 visible = visible && !fullscreen_mode;
1984 action = ctk_ui_manager_get_action (priv->ui_mgr, "/MainMenu/View/SidebarToggle");
1985 g_assert (action != NULL)do { if (action != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 1985, ((const char*) (__func__)), "action != NULL"
); } while (0)
;
1986 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
, visible);
1987 if (visible) {
1988 ctk_widget_show (priv->sidebar);
1989 } else {
1990 ctk_widget_hide (priv->sidebar);
1991 }
1992
1993 if (priv->fullscreen_popup != NULL((void*)0)) {
1994 ctk_widget_hide (priv->fullscreen_popup);
1995 }
1996}
1997
1998static void
1999eoc_window_inhibit_screensaver (EocWindow *window)
2000{
2001 EocWindowPrivate *priv = window->priv;
2002
2003 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)
;
2004
2005 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 2005, ((const char*) (__func__
))
);
2006
2007 window->priv->fullscreen_idle_inhibit_cookie =
2008 ctk_application_inhibit (CTK_APPLICATION (EOC_APP)((((CtkApplication*) (void *) g_type_check_instance_cast ((GTypeInstance
*) (((eoc_application_get_instance ()))), ((ctk_application_get_type
()))))))
,
2009 CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2010 CTK_APPLICATION_INHIBIT_IDLE,
2011 _("Viewing a slideshow")gettext ("Viewing a slideshow"));
2012}
2013
2014static void
2015eoc_window_uninhibit_screensaver (EocWindow *window)
2016{
2017 EocWindowPrivate *priv = window->priv;
2018
2019 if (G_UNLIKELY (priv->fullscreen_idle_inhibit_cookie == 0)(priv->fullscreen_idle_inhibit_cookie == 0))
2020 return;
2021
2022 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 2022, ((const char*) (__func__
))
);
2023
2024 ctk_application_uninhibit (CTK_APPLICATION (EOC_APP)((((CtkApplication*) (void *) g_type_check_instance_cast ((GTypeInstance
*) (((eoc_application_get_instance ()))), ((ctk_application_get_type
()))))))
,
2025 priv->fullscreen_idle_inhibit_cookie);
2026 priv->fullscreen_idle_inhibit_cookie = 0;
2027}
2028
2029static void
2030eoc_window_run_fullscreen (EocWindow *window, gboolean slideshow)
2031{
2032 static const CdkRGBA black = { 0., 0., 0., 1.};
2033
2034 EocWindowPrivate *priv;
2035 CtkWidget *menubar;
2036 gboolean upscale;
2037
2038 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 2038, ((const char*) (__func__
))
);
2039
2040 priv = window->priv;
2041
2042 if (slideshow) {
2043 priv->mode = EOC_WINDOW_MODE_SLIDESHOW;
2044 } else {
2045 /* Stop the timer if we come from slideshowing */
2046 if (priv->mode == EOC_WINDOW_MODE_SLIDESHOW)
2047 slideshow_clear_timeout (window);
2048
2049 priv->mode = EOC_WINDOW_MODE_FULLSCREEN;
2050 }
2051
2052 if (window->priv->fullscreen_popup == NULL((void*)0))
2053 priv->fullscreen_popup
2054 = eoc_window_create_fullscreen_popup (window);
2055
2056 update_ui_visibility (window);
2057
2058 menubar = ctk_ui_manager_get_widget (priv->ui_mgr, "/MainMenu");
2059 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", 2059, ((const
char*) (__func__)), "CTK_IS_WIDGET (menubar)"); } while (0)
;
2060 ctk_widget_hide (menubar);
2061
2062 g_signal_connect (priv->view,g_signal_connect_data ((priv->view), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
2063 "motion-notify-event",g_signal_connect_data ((priv->view), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
2064 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)
2065 window)g_signal_connect_data ((priv->view), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
;
2066
2067 g_signal_connect (priv->view,g_signal_connect_data ((priv->view), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
2068 "leave-notify-event",g_signal_connect_data ((priv->view), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
2069 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)
2070 window)g_signal_connect_data ((priv->view), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
;
2071
2072 g_signal_connect (priv->thumbview,g_signal_connect_data ((priv->thumbview), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
2073 "motion-notify-event",g_signal_connect_data ((priv->thumbview), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
2074 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)
2075 window)g_signal_connect_data ((priv->thumbview), ("motion-notify-event"
), (((GCallback) (fullscreen_motion_notify_cb))), (window), (
(void*)0), (GConnectFlags) 0)
;
2076
2077 g_signal_connect (priv->thumbview,g_signal_connect_data ((priv->thumbview), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
2078 "leave-notify-event",g_signal_connect_data ((priv->thumbview), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
2079 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)
2080 window)g_signal_connect_data ((priv->thumbview), ("leave-notify-event"
), (((GCallback) (fullscreen_leave_notify_cb))), (window), ((
void*)0), (GConnectFlags) 0)
;
2081
2082 fullscreen_set_timeout (window);
2083
2084 if (slideshow) {
2085 priv->slideshow_random =
2086 g_settings_get_boolean (priv->fullscreen_settings,
2087 EOC_CONF_FULLSCREEN_RANDOM"random");
2088
2089 priv->slideshow_loop =
2090 g_settings_get_boolean (priv->fullscreen_settings,
2091 EOC_CONF_FULLSCREEN_LOOP"loop");
2092
2093 priv->slideshow_switch_timeout =
2094 g_settings_get_int (priv->fullscreen_settings,
2095 EOC_CONF_FULLSCREEN_SECONDS"seconds");
2096
2097 slideshow_set_timeout (window);
2098 }
2099
2100 upscale = g_settings_get_boolean (priv->fullscreen_settings,
2101 EOC_CONF_FULLSCREEN_UPSCALE"upscale");
2102
2103 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 ()))))))
,
2104 upscale);
2105
2106 ctk_widget_grab_focus (priv->view);
2107
2108 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 (
)))))))
,
2109 &black);
2110
2111 ctk_window_fullscreen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
);
2112 eoc_window_update_fullscreen_popup (window);
2113
2114 eoc_window_inhibit_screensaver (window);
2115
2116 /* Update both actions as we could've already been in one those modes */
2117 eoc_window_update_slideshow_action (window);
2118 eoc_window_update_fullscreen_action (window);
2119 eoc_window_update_pause_slideshow_action (window);
2120}
2121
2122static void
2123eoc_window_stop_fullscreen (EocWindow *window, gboolean slideshow)
2124{
2125 EocWindowPrivate *priv;
2126 CtkWidget *menubar;
2127
2128 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 2128, ((const char*) (__func__
))
);
2129
2130 priv = window->priv;
2131
2132 if (priv->mode != EOC_WINDOW_MODE_SLIDESHOW &&
2133 priv->mode != EOC_WINDOW_MODE_FULLSCREEN) return;
2134
2135 priv->mode = EOC_WINDOW_MODE_NORMAL;
2136
2137 fullscreen_clear_timeout (window);
2138
2139 if (slideshow) {
2140 slideshow_clear_timeout (window);
2141 }
2142
2143 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))
2144 (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))
2145 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))
;
2146
2147 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))
2148 (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))
2149 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))
;
2150
2151 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))
2152 (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))
2153 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))
;
2154
2155 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))
2156 (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))
2157 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))
;
2158
2159 update_ui_visibility (window);
2160
2161 menubar = ctk_ui_manager_get_widget (priv->ui_mgr, "/MainMenu");
2162 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", 2162, ((const
char*) (__func__)), "CTK_IS_WIDGET (menubar)"); } while (0)
;
2163 ctk_widget_show (menubar);
2164
2165 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));
2166
2167 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 (
)))))))
,
2168 NULL((void*)0));
2169 ctk_window_unfullscreen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
);
2170
2171 if (slideshow) {
2172 eoc_window_update_slideshow_action (window);
2173 } else {
2174 eoc_window_update_fullscreen_action (window);
2175 }
2176
2177 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 ()))))))
);
2178
2179 eoc_window_uninhibit_screensaver (window);
2180}
2181
2182static void
2183eoc_window_print (EocWindow *window)
2184{
2185 CtkWidget *dialog;
2186 GError *error = NULL((void*)0);
2187 CtkPrintOperation *print;
2188 CtkPrintOperationResult res;
2189 CtkPageSetup *page_setup;
2190 CtkPrintSettings *print_settings;
2191 gboolean page_setup_disabled = FALSE(0);
2192
2193 eoc_debug (DEBUG_PRINTINGEOC_DEBUG_PRINTING, "eoc-window.c", 2193, ((const char*) (__func__
))
);
2194
2195 print_settings = eoc_print_get_print_settings ();
2196
2197 /* Make sure the window stays valid while printing */
2198 g_object_ref (window)((__typeof__ (window)) (g_object_ref) (window));
2199
2200 if (window->priv->page_setup != NULL((void*)0))
2201 page_setup = g_object_ref (window->priv->page_setup)((__typeof__ (window->priv->page_setup)) (g_object_ref)
(window->priv->page_setup))
;
2202 else
2203 page_setup = eoc_print_get_page_setup ();
2204
2205 print = eoc_print_operation_new (window->priv->image,
2206 print_settings,
2207 page_setup);
2208
2209 // Disable page setup options if they are locked down
2210 page_setup_disabled = g_settings_get_boolean (window->priv->lockdown_settings,
2211 EOC_CONF_LOCKDOWN_CAN_SETUP_PAGE"disable-print-setup");
2212 if (page_setup_disabled)
2213 ctk_print_operation_set_embed_page_setup (print, FALSE(0));
2214
2215 res = ctk_print_operation_run (print,
2216 CTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
2217 CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, &error);
2218
2219 if (res == CTK_PRINT_OPERATION_RESULT_ERROR) {
2220 dialog = ctk_message_dialog_new (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2221 CTK_DIALOG_DESTROY_WITH_PARENT,
2222 CTK_MESSAGE_ERROR,
2223 CTK_BUTTONS_CLOSE,
2224 _("Error printing file:\n%s")gettext ("Error printing file:\n%s"),
2225 error->message);
2226 g_signal_connect (dialog, "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
2227 G_CALLBACK (ctk_widget_destroy), NULL)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
2228 ctk_widget_show (dialog);
2229 g_error_free (error);
2230 } else if (res == CTK_PRINT_OPERATION_RESULT_APPLY) {
2231 CtkPageSetup *new_page_setup;
2232 eoc_print_set_print_settings (ctk_print_operation_get_print_settings (print));
2233 new_page_setup = ctk_print_operation_get_default_page_setup (print);
2234 if (window->priv->page_setup != NULL((void*)0))
2235 g_object_unref (window->priv->page_setup);
2236 window->priv->page_setup = g_object_ref (new_page_setup)((__typeof__ (new_page_setup)) (g_object_ref) (new_page_setup
))
;
2237 eoc_print_set_page_setup (window->priv->page_setup);
2238 }
2239
2240 if (page_setup != NULL((void*)0))
2241 g_object_unref (page_setup);
2242 g_object_unref (print_settings);
2243 g_object_unref (window);
2244}
2245
2246static void
2247eoc_window_cmd_file_open (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
2248 gpointer user_data)
2249{
2250 EocWindow *window;
2251 EocWindowPrivate *priv;
2252 EocImage *current;
2253 CtkWidget *dlg;
2254
2255 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)
;
2256
2257 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2258
2259 priv = window->priv;
2260
2261 dlg = eoc_file_chooser_new (CTK_FILE_CHOOSER_ACTION_OPEN);
2262 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 ()))))))
);
2263
2264 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 ()))))))
);
2265
2266 if (current != NULL((void*)0)) {
2267 gchar *dir_uri, *file_uri;
2268
2269 file_uri = eoc_image_get_uri_for_display (current);
2270 dir_uri = g_path_get_dirname (file_uri);
2271
2272 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 ()))))))
,
2273 dir_uri);
2274 g_free (file_uri);
2275 g_free (dir_uri);
2276 g_object_unref (current);
2277 } else {
2278 /* If desired by the user,
2279 fallback to the XDG_PICTURES_DIR (if available) */
2280 const gchar *pics_dir;
2281 gboolean use_fallback;
2282
2283 use_fallback = g_settings_get_boolean (priv->ui_settings,
2284 EOC_CONF_UI_FILECHOOSER_XDG_FALLBACK"filechooser-xdg-fallback");
2285 pics_dir = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
2286 if (use_fallback && pics_dir) {
2287 ctk_file_chooser_set_current_folder (CTK_FILE_CHOOSER (dlg)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_file_chooser_get_type ()))))))
,
2288 pics_dir);
2289 }
2290 }
2291
2292 g_signal_connect (dlg, "response",g_signal_connect_data ((dlg), ("response"), (((GCallback) (file_open_dialog_response_cb
))), (window), ((void*)0), (GConnectFlags) 0)
2293 G_CALLBACK (file_open_dialog_response_cb),g_signal_connect_data ((dlg), ("response"), (((GCallback) (file_open_dialog_response_cb
))), (window), ((void*)0), (GConnectFlags) 0)
2294 window)g_signal_connect_data ((dlg), ("response"), (((GCallback) (file_open_dialog_response_cb
))), (window), ((void*)0), (GConnectFlags) 0)
;
2295
2296 ctk_widget_show_all (dlg);
2297}
2298
2299static void
2300eoc_job_close_save_cb (EocJobSave *job, gpointer user_data)
2301{
2302 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2303
2304 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))
2305 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))
2306 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))
;
2307
2308 ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
2309}
2310
2311static void
2312close_confirmation_dialog_response_handler (EocCloseConfirmationDialog *dlg,
2313 gint response_id,
2314 EocWindow *window)
2315{
2316 GList *selected_images;
2317 EocWindowPrivate *priv;
2318
2319 priv = window->priv;
2320
2321 switch (response_id)
2322 {
2323 case CTK_RESPONSE_YES:
2324 /* save selected images */
2325 selected_images = eoc_close_confirmation_dialog_get_selected_images (dlg);
2326 if (eoc_window_save_images (window, selected_images)) {
2327 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)
2328 "finished",g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_close_save_cb))), (window), ((void*)0), (
GConnectFlags) 0)
2329 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)
2330 window)g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_close_save_cb))), (window), ((void*)0), (
GConnectFlags) 0)
;
2331
2332 eoc_job_queue_add_job (priv->save_job);
2333 }
2334
2335 break;
2336
2337 case CTK_RESPONSE_NO:
2338 /* dont save */
2339 ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
2340 break;
2341
2342 default:
2343 /* Cancel */
2344 ctk_widget_destroy (CTK_WIDGET (dlg)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_widget_get_type ()))))))
);
2345 break;
2346 }
2347}
2348
2349static gboolean
2350eoc_window_unsaved_images_confirm (EocWindow *window)
2351{
2352 EocWindowPrivate *priv;
2353 gboolean disabled;
2354 CtkWidget *dialog;
2355 GList *list;
2356 EocImage *image;
2357 CtkTreeIter iter;
2358
2359 priv = window->priv;
2360
2361 disabled = g_settings_get_boolean(priv->ui_settings,
2362 EOC_CONF_UI_DISABLE_CLOSE_CONFIRMATION"disable-close-confirmation");
2363 disabled |= window->priv->save_disabled;
2364 if (disabled || !priv->store) {
2365 return FALSE(0);
2366 }
2367
2368 list = NULL((void*)0);
2369 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)) {
2370 do {
2371 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,
2372 EOC_LIST_STORE_EOC_IMAGE, &image,
2373 -1);
2374 if (!image)
2375 continue;
2376
2377 if (eoc_image_is_modified (image)) {
2378 list = g_list_prepend (list, image);
2379 }
2380 } 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));
2381 }
2382
2383 if (list) {
2384 list = g_list_reverse (list);
2385 dialog = eoc_close_confirmation_dialog_new (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2386 list);
2387
2388 g_list_free (list);
2389 g_signal_connect (dialog,g_signal_connect_data ((dialog), ("response"), (((GCallback) (
close_confirmation_dialog_response_handler))), (window), ((void
*)0), (GConnectFlags) 0)
2390 "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
close_confirmation_dialog_response_handler))), (window), ((void
*)0), (GConnectFlags) 0)
2391 G_CALLBACK (close_confirmation_dialog_response_handler),g_signal_connect_data ((dialog), ("response"), (((GCallback) (
close_confirmation_dialog_response_handler))), (window), ((void
*)0), (GConnectFlags) 0)
2392 window)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
close_confirmation_dialog_response_handler))), (window), ((void
*)0), (GConnectFlags) 0)
;
2393 ctk_window_set_destroy_with_parent (CTK_WINDOW (dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_window_get_type ()))))))
, TRUE(!(0)));
2394
2395 ctk_widget_show (dialog);
2396 return TRUE(!(0));
2397
2398 }
2399 return FALSE(0);
2400}
2401
2402static void
2403eoc_window_cmd_close_window (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
2404 gpointer user_data)
2405{
2406 EocWindow *window;
2407 EocWindowPrivate *priv;
2408
2409 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)
;
2410
2411 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2412 priv = window->priv;
2413
2414 if (priv->save_job != NULL((void*)0)) {
2415 eoc_window_finish_saving (window);
2416 }
2417
2418 if (!eoc_window_unsaved_images_confirm (window)) {
2419 ctk_widget_destroy (CTK_WIDGET (user_data)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((ctk_widget_get_type ()))))))
);
2420 }
2421}
2422
2423static void
2424eoc_window_cmd_preferences (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
2425 gpointer user_data)
2426{
2427 EocWindow *window;
2428 CtkWidget *pref_dlg;
2429
2430 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)
;
2431
2432 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2433
2434 pref_dlg = eoc_preferences_dialog_get_instance (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
);
2435
2436 ctk_widget_show (pref_dlg);
2437}
2438
2439#define EOC_TB_EDITOR_DLG_RESET_RESPONSE128 128
2440
2441static void
2442eoc_window_cmd_edit_toolbar_cb (CtkDialog *dialog, gint response, gpointer data)
2443{
2444 EocWindow *window = EOC_WINDOW (data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_window_get_type ()))))))
;
2445
2446 if (response == EOC_TB_EDITOR_DLG_RESET_RESPONSE128) {
2447 EggToolbarsModel *model;
2448 EggToolbarEditor *editor;
2449
2450 editor = g_object_get_data (G_OBJECT (dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), (((GType) ((20) << (2))))))))
,
2451 "EggToolbarEditor");
2452
2453 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)
;
2454
2455 egg_editable_toolbar_set_edit_mode
2456 (EGG_EDITABLE_TOOLBAR (window->priv->toolbar)((((EggEditableToolbar*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((window->priv->toolbar)), ((egg_editable_toolbar_get_type
()))))))
, FALSE(0));
2457
2458 eoc_application_reset_toolbars_model (EOC_APP(eoc_application_get_instance ()));
2459 model = eoc_application_get_toolbars_model (EOC_APP(eoc_application_get_instance ()));
2460 egg_editable_toolbar_set_model
2461 (EGG_EDITABLE_TOOLBAR (window->priv->toolbar)((((EggEditableToolbar*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((window->priv->toolbar)), ((egg_editable_toolbar_get_type
()))))))
, model);
2462 egg_toolbar_editor_set_model (editor, model);
2463
2464 /* Toolbar would be uneditable now otherwise */
2465 egg_editable_toolbar_set_edit_mode
2466 (EGG_EDITABLE_TOOLBAR (window->priv->toolbar)((((EggEditableToolbar*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((window->priv->toolbar)), ((egg_editable_toolbar_get_type
()))))))
, TRUE(!(0)));
2467 } else if (response == CTK_RESPONSE_HELP) {
2468 eoc_util_show_help ("eoc-toolbareditor", NULL((void*)0));
2469 } else {
2470 egg_editable_toolbar_set_edit_mode
2471 (EGG_EDITABLE_TOOLBAR (window->priv->toolbar)((((EggEditableToolbar*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((window->priv->toolbar)), ((egg_editable_toolbar_get_type
()))))))
, FALSE(0));
2472
2473 eoc_application_save_toolbars_model (EOC_APP(eoc_application_get_instance ()));
2474
2475 ctk_widget_destroy (CTK_WIDGET (dialog)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_widget_get_type ()))))))
);
2476 }
2477}
2478
2479static void
2480eoc_window_cmd_edit_toolbar (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
2481 gpointer *user_data)
2482{
2483 EocWindow *window;
2484 CtkWidget *dialog;
2485 CtkWidget *editor;
2486
2487 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
2488
2489 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2490
2491 dialog = ctk_dialog_new_with_buttons (_("Toolbar Editor")gettext ("Toolbar Editor"),
2492 CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2493 CTK_DIALOG_DESTROY_WITH_PARENT,
2494 _("_Reset to Default")gettext ("_Reset to Default"),
2495 EOC_TB_EDITOR_DLG_RESET_RESPONSE128,
2496 "ctk-close",
2497 CTK_RESPONSE_CLOSE,
2498 "ctk-help",
2499 CTK_RESPONSE_HELP,
2500 NULL((void*)0));
2501
2502 ctk_dialog_set_default_response (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_dialog_get_type ()))))))
,
2503 CTK_RESPONSE_CLOSE);
2504
2505 ctk_container_set_border_width (CTK_CONTAINER (dialog)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_container_get_type ()))))))
, 5);
2506
2507 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);
2508
2509 ctk_window_set_default_size (CTK_WINDOW (dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_window_get_type ()))))))
, 500, 400);
2510
2511 editor = egg_toolbar_editor_new (window->priv->ui_mgr,
2512 eoc_application_get_toolbars_model (EOC_APP(eoc_application_get_instance ())));
2513
2514 ctk_container_set_border_width (CTK_CONTAINER (editor)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((editor)), ((ctk_container_get_type ()))))))
, 5);
2515
2516 // Use as much vertical space as available
2517 ctk_widget_set_vexpand (CTK_WIDGET (editor)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((editor)), ((ctk_widget_get_type ()))))))
, TRUE(!(0)));
2518
2519 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);
2520
2521 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);
2522
2523 egg_editable_toolbar_set_edit_mode
2524 (EGG_EDITABLE_TOOLBAR (window->priv->toolbar)((((EggEditableToolbar*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((window->priv->toolbar)), ((egg_editable_toolbar_get_type
()))))))
, TRUE(!(0)));
2525
2526 g_object_set_data (G_OBJECT (dialog)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), (((GType) ((20) << (2))))))))
, "EggToolbarEditor", editor);
2527
2528 g_signal_connect (dialog,g_signal_connect_data ((dialog), ("response"), (((GCallback) (
eoc_window_cmd_edit_toolbar_cb))), (window), ((void*)0), (GConnectFlags
) 0)
2529 "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
eoc_window_cmd_edit_toolbar_cb))), (window), ((void*)0), (GConnectFlags
) 0)
2530 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)
2531 window)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
eoc_window_cmd_edit_toolbar_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
2532
2533 ctk_widget_show_all (dialog);
2534}
2535
2536static void
2537eoc_window_cmd_help (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
2538 gpointer user_data)
2539{
2540 EocWindow *window;
2541
2542 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)
;
2543
2544 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2545
2546 eoc_util_show_help (NULL((void*)0), CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
);
2547}
2548
2549#define ABOUT_GROUP"About" "About"
2550#define EMAILIFY(string)(g_strdelimit ((string), "%", '@')) (g_strdelimit ((string), "%", '@'))
2551
2552static void
2553eoc_window_cmd_about (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
2554 gpointer user_data)
2555{
2556 EocWindow *window;
2557
2558 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)
;
2559
2560 const char *license[] = {
2561 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")
2562 "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")
2563 "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")
2564 "(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")
,
2565 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")
2566 "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")
2567 "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")
2568 "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")
,
2569 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."
)
2570 "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."
)
2571 "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."
)
2572 };
2573
2574 char *license_trans;
2575 GKeyFile *key_file;
2576 GBytes *bytes;
2577 const guint8 *data;
2578 gsize data_len;
2579 GError *error = NULL((void*)0);
2580 char **authors, **documenters;
2581 gsize n_authors = 0, n_documenters = 0 , i;
2582
2583 bytes = g_resources_lookup_data ("/org/cafe/eoc/ui/eoc.about", G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
2584 g_assert_no_error (error)do { if (error) g_assertion_message_error ("EOC", "eoc-window.c"
, 2584, ((const char*) (__func__)), "error", error, 0, 0); } while
(0)
;
2585
2586 data = g_bytes_get_data (bytes, &data_len);
2587 key_file = g_key_file_new ();
2588 g_key_file_load_from_data (key_file, (const char *) data, data_len, 0, &error);
2589 g_assert_no_error (error)do { if (error) g_assertion_message_error ("EOC", "eoc-window.c"
, 2589, ((const char*) (__func__)), "error", error, 0, 0); } while
(0)
;
2590
2591 authors = g_key_file_get_string_list (key_file, ABOUT_GROUP"About", "Authors", &n_authors, NULL((void*)0));
2592 documenters = g_key_file_get_string_list (key_file, ABOUT_GROUP"About", "Documenters", &n_documenters, NULL((void*)0));
2593
2594 g_key_file_free (key_file);
2595 g_bytes_unref (bytes);
2596
2597 for (i = 0; i < n_authors; ++i)
2598 authors[i] = EMAILIFY (authors[i])(g_strdelimit ((authors[i]), "%", '@'));
2599 for (i = 0; i < n_documenters; ++i)
2600 documenters[i] = EMAILIFY (documenters[i])(g_strdelimit ((documenters[i]), "%", '@'));
2601
2602 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));
2603
2604 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2605
2606 ctk_show_about_dialog (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2607 "program-name", _("Eye of CAFE")gettext ("Eye of CAFE"),
2608 "title", _("About Eye of CAFE")gettext ("About Eye of CAFE"),
2609 "version", VERSION"1.25.0",
2610 "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-2025 Pablo Barciela")
2611 "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-2025 Pablo Barciela")
2612 "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-2025 Pablo Barciela")
2613 "Copyright \xc2\xa9 2023-2025 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-2025 Pablo Barciela")
,
2614 "comments",_("The CAFE image viewer.")gettext ("The CAFE image viewer."),
2615 "authors", authors,
2616 "documenters", documenters,
2617 "translator-credits", _("translator-credits")gettext ("translator-credits"),
2618 "website", "http://www.cafe-desktop.org/",
2619 "logo-icon-name", "eoc",
2620 "wrap-license", TRUE(!(0)),
2621 "license", license_trans,
2622 NULL((void*)0));
2623
2624 g_strfreev (authors);
2625 g_strfreev (documenters);
2626 g_free (license_trans);
2627}
2628
2629static void
2630eoc_window_cmd_show_hide_bar (CtkAction *action, gpointer user_data)
2631{
2632 EocWindow *window;
2633 EocWindowPrivate *priv;
2634 gboolean visible;
2635 const gchar *action_name;
2636
2637 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)
;
2638
2639 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2640 priv = window->priv;
2641
2642 if (priv->mode != EOC_WINDOW_MODE_NORMAL &&
2643 priv->mode != EOC_WINDOW_MODE_FULLSCREEN) return;
2644
2645 visible = ctk_toggle_action_get_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
);
2646 action_name = ctk_action_get_name (action);
2647
2648 if (g_ascii_strcasecmp (action_name, "ViewToolbar") == 0) {
2649 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));
2650
2651 if (priv->mode == EOC_WINDOW_MODE_NORMAL)
2652 g_settings_set_boolean (priv->ui_settings, EOC_CONF_UI_TOOLBAR"toolbar", visible);
2653
2654 } else if (g_ascii_strcasecmp (action_name, "ViewStatusbar") == 0) {
2655 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));
2656
2657 if (priv->mode == EOC_WINDOW_MODE_NORMAL)
2658 g_settings_set_boolean (priv->ui_settings, EOC_CONF_UI_STATUSBAR"statusbar", visible);
2659
2660 } else if (g_ascii_strcasecmp (action_name, "ViewImageCollection") == 0) {
2661 if (visible) {
2662 /* Make sure the focus widget is realized to
2663 * avoid warnings on keypress events */
2664 if (!ctk_widget_get_realized (window->priv->thumbview))
2665 ctk_widget_realize (window->priv->thumbview);
2666
2667 ctk_widget_show (priv->nav);
2668 ctk_widget_grab_focus (priv->thumbview);
2669 } else {
2670 /* Make sure the focus widget is realized to
2671 * avoid warnings on keypress events.
2672 * Don't do it during init phase or the view
2673 * will get a bogus allocation. */
2674 if (!ctk_widget_get_realized (priv->view)
2675 && priv->status == EOC_WINDOW_STATUS_NORMAL)
2676 ctk_widget_realize (priv->view);
2677
2678 ctk_widget_hide (priv->nav);
2679
2680 if (ctk_widget_get_realized (priv->view))
2681 ctk_widget_grab_focus (priv->view);
2682 }
2683 g_settings_set_boolean (priv->ui_settings, EOC_CONF_UI_IMAGE_COLLECTION"image-collection", visible);
2684
2685 } else if (g_ascii_strcasecmp (action_name, "ViewSidebar") == 0) {
2686 if (visible) {
2687 ctk_widget_show (priv->sidebar);
2688 } else {
2689 ctk_widget_hide (priv->sidebar);
2690 }
2691 g_settings_set_boolean (priv->ui_settings, EOC_CONF_UI_SIDEBAR"sidebar", visible);
2692 }
2693}
2694
2695static void
2696wallpaper_info_bar_response (CtkInfoBar *bar G_GNUC_UNUSED__attribute__ ((__unused__)),
2697 gint response,
2698 EocWindow *window)
2699{
2700 if (response == CTK_RESPONSE_YES) {
2701 GAppInfo *app_info;
2702 GError *error = NULL((void*)0);
2703
2704 app_info = g_app_info_create_from_commandline ("cafe-appearance-properties --show-page=background",
2705 "cafe-appearance-properties",
2706 G_APP_INFO_CREATE_NONE,
2707 &error);
2708
2709 if (error != NULL((void*)0)) {
2710 g_warning ("%s%s", _("Error launching appearance preferences dialog: ")gettext ("Error launching appearance preferences dialog: "),
2711 error->message);
2712 g_error_free (error);
2713 error = NULL((void*)0);
2714 }
2715
2716 if (app_info != NULL((void*)0)) {
2717 CdkAppLaunchContext *context;
2718 CdkDisplay *display;
2719
2720 display = ctk_widget_get_display (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
2721 context = cdk_display_get_app_launch_context (display);
2722 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);
2723
2724 if (error != NULL((void*)0)) {
2725 g_warning ("%s%s", _("Error launching appearance preferences dialog: ")gettext ("Error launching appearance preferences dialog: "),
2726 error->message);
2727 g_error_free (error);
2728 error = NULL((void*)0);
2729 }
2730
2731 g_object_unref (context);
2732 g_object_unref (app_info);
2733 }
2734 }
2735
2736 /* Close message area on every response */
2737 eoc_window_set_message_area (window, NULL((void*)0));
2738}
2739
2740static void
2741eoc_window_set_wallpaper (EocWindow *window, const gchar *filename, const gchar *visible_filename)
2742{
2743 CtkWidget *info_bar;
2744 CtkWidget *image;
2745 CtkWidget *label;
2746 CtkWidget *hbox;
2747 gchar *markup;
2748 gchar *text;
2749 gchar *basename;
2750 GSettings *wallpaper_settings;
2751
2752 wallpaper_settings = g_settings_new (EOC_CONF_BACKGROUND_SCHEMA"org.cafe.background");
2753 g_settings_set_string (wallpaper_settings,
2754 EOC_CONF_BACKGROUND_FILE"picture-filename",
2755 filename);
2756 g_object_unref (wallpaper_settings);
2757
2758 /* I18N: When setting mnemonics for these strings, watch out to not
2759 clash with mnemonics from eoc's menubar */
2760 info_bar = ctk_info_bar_new_with_buttons (_("_Open Background Preferences")gettext ("_Open Background Preferences"),
2761 CTK_RESPONSE_YES,
2762 C_("MessageArea","Hi_de")g_dpgettext (((void*)0), "MessageArea" "\004" "Hi_de", strlen
("MessageArea") + 1)
,
2763 CTK_RESPONSE_NO, NULL((void*)0));
2764 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()))))))
,
2765 CTK_MESSAGE_QUESTION);
2766
2767 image = ctk_image_new_from_icon_name ("dialog-question",
2768 CTK_ICON_SIZE_DIALOG);
2769 label = ctk_label_new (NULL((void*)0));
2770
2771 if (!visible_filename)
2772 basename = g_path_get_basename (filename);
2773
2774 /* The newline character is currently necessary due to a problem
2775 * with the automatic line break. */
2776 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?")
2777 "\nWould you like to modify its appearance?")gettext ("The image \"%s\" has been set as Desktop Background."
"\nWould you like to modify its appearance?")
,
2778 visible_filename ? visible_filename : basename);
2779 markup = g_markup_printf_escaped ("<b>%s</b>", text);
2780 ctk_label_set_markup (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, markup);
2781 g_free (markup);
2782 g_free (text);
2783 if (!visible_filename)
2784 g_free (basename);
2785
2786 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 8);
2787 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);
2788 ctk_widget_set_halign (image, CTK_ALIGN_START);
2789 ctk_widget_set_valign (image, CTK_ALIGN_END);
2790 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);
2791 ctk_label_set_xalign (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, 0.0);
2792 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);
2793 ctk_widget_show_all (hbox);
2794 ctk_widget_show (info_bar);
2795
2796
2797 eoc_window_set_message_area (window, info_bar);
2798 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()))))))
,
2799 CTK_RESPONSE_YES);
2800 g_signal_connect (info_bar, "response",g_signal_connect_data ((info_bar), ("response"), (((GCallback
) (wallpaper_info_bar_response))), (window), ((void*)0), (GConnectFlags
) 0)
2801 G_CALLBACK (wallpaper_info_bar_response), window)g_signal_connect_data ((info_bar), ("response"), (((GCallback
) (wallpaper_info_bar_response))), (window), ((void*)0), (GConnectFlags
) 0)
;
2802}
2803
2804static void
2805eoc_job_save_cb (EocJobSave *job, gpointer user_data)
2806{
2807 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2808 CtkAction *action_save;
2809
2810 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))
2811 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))
2812 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))
;
2813
2814 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))
2815 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))
2816 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))
;
2817
2818 g_object_unref (window->priv->save_job);
2819 window->priv->save_job = NULL((void*)0);
2820
2821 update_status_bar (window);
2822 action_save = ctk_action_group_get_action (window->priv->actions_image,
2823 "ImageSave");
2824 ctk_action_set_sensitive (action_save, FALSE(0));
2825}
2826
2827static void
2828eoc_job_copy_cb (EocJobCopy *job, gpointer user_data)
2829{
2830 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2831 gchar *filepath, *basename, *filename, *extension;
2832 CtkAction *action;
2833 GFile *source_file, *dest_file;
2834
2835 /* Create source GFile */
2836 basename = g_file_get_basename (job->images->data);
2837 filepath = g_build_filename (job->dest, basename, NULL((void*)0));
2838 source_file = g_file_new_for_path (filepath);
2839 g_free (filepath);
2840
2841 /* Create destination GFile */
2842 extension = eoc_util_filename_get_extension (basename);
2843 filename = g_strdup_printf ("%s.%s", EOC_WALLPAPER_FILENAME"eoc-wallpaper", extension);
2844 filepath = g_build_filename (job->dest, filename, NULL((void*)0));
2845 dest_file = g_file_new_for_path (filepath);
2846 g_free (filename);
2847 g_free (extension);
2848
2849 /* Move the file */
2850 g_file_move (source_file, dest_file, G_FILE_COPY_OVERWRITE,
2851 NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0));
2852
2853 /* Set the wallpaper */
2854 eoc_window_set_wallpaper (window, filepath, basename);
2855 g_free (basename);
2856 g_free (filepath);
2857
2858 ctk_statusbar_pop (CTK_STATUSBAR (window->priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->statusbar)), ((ctk_statusbar_get_type
()))))))
,
2859 window->priv->copy_file_cid);
2860 action = ctk_action_group_get_action (window->priv->actions_image,
2861 "ImageSetAsWallpaper");
2862 ctk_action_set_sensitive (action, TRUE(!(0)));
2863
2864 window->priv->copy_job = NULL((void*)0);
2865
2866 g_object_unref (source_file);
2867 g_object_unref (dest_file);
2868 g_object_unref (G_OBJECT (job->images->data)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((job->images->data)), (((GType) ((20) << (2))
))))))
);
2869 g_list_free (job->images);
2870 g_object_unref (job);
2871}
2872
2873static gboolean
2874eoc_window_save_images (EocWindow *window, GList *images)
2875{
2876 EocWindowPrivate *priv;
2877
2878 priv = window->priv;
2879
2880 if (window->priv->save_job != NULL((void*)0))
2881 return FALSE(0);
2882
2883 priv->save_job = eoc_job_save_new (images);
2884
2885 g_signal_connect (priv->save_job,g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
2886 "finished",g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
2887 G_CALLBACK (eoc_job_save_cb),g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
2888 window)g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
2889
2890 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)
2891 "progress",g_signal_connect_data ((priv->save_job), ("progress"), (((
GCallback) (eoc_job_save_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
2892 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)
2893 window)g_signal_connect_data ((priv->save_job), ("progress"), (((
GCallback) (eoc_job_save_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
;
2894
2895 return TRUE(!(0));
2896}
2897
2898static void
2899eoc_window_cmd_save (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
2900 gpointer user_data)
2901{
2902 EocWindowPrivate *priv;
2903 EocWindow *window;
2904 GList *images;
2905
2906 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2907 priv = window->priv;
2908
2909 if (window->priv->save_job != NULL((void*)0))
2910 return;
2911
2912 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 ()))))))
);
2913
2914 if (eoc_window_save_images (window, images)) {
2915 eoc_job_queue_add_job (priv->save_job);
2916 }
2917}
2918
2919static GFile*
2920eoc_window_retrieve_save_as_file (EocWindow *window, EocImage *image)
2921{
2922 CtkWidget *dialog;
2923 GFile *save_file = NULL((void*)0);
2924 GFile *last_dest_folder;
2925 gint response;
2926
2927 g_assert (image != NULL)do { if (image != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 2927, ((const char*) (__func__)), "image != NULL"
); } while (0)
;
2928
2929 dialog = eoc_file_chooser_new (CTK_FILE_CHOOSER_ACTION_SAVE);
2930
2931 last_dest_folder = window->priv->last_save_as_folder;
2932
2933 if (last_dest_folder && g_file_query_exists (last_dest_folder, NULL((void*)0))) {
2934 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));
2935 ctk_file_chooser_set_current_name (CTK_FILE_CHOOSER (dialog)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_file_chooser_get_type ()))))))
,
2936 eoc_image_get_caption (image));
2937 } else {
2938 GFile *image_file;
2939
2940 image_file = eoc_image_get_file (image);
2941 /* Setting the file will also navigate to its parent folder */
2942 ctk_file_chooser_set_file (CTK_FILE_CHOOSER (dialog)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_file_chooser_get_type ()))))))
,
2943 image_file, NULL((void*)0));
2944 g_object_unref (image_file);
2945 }
2946
2947 response = ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_dialog_get_type ()))))))
);
2948 ctk_widget_hide (dialog);
2949
2950 if (response == CTK_RESPONSE_OK) {
2951 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 ()))))))
);
2952 if (window->priv->last_save_as_folder)
2953 g_object_unref (window->priv->last_save_as_folder);
2954 window->priv->last_save_as_folder = g_file_get_parent (save_file);
2955 }
2956 ctk_widget_destroy (dialog);
2957
2958 return save_file;
2959}
2960
2961static void
2962eoc_window_cmd_save_as (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
2963 gpointer user_data)
2964{
2965 EocWindowPrivate *priv;
2966 EocWindow *window;
2967 GList *images;
2968 guint n_images;
2969
2970 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
2971 priv = window->priv;
2972
2973 if (window->priv->save_job != NULL((void*)0))
2974 return;
2975
2976 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 ()))))))
);
2977 n_images = g_list_length (images);
2978
2979 if (n_images == 1) {
2980 GFile *file;
2981
2982 file = eoc_window_retrieve_save_as_file (window, images->data);
2983
2984 if (!file) {
2985 g_list_free (images);
2986 return;
2987 }
2988
2989 priv->save_job = eoc_job_save_as_new (images, NULL((void*)0), file);
2990
2991 g_object_unref (file);
2992 } else if (n_images > 1) {
2993 GFile *base_file;
2994 CtkWidget *dialog;
2995 gchar *basedir;
2996 EocURIConverter *converter;
2997
2998 basedir = g_get_current_dir ();
2999 base_file = g_file_new_for_path (basedir);
3000 g_free (basedir);
3001
3002 dialog = eoc_save_as_dialog_new (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
3003 images,
3004 base_file);
3005
3006 ctk_widget_show_all (dialog);
3007
3008 if (ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_dialog_get_type ()))))))
) != CTK_RESPONSE_OK) {
3009 g_object_unref (base_file);
3010 g_list_free (images);
3011 ctk_widget_destroy (dialog);
3012
3013 return;
3014 }
3015
3016 converter = eoc_save_as_dialog_get_converter (dialog);
3017
3018 g_assert (converter != NULL)do { if (converter != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 3018, ((const char*) (__func__)), "converter != NULL"
); } while (0)
;
3019
3020 priv->save_job = eoc_job_save_as_new (images, converter, NULL((void*)0));
3021
3022 ctk_widget_destroy (dialog);
3023
3024 g_object_unref (converter);
3025 g_object_unref (base_file);
3026 } else {
3027 /* n_images = 0 -- No Image selected */
3028 return;
3029 }
3030
3031 g_signal_connect (priv->save_job,g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3032 "finished",g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3033 G_CALLBACK (eoc_job_save_cb),g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3034 window)g_signal_connect_data ((priv->save_job), ("finished"), (((
GCallback) (eoc_job_save_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
3035
3036 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)
3037 "progress",g_signal_connect_data ((priv->save_job), ("progress"), (((
GCallback) (eoc_job_save_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
3038 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)
3039 window)g_signal_connect_data ((priv->save_job), ("progress"), (((
GCallback) (eoc_job_save_progress_cb))), (window), ((void*)0)
, (GConnectFlags) 0)
;
3040
3041 eoc_job_queue_add_job (priv->save_job);
3042}
3043
3044static void
3045eoc_window_cmd_open_containing_folder (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3046 gpointer user_data)
3047{
3048 EocWindowPrivate *priv;
3049
3050 GFile *file;
3051 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)
;
3052
3053 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3054
3055 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)
;
3056
3057 file = eoc_image_get_file (priv->image);
3058
3059 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)
;
3060
3061 eoc_util_show_file_in_filemanager (file,
3062 CTK_WINDOW (user_data)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((ctk_window_get_type ()))))))
);
3063}
3064
3065static void
3066eoc_window_cmd_print (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3067 gpointer user_data)
3068{
3069 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3070
3071 eoc_window_print (window);
3072}
3073
3074/**
3075 * eoc_window_get_properties_dialog:
3076 * @window: a #EocWindow
3077 *
3078 * Gets the @window property dialog. The widget will be built on the first call to this function.
3079 *
3080 * Returns: (transfer none): a #CtkDialog.
3081 */
3082
3083CtkWidget*
3084eoc_window_get_properties_dialog (EocWindow *window)
3085{
3086 EocWindowPrivate *priv;
3087
3088 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)
;
3089
3090 priv = window->priv;
3091
3092 if (priv->properties_dlg == NULL((void*)0)) {
3093 CtkAction *next_image_action, *previous_image_action;
3094
3095 next_image_action =
3096 ctk_action_group_get_action (priv->actions_collection,
3097 "GoNext");
3098
3099 previous_image_action =
3100 ctk_action_group_get_action (priv->actions_collection,
3101 "GoPrevious");
3102 priv->properties_dlg =
3103 eoc_properties_dialog_new (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
3104 EOC_THUMB_VIEW (priv->thumbview)((((EocThumbView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->thumbview)), ((eoc_thumb_view_get_type ()))))))
,
3105 next_image_action,
3106 previous_image_action);
3107
3108 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
()))))))
,
3109 priv->image);
3110 g_settings_bind (priv->ui_settings,
3111 EOC_CONF_UI_PROPSDIALOG_NETBOOK_MODE"propsdialog-netbook-mode",
3112 priv->properties_dlg, "netbook-mode",
3113 G_SETTINGS_BIND_GET);
3114 }
3115
3116 return priv->properties_dlg;
3117}
3118
3119static void
3120eoc_window_cmd_properties (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3121 gpointer user_data)
3122{
3123 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3124 CtkWidget *dialog;
3125
3126 dialog = eoc_window_get_properties_dialog (window);
3127 ctk_widget_show (dialog);
3128}
3129
3130static void
3131eoc_window_cmd_undo (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3132 gpointer user_data)
3133{
3134 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)
;
3135
3136 apply_transformation (EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
, NULL((void*)0));
3137}
3138
3139static void
3140eoc_window_cmd_flip_horizontal (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3141 gpointer user_data)
3142{
3143 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)
;
3144
3145 apply_transformation (EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
,
3146 eoc_transform_flip_new (EOC_TRANSFORM_FLIP_HORIZONTAL));
3147}
3148
3149static void
3150eoc_window_cmd_flip_vertical (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3151 gpointer user_data)
3152{
3153 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)
;
3154
3155 apply_transformation (EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
,
3156 eoc_transform_flip_new (EOC_TRANSFORM_FLIP_VERTICAL));
3157}
3158
3159static void
3160eoc_window_cmd_rotate_90 (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3161 gpointer user_data)
3162{
3163 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)
;
3164
3165 apply_transformation (EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
,
3166 eoc_transform_rotate_new (90));
3167}
3168
3169static void
3170eoc_window_cmd_rotate_270 (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3171 gpointer user_data)
3172{
3173 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)
;
3174
3175 apply_transformation (EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
,
3176 eoc_transform_rotate_new (270));
3177}
3178
3179static void
3180eoc_window_cmd_wallpaper (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3181 gpointer user_data)
3182{
3183 EocWindow *window;
3184 EocWindowPrivate *priv;
3185 EocImage *image;
3186 GFile *file;
3187 char *filename = NULL((void*)0);
3188
3189 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)
;
3190
3191 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3192 priv = window->priv;
3193
3194 /* If currently copying an image to set it as wallpaper, return. */
3195 if (priv->copy_job != NULL((void*)0))
3196 return;
3197
3198 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 ()))))))
);
3199
3200 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)
;
3201
3202 file = eoc_image_get_file (image);
3203
3204 filename = g_file_get_path (file);
3205
3206 /* Currently only local files can be set as wallpaper */
3207 if (filename == NULL((void*)0) || !eoc_util_file_is_persistent (file))
3208 {
3209 GList *files = NULL((void*)0);
3210 CtkAction *action;
3211
3212 action = ctk_action_group_get_action (window->priv->actions_image,
3213 "ImageSetAsWallpaper");
3214 ctk_action_set_sensitive (action, FALSE(0));
3215
3216 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 ()))))))
,
3217 "copy_file_cid");
3218 ctk_statusbar_push (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
3219 priv->copy_file_cid,
3220 _("Saving image locally…")gettext ("Saving image locally…"));
3221
3222 files = g_list_append (files, eoc_image_get_file (image));
3223 priv->copy_job = eoc_job_copy_new (files, g_get_user_data_dir ());
3224 g_signal_connect (priv->copy_job,g_signal_connect_data ((priv->copy_job), ("finished"), (((
GCallback) (eoc_job_copy_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3225 "finished",g_signal_connect_data ((priv->copy_job), ("finished"), (((
GCallback) (eoc_job_copy_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3226 G_CALLBACK (eoc_job_copy_cb),g_signal_connect_data ((priv->copy_job), ("finished"), (((
GCallback) (eoc_job_copy_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3227 window)g_signal_connect_data ((priv->copy_job), ("finished"), (((
GCallback) (eoc_job_copy_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
3228 g_signal_connect (priv->copy_job,g_signal_connect_data ((priv->copy_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3229 "progress",g_signal_connect_data ((priv->copy_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3230 G_CALLBACK (eoc_job_progress_cb),g_signal_connect_data ((priv->copy_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3231 window)g_signal_connect_data ((priv->copy_job), ("progress"), (((
GCallback) (eoc_job_progress_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
3232 eoc_job_queue_add_job (priv->copy_job);
3233
3234 g_object_unref (file);
3235 g_free (filename);
3236 return;
3237 }
3238
3239 g_object_unref (file);
3240
3241 eoc_window_set_wallpaper (window, filename, NULL((void*)0));
3242
3243 g_free (filename);
3244}
3245
3246static gboolean
3247eoc_window_all_images_trasheable (GList *images)
3248{
3249 GFile *file;
3250 GFileInfo *file_info;
3251 GList *iter;
3252 EocImage *image;
3253 gboolean can_trash = TRUE(!(0));
3254
3255 for (iter = images; iter != NULL((void*)0); iter = g_list_next (iter)((iter) ? (((GList *)(iter))->next) : ((void*)0))) {
3256 image = (EocImage *) iter->data;
3257 file = eoc_image_get_file (image);
3258 file_info = g_file_query_info (file,
3259 G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH"access::can-trash",
3260 0, NULL((void*)0), NULL((void*)0));
3261 can_trash = g_file_info_get_attribute_boolean (file_info,
3262 G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH"access::can-trash");
3263
3264 g_object_unref (file_info);
3265 g_object_unref (file);
3266
3267 if (can_trash == FALSE(0))
3268 break;
3269 }
3270
3271 return can_trash;
3272}
3273
3274static int
3275show_move_to_trash_confirm_dialog (EocWindow *window, GList *images, gboolean can_trash)
3276{
3277 CtkWidget *dlg;
3278 char *prompt;
3279 int response;
3280 int n_images;
3281 EocImage *image;
3282 static gboolean dontaskagain = FALSE(0);
3283 gboolean neverask = FALSE(0);
3284 CtkWidget* dontask_cbutton = NULL((void*)0);
3285
3286 /* Check if the user never wants to be bugged. */
3287 neverask = g_settings_get_boolean (window->priv->ui_settings,
3288 EOC_CONF_UI_DISABLE_TRASH_CONFIRMATION"disable-trash-confirmation");
3289
3290 /* Assume agreement, if the user doesn't want to be
3291 * asked and the trash is available */
3292 if (can_trash && (dontaskagain || neverask))
3293 return CTK_RESPONSE_OK;
3294
3295 n_images = g_list_length (images);
3296
3297 if (n_images == 1) {
3298 image = EOC_IMAGE (images->data)((((EocImage*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((images->data)), ((eoc_image_get_type ()))))))
;
3299 if (can_trash) {
3300 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?"
)
,
3301 eoc_image_get_caption (image));
3302 } else {
3303 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?")
3304 "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));
3305 }
3306 } else {
3307 if (can_trash) {
3308 prompt = g_strdup_printf (ngettext("Are you sure you want to move\n"
3309 "the %d selected image to the trash?",
3310 "Are you sure you want to move\n"
3311 "the %d selected images to the trash?", n_images), n_images);
3312 } else {
3313 prompt = g_strdup (_("Some of the selected images can't be moved to the trash "g_strdup_inline (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?"
))
3314 "and will be removed permanently. Are you sure you want "g_strdup_inline (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?"
))
3315 "to proceed?"))g_strdup_inline (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?"
))
;
3316 }
3317 }
3318
3319 dlg = ctk_message_dialog_new_with_markup (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
3320 CTK_DIALOG_MODAL | CTK_DIALOG_DESTROY_WITH_PARENT,
3321 CTK_MESSAGE_WARNING,
3322 CTK_BUTTONS_NONE,
3323 "<span weight=\"bold\" size=\"larger\">%s</span>",
3324 prompt);
3325 g_free (prompt);
3326
3327 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);
3328
3329 if (can_trash) {
3330 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);
3331
3332 dontask_cbutton = ctk_check_button_new_with_mnemonic (_("_Do not ask again during this session")gettext ("_Do not ask again during this session"));
3333 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));
3334
3335 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);
3336 } else {
3337 if (n_images == 1) {
3338 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);
3339 } else {
3340 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);
3341 }
3342 }
3343
3344 ctk_dialog_set_default_response (CTK_DIALOG (dlg)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_dialog_get_type ()))))))
, CTK_RESPONSE_OK);
3345 ctk_window_set_title (CTK_WINDOW (dlg)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_window_get_type ()))))))
, "");
3346 ctk_widget_show_all (dlg);
3347
3348 response = ctk_dialog_run (CTK_DIALOG (dlg)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_dialog_get_type ()))))))
);
3349
3350 /* Only update the property if the user has accepted */
3351 if (can_trash && response == CTK_RESPONSE_OK)
3352 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 ()))))))
);
3353
3354 /* The checkbutton is destroyed together with the dialog */
3355 ctk_widget_destroy (dlg);
3356
3357 return response;
3358}
3359
3360static gboolean
3361move_to_trash_real (EocImage *image, GError **error)
3362{
3363 GFile *file;
3364 GFileInfo *file_info;
3365 gboolean can_trash, result;
3366
3367 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)
;
3368
3369 file = eoc_image_get_file (image);
3370 file_info = g_file_query_info (file,
3371 G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH"access::can-trash",
3372 0, NULL((void*)0), NULL((void*)0));
3373 if (file_info == NULL((void*)0)) {
3374 g_set_error (error,
3375 EOC_WINDOW_ERROR(eoc_window_error_quark ()),
3376 EOC_WINDOW_ERROR_TRASH_NOT_FOUND,
3377 _("Couldn't access trash.")gettext ("Couldn't access trash."));
3378 return FALSE(0);
3379 }
3380
3381 can_trash = g_file_info_get_attribute_boolean (file_info,
3382 G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH"access::can-trash");
3383 g_object_unref (file_info);
3384 if (can_trash)
3385 {
3386 result = g_file_trash (file, NULL((void*)0), NULL((void*)0));
3387 if (result == FALSE(0)) {
3388 g_set_error (error,
3389 EOC_WINDOW_ERROR(eoc_window_error_quark ()),
3390 EOC_WINDOW_ERROR_TRASH_NOT_FOUND,
3391 _("Couldn't access trash.")gettext ("Couldn't access trash."));
3392 }
3393 } else {
3394 result = g_file_delete (file, NULL((void*)0), NULL((void*)0));
3395 if (result == FALSE(0)) {
3396 g_set_error (error,
3397 EOC_WINDOW_ERROR(eoc_window_error_quark ()),
3398 EOC_WINDOW_ERROR_IO,
3399 _("Couldn't delete file")gettext ("Couldn't delete file"));
3400 }
3401 }
3402
3403 g_object_unref (file);
3404
3405 return result;
3406}
3407
3408static void
3409eoc_window_cmd_copy_image (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3410 gpointer user_data)
3411{
3412 CtkClipboard *clipboard;
3413 EocWindow *window;
3414 EocWindowPrivate *priv;
3415 EocImage *image;
3416 EocClipboardHandler *cbhandler;
3417
3418 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)
;
3419
3420 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3421 priv = window->priv;
3422
3423 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 ()))))))
);
3424
3425 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)
;
3426
3427 clipboard = ctk_clipboard_get (CDK_SELECTION_CLIPBOARD((CdkAtom)((gpointer) (gulong) (69))));
3428
3429 cbhandler = eoc_clipboard_handler_new (image);
3430 // cbhandler will self-destruct when it's not needed anymore
3431 eoc_clipboard_handler_copy_to_clipboard (cbhandler, clipboard);
3432
3433}
3434
3435static void
3436eoc_window_cmd_move_to_trash (CtkAction *action, gpointer user_data)
3437{
3438 GList *images;
3439 GList *it;
3440 EocWindowPrivate *priv;
3441 EocListStore *list;
3442 int pos;
3443 EocImage *img;
3444 EocWindow *window;
3445 int response;
3446 int n_images;
3447 gboolean success;
3448 gboolean can_trash;
3449 const gchar *action_name;
3450
3451 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)
;
3452
3453 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3454 priv = window->priv;
3455 list = priv->store;
3456
3457 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 ()))))))
);
3458
3459 if (n_images < 1) return;
3460
3461 /* save position of selected image after the deletion */
3462 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 ()))))))
);
3463
3464 g_assert (images != NULL)do { if (images != ((void*)0)) ; else g_assertion_message_expr
("EOC", "eoc-window.c", 3464, ((const char*) (__func__)), "images != NULL"
); } while (0)
;
3465
3466 /* HACK: eoc_list_store_get_n_selected return list in reverse order */
3467 images = g_list_reverse (images);
3468
3469 can_trash = eoc_window_all_images_trasheable (images);
3470
3471 action_name = ctk_action_get_name (action);
3472
3473 if (g_ascii_strcasecmp (action_name, "Delete") == 0 ||
3474 can_trash == FALSE(0)) {
3475 response = show_move_to_trash_confirm_dialog (window, images, can_trash);
3476
3477 if (response != CTK_RESPONSE_OK) return;
3478 }
3479
3480 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 ()))))))
);
3481
3482 /* FIXME: make a nice progress dialog */
3483 /* Do the work actually. First try to delete the image from the disk. If this
3484 * is successful, remove it from the screen. Otherwise show error dialog.
3485 */
3486 for (it = images; it != NULL((void*)0); it = it->next) {
3487 GError *error = NULL((void*)0);
3488 EocImage *image;
3489
3490 image = EOC_IMAGE (it->data)((((EocImage*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((it->data)), ((eoc_image_get_type ()))))))
;
3491
3492 success = move_to_trash_real (image, &error);
3493
3494 if (success) {
3495 eoc_list_store_remove_image (list, image);
3496 } else {
3497 char *header;
3498 CtkWidget *dlg;
3499
3500 header = g_strdup_printf (_("Error on deleting image %s")gettext ("Error on deleting image %s"),
3501 eoc_image_get_caption (image));
3502
3503 dlg = ctk_message_dialog_new (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
3504 CTK_DIALOG_MODAL | CTK_DIALOG_DESTROY_WITH_PARENT,
3505 CTK_MESSAGE_ERROR,
3506 CTK_BUTTONS_OK,
3507 "%s", header);
3508
3509 ctk_message_dialog_format_secondary_text (CTK_MESSAGE_DIALOG (dlg)((((CtkMessageDialog*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((dlg)), ((ctk_message_dialog_get_type ()))))
))
,
3510 "%s", error->message);
3511
3512 ctk_dialog_run (CTK_DIALOG (dlg)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_dialog_get_type ()))))))
);
3513
3514 ctk_widget_destroy (dlg);
3515
3516 g_free (header);
3517 }
3518 }
3519
3520 /* free list */
3521 g_list_foreach (images, (GFunc) g_object_unref, NULL((void*)0));
3522 g_list_free (images);
3523
3524 /* select image at previously saved position */
3525 pos = MIN (pos, eoc_list_store_length (list) - 1)(((pos) < (eoc_list_store_length (list) - 1)) ? (pos) : (eoc_list_store_length
(list) - 1))
;
3526
3527 if (pos >= 0) {
3528 img = eoc_list_store_get_image_by_pos (list, pos);
3529
3530 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 ()))))))
,
3531 img,
3532 TRUE(!(0)));
3533
3534 if (img != NULL((void*)0)) {
3535 g_object_unref (img);
3536 }
3537 }
3538}
3539
3540static void
3541eoc_window_cmd_fullscreen (CtkAction *action, gpointer user_data)
3542{
3543 EocWindow *window;
3544 gboolean fullscreen;
3545
3546 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)
;
3547
3548 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3548, ((const char*) (__func__
))
);
3549
3550 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3551
3552 fullscreen = ctk_toggle_action_get_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
);
3553
3554 if (fullscreen) {
3555 eoc_window_run_fullscreen (window, FALSE(0));
3556 } else {
3557 eoc_window_stop_fullscreen (window, FALSE(0));
3558 }
3559}
3560
3561static void
3562eoc_window_cmd_slideshow (CtkAction *action, gpointer user_data)
3563{
3564 EocWindow *window;
3565 gboolean slideshow;
3566
3567 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)
;
3568
3569 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3569, ((const char*) (__func__
))
);
3570
3571 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3572
3573 slideshow = ctk_toggle_action_get_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
);
3574
3575 if (slideshow) {
3576 eoc_window_run_fullscreen (window, TRUE(!(0)));
3577 } else {
3578 eoc_window_stop_fullscreen (window, TRUE(!(0)));
3579 }
3580}
3581
3582static void
3583eoc_window_cmd_pause_slideshow (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3584 gpointer user_data)
3585{
3586 EocWindow *window;
3587 gboolean slideshow;
3588
3589 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)
;
3590
3591 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3591, ((const char*) (__func__
))
);
3592
3593 window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
3594
3595 slideshow = window->priv->mode == EOC_WINDOW_MODE_SLIDESHOW;
3596
3597 if (!slideshow && window->priv->mode != EOC_WINDOW_MODE_FULLSCREEN)
3598 return;
3599
3600 eoc_window_run_fullscreen (window, !slideshow);
3601}
3602
3603static void
3604eoc_window_cmd_zoom_in (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3605 gpointer user_data)
3606{
3607 EocWindowPrivate *priv;
3608
3609 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)
;
3610
3611 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3611, ((const char*) (__func__
))
);
3612
3613 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3614
3615 if (priv->view) {
3616 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));
3617 }
3618}
3619
3620static void
3621eoc_window_cmd_zoom_out (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3622 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_out (EOC_SCROLL_VIEW (priv->view)((((EocScrollView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->view)), ((eoc_scroll_view_get_type ()))))))
, FALSE(0));
3634 }
3635}
3636
3637static void
3638eoc_window_cmd_zoom_normal (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3639 gpointer user_data)
3640{
3641 EocWindowPrivate *priv;
3642
3643 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)
;
3644
3645 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3645, ((const char*) (__func__
))
);
3646
3647 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3648
3649 if (priv->view) {
3650 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);
3651 }
3652}
3653
3654static void
3655eoc_window_cmd_zoom_fit (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3656 gpointer user_data)
3657{
3658 EocWindowPrivate *priv;
3659
3660 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)
;
3661
3662 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3662, ((const char*) (__func__
))
);
3663
3664 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3665
3666 if (priv->view) {
3667 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 ()))))))
);
3668 }
3669}
3670
3671static void
3672eoc_window_cmd_go_prev (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3673 gpointer user_data)
3674{
3675 EocWindowPrivate *priv;
3676
3677 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)
;
3678
3679 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3679, ((const char*) (__func__
))
);
3680
3681 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3682
3683 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 ()))))))
,
3684 EOC_THUMB_VIEW_SELECT_LEFT);
3685}
3686
3687static void
3688eoc_window_cmd_go_next (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3689 gpointer user_data)
3690{
3691 EocWindowPrivate *priv;
3692
3693 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)
;
3694
3695 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3695, ((const char*) (__func__
))
);
3696
3697 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3698
3699 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 ()))))))
,
3700 EOC_THUMB_VIEW_SELECT_RIGHT);
3701}
3702
3703static void
3704eoc_window_cmd_go_first (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3705 gpointer user_data)
3706{
3707 EocWindowPrivate *priv;
3708
3709 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)
;
3710
3711 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3711, ((const char*) (__func__
))
);
3712
3713 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3714
3715 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 ()))))))
,
3716 EOC_THUMB_VIEW_SELECT_FIRST);
3717}
3718
3719static void
3720eoc_window_cmd_go_last (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3721 gpointer user_data)
3722{
3723 EocWindowPrivate *priv;
3724
3725 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)
;
3726
3727 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3727, ((const char*) (__func__
))
);
3728
3729 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3730
3731 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 ()))))))
,
3732 EOC_THUMB_VIEW_SELECT_LAST);
3733}
3734
3735static void
3736eoc_window_cmd_go_random (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3737 gpointer user_data)
3738{
3739 EocWindowPrivate *priv;
3740
3741 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)
;
3742
3743 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 3743, ((const char*) (__func__
))
);
3744
3745 priv = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
->priv;
3746
3747 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 ()))))))
,
3748 EOC_THUMB_VIEW_SELECT_RANDOM);
3749}
3750
3751static const CtkActionEntry action_entries_window[] = {
3752 { "Image", NULL((void*)0), N_("_Image")("_Image") },
3753 { "Edit", NULL((void*)0), N_("_Edit")("_Edit") },
3754 { "View", NULL((void*)0), N_("_View")("_View") },
3755 { "Go", NULL((void*)0), N_("_Go")("_Go") },
3756 { "Tools", NULL((void*)0), N_("_Tools")("_Tools") },
3757 { "Help", NULL((void*)0), N_("_Help")("_Help") },
3758
3759 { "ImageOpen", "document-open", N_("_Open…")("_Open…"), "<control>O",
3760 N_("Open a file")("Open a file"),
3761 G_CALLBACK (eoc_window_cmd_file_open)((GCallback) (eoc_window_cmd_file_open)) },
3762 { "ImageClose", "window-close", N_("_Close")("_Close"), "<control>W",
3763 N_("Close window")("Close window"),
3764 G_CALLBACK (eoc_window_cmd_close_window)((GCallback) (eoc_window_cmd_close_window)) },
3765 { "EditToolbar", NULL((void*)0), N_("T_oolbar")("T_oolbar"), NULL((void*)0),
3766 N_("Edit the application toolbar")("Edit the application toolbar"),
3767 G_CALLBACK (eoc_window_cmd_edit_toolbar)((GCallback) (eoc_window_cmd_edit_toolbar)) },
3768 { "EditPreferences", "preferences-desktop", N_("Prefere_nces")("Prefere_nces"), NULL((void*)0),
3769 N_("Preferences for Eye of CAFE")("Preferences for Eye of CAFE"),
3770 G_CALLBACK (eoc_window_cmd_preferences)((GCallback) (eoc_window_cmd_preferences)) },
3771 { "HelpManual", "help-browser", N_("_Contents")("_Contents"), "F1",
3772 N_("Help on this application")("Help on this application"),
3773 G_CALLBACK (eoc_window_cmd_help)((GCallback) (eoc_window_cmd_help)) },
3774 { "HelpAbout", "help-about", N_("_About")("_About"), NULL((void*)0),
3775 N_("About this application")("About this application"),
3776 G_CALLBACK (eoc_window_cmd_about)((GCallback) (eoc_window_cmd_about)) }
3777};
3778
3779static const CtkToggleActionEntry toggle_entries_window[] = {
3780 { "ViewToolbar", NULL((void*)0), N_("_Toolbar")("_Toolbar"), NULL((void*)0),
3781 N_("Changes the visibility of the toolbar in the current window")("Changes the visibility of the toolbar in the current window"
)
,
3782 G_CALLBACK (eoc_window_cmd_show_hide_bar)((GCallback) (eoc_window_cmd_show_hide_bar)), TRUE(!(0)) },
3783 { "ViewStatusbar", NULL((void*)0), N_("_Statusbar")("_Statusbar"), NULL((void*)0),
3784 N_("Changes the visibility of the statusbar in the current window")("Changes the visibility of the statusbar in the current window"
)
,
3785 G_CALLBACK (eoc_window_cmd_show_hide_bar)((GCallback) (eoc_window_cmd_show_hide_bar)), TRUE(!(0)) },
3786 { "ViewImageCollection", "eoc-image-collection", N_("_Image Collection")("_Image Collection"), "<control>F9",
3787 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"
)
,
3788 G_CALLBACK (eoc_window_cmd_show_hide_bar)((GCallback) (eoc_window_cmd_show_hide_bar)), TRUE(!(0)) },
3789 { "ViewSidebar", NULL((void*)0), N_("Side _Pane")("Side _Pane"), "F9",
3790 N_("Changes the visibility of the side pane in the current window")("Changes the visibility of the side pane in the current window"
)
,
3791 G_CALLBACK (eoc_window_cmd_show_hide_bar)((GCallback) (eoc_window_cmd_show_hide_bar)), TRUE(!(0)) },
3792};
3793
3794static const CtkActionEntry action_entries_image[] = {
3795 { "ImageSave", "document-save", N_("_Save")("_Save"), "<control>s",
3796 N_("Save changes in currently selected images")("Save changes in currently selected images"),
3797 G_CALLBACK (eoc_window_cmd_save)((GCallback) (eoc_window_cmd_save)) },
3798 { "ImageOpenWith", NULL((void*)0), N_("Open _with")("Open _with"), NULL((void*)0),
3799 N_("Open the selected image with a different application")("Open the selected image with a different application"),
3800 NULL((void*)0)},
3801 { "ImageSaveAs", "document-save-as", N_("Save _As…")("Save _As…"), "<control><shift>s",
3802 N_("Save the selected images with a different name")("Save the selected images with a different name"),
3803 G_CALLBACK (eoc_window_cmd_save_as)((GCallback) (eoc_window_cmd_save_as)) },
3804 { "ImageOpenContainingFolder", "folder", N_("Open Containing _Folder")("Open Containing _Folder"), NULL((void*)0),
3805 N_("Show the folder which contains this file in the file manager")("Show the folder which contains this file in the file manager"
)
,
3806 G_CALLBACK (eoc_window_cmd_open_containing_folder)((GCallback) (eoc_window_cmd_open_containing_folder)) },
3807 { "ImagePrint", "document-print", N_("_Print…")("_Print…"), "<control>p",
3808 N_("Print the selected image")("Print the selected image"),
3809 G_CALLBACK (eoc_window_cmd_print)((GCallback) (eoc_window_cmd_print)) },
3810 { "ImageProperties", "document-properties", N_("Prope_rties")("Prope_rties"), "<alt>Return",
3811 N_("Show the properties and metadata of the selected image")("Show the properties and metadata of the selected image"),
3812 G_CALLBACK (eoc_window_cmd_properties)((GCallback) (eoc_window_cmd_properties)) },
3813 { "EditUndo", "edit-undo", N_("_Undo")("_Undo"), "<control>z",
3814 N_("Undo the last change in the image")("Undo the last change in the image"),
3815 G_CALLBACK (eoc_window_cmd_undo)((GCallback) (eoc_window_cmd_undo)) },
3816 { "EditFlipHorizontal", "object-flip-horizontal", N_("Flip _Horizontal")("Flip _Horizontal"), NULL((void*)0),
3817 N_("Mirror the image horizontally")("Mirror the image horizontally"),
3818 G_CALLBACK (eoc_window_cmd_flip_horizontal)((GCallback) (eoc_window_cmd_flip_horizontal)) },
3819 { "EditFlipVertical", "object-flip-vertical", N_("Flip _Vertical")("Flip _Vertical"), NULL((void*)0),
3820 N_("Mirror the image vertically")("Mirror the image vertically"),
3821 G_CALLBACK (eoc_window_cmd_flip_vertical)((GCallback) (eoc_window_cmd_flip_vertical)) },
3822 { "EditRotate90", "object-rotate-right", N_("_Rotate Clockwise")("_Rotate Clockwise"), "<control>r",
3823 N_("Rotate the image 90 degrees to the right")("Rotate the image 90 degrees to the right"),
3824 G_CALLBACK (eoc_window_cmd_rotate_90)((GCallback) (eoc_window_cmd_rotate_90)) },
3825 { "EditRotate270", "object-rotate-left", N_("Rotate Counterc_lockwise")("Rotate Counterc_lockwise"), "<ctrl><shift>r",
3826 N_("Rotate the image 90 degrees to the left")("Rotate the image 90 degrees to the left"),
3827 G_CALLBACK (eoc_window_cmd_rotate_270)((GCallback) (eoc_window_cmd_rotate_270)) },
3828 { "ImageSetAsWallpaper", NULL((void*)0), N_("Set as _Desktop Background")("Set as _Desktop Background"),
3829 "<control>F8", N_("Set the selected image as the desktop background")("Set the selected image as the desktop background"),
3830 G_CALLBACK (eoc_window_cmd_wallpaper)((GCallback) (eoc_window_cmd_wallpaper)) },
3831 { "EditMoveToTrash", "user-trash", N_("Move to _Trash")("Move to _Trash"), NULL((void*)0),
3832 N_("Move the selected image to the trash folder")("Move the selected image to the trash folder"),
3833 G_CALLBACK (eoc_window_cmd_move_to_trash)((GCallback) (eoc_window_cmd_move_to_trash)) },
3834 { "EditCopyImage", "edit-copy", N_("_Copy")("_Copy"), "<control>C",
3835 N_("Copy the selected image to the clipboard")("Copy the selected image to the clipboard"),
3836 G_CALLBACK (eoc_window_cmd_copy_image)((GCallback) (eoc_window_cmd_copy_image)) },
3837 { "ViewZoomIn", "zoom-in", N_("_Zoom In")("_Zoom In"), "<control>plus",
3838 N_("Enlarge the image")("Enlarge the image"),
3839 G_CALLBACK (eoc_window_cmd_zoom_in)((GCallback) (eoc_window_cmd_zoom_in)) },
3840 { "ViewZoomOut", "zoom-out", N_("Zoom _Out")("Zoom _Out"), "<control>minus",
3841 N_("Shrink the image")("Shrink the image"),
3842 G_CALLBACK (eoc_window_cmd_zoom_out)((GCallback) (eoc_window_cmd_zoom_out)) },
3843 { "ViewZoomNormal", "zoom-original", N_("_Normal Size")("_Normal Size"), "<control>0",
3844 N_("Show the image at its normal size")("Show the image at its normal size"),
3845 G_CALLBACK (eoc_window_cmd_zoom_normal)((GCallback) (eoc_window_cmd_zoom_normal)) },
3846 { "ViewZoomFit", "zoom-fit-best", N_("_Best Fit")("_Best Fit"), "F",
3847 N_("Fit the image to the window")("Fit the image to the window"),
3848 G_CALLBACK (eoc_window_cmd_zoom_fit)((GCallback) (eoc_window_cmd_zoom_fit)) },
3849 { "ControlEqual", "zoom-in", N_("_Zoom In")("_Zoom In"), "<control>equal",
3850 N_("Enlarge the image")("Enlarge the image"),
3851 G_CALLBACK (eoc_window_cmd_zoom_in)((GCallback) (eoc_window_cmd_zoom_in)) },
3852 { "ControlKpAdd", "zoom-in", N_("_Zoom In")("_Zoom In"), "<control>KP_Add",
3853 N_("Shrink the image")("Shrink the image"),
3854 G_CALLBACK (eoc_window_cmd_zoom_in)((GCallback) (eoc_window_cmd_zoom_in)) },
3855 { "ControlKpSub", "zoom-out", N_("Zoom _Out")("Zoom _Out"), "<control>KP_Subtract",
3856 N_("Shrink the image")("Shrink the image"),
3857 G_CALLBACK (eoc_window_cmd_zoom_out)((GCallback) (eoc_window_cmd_zoom_out)) },
3858 { "Delete", NULL((void*)0), N_("Move to _Trash")("Move to _Trash"), "Delete",
3859 NULL((void*)0),
3860 G_CALLBACK (eoc_window_cmd_move_to_trash)((GCallback) (eoc_window_cmd_move_to_trash)) },
3861};
3862
3863static const CtkToggleActionEntry toggle_entries_image[] = {
3864 { "ViewFullscreen", "view-fullscreen", N_("_Fullscreen")("_Fullscreen"), "F11",
3865 N_("Show the current image in fullscreen mode")("Show the current image in fullscreen mode"),
3866 G_CALLBACK (eoc_window_cmd_fullscreen)((GCallback) (eoc_window_cmd_fullscreen)), FALSE(0) },
3867 { "PauseSlideshow", "media-playback-pause", N_("Pause Slideshow")("Pause Slideshow"),
3868 NULL((void*)0), N_("Pause or resume the slideshow")("Pause or resume the slideshow"),
3869 G_CALLBACK (eoc_window_cmd_pause_slideshow)((GCallback) (eoc_window_cmd_pause_slideshow)), FALSE(0) },
3870};
3871
3872static const CtkActionEntry action_entries_collection[] = {
3873 { "GoPrevious", "go-previous", N_("_Previous Image")("_Previous Image"), "<Alt>Left",
3874 N_("Go to the previous image of the collection")("Go to the previous image of the collection"),
3875 G_CALLBACK (eoc_window_cmd_go_prev)((GCallback) (eoc_window_cmd_go_prev)) },
3876 { "GoNext", "go-next", N_("_Next Image")("_Next Image"), "<Alt>Right",
3877 N_("Go to the next image of the collection")("Go to the next image of the collection"),
3878 G_CALLBACK (eoc_window_cmd_go_next)((GCallback) (eoc_window_cmd_go_next)) },
3879 { "GoFirst", "go-first", N_("_First Image")("_First Image"), "<Alt>Home",
3880 N_("Go to the first image of the collection")("Go to the first image of the collection"),
3881 G_CALLBACK (eoc_window_cmd_go_first)((GCallback) (eoc_window_cmd_go_first)) },
3882 { "GoLast", "go-last", N_("_Last Image")("_Last Image"), "<Alt>End",
3883 N_("Go to the last image of the collection")("Go to the last image of the collection"),
3884 G_CALLBACK (eoc_window_cmd_go_last)((GCallback) (eoc_window_cmd_go_last)) },
3885 { "GoRandom", NULL((void*)0), N_("_Random Image")("_Random Image"), "<control>M",
3886 N_("Go to a random image of the collection")("Go to a random image of the collection"),
3887 G_CALLBACK (eoc_window_cmd_go_random)((GCallback) (eoc_window_cmd_go_random)) },
3888 { "BackSpace", NULL((void*)0), N_("_Previous Image")("_Previous Image"), "BackSpace",
3889 NULL((void*)0),
3890 G_CALLBACK (eoc_window_cmd_go_prev)((GCallback) (eoc_window_cmd_go_prev)) },
3891 { "Home", NULL((void*)0), N_("_First Image")("_First Image"), "Home",
3892 NULL((void*)0),
3893 G_CALLBACK (eoc_window_cmd_go_first)((GCallback) (eoc_window_cmd_go_first)) },
3894 { "End", NULL((void*)0), N_("_Last Image")("_Last Image"), "End",
3895 NULL((void*)0),
3896 G_CALLBACK (eoc_window_cmd_go_last)((GCallback) (eoc_window_cmd_go_last)) },
3897};
3898
3899static const CtkToggleActionEntry toggle_entries_collection[] = {
3900 { "ViewSlideshow", "slideshow-play", N_("S_lideshow")("S_lideshow"), "F5",
3901 N_("Start a slideshow view of the images")("Start a slideshow view of the images"),
3902 G_CALLBACK (eoc_window_cmd_slideshow)((GCallback) (eoc_window_cmd_slideshow)), FALSE(0) },
3903};
3904
3905static void
3906menu_item_select_cb (CtkMenuItem *proxy, EocWindow *window)
3907{
3908 CtkAction *action;
3909 char *message;
3910
3911 action = ctk_activatable_get_related_action (CTK_ACTIVATABLE (proxy)((((CtkActivatable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((proxy)), ((ctk_activatable_get_type ()))))))
);
3912
3913 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)
;
3914
3915 g_object_get (G_OBJECT (action)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), (((GType) ((20) << (2))))))))
, "tooltip", &message, NULL((void*)0));
3916
3917 if (message) {
3918 ctk_statusbar_push (CTK_STATUSBAR (window->priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->statusbar)), ((ctk_statusbar_get_type
()))))))
,
3919 window->priv->tip_message_cid, message);
3920 g_free (message);
3921 }
3922}
3923
3924static void
3925menu_item_deselect_cb (CtkMenuItem *proxy G_GNUC_UNUSED__attribute__ ((__unused__)),
3926 EocWindow *window)
3927{
3928 ctk_statusbar_pop (CTK_STATUSBAR (window->priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->statusbar)), ((ctk_statusbar_get_type
()))))))
,
3929 window->priv->tip_message_cid);
3930}
3931
3932static void
3933connect_proxy_cb (CtkUIManager *manager,
3934 CtkAction *action,
3935 CtkWidget *proxy,
3936 EocWindow *window)
3937{
3938 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; }))))
) {
3939 disconnect_proxy_cb (manager, action, proxy, window);
3940 g_signal_connect (proxy, "select",g_signal_connect_data ((proxy), ("select"), (((GCallback) (menu_item_select_cb
))), (window), ((void*)0), (GConnectFlags) 0)
3941 G_CALLBACK (menu_item_select_cb), window)g_signal_connect_data ((proxy), ("select"), (((GCallback) (menu_item_select_cb
))), (window), ((void*)0), (GConnectFlags) 0)
;
3942 g_signal_connect (proxy, "deselect",g_signal_connect_data ((proxy), ("deselect"), (((GCallback) (
menu_item_deselect_cb))), (window), ((void*)0), (GConnectFlags
) 0)
3943 G_CALLBACK (menu_item_deselect_cb), window)g_signal_connect_data ((proxy), ("deselect"), (((GCallback) (
menu_item_deselect_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
3944 }
3945}
3946
3947static void
3948disconnect_proxy_cb (CtkUIManager *manager G_GNUC_UNUSED__attribute__ ((__unused__)),
3949 CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
3950 CtkWidget *proxy,
3951 EocWindow *window)
3952{
3953 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; }))))
) {
3954 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))
3955 (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))
;
3956 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))
3957 (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))
;
3958 }
3959}
3960
3961static void
3962set_action_properties (CtkActionGroup *window_group,
3963 CtkActionGroup *image_group,
3964 CtkActionGroup *collection_group)
3965{
3966 CtkAction *action;
3967
3968 action = ctk_action_group_get_action (collection_group, "GoPrevious");
3969 g_object_set (action, "short_label", _("Previous")gettext ("Previous"), NULL((void*)0));
3970 g_object_set (action, "is-important", TRUE(!(0)), NULL((void*)0));
3971
3972 action = ctk_action_group_get_action (collection_group, "GoNext");
3973 g_object_set (action, "short_label", _("Next")gettext ("Next"), NULL((void*)0));
3974 g_object_set (action, "is-important", TRUE(!(0)), NULL((void*)0));
3975
3976 action = ctk_action_group_get_action (image_group, "EditRotate90");
3977 g_object_set (action, "short_label", _("Right")gettext ("Right"), NULL((void*)0));
3978
3979 action = ctk_action_group_get_action (image_group, "EditRotate270");
3980 g_object_set (action, "short_label", _("Left")gettext ("Left"), NULL((void*)0));
3981
3982 action = ctk_action_group_get_action (image_group, "ImageOpenContainingFolder");
3983 g_object_set (action, "short_label", _("Open Folder")gettext ("Open Folder"), NULL((void*)0));
3984
3985 action = ctk_action_group_get_action (image_group, "ViewZoomIn");
3986 g_object_set (action, "short_label", _("In")gettext ("In"), NULL((void*)0));
3987
3988 action = ctk_action_group_get_action (image_group, "ViewZoomOut");
3989 g_object_set (action, "short_label", _("Out")gettext ("Out"), NULL((void*)0));
3990
3991 action = ctk_action_group_get_action (image_group, "ViewZoomNormal");
3992 g_object_set (action, "short_label", _("Normal")gettext ("Normal"), NULL((void*)0));
3993
3994 action = ctk_action_group_get_action (image_group, "ViewZoomFit");
3995 g_object_set (action, "short_label", _("Fit")gettext ("Fit"), NULL((void*)0));
3996
3997 action = ctk_action_group_get_action (window_group, "ViewImageCollection");
3998 g_object_set (action, "short_label", _("Collection")gettext ("Collection"), NULL((void*)0));
3999
4000 action = ctk_action_group_get_action (image_group, "EditMoveToTrash");
4001 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));
4002}
4003
4004static gint
4005sort_recents_mru (CtkRecentInfo *a, CtkRecentInfo *b)
4006{
4007 gboolean has_eoc_a, has_eoc_b;
4008
4009 /* We need to check this first as ctk_recent_info_get_application_info
4010 * will treat it as a non-fatal error when the CtkRecentInfo doesn't
4011 * have the application registered. */
4012 has_eoc_a = ctk_recent_info_has_application (a,
4013 EOC_RECENT_FILES_APP_NAME"Eye of CAFE Image Viewer");
4014 has_eoc_b = ctk_recent_info_has_application (b,
4015 EOC_RECENT_FILES_APP_NAME"Eye of CAFE Image Viewer");
4016 if (has_eoc_a && has_eoc_b) {
4017 GDateTime *time_a = NULL((void*)0);
4018 GDateTime *time_b = NULL((void*)0);
4019
4020 /* These should not fail as we already checked that
4021 * the application is registered with the info objects */
4022 ctk_recent_info_get_application_info (a,
4023 EOC_RECENT_FILES_APP_NAME"Eye of CAFE Image Viewer",
4024 NULL((void*)0),
4025 NULL((void*)0),
4026 &time_a);
4027 ctk_recent_info_get_application_info (b,
4028 EOC_RECENT_FILES_APP_NAME"Eye of CAFE Image Viewer",
4029 NULL((void*)0),
4030 NULL((void*)0),
4031 &time_b);
4032
4033 return (g_date_time_to_unix (time_b) - g_date_time_to_unix (time_a));
4034 } else if (has_eoc_a) {
4035 return -1;
4036 } else if (has_eoc_b) {
4037 return 1;
4038 }
4039
4040 return 0;
4041}
4042
4043static void
4044eoc_window_update_recent_files_menu (EocWindow *window)
4045{
4046 EocWindowPrivate *priv;
4047 GList *actions = NULL((void*)0), *li = NULL((void*)0), *items = NULL((void*)0);
4048 guint count_recent = 0;
4049
4050 priv = window->priv;
4051
4052 if (priv->recent_menu_id != 0)
4053 ctk_ui_manager_remove_ui (priv->ui_mgr, priv->recent_menu_id);
4054
4055 actions = ctk_action_group_list_actions (priv->actions_recent);
4056
4057 for (li = actions; li != NULL((void*)0); li = li->next) {
4058 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))
4059 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))
4060 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))
;
4061
4062 ctk_action_group_remove_action (priv->actions_recent,
4063 CTK_ACTION (li->data)((((CtkAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((li->data)), ((ctk_action_get_type ()))))))
);
4064 }
4065
4066 g_list_free (actions);
4067
4068 priv->recent_menu_id = ctk_ui_manager_new_merge_id (priv->ui_mgr);
4069 items = ctk_recent_manager_get_items (ctk_recent_manager_get_default());
4070 items = g_list_sort (items, (GCompareFunc) sort_recents_mru);
4071
4072 for (li = items; li != NULL((void*)0) && count_recent < EOC_RECENT_FILES_LIMIT5; li = li->next) {
4073 gchar *action_name;
4074 gchar *label;
4075 gchar *tip;
4076 gchar **display_name;
4077 gchar *label_filename;
4078 CtkAction *action;
4079 CtkRecentInfo *info = li->data;
4080
4081 /* Sorting moves non-EOC files to the end of the list.
4082 * So no file of interest will follow if this test fails */
4083 if (!ctk_recent_info_has_application (info, EOC_RECENT_FILES_APP_NAME"Eye of CAFE Image Viewer"))
4084 break;
4085
4086 count_recent++;
4087
4088 action_name = g_strdup_printf ("recent-info-%d", count_recent);
4089 display_name = g_strsplit (ctk_recent_info_get_display_name (info), "_", -1);
4090 label_filename = g_strjoinv ("__", display_name);
4091 label = g_strdup_printf ("%s_%d. %s",
4092 (is_rtl(ctk_widget_get_default_direction () == CTK_TEXT_DIR_RTL) ? "\xE2\x80\x8F" : ""), count_recent, label_filename);
4093 g_free (label_filename);
4094 g_strfreev (display_name);
4095
4096 tip = ctk_recent_info_get_uri_display (info);
4097
4098 /* This is a workaround for a bug (#351945) regarding
4099 * ctk_recent_info_get_uri_display() and remote URIs.
4100 * cafe_vfs_format_uri_for_display is sufficient here
4101 * since the password gets stripped when adding the
4102 * file to the recently used list. */
4103 if (tip == NULL((void*)0))
4104 tip = g_uri_unescape_string (ctk_recent_info_get_uri (info), NULL((void*)0));
4105
4106 action = ctk_action_new (action_name, label, tip, NULL((void*)0));
4107 ctk_action_set_always_show_image (action, TRUE(!(0)));
4108
4109 g_object_set_data_full (G_OBJECT (action)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), (((GType) ((20) << (2))))))))
, "ctk-recent-info",
4110 ctk_recent_info_ref (info),
4111 (GDestroyNotify) ctk_recent_info_unref);
4112
4113 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));
4114
4115 g_signal_connect (action, "activate",g_signal_connect_data ((action), ("activate"), (((GCallback) (
eoc_window_open_recent_cb))), (window), ((void*)0), (GConnectFlags
) 0)
4116 G_CALLBACK (eoc_window_open_recent_cb),g_signal_connect_data ((action), ("activate"), (((GCallback) (
eoc_window_open_recent_cb))), (window), ((void*)0), (GConnectFlags
) 0)
4117 window)g_signal_connect_data ((action), ("activate"), (((GCallback) (
eoc_window_open_recent_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
4118
4119 ctk_action_group_add_action (priv->actions_recent, action);
4120
4121 g_object_unref (action);
4122
4123 ctk_ui_manager_add_ui (priv->ui_mgr, priv->recent_menu_id,
4124 "/MainMenu/Image/RecentDocuments",
4125 action_name, action_name,
4126 CTK_UI_MANAGER_AUTO, FALSE(0));
4127
4128 g_free (action_name);
4129 g_free (label);
4130 g_free (tip);
4131 }
4132
4133 g_list_foreach (items, (GFunc) ctk_recent_info_unref, NULL((void*)0));
4134 g_list_free (items);
4135}
4136
4137static void
4138eoc_window_recent_manager_changed_cb (CtkRecentManager *manager G_GNUC_UNUSED__attribute__ ((__unused__)),
4139 EocWindow *window)
4140{
4141 eoc_window_update_recent_files_menu (window);
4142}
4143
4144static void
4145eoc_window_drag_data_received (CtkWidget *widget,
4146 CdkDragContext *context,
4147 gint x G_GNUC_UNUSED__attribute__ ((__unused__)),
4148 gint y G_GNUC_UNUSED__attribute__ ((__unused__)),
4149 CtkSelectionData *selection_data,
4150 guint info G_GNUC_UNUSED__attribute__ ((__unused__)),
4151 guint time)
4152{
4153 GSList *file_list;
4154 EocWindow *window;
4155 CdkAtom target;
4156 CtkWidget *src;
4157
4158 target = ctk_selection_data_get_target (selection_data);
4159
4160 if (!ctk_targets_include_uri (&target, 1))
4161 return;
4162
4163 /* if the request is from another process this will return NULL */
4164 src = ctk_drag_get_source_widget (context);
4165
4166 /* if the drag request originates from the current eoc instance, ignore
4167 the request if the source window is the same as the dest window */
4168 if (src &&
4169 ctk_widget_get_toplevel (src) == ctk_widget_get_toplevel (widget))
4170 {
4171 cdk_drag_status (context, 0, time);
4172 return;
4173 }
4174
4175 if (cdk_drag_context_get_suggested_action (context) == CDK_ACTION_COPY) {
4176 window = EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
;
4177
4178 file_list = eoc_util_parse_uri_string_list_to_file_list ((const gchar *) ctk_selection_data_get_data (selection_data));
4179
4180 eoc_window_open_file_list (window, file_list);
4181 }
4182}
4183
4184static void
4185eoc_window_set_drag_dest (EocWindow *window)
4186{
4187 ctk_drag_dest_set (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
,
4188 CTK_DEST_DEFAULT_MOTION | CTK_DEST_DEFAULT_DROP,
4189 NULL((void*)0), 0,
4190 CDK_ACTION_COPY | CDK_ACTION_ASK);
4191 ctk_drag_dest_add_uri_targets (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
4192}
4193
4194static void
4195eoc_window_sidebar_visibility_changed (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
4196 EocWindow *window)
4197{
4198 CtkAction *action;
4199 gboolean visible;
4200
4201 visible = ctk_widget_get_visible (window->priv->sidebar);
4202
4203 action = ctk_action_group_get_action (window->priv->actions_window,
4204 "ViewSidebar");
4205
4206 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)
4207 ctk_toggle_action_set_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
, visible);
4208
4209 /* Focus the image */
4210 if (!visible && window->priv->image != NULL((void*)0))
4211 ctk_widget_grab_focus (window->priv->view);
4212}
4213
4214static void
4215eoc_window_sidebar_page_added (EocSidebar *sidebar,
4216 CtkWidget *main_widget G_GNUC_UNUSED__attribute__ ((__unused__)),
4217 EocWindow *window)
4218{
4219 if (eoc_sidebar_get_n_pages (sidebar) == 1) {
4220 CtkAction *action;
4221 gboolean show;
4222
4223 action = ctk_action_group_get_action (window->priv->actions_window,
4224 "ViewSidebar");
4225
4226 ctk_action_set_sensitive (action, TRUE(!(0)));
4227
4228 show = ctk_toggle_action_get_active (CTK_TOGGLE_ACTION (action)((((CtkToggleAction*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action)), ((ctk_toggle_action_get_type ()))))))
);
4229
4230 if (show)
4231 ctk_widget_show (CTK_WIDGET (sidebar)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sidebar)), ((ctk_widget_get_type ()))))))
);
4232 }
4233}
4234static void
4235eoc_window_sidebar_page_removed (EocSidebar *sidebar,
4236 CtkWidget *main_widget G_GNUC_UNUSED__attribute__ ((__unused__)),
4237 EocWindow *window)
4238{
4239 if (eoc_sidebar_is_empty (sidebar)) {
4240 CtkAction *action;
4241
4242 ctk_widget_hide (CTK_WIDGET (sidebar)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sidebar)), ((ctk_widget_get_type ()))))))
);
4243
4244 action = ctk_action_group_get_action (window->priv->actions_window,
4245 "ViewSidebar");
4246
4247 ctk_action_set_sensitive (action, FALSE(0));
4248 }
4249}
4250
4251static void
4252eoc_window_finish_saving (EocWindow *window)
4253{
4254 EocWindowPrivate *priv = window->priv;
4255
4256 ctk_widget_set_sensitive (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
, FALSE(0));
4257
4258 do {
4259 ctk_main_iteration ();
4260 } while (priv->save_job != NULL((void*)0));
4261}
4262
4263static GAppInfo *
4264get_appinfo_for_editor (EocWindow *window)
4265{
4266 /* We want this function to always return the same thing, not
4267 * just for performance reasons, but because if someone edits
4268 * GConf while eoc is running, the application could get into an
4269 * inconsistent state. If the editor exists once, it gets added
4270 * to the "available" list of the EggToolbarsModel (for which
4271 * there is no API to remove it). If later the editor no longer
4272 * existed when constructing a new window, we'd be unable to
4273 * construct a CtkAction for the editor for that window, causing
4274 * assertion failures when viewing the "Edit Toolbars" dialog
4275 * (item is available, but can't find the CtkAction for it).
4276 *
4277 * By ensuring we keep the GAppInfo around, we avoid the
4278 * possibility of that situation occurring.
4279 */
4280 static GDesktopAppInfo *app_info = NULL((void*)0);
4281 static gboolean initialised;
4282
4283 if (!initialised) {
4284 gchar *editor;
4285
4286 editor = g_settings_get_string (window->priv->ui_settings,
4287 EOC_CONF_UI_EXTERNAL_EDITOR"external-editor");
4288
4289 if (editor != NULL((void*)0)) {
4290 app_info = g_desktop_app_info_new (editor);
4291 }
4292
4293 initialised = TRUE(!(0));
4294 g_free (editor);
4295 }
4296
4297 return (GAppInfo *) app_info;
4298}
4299
4300static void
4301eoc_window_open_editor (CtkAction *action G_GNUC_UNUSED__attribute__ ((__unused__)),
4302 EocWindow *window)
4303{
4304 CdkAppLaunchContext *context;
4305 GAppInfo *app_info;
4306 GList files;
4307
4308 app_info = get_appinfo_for_editor (window);
4309
4310 if (app_info == NULL((void*)0))
4311 return;
4312
4313 context = cdk_display_get_app_launch_context (
4314 ctk_widget_get_display (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
));
4315 cdk_app_launch_context_set_screen (context,
4316 ctk_widget_get_screen (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
));
4317 cdk_app_launch_context_set_icon (context,
4318 g_app_info_get_icon (app_info));
4319 cdk_app_launch_context_set_timestamp (context,
4320 ctk_get_current_event_time ());
4321
4322 {
4323 GList f = { eoc_image_get_file (window->priv->image) };
4324 files = f;
4325 }
4326
4327 g_app_info_launch (app_info, &files,
4328 G_APP_LAUNCH_CONTEXT (context)((((GAppLaunchContext*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((context)), ((g_app_launch_context_get_type
()))))))
, NULL((void*)0));
4329
4330 g_object_unref (files.data);
4331 g_object_unref (context);
4332}
4333
4334static void
4335eoc_window_add_open_editor_action (EocWindow *window)
4336{
4337 EggToolbarsModel *model;
4338 GAppInfo *app_info;
4339 CtkAction *action;
4340 gchar *tooltip;
4341
4342 app_info = get_appinfo_for_editor (window);
4343
4344 if (app_info == NULL((void*)0))
4345 return;
4346
4347 model = eoc_application_get_toolbars_model (EOC_APP(eoc_application_get_instance ()));
4348 egg_toolbars_model_set_name_flags (model, "OpenEditor",
4349 EGG_TB_MODEL_NAME_KNOWN);
4350
4351 tooltip = g_strdup_printf (_("Edit the current image using %s")gettext ("Edit the current image using %s"),
4352 g_app_info_get_name (app_info));
4353 action = ctk_action_new ("OpenEditor", _("Edit Image")gettext ("Edit Image"), tooltip, NULL((void*)0));
4354 ctk_action_set_gicon (action, g_app_info_get_icon (app_info));
4355 ctk_action_set_is_important (action, TRUE(!(0)));
4356
4357 g_signal_connect (action, "activate",g_signal_connect_data ((action), ("activate"), (((GCallback) (
eoc_window_open_editor))), (window), ((void*)0), (GConnectFlags
) 0)
4358 G_CALLBACK (eoc_window_open_editor), window)g_signal_connect_data ((action), ("activate"), (((GCallback) (
eoc_window_open_editor))), (window), ((void*)0), (GConnectFlags
) 0)
;
4359
4360 ctk_action_group_add_action (window->priv->actions_image, action);
4361
4362 g_object_unref (action);
4363 g_free (tooltip);
4364}
4365
4366static void
4367eoc_window_construct_ui (EocWindow *window)
4368{
4369 EocWindowPrivate *priv;
4370
4371 GError *error = NULL((void*)0);
4372
4373 CtkWidget *menubar;
4374 CtkWidget *thumb_popup;
4375 CtkWidget *view_popup;
4376 CtkWidget *hpaned;
4377 CtkWidget *menuitem;
4378
4379 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)
;
4380
4381 priv = window->priv;
4382
4383 priv->box = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4384 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, priv->box);
4385 ctk_widget_show (priv->box);
4386
4387 priv->ui_mgr = ctk_ui_manager_new ();
4388
4389 priv->actions_window = ctk_action_group_new ("MenuActionsWindow");
4390
4391 ctk_action_group_set_translation_domain (priv->actions_window,
4392 GETTEXT_PACKAGE"eoc");
4393
4394 ctk_action_group_add_actions (priv->actions_window,
4395 action_entries_window,
4396 G_N_ELEMENTS (action_entries_window)(sizeof (action_entries_window) / sizeof ((action_entries_window
)[0]))
,
4397 window);
4398
4399 ctk_action_group_add_toggle_actions (priv->actions_window,
4400 toggle_entries_window,
4401 G_N_ELEMENTS (toggle_entries_window)(sizeof (toggle_entries_window) / sizeof ((toggle_entries_window
)[0]))
,
4402 window);
4403
4404 ctk_ui_manager_insert_action_group (priv->ui_mgr, priv->actions_window, 0);
4405
4406 priv->actions_image = ctk_action_group_new ("MenuActionsImage");
4407 ctk_action_group_set_translation_domain (priv->actions_image,
4408 GETTEXT_PACKAGE"eoc");
4409
4410 ctk_action_group_add_actions (priv->actions_image,
4411 action_entries_image,
4412 G_N_ELEMENTS (action_entries_image)(sizeof (action_entries_image) / sizeof ((action_entries_image
)[0]))
,
4413 window);
4414
4415 eoc_window_add_open_editor_action (window);
4416
4417 ctk_action_group_add_toggle_actions (priv->actions_image,
4418 toggle_entries_image,
4419 G_N_ELEMENTS (toggle_entries_image)(sizeof (toggle_entries_image) / sizeof ((toggle_entries_image
)[0]))
,
4420 window);
4421
4422 ctk_ui_manager_insert_action_group (priv->ui_mgr, priv->actions_image, 0);
4423
4424 priv->actions_collection = ctk_action_group_new ("MenuActionsCollection");
4425 ctk_action_group_set_translation_domain (priv->actions_collection,
4426 GETTEXT_PACKAGE"eoc");
4427
4428 ctk_action_group_add_actions (priv->actions_collection,
4429 action_entries_collection,
4430 G_N_ELEMENTS (action_entries_collection)(sizeof (action_entries_collection) / sizeof ((action_entries_collection
)[0]))
,
4431 window);
4432
4433 ctk_action_group_add_toggle_actions (priv->actions_collection,
4434 toggle_entries_collection,
4435 G_N_ELEMENTS (toggle_entries_collection)(sizeof (toggle_entries_collection) / sizeof ((toggle_entries_collection
)[0]))
,
4436 window);
4437
4438 set_action_properties (priv->actions_window,
4439 priv->actions_image,
4440 priv->actions_collection);
4441
4442 ctk_ui_manager_insert_action_group (priv->ui_mgr, priv->actions_collection, 0);
4443
4444 if (!ctk_ui_manager_add_ui_from_resource (priv->ui_mgr,
4445 "/org/cafe/eoc/ui/eoc-ui.xml",
4446 &error)) {
4447 g_warning ("building menus failed: %s", error->message);
4448 g_error_free (error);
4449 }
4450
4451 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)
4452 G_CALLBACK (connect_proxy_cb), window)g_signal_connect_data ((priv->ui_mgr), ("connect_proxy"), (
((GCallback) (connect_proxy_cb))), (window), ((void*)0), (GConnectFlags
) 0)
;
4453 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)
4454 G_CALLBACK (disconnect_proxy_cb), window)g_signal_connect_data ((priv->ui_mgr), ("disconnect_proxy"
), (((GCallback) (disconnect_proxy_cb))), (window), ((void*)0
), (GConnectFlags) 0)
;
4455
4456 menubar = ctk_ui_manager_get_widget (priv->ui_mgr, "/MainMenu");
4457 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", 4457, ((const
char*) (__func__)), "CTK_IS_WIDGET (menubar)"); } while (0)
;
4458 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);
4459 ctk_widget_show (menubar);
4460
4461 menuitem = ctk_ui_manager_get_widget (priv->ui_mgr,
4462 "/MainMenu/Edit/EditFlipHorizontal");
4463 ctk_image_menu_item_set_always_show_image (
4464 CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, TRUE(!(0)));
4465
4466 menuitem = ctk_ui_manager_get_widget (priv->ui_mgr,
4467 "/MainMenu/Edit/EditFlipVertical");
4468 ctk_image_menu_item_set_always_show_image (
4469 CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, TRUE(!(0)));
4470
4471 menuitem = ctk_ui_manager_get_widget (priv->ui_mgr,
4472 "/MainMenu/Edit/EditRotate90");
4473 ctk_image_menu_item_set_always_show_image (
4474 CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, TRUE(!(0)));
4475
4476 menuitem = ctk_ui_manager_get_widget (priv->ui_mgr,
4477 "/MainMenu/Edit/EditRotate270");
4478 ctk_image_menu_item_set_always_show_image (
4479 CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, TRUE(!(0)));
4480
4481 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
()))))))
4482 (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
()))))))
4483 "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
()))))))
4484 "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
()))))))
4485 "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
()))))))
4486 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
()))))))
;
4487
4488 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 ()))))))
),
4489 CTK_STYLE_CLASS_PRIMARY_TOOLBAR"primary-toolbar");
4490
4491 egg_editable_toolbar_show (EGG_EDITABLE_TOOLBAR (priv->toolbar)((((EggEditableToolbar*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((priv->toolbar)), ((egg_editable_toolbar_get_type
()))))))
,
4492 "Toolbar");
4493
4494 ctk_box_pack_start (CTK_BOX (priv->box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->box)), ((ctk_box_get_type ()))))))
,
4495 priv->toolbar,
4496 FALSE(0),
4497 FALSE(0),
4498 0);
4499
4500 ctk_widget_show (priv->toolbar);
4501
4502 ctk_window_add_accel_group (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
4503 ctk_ui_manager_get_accel_group (priv->ui_mgr));
4504
4505 priv->actions_recent = ctk_action_group_new ("RecentFilesActions");
4506 ctk_action_group_set_translation_domain (priv->actions_recent,
4507 GETTEXT_PACKAGE"eoc");
4508
4509 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)
4510 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)
4511 window)g_signal_connect_data ((ctk_recent_manager_get_default ()), (
"changed"), (((GCallback) (eoc_window_recent_manager_changed_cb
))), (window), ((void*)0), (GConnectFlags) 0)
;
4512
4513 eoc_window_update_recent_files_menu (window);
4514
4515 ctk_ui_manager_insert_action_group (priv->ui_mgr, priv->actions_recent, 0);
4516
4517 priv->cbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4518 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);
4519 ctk_widget_show (priv->cbox);
4520
4521 priv->statusbar = eoc_statusbar_new ();
4522 ctk_box_pack_end (CTK_BOX (priv->box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->box)), ((ctk_box_get_type ()))))))
,
4523 CTK_WIDGET (priv->statusbar)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_widget_get_type ()))))))
,
4524 FALSE(0), FALSE(0), 0);
4525 ctk_widget_show (priv->statusbar);
4526
4527 priv->image_info_message_cid =
4528 ctk_statusbar_get_context_id (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
4529 "image_info_message");
4530 priv->tip_message_cid =
4531 ctk_statusbar_get_context_id (CTK_STATUSBAR (priv->statusbar)((((CtkStatusbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->statusbar)), ((ctk_statusbar_get_type ()))))))
,
4532 "tip_message");
4533
4534 priv->layout = ctk_box_new (CTK_ORIENTATION_VERTICAL, 2);
4535
4536 hpaned = ctk_paned_new (CTK_ORIENTATION_HORIZONTAL);
4537
4538 priv->sidebar = eoc_sidebar_new ();
4539 /* The sidebar shouldn't be shown automatically on show_all(),
4540 but only when the user actually wants it. */
4541 ctk_widget_set_no_show_all (priv->sidebar, TRUE(!(0)));
4542
4543 ctk_widget_set_size_request (priv->sidebar, 210, -1);
4544
4545 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)
4546 "show",g_signal_connect_data ((priv->sidebar), ("show"), (((GCallback
) (eoc_window_sidebar_visibility_changed))), (window), ((void
*)0), G_CONNECT_AFTER)
4547 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)
4548 window)g_signal_connect_data ((priv->sidebar), ("show"), (((GCallback
) (eoc_window_sidebar_visibility_changed))), (window), ((void
*)0), G_CONNECT_AFTER)
;
4549
4550 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)
4551 "hide",g_signal_connect_data ((priv->sidebar), ("hide"), (((GCallback
) (eoc_window_sidebar_visibility_changed))), (window), ((void
*)0), G_CONNECT_AFTER)
4552 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)
4553 window)g_signal_connect_data ((priv->sidebar), ("hide"), (((GCallback
) (eoc_window_sidebar_visibility_changed))), (window), ((void
*)0), G_CONNECT_AFTER)
;
4554
4555 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)
4556 "page-added",g_signal_connect_data ((priv->sidebar), ("page-added"), ((
(GCallback) (eoc_window_sidebar_page_added))), (window), ((void
*)0), G_CONNECT_AFTER)
4557 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)
4558 window)g_signal_connect_data ((priv->sidebar), ("page-added"), ((
(GCallback) (eoc_window_sidebar_page_added))), (window), ((void
*)0), G_CONNECT_AFTER)
;
4559
4560 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)
4561 "page-removed",g_signal_connect_data ((priv->sidebar), ("page-removed"), (
((GCallback) (eoc_window_sidebar_page_removed))), (window), (
(void*)0), G_CONNECT_AFTER)
4562 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)
4563 window)g_signal_connect_data ((priv->sidebar), ("page-removed"), (
((GCallback) (eoc_window_sidebar_page_removed))), (window), (
(void*)0), G_CONNECT_AFTER)
;
4564
4565 priv->view = eoc_scroll_view_new ();
4566
4567 eoc_sidebar_add_page (EOC_SIDEBAR (priv->sidebar)((((EocSidebar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->sidebar)), ((eoc_sidebar_get_type()))))))
,
4568 _("Properties")gettext ("Properties"),
4569 CTK_WIDGET (eoc_metadata_sidebar_new (window))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((eoc_metadata_sidebar_new (window))), ((ctk_widget_get_type
()))))))
);
4570
4571 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);
4572 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)
4573 "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)
4574 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)
4575 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)
;
4576
4577 g_settings_bind (priv->view_settings, EOC_CONF_VIEW_SCROLL_WHEEL_ZOOM"scroll-wheel-zoom",
4578 priv->view, "scrollwheel-zoom", G_SETTINGS_BIND_GET);
4579 g_settings_bind (priv->view_settings, EOC_CONF_VIEW_ZOOM_MULTIPLIER"zoom-multiplier",
4580 priv->view, "zoom-multiplier", G_SETTINGS_BIND_GET);
4581
4582 view_popup = ctk_ui_manager_get_widget (priv->ui_mgr, "/ViewPopup");
4583 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 ()))))))
,
4584 CTK_MENU (view_popup)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((view_popup)), ((ctk_menu_get_type ()))))))
);
4585
4586 ctk_paned_pack1 (CTK_PANED (hpaned)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned)), ((ctk_paned_get_type ()))))))
,
4587 priv->sidebar,
4588 FALSE(0),
4589 FALSE(0));
4590
4591 ctk_paned_pack2 (CTK_PANED (hpaned)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned)), ((ctk_paned_get_type ()))))))
,
4592 priv->view,
4593 TRUE(!(0)),
4594 FALSE(0));
4595
4596 ctk_widget_show_all (hpaned);
4597
4598 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);
4599
4600 priv->thumbview = g_object_ref (eoc_thumb_view_new ())((__typeof__ (eoc_thumb_view_new ())) (g_object_ref) (eoc_thumb_view_new
()))
;
4601
4602 /* giving shape to the view */
4603 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);
4604 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);
4605
4606 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)
4607 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)
;
4608
4609 priv->nav = eoc_thumb_nav_new (priv->thumbview,
4610 EOC_THUMB_NAV_MODE_ONE_ROW,
4611 g_settings_get_boolean (priv->ui_settings,
4612 EOC_CONF_UI_SCROLL_BUTTONS"scroll-buttons"));
4613
4614 // Bind the scroll buttons to their GSettings key
4615 g_settings_bind (priv->ui_settings, EOC_CONF_UI_SCROLL_BUTTONS"scroll-buttons",
4616 priv->nav, "show-buttons", G_SETTINGS_BIND_GET);
4617
4618 thumb_popup = ctk_ui_manager_get_widget (priv->ui_mgr, "/ThumbnailPopup");
4619 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 ()))))))
,
4620 CTK_MENU (thumb_popup)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((thumb_popup)), ((ctk_menu_get_type ()))))))
);
4621
4622 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);
4623
4624 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);
4625
4626 eoc_window_can_save_changed_cb (priv->lockdown_settings,
4627 EOC_CONF_LOCKDOWN_CAN_SAVE"disable-save-to-disk",
4628 window);
4629 g_settings_bind (priv->ui_settings, EOC_CONF_UI_IMAGE_COLLECTION_POSITION"image-collection-position",
4630 window, "collection-position", G_SETTINGS_BIND_GET);
4631 g_settings_bind (priv->ui_settings, EOC_CONF_UI_IMAGE_COLLECTION_RESIZABLE"image-collection-resizable",
4632 window, "collection-resizable", G_SETTINGS_BIND_GET);
4633
4634 update_action_groups_state (window);
4635
4636 if ((priv->flags & EOC_STARTUP_FULLSCREEN) ||
4637 (priv->flags & EOC_STARTUP_SLIDE_SHOW)) {
4638 eoc_window_run_fullscreen (window, (priv->flags & EOC_STARTUP_SLIDE_SHOW));
4639 } else {
4640 priv->mode = EOC_WINDOW_MODE_NORMAL;
4641 update_ui_visibility (window);
4642 }
4643
4644 eoc_window_set_drag_dest (window);
4645}
4646
4647static void
4648eoc_window_init (EocWindow *window)
4649{
4650 CdkGeometry hints;
4651 CdkScreen *screen;
4652 EocWindowPrivate *priv;
4653
4654 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 4654, ((const char*) (__func__
))
);
4655
4656 CtkStyleContext *context;
4657
4658 context = ctk_widget_get_style_context (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
4659 ctk_style_context_add_class (context, "eoc-window");
4660
4661 hints.min_width = EOC_WINDOW_MIN_WIDTH440;
4662 hints.min_height = EOC_WINDOW_MIN_HEIGHT350;
4663
4664 screen = ctk_widget_get_screen (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
4665
4666 priv = window->priv = eoc_window_get_instance_private (window);
4667
4668 priv->view_settings = g_settings_new (EOC_CONF_VIEW"org.cafe.eoc"".view");
4669 priv->ui_settings = g_settings_new (EOC_CONF_UI"org.cafe.eoc"".ui");
4670 priv->fullscreen_settings = g_settings_new (EOC_CONF_FULLSCREEN"org.cafe.eoc"".full-screen");
4671 priv->lockdown_settings = g_settings_new (EOC_CONF_LOCKDOWN_SCHEMA"org.cafe.lockdown");
4672
4673 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)
4674 "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)
4675 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)
4676 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)
;
4677
4678 window->priv->store = NULL((void*)0);
4679 window->priv->image = NULL((void*)0);
4680
4681 window->priv->fullscreen_popup = NULL((void*)0);
4682 window->priv->fullscreen_timeout_source = NULL((void*)0);
4683 window->priv->slideshow_random = FALSE(0);
4684 window->priv->slideshow_loop = FALSE(0);
4685 window->priv->slideshow_switch_timeout = 0;
4686 window->priv->slideshow_switch_source = NULL((void*)0);
4687 window->priv->fullscreen_idle_inhibit_cookie = 0;
4688
4689 ctk_window_set_geometry_hints (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
4690 CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
,
4691 &hints,
4692 CDK_HINT_MIN_SIZE);
4693
4694 ctk_window_set_default_size (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
4695 EOC_WINDOW_DEFAULT_WIDTH540,
4696 EOC_WINDOW_DEFAULT_HEIGHT450);
4697
4698 ctk_window_set_position (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, CTK_WIN_POS_CENTER);
4699
4700 window->priv->mode = EOC_WINDOW_MODE_UNKNOWN;
4701 window->priv->status = EOC_WINDOW_STATUS_UNKNOWN;
4702
4703#if defined(HAVE_LCMS1) && defined(CDK_WINDOWING_X11)
4704 window->priv->display_profile =
4705 eoc_window_get_display_profile (screen);
4706#endif
4707
4708 window->priv->recent_menu_id = 0;
4709
4710 window->priv->collection_position = 0;
4711 window->priv->collection_resizable = FALSE(0);
4712
4713 window->priv->save_disabled = FALSE(0);
4714
4715 window->priv->page_setup = NULL((void*)0);
4716
4717 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
()))))))
);
4718}
4719
4720static void
4721eoc_window_dispose (GObject *object)
4722{
4723 EocWindow *window;
4724 EocWindowPrivate *priv;
4725
4726 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)
;
4727 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)
;
4728
4729 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 4729, ((const char*) (__func__
))
);
4730
4731 window = EOC_WINDOW (object)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((eoc_window_get_type ()))))))
;
4732 priv = window->priv;
4733
4734 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 ()))))))
);
4735
4736 if (priv->extensions != NULL((void*)0)) {
4737 g_object_unref (priv->extensions);
4738 priv->extensions = NULL((void*)0);
4739 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 ()))))))
);
4740 }
4741
4742 if (priv->page_setup != NULL((void*)0)) {
4743 g_object_unref (priv->page_setup);
4744 priv->page_setup = NULL((void*)0);
4745 }
4746
4747 if (priv->thumbview)
4748 {
4749 /* Disconnect so we don't get any unwanted callbacks
4750 * when the thumb view is disposed. */
4751 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))
4752 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))
4753 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))
;
4754 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)
;
4755 }
4756
4757 if (priv->store != NULL((void*)0)) {
4758 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))
4759 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))
4760 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))
;
4761 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))
4762 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))
4763 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))
;
4764 g_object_unref (priv->store);
4765 priv->store = NULL((void*)0);
4766 }
4767
4768 if (priv->image != NULL((void*)0)) {
4769 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))
4770 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))
4771 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))
;
4772 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))
4773 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))
4774 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))
;
4775 g_object_unref (priv->image);
4776 priv->image = NULL((void*)0);
4777 }
4778
4779 if (priv->actions_window != NULL((void*)0)) {
4780 g_object_unref (priv->actions_window);
4781 priv->actions_window = NULL((void*)0);
4782 }
4783
4784 if (priv->actions_image != NULL((void*)0)) {
4785 g_object_unref (priv->actions_image);
4786 priv->actions_image = NULL((void*)0);
4787 }
4788
4789 if (priv->actions_collection != NULL((void*)0)) {
4790 g_object_unref (priv->actions_collection);
4791 priv->actions_collection = NULL((void*)0);
4792 }
4793
4794 if (priv->actions_recent != NULL((void*)0)) {
4795 g_object_unref (priv->actions_recent);
4796 priv->actions_recent = NULL((void*)0);
4797 }
4798
4799 if (priv->actions_open_with != NULL((void*)0)) {
4800 g_object_unref (priv->actions_open_with);
4801 priv->actions_open_with = NULL((void*)0);
4802 }
4803
4804 fullscreen_clear_timeout (window);
4805
4806 if (window->priv->fullscreen_popup != NULL((void*)0)) {
4807 ctk_widget_destroy (priv->fullscreen_popup);
4808 priv->fullscreen_popup = NULL((void*)0);
4809 }
4810
4811 slideshow_clear_timeout (window);
4812 eoc_window_uninhibit_screensaver (window);
4813
4814 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))
4815 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))
4816 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))
;
4817
4818 priv->recent_menu_id = 0;
4819
4820 eoc_window_clear_load_job (window);
4821
4822 eoc_window_clear_transform_job (window);
4823
4824 if (priv->view_settings) {
4825 g_object_unref (priv->view_settings);
4826 priv->view_settings = NULL((void*)0);
4827 }
4828 if (priv->ui_settings) {
4829 g_object_unref (priv->ui_settings);
4830 priv->ui_settings = NULL((void*)0);
4831 }
4832 if (priv->fullscreen_settings) {
4833 g_object_unref (priv->fullscreen_settings);
4834 priv->fullscreen_settings = NULL((void*)0);
4835 }
4836 if (priv->lockdown_settings) {
4837 g_object_unref (priv->lockdown_settings);
4838 priv->lockdown_settings = NULL((void*)0);
4839 }
4840
4841 if (priv->file_list != NULL((void*)0)) {
4842 g_slist_foreach (priv->file_list, (GFunc) g_object_unref, NULL((void*)0));
4843 g_slist_free (priv->file_list);
4844 priv->file_list = NULL((void*)0);
4845 }
4846
4847#if defined(HAVE_LCMS1) && defined(CDK_WINDOWING_X11)
4848 if (priv->display_profile != NULL((void*)0)) {
4849 cmsCloseProfile (priv->display_profile);
4850 priv->display_profile = NULL((void*)0);
4851 }
4852#endif
4853
4854 if (priv->last_save_as_folder != NULL((void*)0)) {
4855 g_object_unref (priv->last_save_as_folder);
4856 priv->last_save_as_folder = NULL((void*)0);
4857 }
4858
4859 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 ()))))))
);
4860
4861 G_OBJECT_CLASS (eoc_window_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((eoc_window_parent_class)), (((GType) ((20) << (2))
))))))
->dispose (object);
4862}
4863
4864static gint
4865eoc_window_delete (CtkWidget *widget,
4866 CdkEventAny *event G_GNUC_UNUSED__attribute__ ((__unused__)))
4867{
4868 EocWindow *window;
4869 EocWindowPrivate *priv;
4870
4871 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)
;
4872
4873 window = EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
;
4874 priv = window->priv;
4875
4876 if (priv->save_job != NULL((void*)0)) {
4877 eoc_window_finish_saving (window);
4878 }
4879
4880 if (eoc_window_unsaved_images_confirm (window)) {
4881 return TRUE(!(0));
4882 }
4883
4884 ctk_widget_destroy (widget);
4885
4886 return TRUE(!(0));
4887}
4888
4889static gint
4890eoc_window_key_press (CtkWidget *widget, CdkEventKey *event)
4891{
4892 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 ()))))))
;
4893 gint result = FALSE(0);
4894 gboolean handle_selection = FALSE(0);
4895
4896 switch (event->keyval) {
4897 case CDK_KEY_space0x020:
4898 if (event->state & CDK_CONTROL_MASK) {
4899 handle_selection = TRUE(!(0));
4900 break;
4901 }
4902 case CDK_KEY_Return0xff0d:
4903 if (ctk_container_get_focus_child (tbcontainer) == NULL((void*)0)) {
4904 /* Image properties dialog case */
4905 if (event->state & CDK_MOD1_MASK) {
4906 result = FALSE(0);
4907 break;
4908 }
4909
4910 if (event->state & CDK_SHIFT_MASK) {
4911 eoc_window_cmd_go_prev (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4912 } else {
4913 eoc_window_cmd_go_next (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4914 }
4915 result = TRUE(!(0));
4916 }
4917 break;
4918 case CDK_KEY_p0x070:
4919 case CDK_KEY_P0x050:
4920 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) {
4921 gboolean slideshow;
4922
4923 slideshow = EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->mode == EOC_WINDOW_MODE_SLIDESHOW;
4924 eoc_window_run_fullscreen (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
, !slideshow);
4925 }
4926 break;
4927 case CDK_KEY_Q0x051:
4928 case CDK_KEY_q0x071:
4929 case CDK_KEY_Escape0xff1b:
4930 if (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->mode == EOC_WINDOW_MODE_FULLSCREEN) {
4931 eoc_window_stop_fullscreen (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
, FALSE(0));
4932 } else if (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->mode == EOC_WINDOW_MODE_SLIDESHOW) {
4933 eoc_window_stop_fullscreen (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
, TRUE(!(0)));
4934 } else {
4935 eoc_window_cmd_close_window (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4936 return TRUE(!(0));
4937 }
4938 break;
4939 case CDK_KEY_Left0xff51:
4940 if (event->state & CDK_MOD1_MASK) {
4941 /* Alt+Left moves to previous image */
4942 if (is_rtl(ctk_widget_get_default_direction () == CTK_TEXT_DIR_RTL)) { /* move to next in RTL mode */
4943 eoc_window_cmd_go_next (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4944 } else {
4945 eoc_window_cmd_go_prev (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4946 }
4947 result = TRUE(!(0));
4948 break;
4949 } /* else fall-trough is intended */
4950 case CDK_KEY_Up0xff52:
4951 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 ()))))))
)) {
4952 /* break to let scrollview handle the key */
4953 break;
4954 }
4955 if (ctk_container_get_focus_child (tbcontainer) != NULL((void*)0))
4956 break;
4957 if (!ctk_widget_get_visible (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->nav)) {
4958 if (is_rtl(ctk_widget_get_default_direction () == CTK_TEXT_DIR_RTL) && event->keyval == CDK_KEY_Left0xff51) {
4959 /* handle RTL fall-through,
4960 * need to behave like CDK_Down then */
4961 eoc_window_cmd_go_next (NULL((void*)0),
4962 EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4963 } else {
4964 eoc_window_cmd_go_prev (NULL((void*)0),
4965 EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4966 }
4967 result = TRUE(!(0));
4968 break;
4969 }
4970 case CDK_KEY_Right0xff53:
4971 if (event->state & CDK_MOD1_MASK) {
4972 /* Alt+Right moves to next image */
4973 if (is_rtl(ctk_widget_get_default_direction () == CTK_TEXT_DIR_RTL)) { /* move to previous in RTL mode */
4974 eoc_window_cmd_go_prev (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4975 } else {
4976 eoc_window_cmd_go_next (NULL((void*)0), EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4977 }
4978 result = TRUE(!(0));
4979 break;
4980 } /* else fall-trough is intended */
4981 case CDK_KEY_Down0xff54:
4982 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 ()))))))
)) {
4983 /* break to let scrollview handle the key */
4984 break;
4985 }
4986 if (ctk_container_get_focus_child (tbcontainer) != NULL((void*)0))
4987 break;
4988 if (!ctk_widget_get_visible (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->nav)) {
4989 if (is_rtl(ctk_widget_get_default_direction () == CTK_TEXT_DIR_RTL) && event->keyval == CDK_KEY_Right0xff53) {
4990 /* handle RTL fall-through,
4991 * need to behave like CDK_Up then */
4992 eoc_window_cmd_go_prev (NULL((void*)0),
4993 EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4994 } else {
4995 eoc_window_cmd_go_next (NULL((void*)0),
4996 EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
4997 }
4998 result = TRUE(!(0));
4999 break;
5000 }
5001 case CDK_KEY_Page_Up0xff55:
5002 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 ()))))))
)) {
5003 if (!ctk_widget_get_visible (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->nav)) {
5004 /* If the iconview is not visible skip to the
5005 * previous image manually as it won't handle
5006 * the keypress then. */
5007 eoc_window_cmd_go_prev (NULL((void*)0),
5008 EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
5009 result = TRUE(!(0));
5010 } else
5011 handle_selection = TRUE(!(0));
5012 }
5013 break;
5014 case CDK_KEY_Page_Down0xff56:
5015 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 ()))))))
)) {
5016 if (!ctk_widget_get_visible (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->nav)) {
5017 /* If the iconview is not visible skip to the
5018 * next image manually as it won't handle
5019 * the keypress then. */
5020 eoc_window_cmd_go_next (NULL((void*)0),
5021 EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
5022 result = TRUE(!(0));
5023 } else
5024 handle_selection = TRUE(!(0));
5025 }
5026 break;
5027 }
5028
5029 /* Update slideshow timeout */
5030 if (result && (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
->priv->mode == EOC_WINDOW_MODE_SLIDESHOW)) {
5031 slideshow_set_timeout (EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
);
5032 }
5033
5034 if (handle_selection == TRUE(!(0)) && result == FALSE(0)) {
5035 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 ()))))))
);
5036
5037 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 ()))))))
,
5038 (CdkEvent *) event);
5039 }
5040
5041 /* If the focus is not in the toolbar and we still haven't handled the
5042 event, give the scrollview a chance to do it. */
5043 if (!ctk_container_get_focus_child (tbcontainer) && result == FALSE(0) &&
5044 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 ()))))))
)) {
5045 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 ()))))))
,
5046 (CdkEvent *) event);
5047 }
5048
5049 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) {
5050 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);
5051 }
5052
5053 return result;
5054}
5055
5056static gint
5057eoc_window_button_press (CtkWidget *widget, CdkEventButton *event)
5058{
5059 EocWindow *window = EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
;
5060 gint result = FALSE(0);
5061
5062 if (event->type == CDK_BUTTON_PRESS) {
5063 switch (event->button) {
5064 case 6:
5065 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
()))))))
,
5066 EOC_THUMB_VIEW_SELECT_LEFT);
5067 result = TRUE(!(0));
5068 break;
5069 case 7:
5070 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
()))))))
,
5071 EOC_THUMB_VIEW_SELECT_RIGHT);
5072 result = TRUE(!(0));
5073 break;
5074 }
5075 }
5076
5077 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) {
5078 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);
5079 }
5080
5081 return result;
5082}
5083
5084static gboolean
5085eoc_window_focus_out_event (CtkWidget *widget, CdkEventFocus *event)
5086{
5087 EocWindow *window = EOC_WINDOW (widget)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((eoc_window_get_type ()))))))
;
5088 EocWindowPrivate *priv = window->priv;
5089 gboolean fullscreen;
5090
5091 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 5091, ((const char*) (__func__
))
);
5092
5093 fullscreen = priv->mode == EOC_WINDOW_MODE_FULLSCREEN ||
5094 priv->mode == EOC_WINDOW_MODE_SLIDESHOW;
5095
5096 if (fullscreen) {
5097 ctk_widget_hide (priv->fullscreen_popup);
5098 }
5099
5100 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);
5101}
5102
5103static void
5104eoc_window_set_property (GObject *object,
5105 guint property_id,
5106 const GValue *value,
5107 GParamSpec *pspec)
5108{
5109 EocWindow *window;
5110 EocWindowPrivate *priv;
5111
5112 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)
;
5113
5114 window = EOC_WINDOW (object)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((eoc_window_get_type ()))))))
;
5115 priv = window->priv;
5116
5117 switch (property_id) {
5118 case PROP_COLLECTION_POS:
5119 eoc_window_set_collection_mode (window, g_value_get_enum (value),
5120 priv->collection_resizable);
5121 break;
5122 case PROP_COLLECTION_RESIZABLE:
5123 eoc_window_set_collection_mode (window, priv->collection_position,
5124 g_value_get_boolean (value));
5125 break;
5126 case PROP_STARTUP_FLAGS:
5127 priv->flags = g_value_get_flags (value);
5128 break;
5129
5130 default:
5131 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", 5131, ("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)
;
5132 }
5133}
5134
5135static void
5136eoc_window_get_property (GObject *object,
5137 guint property_id,
5138 GValue *value,
5139 GParamSpec *pspec)
5140{
5141 EocWindow *window;
5142 EocWindowPrivate *priv;
5143
5144 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)
;
5145
5146 window = EOC_WINDOW (object)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((eoc_window_get_type ()))))))
;
5147 priv = window->priv;
5148
5149 switch (property_id) {
5150 case PROP_COLLECTION_POS:
5151 g_value_set_enum (value, priv->collection_position);
5152 break;
5153 case PROP_COLLECTION_RESIZABLE:
5154 g_value_set_boolean (value, priv->collection_resizable);
5155 break;
5156 case PROP_STARTUP_FLAGS:
5157 g_value_set_flags (value, priv->flags);
5158 break;
5159
5160 default:
5161 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", 5161, ("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)
;
5162 }
5163}
5164
5165static void
5166on_extension_added (BeanExtensionSet *set G_GNUC_UNUSED__attribute__ ((__unused__)),
5167 BeanPluginInfo *info G_GNUC_UNUSED__attribute__ ((__unused__)),
5168 BeanExtension *exten,
5169 CtkWindow *window)
5170{
5171 bean_extension_call (exten, "activate", window);
5172}
5173
5174static void
5175on_extension_removed (BeanExtensionSet *set G_GNUC_UNUSED__attribute__ ((__unused__)),
5176 BeanPluginInfo *info G_GNUC_UNUSED__attribute__ ((__unused__)),
5177 BeanExtension *exten,
5178 CtkWindow *window)
5179{
5180 bean_extension_call (exten, "deactivate", window);
5181}
5182
5183static GObject *
5184eoc_window_constructor (GType type,
5185 guint n_construct_properties,
5186 GObjectConstructParam *construct_params)
5187{
5188 GObject *object;
5189 EocWindowPrivate *priv;
5190
5191 object = G_OBJECT_CLASS (eoc_window_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((eoc_window_parent_class)), (((GType) ((20) << (2))
))))))
->constructor
5192 (type, n_construct_properties, construct_params);
5193
5194 priv = EOC_WINDOW (object)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((eoc_window_get_type ()))))))
->priv;
5195
5196 eoc_window_construct_ui (EOC_WINDOW (object)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((eoc_window_get_type ()))))))
);
5197
5198 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 ()))))))
,
5199 EOC_TYPE_WINDOW_ACTIVATABLE(eoc_window_activatable_get_type ()),
5200 "window",
5201 EOC_WINDOW (object)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((eoc_window_get_type ()))))))
, NULL((void*)0));
5202
5203 bean_extension_set_call (priv->extensions, "activate");
5204
5205 g_signal_connect (priv->extensions, "extension-added",g_signal_connect_data ((priv->extensions), ("extension-added"
), (((GCallback) (on_extension_added))), (object), ((void*)0)
, (GConnectFlags) 0)
5206 G_CALLBACK (on_extension_added), object)g_signal_connect_data ((priv->extensions), ("extension-added"
), (((GCallback) (on_extension_added))), (object), ((void*)0)
, (GConnectFlags) 0)
;
5207 g_signal_connect (priv->extensions, "extension-removed",g_signal_connect_data ((priv->extensions), ("extension-removed"
), (((GCallback) (on_extension_removed))), (object), ((void*)
0), (GConnectFlags) 0)
5208 G_CALLBACK (on_extension_removed), object)g_signal_connect_data ((priv->extensions), ("extension-removed"
), (((GCallback) (on_extension_removed))), (object), ((void*)
0), (GConnectFlags) 0)
;
5209
5210 return object;
5211}
5212
5213static void
5214eoc_window_class_init (EocWindowClass *class)
5215{
5216 GObjectClass *g_object_class = (GObjectClass *) class;
5217 CtkWidgetClass *widget_class = (CtkWidgetClass *) class;
5218
5219 g_object_class->constructor = eoc_window_constructor;
5220 g_object_class->dispose = eoc_window_dispose;
5221 g_object_class->set_property = eoc_window_set_property;
5222 g_object_class->get_property = eoc_window_get_property;
5223
5224 widget_class->delete_event = eoc_window_delete;
5225 widget_class->key_press_event = eoc_window_key_press;
5226 widget_class->button_press_event = eoc_window_button_press;
5227 widget_class->drag_data_received = eoc_window_drag_data_received;
5228 widget_class->focus_out_event = eoc_window_focus_out_event;
5229
5230/**
5231 * EocWindow:collection-position:
5232 *
5233 * Determines the position of the image collection in the window
5234 * relative to the image.
5235 */
5236 g_object_class_install_property (
5237 g_object_class, PROP_COLLECTION_POS,
5238 g_param_spec_enum ("collection-position", NULL((void*)0), NULL((void*)0),
5239 EOC_TYPE_WINDOW_COLLECTION_POS(eoc_window_collection_pos_get_type()),
5240 EOC_WINDOW_COLLECTION_POS_BOTTOM,
5241 G_PARAM_READWRITE | G_PARAM_STATIC_NAME));
5242
5243/**
5244 * EocWindow:collection-resizable:
5245 *
5246 * If %TRUE the collection will be resizable by the user otherwise it will be
5247 * in single column/row mode.
5248 */
5249 g_object_class_install_property (
5250 g_object_class, PROP_COLLECTION_RESIZABLE,
5251 g_param_spec_boolean ("collection-resizable", NULL((void*)0), NULL((void*)0), FALSE(0),
5252 G_PARAM_READWRITE | G_PARAM_STATIC_NAME));
5253
5254/**
5255 * EocWindow:startup-flags:
5256 *
5257 * A bitwise OR of #EocStartupFlags elements, indicating how the window
5258 * should behave upon creation.
5259 */
5260 g_object_class_install_property (g_object_class,
5261 PROP_STARTUP_FLAGS,
5262 g_param_spec_flags ("startup-flags",
5263 NULL((void*)0),
5264 NULL((void*)0),
5265 EOC_TYPE_STARTUP_FLAGS(eoc_startup_flags_get_type()),
5266 0,
5267 G_PARAM_READWRITE |
5268 G_PARAM_CONSTRUCT_ONLY));
5269
5270/**
5271 * EocWindow::prepared:
5272 * @window: the object which received the signal.
5273 *
5274 * The #EocWindow::prepared signal is emitted when the @window is ready
5275 * to be shown.
5276 */
5277 signals [SIGNAL_PREPARED] =
5278 g_signal_new ("prepared",
5279 EOC_TYPE_WINDOW(eoc_window_get_type ()),
5280 G_SIGNAL_RUN_LAST,
5281 G_STRUCT_OFFSET (EocWindowClass, prepared)((glong) __builtin_offsetof(EocWindowClass, prepared)),
5282 NULL((void*)0), NULL((void*)0),
5283 g_cclosure_marshal_VOID__VOID,
5284 G_TYPE_NONE((GType) ((1) << (2))), 0);
5285}
5286
5287/**
5288 * eoc_window_new:
5289 * @flags: the initialization parameters for the new window.
5290 *
5291 *
5292 * Creates a new and empty #EocWindow. Use @flags to indicate
5293 * if the window should be initialized fullscreen, in slideshow mode,
5294 * and/or without the thumbnails collection visible. See #EocStartupFlags.
5295 *
5296 * Returns: a newly created #EocWindow.
5297 **/
5298CtkWidget*
5299eoc_window_new (EocStartupFlags flags)
5300{
5301 EocWindow *window;
5302
5303 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 5303, ((const char*) (__func__
))
);
5304
5305 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
()))))))
5306 "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
()))))))
5307 "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
()))))))
5308 "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
()))))))
5309 "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
()))))))
5310 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
()))))))
;
5311
5312 return CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
;
5313}
5314
5315static void
5316eoc_window_list_store_image_added (CtkTreeModel *tree_model G_GNUC_UNUSED__attribute__ ((__unused__)),
5317 CtkTreePath *path G_GNUC_UNUSED__attribute__ ((__unused__)),
5318 CtkTreeIter *iter G_GNUC_UNUSED__attribute__ ((__unused__)),
5319 gpointer user_data)
5320{
5321 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
5322
5323 update_image_pos (window);
5324 update_action_groups_state (window);
5325}
5326
5327static void
5328eoc_window_list_store_image_removed (CtkTreeModel *tree_model G_GNUC_UNUSED__attribute__ ((__unused__)),
5329 CtkTreePath *path G_GNUC_UNUSED__attribute__ ((__unused__)),
5330 gpointer user_data)
5331{
5332 EocWindow *window = EOC_WINDOW (user_data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((user_data)), ((eoc_window_get_type ()))))))
;
5333
5334 update_image_pos (window);
5335 update_action_groups_state (window);
5336}
5337
5338static void
5339eoc_job_model_cb (EocJobModel *job, gpointer data)
5340{
5341 EocWindow *window;
5342 EocWindowPrivate *priv;
5343 gint n_images;
5344
5345 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 5345, ((const char*) (__func__
))
);
5346
5347#ifdef HAVE_EXIF1
5348 int i;
5349 EocImage *image;
5350#endif
5351
5352 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)
;
5353
5354 window = EOC_WINDOW (data)((((EocWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((eoc_window_get_type ()))))))
;
5355 priv = window->priv;
5356
5357 if (priv->store != NULL((void*)0)) {
5358 g_object_unref (priv->store);
5359 priv->store = NULL((void*)0);
5360 }
5361
5362 priv->store = g_object_ref (job->store)((__typeof__ (job->store)) (g_object_ref) (job->store));
5363
5364 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())))))
);
5365
5366#ifdef HAVE_EXIF1
5367 if (g_settings_get_boolean (priv->view_settings, EOC_CONF_VIEW_AUTOROTATE"autorotate")) {
5368 for (i = 0; i < n_images; i++) {
5369 image = eoc_list_store_get_image_by_pos (priv->store, i);
5370 eoc_image_autorotate (image);
5371 g_object_unref (image);
5372 }
5373 }
5374#endif
5375
5376 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);
5377
5378 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)
5379 "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)
5380 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)
5381 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)
;
5382
5383 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)
5384 "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)
5385 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)
5386 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)
;
5387
5388 if (n_images == 0) {
5389 gint n_files;
5390
5391 priv->status = EOC_WINDOW_STATUS_NORMAL;
5392 update_action_groups_state (window);
5393
5394 n_files = g_slist_length (priv->file_list);
5395
5396 if (n_files > 0) {
5397 CtkWidget *message_area;
5398 GFile *file = NULL((void*)0);
5399
5400 if (n_files == 1) {
5401 file = (GFile *) priv->file_list->data;
5402 }
5403
5404 message_area = eoc_no_images_error_message_area_new (file);
5405
5406 eoc_window_set_message_area (window, message_area);
5407
5408 ctk_widget_show (message_area);
5409 }
5410
5411 g_signal_emit (window, signals[SIGNAL_PREPARED], 0);
5412 }
5413}
5414
5415/**
5416 * eoc_window_open_file_list:
5417 * @window: An #EocWindow.
5418 * @file_list: (element-type GFile): A %NULL-terminated list of #GFile's.
5419 *
5420 * Opens a list of files, adding them to the collection in @window.
5421 * Files will be checked to be readable and later filtered according
5422 * with eoc_list_store_add_files().
5423 **/
5424void
5425eoc_window_open_file_list (EocWindow *window, GSList *file_list)
5426{
5427 EocJob *job;
5428
5429 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 5429, ((const char*) (__func__
))
);
5430
5431 window->priv->status = EOC_WINDOW_STATUS_INIT;
5432
5433 g_slist_foreach (file_list, (GFunc) g_object_ref, NULL((void*)0));
5434 window->priv->file_list = file_list;
5435
5436 job = eoc_job_model_new (file_list);
5437
5438 g_signal_connect (job,g_signal_connect_data ((job), ("finished"), (((GCallback) (eoc_job_model_cb
))), (window), ((void*)0), (GConnectFlags) 0)
5439 "finished",g_signal_connect_data ((job), ("finished"), (((GCallback) (eoc_job_model_cb
))), (window), ((void*)0), (GConnectFlags) 0)
5440 G_CALLBACK (eoc_job_model_cb),g_signal_connect_data ((job), ("finished"), (((GCallback) (eoc_job_model_cb
))), (window), ((void*)0), (GConnectFlags) 0)
5441 window)g_signal_connect_data ((job), ("finished"), (((GCallback) (eoc_job_model_cb
))), (window), ((void*)0), (GConnectFlags) 0)
;
5442
5443 eoc_job_queue_add_job (job);
5444 g_object_unref (job);
5445}
5446
5447/**
5448 * eoc_window_get_ui_manager:
5449 * @window: An #EocWindow.
5450 *
5451 * Gets the #CtkUIManager that describes the UI of @window.
5452 *
5453 * Returns: (transfer none): A #CtkUIManager.
5454 **/
5455CtkUIManager *
5456eoc_window_get_ui_manager (EocWindow *window)
5457{
5458 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)
;
5459
5460 return window->priv->ui_mgr;
5461}
5462
5463/**
5464 * eoc_window_get_mode:
5465 * @window: An #EocWindow.
5466 *
5467 * Gets the mode of @window. See #EocWindowMode for details.
5468 *
5469 * Returns: An #EocWindowMode.
5470 **/
5471EocWindowMode
5472eoc_window_get_mode (EocWindow *window)
5473{
5474 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)
;
5475
5476 return window->priv->mode;
5477}
5478
5479/**
5480 * eoc_window_set_mode:
5481 * @window: an #EocWindow.
5482 * @mode: an #EocWindowMode value.
5483 *
5484 * Changes the mode of @window to normal, fullscreen, or slideshow.
5485 * See #EocWindowMode for details.
5486 **/
5487void
5488eoc_window_set_mode (EocWindow *window, EocWindowMode mode)
5489{
5490 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)
;
5491
5492 if (window->priv->mode == mode)
5493 return;
5494
5495 switch (mode) {
5496 case EOC_WINDOW_MODE_NORMAL:
5497 eoc_window_stop_fullscreen (window,
5498 window->priv->mode == EOC_WINDOW_MODE_SLIDESHOW);
5499 break;
5500 case EOC_WINDOW_MODE_FULLSCREEN:
5501 eoc_window_run_fullscreen (window, FALSE(0));
5502 break;
5503 case EOC_WINDOW_MODE_SLIDESHOW:
5504 eoc_window_run_fullscreen (window, TRUE(!(0)));
5505 break;
5506 case EOC_WINDOW_MODE_UNKNOWN:
5507 break;
5508 }
5509}
5510
5511/**
5512 * eoc_window_get_store:
5513 * @window: An #EocWindow.
5514 *
5515 * Gets the #EocListStore that contains the images in the collection
5516 * of @window.
5517 *
5518 * Returns: (transfer none): an #EocListStore.
5519 **/
5520EocListStore *
5521eoc_window_get_store (EocWindow *window)
5522{
5523 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)
;
5524
5525 return EOC_LIST_STORE (window->priv->store)((((EocListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window->priv->store)), (eoc_list_store_get_type())
))))
;
5526}
5527
5528/**
5529 * eoc_window_get_view:
5530 * @window: An #EocWindow.
5531 *
5532 * Gets the #EocScrollView in the window.
5533 *
5534 * Returns: (transfer none): the #EocScrollView.
5535 **/
5536CtkWidget *
5537eoc_window_get_view (EocWindow *window)
5538{
5539 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)
;
5540
5541 return window->priv->view;
5542}
5543
5544/**
5545 * eoc_window_get_sidebar:
5546 * @window: An #EocWindow.
5547 *
5548 * Gets the sidebar widget of @window.
5549 *
5550 * Returns: (transfer none): the #EocSidebar.
5551 **/
5552CtkWidget *
5553eoc_window_get_sidebar (EocWindow *window)
5554{
5555 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)
;
5556
5557 return window->priv->sidebar;
5558}
5559
5560/**
5561 * eoc_window_get_thumb_view:
5562 * @window: an #EocWindow.
5563 *
5564 * Gets the thumbnails view in @window.
5565 *
5566 * Returns: (transfer none): an #EocThumbView.
5567 **/
5568CtkWidget *
5569eoc_window_get_thumb_view (EocWindow *window)
5570{
5571 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)
;
5572
5573 return window->priv->thumbview;
5574}
5575
5576/**
5577 * eoc_window_get_thumb_nav:
5578 * @window: an #EocWindow.
5579 *
5580 * Gets the thumbnails navigation pane in @window.
5581 *
5582 * Returns: (transfer none): an #EocThumbNav.
5583 **/
5584CtkWidget *
5585eoc_window_get_thumb_nav (EocWindow *window)
5586{
5587 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)
;
5588
5589 return window->priv->nav;
5590}
5591
5592/**
5593 * eoc_window_get_statusbar:
5594 * @window: an #EocWindow.
5595 *
5596 * Gets the statusbar in @window.
5597 *
5598 * Returns: (transfer none): a #EocStatusBar.
5599 **/
5600CtkWidget *
5601eoc_window_get_statusbar (EocWindow *window)
5602{
5603 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)
;
5604
5605 return window->priv->statusbar;
5606}
5607
5608/**
5609 * eoc_window_get_image:
5610 * @window: an #EocWindow.
5611 *
5612 * Gets the image currently displayed in @window or %NULL if
5613 * no image is being displayed.
5614 *
5615 * Returns: (transfer none): an #EocImage.
5616 **/
5617EocImage *
5618eoc_window_get_image (EocWindow *window)
5619{
5620 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)
;
5621
5622 return window->priv->image;
5623}
5624
5625/**
5626 * eoc_window_is_empty:
5627 * @window: an #EocWindow.
5628 *
5629 * Tells whether @window is currently empty or not.
5630 *
5631 * Returns: %TRUE if @window has no images, %FALSE otherwise.
5632 **/
5633gboolean
5634eoc_window_is_empty (EocWindow *window)
5635{
5636 EocWindowPrivate *priv;
5637 gboolean empty = TRUE(!(0));
5638
5639 eoc_debug (DEBUG_WINDOWEOC_DEBUG_WINDOW, "eoc-window.c", 5639, ((const char*) (__func__
))
);
5640
5641 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)
;
5642
5643 priv = window->priv;
5644
5645 if (priv->store != NULL((void*)0)) {
5646 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);
5647 }
5648
5649 return empty;
5650}
5651
5652void
5653eoc_window_reload_image (EocWindow *window)
5654{
5655 CtkWidget *view;
5656
5657 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)
;
5658
5659 if (window->priv->image == NULL((void*)0))
5660 return;
5661
5662 g_object_unref (window->priv->image);
5663 window->priv->image = NULL((void*)0);
5664
5665 view = eoc_window_get_view (window);
5666 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));
5667
5668 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
()))))))
,
5669 EOC_THUMB_VIEW_SELECT_CURRENT);
5670}