annotate src/cellrenderericon.c @ 1219:86fcbd0fcb7b

added change notification to bar_info.c
author nadvornik
date Tue, 23 Dec 2008 20:53:44 +0000
parents 1646720364cf
children c9949c19a6d0
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 /* cellrenderericon.c, based on:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * gtkcellrendererpixbuf.c
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
4 * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 * This library is free software; you can redistribute it and/or
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 * modify it under the terms of the GNU Library General Public
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * version 2 of the License, or (at your option) any later version.
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 * This library is distributed in the hope that it will be useful,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 * Library General Public License for more details.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 * You should have received a copy of the GNU Library General Public
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 * License along with this library; if not, write to the
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 * Boston, MA 02111-1307, USA.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include <stdlib.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "cellrenderericon.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "intl.h"
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27 #define FIXED_ICON_SIZE_MAX 512
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28
852
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
29 #define TOGGLE_WIDTH 13
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
30 #define TOGGLE_SPACING 18
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
31
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
32
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 static void gqv_cell_renderer_icon_get_property(GObject *object,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 9
diff changeset
34 guint param_id,
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 9
diff changeset
35 GValue *value,
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 9
diff changeset
36 GParamSpec *pspec);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37 static void gqv_cell_renderer_icon_set_property(GObject *object,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38 guint param_id,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 const GValue *value,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 GParamSpec *pspec);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 static void gqv_cell_renderer_icon_init(GQvCellRendererIcon *celltext);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 static void gqv_cell_renderer_icon_class_init(GQvCellRendererIconClass *class);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 static void gqv_cell_renderer_icon_finalize(GObject *object);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 static void gqv_cell_renderer_icon_get_size(GtkCellRenderer *cell,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 GtkWidget *widget,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 GdkRectangle *rectangle,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47 gint *x_offset,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 gint *y_offset,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 gint *width,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 gint *height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 static void gqv_cell_renderer_icon_render(GtkCellRenderer *cell,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 GdkWindow *window,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53 GtkWidget *widget,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 GdkRectangle *background_area,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 GdkRectangle *cell_area,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56 GdkRectangle *expose_area,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57 GtkCellRendererState flags);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58
966
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
59 static gint gqv_cell_renderer_icon_activate (GtkCellRenderer *cell,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
60 GdkEvent *event,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
61 GtkWidget *widget,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
62 const gchar *path,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
63 GdkRectangle *background_area,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
64 GdkRectangle *cell_area,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
65 GtkCellRendererState flags);
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
66
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
67 enum {
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
68 TOGGLED,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
69 LAST_SIGNAL
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
70 };
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73 PROP_ZERO,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74 PROP_PIXBUF,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75 PROP_TEXT,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 PROP_BACKGROUND_GDK,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 PROP_FOREGROUND_GDK,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78 PROP_FOCUSED,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 PROP_FIXED_WIDTH,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80 PROP_FIXED_HEIGHT,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 PROP_BACKGROUND_SET,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83 PROP_FOREGROUND_SET,
852
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
84 PROP_SHOW_TEXT,
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
85 PROP_SHOW_MARKS,
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
86 PROP_NUM_MARKS,
966
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
87 PROP_MARKS,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
88 PROP_TOGGLED
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90
966
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
91 static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
92
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93 static gpointer parent_class;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95 GType
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
96 gqv_cell_renderer_icon_get_type(void)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98 static GType cell_icon_type = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 if (!cell_icon_type)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102 static const GTypeInfo cell_icon_info =
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103 {
691
631d626c1f6b Fix some incomplete initialization warnings.
zas_
parents: 534
diff changeset
104 sizeof(GQvCellRendererIconClass), /* class_size */
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105 NULL, /* base_init */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
106 NULL, /* base_finalize */
691
631d626c1f6b Fix some incomplete initialization warnings.
zas_
parents: 534
diff changeset
107 (GClassInitFunc) gqv_cell_renderer_icon_class_init, /* class_init */
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108 NULL, /* class_finalize */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109 NULL, /* class_data */
691
631d626c1f6b Fix some incomplete initialization warnings.
zas_
parents: 534
diff changeset
110 sizeof(GQvCellRendererIcon), /* instance_size */
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111 0, /* n_preallocs */
691
631d626c1f6b Fix some incomplete initialization warnings.
zas_
parents: 534
diff changeset
112 (GInstanceInitFunc) gqv_cell_renderer_icon_init, /* instance_init */
631d626c1f6b Fix some incomplete initialization warnings.
zas_
parents: 534
diff changeset
113 NULL, /* value_table */
534
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
114 };
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115
534
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
116 cell_icon_type = g_type_register_static(GTK_TYPE_CELL_RENDERER,
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
117 "GQvCellRendererIcon",
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
118 &cell_icon_info, 0);
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
119 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 return cell_icon_type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 }
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 static void
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
125 gqv_cell_renderer_icon_init(GQvCellRendererIcon *cellicon)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126 {
966
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
127 GTK_CELL_RENDERER(cellicon)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128 GTK_CELL_RENDERER(cellicon)->xpad = 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 GTK_CELL_RENDERER(cellicon)->ypad = 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
130 }
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 static void
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
133 gqv_cell_renderer_icon_class_init(GQvCellRendererIconClass *class)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134 {
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
135 GObjectClass *object_class = G_OBJECT_CLASS(class);
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
136 GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS(class);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
137
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
138 parent_class = g_type_class_peek_parent(class);
9
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 object_class->finalize = gqv_cell_renderer_icon_finalize;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
142 object_class->get_property = gqv_cell_renderer_icon_get_property;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 object_class->set_property = gqv_cell_renderer_icon_set_property;
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 cell_class->get_size = gqv_cell_renderer_icon_get_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
146 cell_class->render = gqv_cell_renderer_icon_render;
966
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
147 cell_class->activate = gqv_cell_renderer_icon_activate;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 g_object_class_install_property(object_class,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 PROP_PIXBUF,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
151 g_param_spec_object("pixbuf",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152 _("Pixbuf Object"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 _("The pixbuf to render"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154 GDK_TYPE_PIXBUF,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 G_PARAM_READWRITE));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 g_object_class_install_property(object_class,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 PROP_TEXT,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 g_param_spec_string("text",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160 _("Text"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 _("Text to render"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 NULL,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 G_PARAM_READWRITE));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165 g_object_class_install_property(object_class,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 PROP_BACKGROUND_GDK,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167 g_param_spec_boxed("background_gdk",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168 _("Background color"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 _("Background color as a GdkColor"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 GDK_TYPE_COLOR,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 G_PARAM_READWRITE));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 g_object_class_install_property(object_class,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174 PROP_FOREGROUND_GDK,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175 g_param_spec_boxed("foreground_gdk",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 _("Foreground color"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 _("Foreground color as a GdkColor"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 GDK_TYPE_COLOR,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 G_PARAM_READWRITE));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181 g_object_class_install_property(object_class,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 PROP_FOCUSED,
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
183 g_param_spec_boolean("has_focus",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184 _("Focus"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 _("Draw focus indicator"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 FALSE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187 G_PARAM_READWRITE));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 g_object_class_install_property(object_class,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 PROP_FIXED_WIDTH,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
191 g_param_spec_int("fixed_width",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
192 _("Fixed width"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193 _("Width of cell"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 -1, FIXED_ICON_SIZE_MAX,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 -1,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 G_PARAM_READWRITE));
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 g_object_class_install_property(object_class,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199 PROP_FIXED_HEIGHT,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200 g_param_spec_int("fixed_height",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201 _("Fixed height"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 _("Height of icon excluding text"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 -1, FIXED_ICON_SIZE_MAX,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204 -1,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 G_PARAM_READWRITE));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 g_object_class_install_property(object_class,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 PROP_BACKGROUND_SET,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209 g_param_spec_boolean("background_set",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210 _("Background set"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 _("Whether this tag affects the background color"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212 FALSE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 G_PARAM_READWRITE));
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 g_object_class_install_property(object_class,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 PROP_FOREGROUND_SET,
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
217 g_param_spec_boolean("foreground_set",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 _("Foreground set"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 _("Whether this tag affects the foreground color"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 FALSE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 G_PARAM_READWRITE));
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 g_object_class_install_property(object_class,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224 PROP_SHOW_TEXT,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 g_param_spec_boolean("show_text",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226 _("Show text"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 _("Whether the text is displayed"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228 TRUE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229 G_PARAM_READWRITE));
852
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
230
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
231 g_object_class_install_property(object_class,
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
232 PROP_SHOW_MARKS,
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
233 g_param_spec_boolean("show_marks",
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
234 _("Show marks"),
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
235 _("Whether the marks are displayed"),
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
236 TRUE,
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
237 G_PARAM_READWRITE));
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
238
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
239 g_object_class_install_property(object_class,
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
240 PROP_NUM_MARKS,
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
241 g_param_spec_int("num_marks",
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
242 _("Number of marks"),
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
243 _("Number of marks"),
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
244 0, 32,
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
245 6,
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
246 G_PARAM_READWRITE));
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
247
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
248 g_object_class_install_property(object_class,
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
249 PROP_MARKS,
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
250 g_param_spec_uint("marks",
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
251 _("Marks"),
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
252 _("Marks bit array"),
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
253 0, 0xffffffff,
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
254 0,
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
255 G_PARAM_READWRITE));
966
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
256
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
257 g_object_class_install_property(object_class,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
258 PROP_TOGGLED,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
259 g_param_spec_uint("toggled_mark",
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
260 _("Toggled mark"),
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
261 _("Toggled mark"),
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
262 0, 32,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
263 0,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
264 G_PARAM_READWRITE));
995
6ca2c5fd7b13 Whitespaces cleanup.
zas_
parents: 966
diff changeset
265 toggle_cell_signals[TOGGLED] =
966
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
266 g_signal_new ("toggled",
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
267 G_OBJECT_CLASS_TYPE (object_class),
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
268 G_SIGNAL_RUN_LAST,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
269 G_STRUCT_OFFSET (GQvCellRendererIconClass, toggled),
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
270 NULL, NULL,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
271 g_cclosure_marshal_VOID__STRING,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
272 G_TYPE_NONE, 1,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
273 G_TYPE_STRING);
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
274
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 static void
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
278 gqv_cell_renderer_icon_finalize(GObject *object)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279 {
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
280 GQvCellRendererIcon *cellicon = GQV_CELL_RENDERER_ICON(object);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
282 if (cellicon->pixbuf) g_object_unref(cellicon->pixbuf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284 g_free(cellicon->text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
286 (*(G_OBJECT_CLASS(parent_class))->finalize)(object);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 static void
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 gqv_cell_renderer_icon_get_property(GObject *object,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 guint param_id,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 GValue *value,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 GParamSpec *pspec)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 {
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
295 GQvCellRendererIcon *cellicon = GQV_CELL_RENDERER_ICON(object);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 9
diff changeset
296
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 switch (param_id)
534
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
298 {
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
299 case PROP_PIXBUF:
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
300 g_value_set_object(value, cellicon->pixbuf ? G_OBJECT(cellicon->pixbuf) : NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302 case PROP_TEXT:
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
303 g_value_set_string(value, cellicon->text);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 case PROP_BACKGROUND_GDK:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307 GdkColor color;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 color.red = cellicon->background.red;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 color.green = cellicon->background.green;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311 color.blue = cellicon->background.blue;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
313 g_value_set_boxed(value, &color);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316 case PROP_FOREGROUND_GDK:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 GdkColor color;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320 color.red = cellicon->foreground.red;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321 color.green = cellicon->foreground.green;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322 color.blue = cellicon->foreground.blue;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
324 g_value_set_boxed(value, &color);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327 case PROP_FOCUSED:
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
328 g_value_set_boolean(value, cellicon->focused);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 case PROP_FIXED_WIDTH:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331 g_value_set_int(value, cellicon->fixed_width);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
333 case PROP_FIXED_HEIGHT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334 g_value_set_int(value, cellicon->fixed_height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
335 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336 case PROP_BACKGROUND_SET:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337 g_value_set_boolean(value, cellicon->background_set);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339 case PROP_FOREGROUND_SET:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340 g_value_set_boolean(value, cellicon->foreground_set);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342 case PROP_SHOW_TEXT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343 g_value_set_boolean(value, cellicon->show_text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
344 break;
852
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
345 case PROP_SHOW_MARKS:
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
346 g_value_set_boolean(value, cellicon->show_marks);
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
347 break;
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
348 case PROP_NUM_MARKS:
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
349 g_value_set_int(value, cellicon->num_marks);
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
350 break;
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
351 case PROP_MARKS:
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
352 g_value_set_uint(value, cellicon->marks);
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
353 break;
966
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
354 case PROP_TOGGLED:
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
355 g_value_set_uint(value, cellicon->toggled_mark);
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
356 break;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
357 default:
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
358 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
361 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
363 static void
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
364 set_bg_color(GQvCellRendererIcon *cellicon,
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
365 GdkColor *color)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367 if (color)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
368 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
369 if (!cellicon->background_set)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371 cellicon->background_set = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
372 g_object_notify(G_OBJECT(cellicon), "background_set");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
374
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
375 cellicon->background.red = color->red;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
376 cellicon->background.green = color->green;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377 cellicon->background.blue = color->blue;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
380 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
381 if (cellicon->background_set)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
382 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
383 cellicon->background_set = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
384 g_object_notify(G_OBJECT(cellicon), "background_set");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
385 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
386 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
389 static void set_fg_color(GQvCellRendererIcon *cellicon,
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
390 GdkColor *color)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392 if (color)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
393 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 if (!cellicon->foreground_set)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
395 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
396 cellicon->foreground_set = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 g_object_notify(G_OBJECT(cellicon), "foreground_set");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
399
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
400 cellicon->foreground.red = color->red;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401 cellicon->foreground.green = color->green;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
402 cellicon->foreground.blue = color->blue;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
403 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
405 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
406 if (cellicon->foreground_set)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
408 cellicon->foreground_set = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
409 g_object_notify(G_OBJECT(cellicon), "foreground_set");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 static void
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
415 gqv_cell_renderer_icon_set_property(GObject *object,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
416 guint param_id,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417 const GValue *value,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 GParamSpec *pspec)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
419 {
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
420 GQvCellRendererIcon *cellicon = GQV_CELL_RENDERER_ICON(object);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 9
diff changeset
421
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
422 switch (param_id)
534
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
423 {
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
424 case PROP_PIXBUF:
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425 {
534
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
426 GdkPixbuf *pixbuf;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
427
1001
d22e21bfd2a3 Consistency: type * instead of type*.
zas_
parents: 995
diff changeset
428 pixbuf = (GdkPixbuf *) g_value_get_object(value);
534
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
429 if (pixbuf) g_object_ref(pixbuf);
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
430 if (cellicon->pixbuf) g_object_unref(cellicon->pixbuf);
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
431 cellicon->pixbuf = pixbuf;
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
432 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
433 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
434 case PROP_TEXT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
435 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
437
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438 text = cellicon->text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439 cellicon->text = g_strdup(g_value_get_string(value));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
440 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
441
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442 g_object_notify(object, "text");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
445 case PROP_BACKGROUND_GDK:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
446 set_bg_color(cellicon, g_value_get_boxed(value));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
447 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
448 case PROP_FOREGROUND_GDK:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
449 set_fg_color(cellicon, g_value_get_boxed(value));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451 case PROP_FOCUSED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452 cellicon->focused = g_value_get_boolean(value);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 case PROP_FIXED_WIDTH:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455 cellicon->fixed_width = g_value_get_int(value);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
457 case PROP_FIXED_HEIGHT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
458 cellicon->fixed_height = g_value_get_int(value);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
460 case PROP_BACKGROUND_SET:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461 cellicon->background_set = g_value_get_boolean(value);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
462 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
463 case PROP_FOREGROUND_SET:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
464 cellicon->foreground_set = g_value_get_boolean(value);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
465 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
466 case PROP_SHOW_TEXT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
467 cellicon->show_text = g_value_get_boolean(value);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
468 break;
852
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
469 case PROP_SHOW_MARKS:
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
470 cellicon->show_marks = g_value_get_boolean(value);
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
471 break;
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
472 case PROP_NUM_MARKS:
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
473 cellicon->num_marks = g_value_get_int(value);
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
474 break;
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
475 case PROP_MARKS:
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
476 cellicon->marks = g_value_get_uint(value);
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
477 break;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
478 default:
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 446
diff changeset
479 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
480 break;
534
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
481 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
482 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
483
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
484 static PangoLayout *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
485 gqv_cell_renderer_icon_get_layout(GQvCellRendererIcon *cellicon, GtkWidget *widget, gboolean will_render)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
486 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
487 PangoLayout *layout;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
488 gint width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
489
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
490 width = (cellicon->fixed_width > 0) ? cellicon->fixed_width * PANGO_SCALE : -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
491
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
492 layout = gtk_widget_create_pango_layout(widget, cellicon->text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
493 pango_layout_set_width(layout, width);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
494 pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
495 pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
496
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
497 if (will_render)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
498 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
499 PangoAttrList *attr_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
500
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
501 attr_list = pango_attr_list_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
502
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
503 if (cellicon->foreground_set)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
504 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
505 PangoColor color;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
506 PangoAttribute *attr;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
507
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
508 color = cellicon->foreground;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
509
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
510 attr = pango_attr_foreground_new(color.red, color.green, color.blue);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
511
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512 attr->start_index = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513 attr->end_index = G_MAXINT;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514 pango_attr_list_insert(attr_list, attr);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
517 pango_layout_set_attributes(layout, attr_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518 pango_attr_list_unref(attr_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
520
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
521 return layout;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
522 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
523
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
524 /**
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
525 * gqv_cell_renderer_icon_new:
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 9
diff changeset
526 *
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
527 * Creates a new #GQvCellRendererIcon. Adjust rendering
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
528 * parameters using object properties. Object properties can be set
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529 * globally (with g_object_set()). Also, with #GtkTreeViewColumn, you
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
530 * can bind a property to a value in a #GtkTreeModel. For example, you
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
531 * can bind the "pixbuf" property on the cell renderer to a pixbuf value
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
532 * in the model, thus rendering a different image in each row of the
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
533 * #GtkTreeView.
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 9
diff changeset
534 *
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
535 * Return value: the new cell renderer
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
536 **/
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
537 GtkCellRenderer *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
538 gqv_cell_renderer_icon_new(void)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
539 {
534
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
540 return g_object_new(GQV_TYPE_CELL_RENDERER_ICON, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
541 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
543 static void
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
544 gqv_cell_renderer_icon_get_size(GtkCellRenderer *cell,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
545 GtkWidget *widget,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
546 GdkRectangle *cell_area,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
547 gint *x_offset,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
548 gint *y_offset,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
549 gint *width,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
550 gint *height)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
551 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
552 GQvCellRendererIcon *cellicon = (GQvCellRendererIcon *) cell;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
553 gint calc_width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
554 gint calc_height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
555
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
556 if (cellicon->fixed_width > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
557 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
558 calc_width = cellicon->fixed_width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
559 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
560 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
561 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
562 calc_width = (cellicon->pixbuf) ? gdk_pixbuf_get_width(cellicon->pixbuf) : 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
563 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
564
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
565 if (cellicon->fixed_height > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
566 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
567 calc_height = cellicon->fixed_height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
568 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
569 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
570 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
571 calc_height = (cellicon->pixbuf) ? gdk_pixbuf_get_height(cellicon->pixbuf) : 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
572 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
573
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
574 if (cellicon->show_text && cellicon->text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
575 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 PangoLayout *layout;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577 PangoRectangle rect;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
579 layout = gqv_cell_renderer_icon_get_layout(cellicon, widget, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
580 pango_layout_get_pixel_extents(layout, NULL, &rect);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 g_object_unref(layout);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 calc_width = MAX(calc_width, rect.width);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
584 calc_height += rect.height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
586
852
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
587 if (cellicon->show_marks)
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
588 {
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
589 calc_height += TOGGLE_SPACING;
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
590 calc_width = MAX(calc_width, TOGGLE_SPACING * cellicon->num_marks);
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
591 }
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
592
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593 calc_width += (gint)cell->xpad * 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594 calc_height += (gint)cell->ypad * 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596 if (x_offset) *x_offset = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597 if (y_offset) *y_offset = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599 if (cell_area && calc_width > 0 && calc_height > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
601 if (x_offset)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603 *x_offset = (cell->xalign * (cell_area->width - calc_width - 2 * cell->xpad));
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
604 *x_offset = MAX(*x_offset, 0) + cell->xpad;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
605 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
606 if (y_offset)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608 *y_offset = (cell->yalign * (cell_area->height - calc_height - 2 * cell->ypad));
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
609 *y_offset = MAX(*y_offset, 0) + cell->ypad;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
612
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
613 if (width) *width = calc_width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614 if (height) *height = calc_height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617 static void
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618 gqv_cell_renderer_icon_render(GtkCellRenderer *cell,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619 GdkWindow *window,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620 GtkWidget *widget,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 GdkRectangle *background_area,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 GdkRectangle *cell_area,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623 GdkRectangle *expose_area,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624 GtkCellRendererState flags)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627 GQvCellRendererIcon *cellicon = (GQvCellRendererIcon *) cell;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
628 GdkPixbuf *pixbuf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 const gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
630 GdkRectangle cell_rect;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
631 GtkStateType state;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
632
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633 pixbuf = cellicon->pixbuf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 text = cellicon->text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
635
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
636 if (!pixbuf && !text) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
637
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
638 gqv_cell_renderer_icon_get_size(cell, widget, cell_area,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639 &cell_rect.x, &cell_rect.y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
640 &cell_rect.width, &cell_rect.height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
641
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
642 cell_rect.x += cell->xpad;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
643 cell_rect.y += cell->ypad;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
644 cell_rect.width -= cell->xpad * 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
645 cell_rect.height -= cell->ypad * 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
646
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
647 if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
648 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
649 if (GTK_WIDGET_HAS_FOCUS(widget))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650 state = GTK_STATE_SELECTED;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
651 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652 state = GTK_STATE_ACTIVE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
653 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
654 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656 if (GTK_WIDGET_STATE(widget) == GTK_STATE_INSENSITIVE)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
657 state = GTK_STATE_INSENSITIVE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
658 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 state = GTK_STATE_NORMAL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
661
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
662 if (pixbuf)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
663 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664 GdkRectangle pix_rect;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665 GdkRectangle draw_rect;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
667 pix_rect.width = gdk_pixbuf_get_width(pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
668 pix_rect.height = gdk_pixbuf_get_height(pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
669
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
670 pix_rect.x = cell_area->x + (cell_area->width - pix_rect.width) / 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
671
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672 if (cellicon->fixed_height > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
673 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
674 pix_rect.y = cell_area->y + cell->ypad + (cellicon->fixed_height - pix_rect.height) / 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
678 pix_rect.y = cell_area->y + cell_rect.y;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
679 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
680
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
681 if (gdk_rectangle_intersect(cell_area, &pix_rect, &draw_rect) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
682 gdk_rectangle_intersect(expose_area, &draw_rect, &draw_rect))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
683 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
684 gdk_draw_pixbuf(window,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
685 widget->style->black_gc,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
686 pixbuf,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687 /* pixbuf 0, 0 is at pix_rect.x, pix_rect.y */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
688 draw_rect.x - pix_rect.x,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
689 draw_rect.y - pix_rect.y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
690 draw_rect.x,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
691 draw_rect.y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
692 draw_rect.width,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
693 draw_rect.height,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694 GDK_RGB_DITHER_NORMAL,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
695 0, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
696 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
697 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
698
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
699 if (cellicon->show_text && text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
700 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
701 PangoLayout *layout;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
702 PangoRectangle text_rect;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
703 GdkRectangle pix_rect;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 9
diff changeset
704 GdkRectangle draw_rect;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
706 layout = gqv_cell_renderer_icon_get_layout(cellicon, widget, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
707 pango_layout_get_pixel_extents(layout, NULL, &text_rect);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
708
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
709 pix_rect.width = text_rect.width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710 pix_rect.height = text_rect.height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
711 pix_rect.x = cell_area->x + cell->xpad + (cell_rect.width - text_rect.width + 1) / 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
712 pix_rect.y = cell_area->y + cell->ypad + (cell_rect.height - text_rect.height);
852
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
713
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
714 if (cellicon->show_marks)
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
715 {
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
716 pix_rect.y -= TOGGLE_SPACING;
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
717 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
718
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
719 if (gdk_rectangle_intersect(cell_area, &pix_rect, &draw_rect) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
720 gdk_rectangle_intersect(expose_area, &draw_rect, &draw_rect))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
721 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
722 gtk_paint_layout(widget->style, window,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
723 state, TRUE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
724 cell_area, widget,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
725 "cellrenderertext",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
726 pix_rect.x - text_rect.x, pix_rect.y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727 layout);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
728 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
729
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
730 g_object_unref(layout);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
731 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
732
852
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
733 if (cellicon->show_marks)
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
734 {
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
735 GdkRectangle pix_rect;
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
736 GdkRectangle draw_rect;
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
737 gint i;
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
738
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
739 pix_rect.width = TOGGLE_SPACING * cellicon->num_marks;
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
740 pix_rect.height = TOGGLE_SPACING;
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
741 pix_rect.x = cell_area->x + cell->xpad + (cell_rect.width - pix_rect.width + 1) / 2 + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
742 pix_rect.y = cell_area->y + cell->ypad + (cell_rect.height - pix_rect.height) + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
743
853
b54e3fc9cafb optimized marks drawing
nadvornik
parents: 852
diff changeset
744 if (gdk_rectangle_intersect(cell_area, &pix_rect, &draw_rect) &&
b54e3fc9cafb optimized marks drawing
nadvornik
parents: 852
diff changeset
745 gdk_rectangle_intersect(expose_area, &draw_rect, &draw_rect))
852
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
746 {
853
b54e3fc9cafb optimized marks drawing
nadvornik
parents: 852
diff changeset
747 for (i = 0; i < cellicon->num_marks; i++)
b54e3fc9cafb optimized marks drawing
nadvornik
parents: 852
diff changeset
748 {
b54e3fc9cafb optimized marks drawing
nadvornik
parents: 852
diff changeset
749 gtk_paint_check (widget->style, window,
b54e3fc9cafb optimized marks drawing
nadvornik
parents: 852
diff changeset
750 state, (cellicon->marks & (1 << i)) ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
b54e3fc9cafb optimized marks drawing
nadvornik
parents: 852
diff changeset
751 cell_area, widget, "cellcheck",
b54e3fc9cafb optimized marks drawing
nadvornik
parents: 852
diff changeset
752 pix_rect.x + i * TOGGLE_SPACING + (TOGGLE_WIDTH - TOGGLE_SPACING) / 2,
b54e3fc9cafb optimized marks drawing
nadvornik
parents: 852
diff changeset
753 pix_rect.y,
b54e3fc9cafb optimized marks drawing
nadvornik
parents: 852
diff changeset
754 TOGGLE_WIDTH, TOGGLE_WIDTH);
b54e3fc9cafb optimized marks drawing
nadvornik
parents: 852
diff changeset
755 }
852
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
756 }
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
757 }
8308d3606991 show marks in iconview
nadvornik
parents: 691
diff changeset
758
534
0a2b8210ef1d Indentation fixes.
zas_
parents: 513
diff changeset
759 if (cellicon->focused && GTK_WIDGET_HAS_FOCUS(widget))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
760 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
761 gtk_paint_focus(widget->style, window,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
762 state,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
763 cell_area, widget,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
764 "cellrendererfocus",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
765 cell_area->x, cell_area->y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
766 cell_area->width, cell_area->height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
767 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
768 }
966
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
769
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
770 static gint
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
771 gqv_cell_renderer_icon_activate (GtkCellRenderer *cell,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
772 GdkEvent *event,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
773 GtkWidget *widget,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
774 const gchar *path,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
775 GdkRectangle *background_area,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
776 GdkRectangle *cell_area,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
777 GtkCellRendererState flags)
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
778 {
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
779 GQvCellRendererIcon *cellicon = (GQvCellRendererIcon *) cell;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
780 GdkEventButton *bevent = &event->button;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
781
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
782 if (cellicon->show_marks &&
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
783 event->type == GDK_BUTTON_PRESS &&
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
784 !(bevent->state & GDK_SHIFT_MASK ) &&
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
785 !(bevent->state & GDK_CONTROL_MASK ))
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
786 {
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
787 GdkRectangle rect;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
788 GdkRectangle cell_rect;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
789 gint i;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
790
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
791 gqv_cell_renderer_icon_get_size(cell, widget, cell_area,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
792 &cell_rect.x, &cell_rect.y,
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
793 &cell_rect.width, &cell_rect.height);
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
794
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
795 cell_rect.x += cell->xpad;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
796 cell_rect.y += cell->ypad;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
797 cell_rect.width -= cell->xpad * 2;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
798 cell_rect.height -= cell->ypad * 2;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
799
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
800 rect.width = TOGGLE_WIDTH;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
801 rect.height = TOGGLE_WIDTH;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
802 rect.y = cell_area->y + cell->ypad + (cell_rect.height - TOGGLE_SPACING) + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
803 for (i = 0; i < cellicon->num_marks; i++)
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
804 {
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
805 rect.x = cell_area->x + cell->xpad + (cell_rect.width - TOGGLE_SPACING * cellicon->num_marks + 1) / 2 + i * TOGGLE_SPACING;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
806
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
807 if (bevent->x >= rect.x && bevent->x < rect.x + rect.width &&
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
808 bevent->y >= rect.y && bevent->y < rect.y + rect.height)
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
809 {
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
810 cellicon->toggled_mark = i;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
811 g_signal_emit (cell, toggle_cell_signals[TOGGLED], 0, path);
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
812 break;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
813 }
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
814 }
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
815 }
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
816 return FALSE;
c24a297efbef marks in iconview made clickable
nadvornik
parents: 853
diff changeset
817 }
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 1001
diff changeset
818 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */