annotate src/image-overlay.c @ 111:3a69a7a3f461

Wed Nov 15 02:05:27 2006 John Ellis <johne@verizon.net> * view_file_icon.c: Fix odd crash when removing files, it seems the high priority idle sync is no longer called before the treeview tries to redraw itself, so fix the cleanup of removed pointers so that they are always valid or NULL (I wonder if the priorities used by GtkTreeView have changed in newer versions of GTK?). * view_file_list.c: Fix progress bar warning when files are removed before thumbnail generation is finished.
author gqview
date Wed, 15 Nov 2006 07:19:16 +0000
parents 17acca639a86
children 0c2e1f0a001b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2 * GQview
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * (C) 2004 John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
4 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12 #include "gqview.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13 #include "image-overlay.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15 #include "collect.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 #include "filelist.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 #include "image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "img-view.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "layout.h"
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
20 #include "pixbuf-renderer.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "pixbuf_util.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 *----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 * image overlay
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27 *----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30 typedef struct _OverlayUpdate OverlayUpdate;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 struct _OverlayUpdate {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32 ImageWindow *imd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 gint id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34 gint idle_id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 gulong destroy_id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38 #define IMAGE_OVERLAY_UPDATE_KEY "image-overlay-update"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 #define IMAGE_OVERLAY_X 10
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 #define IMAGE_OVERLAY_Y -10
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 static GdkPixbuf *image_overlay_info_render(ImageWindow *imd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 GdkPixbuf *pixbuf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47 gint width, height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 PangoLayout *layout;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 const gchar *name;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 gchar *name_escaped;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 gchar *size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53 gint n, t;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 CollectionData *cd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 CollectInfo *info;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56 gchar *ct;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58 name = image_get_name(imd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59 if (name)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 name_escaped = g_markup_escape_text(name, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
63 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
64 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 name_escaped = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68 cd = image_get_collection(imd, &info);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 if (cd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73 t = g_list_length(cd->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74 n = g_list_index(cd->list, info) + 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75 buf = g_markup_escape_text((cd->name) ? cd->name : _("Untitled"), -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 ct = g_strdup_printf("<i>%s</i>\n", buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 LayoutWindow *lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83 lw = layout_find_by_image(imd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84 if (lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
85 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86 if (lw->slideshow)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
87 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 n = g_list_length(lw->slideshow->list_done);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 t = n + g_list_length(lw->slideshow->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93 t = layout_list_count(lw, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 n = layout_list_get_index(lw, image_get_path(lw->image)) + 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97 else if (view_window_find_image(imd, &n, &t))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99 n++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103 t = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104 n = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
106
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
107 if (n < 1) n = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108 if (t < 1) t = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
110 ct = g_strdup("");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
112
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113 size = text_from_size_abrev(imd->size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114 if (!name_escaped)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
116 text = g_strdup_printf(_("Untitled"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118 else if (imd->unknown)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120 text = g_strdup_printf("%s(%d/%d) <b>%s</b>\n%s - %s", ct,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 n, t, name_escaped,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 text_from_time(imd->mtime), size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
123 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
124 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
125 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126 gint w, h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128 if (imd->delay_flip &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 imd->il && imd->il->pixbuf &&
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
130 image_get_pixbuf(imd) != imd->il->pixbuf)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 w = gdk_pixbuf_get_width(imd->il->pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133 h = gdk_pixbuf_get_height(imd->il->pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
135 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
136 {
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
137 pixbuf_renderer_get_image_size(PIXBUF_RENDERER(imd->pr), &w, &h);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
139
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
140 text = g_strdup_printf("%s(%d/%d) <b>%s</b>\n%d x %d - %s - %s", ct,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141 n, t, name_escaped,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
142 w, h,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 text_from_time(imd->mtime), size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
145 g_free(size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
146 g_free(ct);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 g_free(name_escaped);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
149 layout = gtk_widget_create_pango_layout(imd->pr, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 pango_layout_set_markup(layout, text, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
151 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 pango_layout_get_pixel_size(layout, &width, &height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 width += 10;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156 height += 10;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 pixbuf_set_rect_fill(pixbuf, 3, 3, width-6, height-6, 240, 240, 240, 210);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160 pixbuf_set_rect(pixbuf, 0, 0, width, height, 240, 240, 240, 80, 1, 1, 1, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 pixbuf_set_rect(pixbuf, 1, 1, width-2, height-2, 240, 240, 240, 130, 1, 1, 1, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 pixbuf_set_rect(pixbuf, 2, 2, width-4, height-4, 240, 240, 240, 180, 1, 1, 1, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 pixbuf_pixel_set(pixbuf, 0, 0, 0, 0, 0, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 pixbuf_pixel_set(pixbuf, width - 1, 0, 0, 0, 0, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165 pixbuf_pixel_set(pixbuf, 0, height - 1, 0, 0, 0, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 pixbuf_pixel_set(pixbuf, width - 1, height - 1, 0, 0, 0, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
168 pixbuf_draw_layout(pixbuf, layout, imd->pr, 5, 5, 0, 0, 0, 255);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 g_object_unref(G_OBJECT(layout));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172 return pixbuf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175 static void image_overlay_update_destroy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 OverlayUpdate *ou = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 g_source_remove(ou->idle_id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180 g_free(ou);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 static gint image_overlay_update_cb(gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 OverlayUpdate *ou = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 GdkPixbuf *pixbuf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 pixbuf = image_overlay_info_render(ou->imd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 image_overlay_set(ou->imd, ou->id, pixbuf, IMAGE_OVERLAY_X, IMAGE_OVERLAY_Y);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 g_object_unref(pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
191
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
192 g_object_set_data(G_OBJECT(ou->imd->pr), IMAGE_OVERLAY_UPDATE_KEY, NULL);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
193 g_signal_handler_disconnect(ou->imd->pr, ou->destroy_id);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 g_free(ou);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199 static void image_overlay_update_schedule(ImageWindow *imd, gint id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201 OverlayUpdate *ou;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
203 ou = g_object_get_data(G_OBJECT(imd->pr), IMAGE_OVERLAY_UPDATE_KEY);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204 if (ou) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 ou = g_new0(OverlayUpdate, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 ou->imd = imd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 ou->id = id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209 ou->idle_id = g_idle_add_full(G_PRIORITY_HIGH, image_overlay_update_cb, ou, NULL);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
210 ou->destroy_id = g_signal_connect(G_OBJECT(imd->pr), "destroy",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 G_CALLBACK(image_overlay_update_destroy_cb), ou);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
212 g_object_set_data(G_OBJECT(imd->pr), IMAGE_OVERLAY_UPDATE_KEY, ou);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215 void image_overlay_update(ImageWindow *imd, gint id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 if (id < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 image_overlay_update_schedule(imd, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 static void image_overlay_upate_cb(ImageWindow *imd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 gint id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 id = GPOINTER_TO_INT(data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226 image_overlay_update_schedule(imd, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229 gint image_overlay_info_enable(ImageWindow *imd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 gint id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232 GdkPixbuf *pixbuf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 pixbuf = image_overlay_info_render(imd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 id = image_overlay_add(imd, pixbuf, IMAGE_OVERLAY_X, IMAGE_OVERLAY_Y, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
236 g_object_unref(pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
237
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 image_set_new_func(imd, image_overlay_upate_cb, GINT_TO_POINTER(id));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240 return id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
242
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243 void image_overlay_info_disable(ImageWindow *imd, gint id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245 image_set_new_func(imd, NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 image_overlay_remove(imd, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248