pidgin/gtkcellrendererexpander.c

Mon, 22 Aug 2011 22:46:08 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Mon, 22 Aug 2011 22:46:08 +0000
branch
cpw.qulogic.gtk3
changeset 32437
a1093fbc45d2
parent 32398
d192c2933e1d
child 32438
dc8991868906
child 33132
24afd2b22579
permissions
-rw-r--r--

Force disable GtkSpell, since it's not currently compatible with GTK+3.

14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1 /*
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2 * @file gtkcellrendererexpander.c GTK+ Cell Renderer Expander
16254
eeb2bba4dc94 Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@pidgin.im>
parents: 15931
diff changeset
3 * @ingroup pidgin
20330
650a7af9c238 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents: 20327
diff changeset
4 */
650a7af9c238 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents: 20327
diff changeset
5
650a7af9c238 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents: 20327
diff changeset
6 /* pidgin
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
7 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
10 * source distribution.
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
11 *
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
15 * (at your option) any later version.
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16 *
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
20 * GNU General Public License for more details.
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
21 *
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16254
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
25 *
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
26 */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
27
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
28 /* This is taken largely from GtkCellRenderer[Text|Pixbuf|Toggle] by
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
29 * Jonathon Blandford <jrb@redhat.com> for RedHat, Inc.
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
30 */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
31
14719
d2bad68670ed [gaim-migrate @ 17403]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14654
diff changeset
32 #include <gtk/gtk.h>
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
33 #include "gtkcellrendererexpander.h"
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
34
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
35 static void pidgin_cell_renderer_expander_get_property (GObject *object,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
36 guint param_id,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
37 GValue *value,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
38 GParamSpec *pspec);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
39 static void pidgin_cell_renderer_expander_set_property (GObject *object,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
40 guint param_id,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
41 const GValue *value,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
42 GParamSpec *pspec);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
43 static void pidgin_cell_renderer_expander_init (PidginCellRendererExpander *cellexpander);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
44 static void pidgin_cell_renderer_expander_class_init (PidginCellRendererExpanderClass *class);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
45 static void pidgin_cell_renderer_expander_get_size (GtkCellRenderer *cell,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
46 GtkWidget *widget,
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
47 const GdkRectangle *cell_area,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
48 gint *x_offset,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
49 gint *y_offset,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
50 gint *width,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
51 gint *height);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
52 static void pidgin_cell_renderer_expander_render (GtkCellRenderer *cell,
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
53 cairo_t *cr,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
54 GtkWidget *widget,
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
55 const GdkRectangle *background_area,
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
56 const GdkRectangle *cell_area,
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
57 GtkCellRendererState flags);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
58 static gboolean pidgin_cell_renderer_expander_activate (GtkCellRenderer *r,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
59 GdkEvent *event,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
60 GtkWidget *widget,
14953
76aa1c4e6580 [gaim-migrate @ 17663]
Damien Carbery
parents: 14860
diff changeset
61 const gchar *p,
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
62 const GdkRectangle *bg,
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
63 const GdkRectangle *cell,
14860
24b350529a69 [gaim-migrate @ 17563]
Taso N. Devetzis
parents: 14719
diff changeset
64 GtkCellRendererState flags);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
65 static void pidgin_cell_renderer_expander_finalize (GObject *gobject);
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
66
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
67 enum {
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
68 LAST_SIGNAL
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
69 };
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
70
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
71 enum {
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
72 PROP_0,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
73 PROP_IS_EXPANDER
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
74 };
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
75
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
76 static gpointer parent_class;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
77 /* static guint expander_cell_renderer_signals [LAST_SIGNAL]; */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
78
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
79 GType pidgin_cell_renderer_expander_get_type (void)
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
80 {
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
81 static GType cell_expander_type = 0;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
82
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
83 if (!cell_expander_type)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
84 {
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
85 static const GTypeInfo cell_expander_info =
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
86 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
87 sizeof (PidginCellRendererExpanderClass),
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
88 NULL, /* base_init */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
89 NULL, /* base_finalize */
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
90 (GClassInitFunc) pidgin_cell_renderer_expander_class_init,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
91 NULL, /* class_finalize */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
92 NULL, /* class_data */
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
93 sizeof (PidginCellRendererExpander),
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
94 0, /* n_preallocs */
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
95 (GInstanceInitFunc) pidgin_cell_renderer_expander_init,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
96 NULL /* value_table */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
97 };
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
98
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
99 cell_expander_type =
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
100 g_type_register_static (GTK_TYPE_CELL_RENDERER,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
101 "PidginCellRendererExpander",
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
102 &cell_expander_info, 0);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
103 }
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
104
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
105 return cell_expander_type;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
106 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
107
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
108 static void pidgin_cell_renderer_expander_init (PidginCellRendererExpander *cellexpander)
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
109 {
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
110 g_object_set(G_OBJECT(cellexpander), "mode",
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
111 GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
112 /*GTK_CELL_RENDERER(cellexpander)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;*/
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
113 gtk_cell_renderer_set_padding(GTK_CELL_RENDERER(cellexpander), 0, 2);
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
114 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
115
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
116 static void pidgin_cell_renderer_expander_class_init (PidginCellRendererExpanderClass *class)
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
117 {
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
118 GObjectClass *object_class = G_OBJECT_CLASS(class);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
119 GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS(class);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
120
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
121 parent_class = g_type_class_peek_parent (class);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
122 object_class->finalize = pidgin_cell_renderer_expander_finalize;
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
123
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
124 object_class->get_property = pidgin_cell_renderer_expander_get_property;
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
125 object_class->set_property = pidgin_cell_renderer_expander_set_property;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
126
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
127 cell_class->get_size = pidgin_cell_renderer_expander_get_size;
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
128 cell_class->render = pidgin_cell_renderer_expander_render;
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
129 cell_class->activate = pidgin_cell_renderer_expander_activate;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
130
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
131 g_object_class_install_property (object_class,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
132 PROP_IS_EXPANDER,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
133 g_param_spec_boolean ("expander-visible",
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
134 "Is Expander",
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
135 "True if the renderer should draw an expander",
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
136 FALSE,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
137 G_PARAM_READWRITE));
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
138 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
139
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
140 static void pidgin_cell_renderer_expander_finalize (GObject *object)
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
141 {
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
142 /*
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
143 PidginCellRendererExpander *cellexpander = PIDGIN_CELL_RENDERER_EXPANDER(object);
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
144 */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
145
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
146 (* G_OBJECT_CLASS (parent_class)->finalize) (object);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
147 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
148
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
149 static void pidgin_cell_renderer_expander_get_property (GObject *object,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
150 guint param_id,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
151 GValue *value,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
152 GParamSpec *psec)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
153 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
154 PidginCellRendererExpander *cellexpander = PIDGIN_CELL_RENDERER_EXPANDER(object);
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
155
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
156 switch (param_id)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
157 {
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
158 case PROP_IS_EXPANDER:
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
159 g_value_set_boolean(value, cellexpander->is_expander);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
160 break;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
161 default:
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
162 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, psec);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
163 break;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
164
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
165 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
166 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
167
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
168 static void pidgin_cell_renderer_expander_set_property (GObject *object,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
169 guint param_id,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
170 const GValue *value,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
171 GParamSpec *pspec)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
172 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
173 PidginCellRendererExpander *cellexpander = PIDGIN_CELL_RENDERER_EXPANDER (object);
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
174
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
175 switch (param_id)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
176 {
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
177 case PROP_IS_EXPANDER:
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
178 cellexpander->is_expander = g_value_get_boolean(value);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
179 break;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
180 default:
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
181 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
182 break;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
183 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
184 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
185
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
186 GtkCellRenderer *pidgin_cell_renderer_expander_new(void)
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
187 {
15883
969b74a3e27a According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
188 return g_object_new(PIDGIN_TYPE_GTK_CELL_RENDERER_EXPANDER, NULL);
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
189 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
190
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
191 static void pidgin_cell_renderer_expander_get_size (GtkCellRenderer *cell,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
192 GtkWidget *widget,
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
193 const GdkRectangle *cell_area,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
194 gint *x_offset,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
195 gint *y_offset,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
196 gint *width,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
197 gint *height)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
198 {
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
199 gint calc_width;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
200 gint calc_height;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
201 gint expander_size;
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
202 gint xpad;
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
203 gint ypad;
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
204 gfloat xalign;
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
205 gfloat yalign;
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
206
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
207 gtk_widget_style_get(widget, "expander-size", &expander_size, NULL);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
208
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
209 gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
210 gtk_cell_renderer_get_alignment(cell, &xalign, &yalign);
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
211 calc_width = (gint) xpad * 2 + expander_size;
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
212 calc_height = (gint) ypad * 2 + expander_size;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
213
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
214 if (width)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
215 *width = calc_width;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
216
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
217 if (height)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
218 *height = calc_height;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
219
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
220 if (cell_area)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
221 {
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
222 if (x_offset)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
223 {
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
224 *x_offset = xalign * (cell_area->width - calc_width);
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
225 *x_offset = MAX (*x_offset, 0);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
226 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
227 if (y_offset)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
228 {
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
229 *y_offset = yalign * (cell_area->height - calc_height);
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
230 *y_offset = MAX (*y_offset, 0);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
231 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
232 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
233 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
234
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
235
24379
02a9ca3f4a34 Fixes a bug in the blist theme where a line appears only under the expander
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 20404
diff changeset
236 static void pidgin_cell_renderer_expander_render(GtkCellRenderer *cell,
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
237 cairo_t *cr,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
238 GtkWidget *widget,
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
239 const GdkRectangle *background_area,
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
240 const GdkRectangle *cell_area,
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
241 GtkCellRendererState flags)
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
242 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
243 PidginCellRendererExpander *cellexpander = (PidginCellRendererExpander *) cell;
24379
02a9ca3f4a34 Fixes a bug in the blist theme where a line appears only under the expander
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 20404
diff changeset
244 gboolean set;
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
245 gint width, height;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
246 GtkStateType state;
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
247 gint xpad;
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
248 gint ypad;
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
249 gboolean is_expanded;
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
250 GtkAllocation allocation;
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
251
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
252 gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
32397
3db003e082a9 change property expanded to is-expanded
Marcus Lundblad <malu@pidgin.im>
parents: 32394
diff changeset
253 g_object_get(G_OBJECT(cell), "is-expanded", &is_expanded, NULL);
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
254
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
255 if (!cellexpander->is_expander)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
256 return;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
257
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
258 width = cell_area->width;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
259 height = cell_area->height;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24379
diff changeset
260
32398
d192c2933e1d avoid illegal gobject cast here
Marcus Lundblad <malu@pidgin.im>
parents: 32397
diff changeset
261 if (!gtk_widget_get_sensitive(widget))
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
262 state = GTK_STATE_INSENSITIVE;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
263 else if (flags & GTK_CELL_RENDERER_PRELIT)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
264 state = GTK_STATE_PRELIGHT;
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
265 else if (gtk_widget_has_focus(widget) && flags & GTK_CELL_RENDERER_SELECTED)
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
266 state = GTK_STATE_ACTIVE;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
267 else
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
268 state = GTK_STATE_NORMAL;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
269
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
270 width -= xpad*2;
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
271 height -= ypad*2;
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
272
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
273 gtk_paint_expander (gtk_widget_get_style(widget),
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
274 cr, state,
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
275 widget, "treeview",
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
276 cell_area->x + xpad + (width / 2),
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
277 cell_area->y + ypad + (height / 2),
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
278 is_expanded ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED);
24379
02a9ca3f4a34 Fixes a bug in the blist theme where a line appears only under the expander
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 20404
diff changeset
279
02a9ca3f4a34 Fixes a bug in the blist theme where a line appears only under the expander
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 20404
diff changeset
280 /* only draw the line if the color isn't set - this prevents a bug where the hline appears only under the expander */
02a9ca3f4a34 Fixes a bug in the blist theme where a line appears only under the expander
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 20404
diff changeset
281 g_object_get(cellexpander, "cell-background-set", &set, NULL);
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
282 gtk_widget_get_allocation(widget, &allocation);
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
283
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
284 if (is_expanded && !set)
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
285 gtk_paint_hline (gtk_widget_get_style(widget), cr, state, widget, NULL, 0,
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
286 allocation.width, cell_area->y + cell_area->height);
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
287 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
288
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
289 static gboolean pidgin_cell_renderer_expander_activate(GtkCellRenderer *r,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
290 GdkEvent *event,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
291 GtkWidget *widget,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
292 const gchar *p,
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
293 const GdkRectangle *bg,
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 29500
diff changeset
294 const GdkRectangle *cell,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
295 GtkCellRendererState flags)
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
296 {
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
297 GtkTreePath *path = gtk_tree_path_new_from_string(p);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
298 if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(widget), path))
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
299 gtk_tree_view_collapse_row(GTK_TREE_VIEW(widget), path);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
300 else
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
301 gtk_tree_view_expand_row(GTK_TREE_VIEW(widget),path,FALSE);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
302 gtk_tree_path_free(path);
14626
964677efbddf [gaim-migrate @ 17287]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14623
diff changeset
303 return FALSE;
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
304 }

mercurial