annotate src/gtkcellview.c @ 13556:c5c14bb91c28

[gaim-migrate @ 15934] Adding a DBUS example script written by Sadrul. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 23 Mar 2006 18:42:25 +0000
parents 7ab959eb857e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10708
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1 /* gtkellview.c
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2 * Copyright (C) 2002, 2003 Kristian Rietveld <kris@gtk.org>
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
3 *
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
4 * This library is free software; you can redistribute it and/or
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
5 * modify it under the terms of the GNU Library General Public
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
6 * License as published by the Free Software Foundation; either
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
7 * version 2 of the License, or (at your option) any later version.
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
8 *
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
9 * This library is distributed in the hope that it will be useful,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
12 * Library General Public License for more details.
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
13 *
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
14 * You should have received a copy of the GNU Library General Public
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
15 * License along with this library; if not, write to the
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
17 * Boston, MA 02111-1307, USA.
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
18 */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
19
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
20 /*
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
21 #include <config.h>
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
22 */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
23 #include "gtkcellview.h"
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
24 #include <gtk/gtkversion.h>
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
25 #if !GTK_CHECK_VERSION(2,6,0)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
26 #if GTK_CHECK_VERSION(2,4,0)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
27 #include <gtk/gtkcelllayout.h>
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
28 #else
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
29 #include "gtkcelllayout.h"
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
30 #endif
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
31 #include <gtk/gtksignal.h>
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
32 #include <gtk/gtkcellrenderertext.h>
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
33 #include <gtk/gtkcellrendererpixbuf.h>
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
34 #include <gobject/gmarshal.h>
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
35
13382
7ab959eb857e [gaim-migrate @ 15755]
Richard Laager <rlaager@wiktel.com>
parents: 10708
diff changeset
36 #define P_(x) (x)
10708
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
37
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
38 typedef struct _GtkCellViewCellInfo GtkCellViewCellInfo;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
39 struct _GtkCellViewCellInfo
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
40 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
41 GtkCellRenderer *cell;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
42
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
43 gint requested_width;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
44 gint real_width;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
45 guint expand : 1;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
46 guint pack : 1;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
47
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
48 GSList *attributes;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
49
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
50 GtkCellLayoutDataFunc func;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
51 gpointer func_data;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
52 GDestroyNotify destroy;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
53 };
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
54
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
55 struct _GtkCellViewPrivate
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
56 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
57 GtkTreeModel *model;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
58 GtkTreeRowReference *displayed_row;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
59 GList *cell_list;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
60 gint spacing;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
61
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
62 GdkColor background;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
63 gboolean background_set;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
64 };
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
65
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
66
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
67 static void gtk_cell_view_class_init (GtkCellViewClass *klass);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
68 static void gtk_cell_view_cell_layout_init (GtkCellLayoutIface *iface);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
69 static void gtk_cell_view_get_property (GObject *object,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
70 guint param_id,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
71 GValue *value,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
72 GParamSpec *pspec);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
73 static void gtk_cell_view_set_property (GObject *object,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
74 guint param_id,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
75 const GValue *value,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
76 GParamSpec *pspec);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
77 static void gtk_cell_view_init (GtkCellView *cellview);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
78 static void gtk_cell_view_finalize (GObject *object);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
79 static void gtk_cell_view_style_set (GtkWidget *widget,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
80 GtkStyle *previous_style);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
81 static void gtk_cell_view_size_request (GtkWidget *widget,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
82 GtkRequisition *requisition);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
83 static void gtk_cell_view_size_allocate (GtkWidget *widget,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
84 GtkAllocation *allocation);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
85 static gboolean gtk_cell_view_expose (GtkWidget *widget,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
86 GdkEventExpose *event);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
87 static void gtk_cell_view_set_valuesv (GtkCellView *cellview,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
88 GtkCellRenderer *renderer,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
89 va_list args);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
90 static GtkCellViewCellInfo *gtk_cell_view_get_cell_info (GtkCellView *cellview,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
91 GtkCellRenderer *renderer);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
92 static void gtk_cell_view_set_cell_data (GtkCellView *cellview);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
93
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
94
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
95 static void gtk_cell_view_cell_layout_pack_start (GtkCellLayout *layout,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
96 GtkCellRenderer *renderer,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
97 gboolean expand);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
98 static void gtk_cell_view_cell_layout_pack_end (GtkCellLayout *layout,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
99 GtkCellRenderer *renderer,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
100 gboolean expand);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
101 static void gtk_cell_view_cell_layout_add_attribute (GtkCellLayout *layout,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
102 GtkCellRenderer *renderer,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
103 const gchar *attribute,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
104 gint column);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
105 static void gtk_cell_view_cell_layout_clear (GtkCellLayout *layout);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
106 static void gtk_cell_view_cell_layout_clear_attributes (GtkCellLayout *layout,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
107 GtkCellRenderer *renderer);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
108 static void gtk_cell_view_cell_layout_set_cell_data_func (GtkCellLayout *layout,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
109 GtkCellRenderer *cell,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
110 GtkCellLayoutDataFunc func,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
111 gpointer func_data,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
112 GDestroyNotify destroy);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
113 static void gtk_cell_view_cell_layout_reorder (GtkCellLayout *layout,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
114 GtkCellRenderer *cell,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
115 gint position);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
116
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
117
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
118 enum
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
119 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
120 PROP_0,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
121 PROP_BACKGROUND,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
122 PROP_BACKGROUND_GDK,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
123 PROP_BACKGROUND_SET
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
124 };
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
125
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
126 static GtkObjectClass *parent_class = NULL;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
127
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
128
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
129 GType
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
130 gtk_cell_view_get_type (void)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
131 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
132 static GType cell_view_type = 0;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
133
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
134 if (!cell_view_type)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
135 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
136 static const GTypeInfo cell_view_info =
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
137 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
138 sizeof (GtkCellViewClass),
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
139 NULL, /* base_init */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
140 NULL, /* base_finalize */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
141 (GClassInitFunc) gtk_cell_view_class_init,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
142 NULL, /* class_finalize */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
143 NULL, /* class_data */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
144 sizeof (GtkCellView),
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
145 0,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
146 (GInstanceInitFunc) gtk_cell_view_init
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
147 };
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
148
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
149 static const GInterfaceInfo cell_layout_info =
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
150 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
151 (GInterfaceInitFunc) gtk_cell_view_cell_layout_init,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
152 NULL,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
153 NULL
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
154 };
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
155
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
156 cell_view_type = g_type_register_static (GTK_TYPE_WIDGET, "GaimGtkCellView",
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
157 &cell_view_info, 0);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
158
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
159 g_type_add_interface_static (cell_view_type, GTK_TYPE_CELL_LAYOUT,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
160 &cell_layout_info);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
161 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
162
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
163 return cell_view_type;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
164 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
165
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
166 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
167 gtk_cell_view_class_init (GtkCellViewClass *klass)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
168 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
169 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
170 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
171
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
172 parent_class = g_type_class_peek_parent (klass);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
173
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
174 gobject_class->get_property = gtk_cell_view_get_property;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
175 gobject_class->set_property = gtk_cell_view_set_property;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
176 gobject_class->finalize = gtk_cell_view_finalize;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
177
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
178 widget_class->expose_event = gtk_cell_view_expose;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
179 widget_class->size_allocate = gtk_cell_view_size_allocate;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
180 widget_class->size_request = gtk_cell_view_size_request;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
181 widget_class->style_set = gtk_cell_view_style_set;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
182
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
183 /* properties */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
184 g_object_class_install_property (gobject_class,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
185 PROP_BACKGROUND,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
186 g_param_spec_string ("background",
13382
7ab959eb857e [gaim-migrate @ 15755]
Richard Laager <rlaager@wiktel.com>
parents: 10708
diff changeset
187 P_("Background color name"),
7ab959eb857e [gaim-migrate @ 15755]
Richard Laager <rlaager@wiktel.com>
parents: 10708
diff changeset
188 P_("Background color as a string"),
10708
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
189 NULL,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
190 G_PARAM_WRITABLE));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
191 g_object_class_install_property (gobject_class,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
192 PROP_BACKGROUND_GDK,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
193 g_param_spec_boxed ("background_gdk",
13382
7ab959eb857e [gaim-migrate @ 15755]
Richard Laager <rlaager@wiktel.com>
parents: 10708
diff changeset
194 P_("Background color"),
7ab959eb857e [gaim-migrate @ 15755]
Richard Laager <rlaager@wiktel.com>
parents: 10708
diff changeset
195 P_("Background color as a GdkColor"),
10708
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
196 GDK_TYPE_COLOR,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
197 G_PARAM_READABLE | G_PARAM_WRITABLE));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
198
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
199 #define ADD_SET_PROP(propname, propval, nick, blurb) g_object_class_install_property (gobject_class, propval, g_param_spec_boolean (propname, nick, blurb, FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE))
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
200
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
201 ADD_SET_PROP ("background_set", PROP_BACKGROUND_SET,
13382
7ab959eb857e [gaim-migrate @ 15755]
Richard Laager <rlaager@wiktel.com>
parents: 10708
diff changeset
202 P_("Background set"),
7ab959eb857e [gaim-migrate @ 15755]
Richard Laager <rlaager@wiktel.com>
parents: 10708
diff changeset
203 P_("Whether this tag affects the background color"));
10708
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
204 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
205
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
206 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
207 gtk_cell_view_cell_layout_init (GtkCellLayoutIface *iface)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
208 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
209 iface->pack_start = gtk_cell_view_cell_layout_pack_start;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
210 iface->pack_end = gtk_cell_view_cell_layout_pack_end;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
211 iface->clear = gtk_cell_view_cell_layout_clear;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
212 iface->add_attribute = gtk_cell_view_cell_layout_add_attribute;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
213 iface->set_cell_data_func = gtk_cell_view_cell_layout_set_cell_data_func;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
214 iface->clear_attributes = gtk_cell_view_cell_layout_clear_attributes;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
215 iface->reorder = gtk_cell_view_cell_layout_reorder;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
216 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
217
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
218 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
219 gtk_cell_view_get_property (GObject *object,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
220 guint param_id,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
221 GValue *value,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
222 GParamSpec *pspec)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
223 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
224 GtkCellView *view = GTK_CELL_VIEW (object);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
225
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
226 switch (param_id)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
227 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
228 case PROP_BACKGROUND_GDK:
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
229 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
230 GdkColor color;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
231
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
232 color = view->priv->background;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
233
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
234 g_value_set_boxed (value, &color);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
235 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
236 break;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
237 case PROP_BACKGROUND_SET:
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
238 g_value_set_boolean (value, view->priv->background_set);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
239 break;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
240 default:
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
241 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
242 break;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
243 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
244 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
245
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
246 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
247 gtk_cell_view_set_property (GObject *object,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
248 guint param_id,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
249 const GValue *value,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
250 GParamSpec *pspec)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
251 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
252 GtkCellView *view = GTK_CELL_VIEW (object);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
253
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
254 switch (param_id)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
255 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
256 case PROP_BACKGROUND:
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
257 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
258 GdkColor color;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
259
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
260 if (!g_value_get_string (value))
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
261 gtk_cell_view_set_background_color (view, NULL);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
262 else if (gdk_color_parse (g_value_get_string (value), &color))
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
263 gtk_cell_view_set_background_color (view, &color);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
264 else
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
265 g_warning ("Don't know color `%s'", g_value_get_string (value));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
266
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
267 g_object_notify (object, "background_gdk");
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
268 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
269 break;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
270 case PROP_BACKGROUND_GDK:
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
271 gtk_cell_view_set_background_color (view, g_value_get_boxed (value));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
272 break;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
273 case PROP_BACKGROUND_SET:
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
274 view->priv->background_set = g_value_get_boolean (value);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
275 break;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
276 default:
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
277 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
278 break;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
279 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
280 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
281
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
282 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
283 gtk_cell_view_init (GtkCellView *cellview)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
284 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
285 GTK_WIDGET_SET_FLAGS (cellview, GTK_NO_WINDOW);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
286
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
287 cellview->priv = g_new0(GtkCellViewPrivate,1);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
288 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
289
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
290 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
291 gtk_cell_view_style_set (GtkWidget *widget,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
292 GtkStyle *previous_style)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
293 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
294 if (previous_style && GTK_WIDGET_REALIZED (widget))
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
295 gdk_window_set_background (widget->window,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
296 &widget->style->base[GTK_WIDGET_STATE (widget)]);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
297 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
298
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
299 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
300 gtk_cell_view_finalize (GObject *object)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
301 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
302 GtkCellView *cellview = GTK_CELL_VIEW (object);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
303
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
304 gtk_cell_view_cell_layout_clear (GTK_CELL_LAYOUT (cellview));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
305
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
306 if (cellview->priv->model)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
307 g_object_unref (cellview->priv->model);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
308
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
309 if (cellview->priv->displayed_row)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
310 gtk_tree_row_reference_free (cellview->priv->displayed_row);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
311
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
312 if (G_OBJECT_CLASS (parent_class)->finalize)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
313 (* G_OBJECT_CLASS (parent_class)->finalize) (object);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
314
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
315 g_free (cellview->priv);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
316 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
317
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
318 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
319 gtk_cell_view_size_request (GtkWidget *widget,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
320 GtkRequisition *requisition)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
321 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
322 GList *i;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
323 gboolean first_cell = TRUE;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
324 GtkCellView *cellview;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
325
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
326 cellview = GTK_CELL_VIEW (widget);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
327
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
328 requisition->width = 0;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
329 requisition->height = 0;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
330
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
331 if (cellview->priv->displayed_row)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
332 gtk_cell_view_set_cell_data (cellview);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
333
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
334 for (i = cellview->priv->cell_list; i; i = i->next)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
335 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
336 gint width, height;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
337 GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
338
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
339 if (!info->cell->visible)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
340 continue;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
341
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
342 if (!first_cell)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
343 requisition->width += cellview->priv->spacing;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
344
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
345 gtk_cell_renderer_get_size (info->cell, widget, NULL, NULL, NULL,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
346 &width, &height);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
347
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
348 info->requested_width = width;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
349 requisition->width += width;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
350 requisition->height = MAX (requisition->height, height);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
351
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
352 first_cell = FALSE;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
353 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
354 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
355
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
356 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
357 gtk_cell_view_size_allocate (GtkWidget *widget,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
358 GtkAllocation *allocation)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
359 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
360 GList *i;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
361 gint expand_cell_count = 0;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
362 gint full_requested_width = 0;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
363 gint extra_space;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
364 GtkCellView *cellview;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
365
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
366 widget->allocation = *allocation;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
367
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
368 cellview = GTK_CELL_VIEW (widget);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
369
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
370 /* checking how much extra space we have */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
371 for (i = cellview->priv->cell_list; i; i = i->next)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
372 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
373 GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
374
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
375 if (!info->cell->visible)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
376 continue;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
377
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
378 if (info->expand)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
379 expand_cell_count++;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
380
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
381 full_requested_width += info->requested_width;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
382 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
383
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
384 extra_space = widget->allocation.width - full_requested_width;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
385 if (extra_space < 0)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
386 extra_space = 0;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
387 else if (extra_space > 0 && expand_cell_count > 0)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
388 extra_space /= expand_cell_count;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
389
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
390 /* iterate list for PACK_START cells */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
391 for (i = cellview->priv->cell_list; i; i = i->next)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
392 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
393 GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
394
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
395 if (info->pack == GTK_PACK_END)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
396 continue;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
397
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
398 if (!info->cell->visible)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
399 continue;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
400
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
401 info->real_width = info->requested_width + (info->expand ? extra_space : 0);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
402 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
403
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
404 /* iterate list for PACK_END cells */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
405 for (i = cellview->priv->cell_list; i; i = i->next)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
406 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
407 GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
408
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
409 if (info->pack == GTK_PACK_START)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
410 continue;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
411
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
412 if (!info->cell->visible)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
413 continue;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
414
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
415 info->real_width = info->requested_width + (info->expand ? extra_space : 0);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
416 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
417 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
418
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
419 static gboolean
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
420 gtk_cell_view_expose (GtkWidget *widget,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
421 GdkEventExpose *event)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
422 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
423 GList *i;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
424 GtkCellView *cellview;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
425 GdkRectangle area;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
426 GtkCellRendererState state;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
427 gboolean rtl = (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
428
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
429 cellview = GTK_CELL_VIEW (widget);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
430
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
431 if (! GTK_WIDGET_DRAWABLE (widget))
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
432 return FALSE;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
433
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
434 /* "blank" background */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
435 if (cellview->priv->background_set)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
436 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
437 GdkGC *gc;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
438
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
439 gc = gdk_gc_new (GTK_WIDGET (cellview)->window);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
440 gdk_gc_set_rgb_fg_color (gc, &cellview->priv->background);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
441
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
442 gdk_draw_rectangle (GTK_WIDGET (cellview)->window,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
443 gc,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
444 TRUE,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
445
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
446 /*0, 0,*/
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
447 widget->allocation.x,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
448 widget->allocation.y,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
449
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
450 widget->allocation.width,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
451 widget->allocation.height);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
452
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
453 g_object_unref (G_OBJECT (gc));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
454 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
455
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
456 /* set cell data (if available) */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
457 if (cellview->priv->displayed_row)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
458 gtk_cell_view_set_cell_data (cellview);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
459 else if (cellview->priv->model)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
460 return FALSE;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
461
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
462 /* render cells */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
463 area = widget->allocation;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
464
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
465 /* we draw on our very own window, initialize x and y to zero */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
466 area.x = widget->allocation.x + (rtl ? widget->allocation.width : 0);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
467 area.y = widget->allocation.y;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
468
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
469 if (GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
470 state = GTK_CELL_RENDERER_PRELIT;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
471 else
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
472 state = 0;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
473
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
474 /* PACK_START */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
475 for (i = cellview->priv->cell_list; i; i = i->next)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
476 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
477 GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
478
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
479 if (info->pack == GTK_PACK_END)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
480 continue;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
481
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
482 if (!info->cell->visible)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
483 continue;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
484
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
485 area.width = info->real_width;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
486 if (rtl)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
487 area.x -= area.width;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
488
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
489 gtk_cell_renderer_render (info->cell,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
490 event->window,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
491 widget,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
492 /* FIXME! */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
493 &area, &area, &event->area, state);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
494
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
495 if (!rtl)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
496 area.x += info->real_width;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
497 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
498
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
499 area.x = rtl ? widget->allocation.x : (widget->allocation.x + widget->allocation.width);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
500
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
501 /* PACK_END */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
502 for (i = cellview->priv->cell_list; i; i = i->next)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
503 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
504 GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
505
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
506 if (info->pack == GTK_PACK_START)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
507 continue;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
508
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
509 if (!info->cell->visible)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
510 continue;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
511
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
512 area.width = info->real_width;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
513 if (!rtl)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
514 area.x -= area.width;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
515
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
516 gtk_cell_renderer_render (info->cell,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
517 widget->window,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
518 widget,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
519 /* FIXME ! */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
520 &area, &area, &event->area, state);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
521 if (rtl)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
522 area.x += info->real_width;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
523 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
524
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
525 return FALSE;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
526 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
527
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
528 static GtkCellViewCellInfo *
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
529 gtk_cell_view_get_cell_info (GtkCellView *cellview,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
530 GtkCellRenderer *renderer)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
531 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
532 GList *i;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
533
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
534 for (i = cellview->priv->cell_list; i; i = i->next)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
535 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
536 GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
537
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
538 if (info->cell == renderer)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
539 return info;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
540 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
541
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
542 return NULL;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
543 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
544
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
545 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
546 gtk_cell_view_set_cell_data (GtkCellView *cellview)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
547 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
548 GList *i;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
549 GtkTreeIter iter;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
550 GtkTreePath *path;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
551
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
552 g_return_if_fail (cellview->priv->displayed_row != NULL);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
553
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
554 path = gtk_tree_row_reference_get_path (cellview->priv->displayed_row);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
555 gtk_tree_model_get_iter (cellview->priv->model, &iter, path);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
556 gtk_tree_path_free (path);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
557
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
558 for (i = cellview->priv->cell_list; i; i = i->next)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
559 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
560 GSList *j;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
561 GtkCellViewCellInfo *info = i->data;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
562
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
563 g_object_freeze_notify (G_OBJECT (info->cell));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
564
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
565 for (j = info->attributes; j && j->next; j = j->next->next)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
566 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
567 gchar *property = j->data;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
568 gint column = GPOINTER_TO_INT (j->next->data);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
569 GValue value = {0, };
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
570
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
571 gtk_tree_model_get_value (cellview->priv->model, &iter,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
572 column, &value);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
573 g_object_set_property (G_OBJECT (info->cell),
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
574 property, &value);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
575 g_value_unset (&value);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
576 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
577
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
578 if (info->func)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
579 (* info->func) (GTK_CELL_LAYOUT (cellview),
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
580 info->cell,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
581 cellview->priv->model,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
582 &iter,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
583 info->func_data);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
584
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
585 g_object_thaw_notify (G_OBJECT (info->cell));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
586 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
587 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
588
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
589 /* GtkCellLayout implementation */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
590 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
591 gtk_cell_view_cell_layout_pack_start (GtkCellLayout *layout,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
592 GtkCellRenderer *renderer,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
593 gboolean expand)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
594 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
595 GtkCellViewCellInfo *info;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
596 GtkCellView *cellview = GTK_CELL_VIEW (layout);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
597
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
598 g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
599 g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
600 g_return_if_fail (!gtk_cell_view_get_cell_info (cellview, renderer));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
601
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
602 g_object_ref (G_OBJECT (renderer));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
603 gtk_object_sink (GTK_OBJECT (renderer));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
604
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
605 info = g_new0 (GtkCellViewCellInfo, 1);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
606 info->cell = renderer;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
607 info->expand = expand ? TRUE : FALSE;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
608 info->pack = GTK_PACK_START;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
609
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
610 cellview->priv->cell_list = g_list_append (cellview->priv->cell_list, info);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
611 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
612
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
613 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
614 gtk_cell_view_cell_layout_pack_end (GtkCellLayout *layout,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
615 GtkCellRenderer *renderer,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
616 gboolean expand)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
617 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
618 GtkCellViewCellInfo *info;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
619 GtkCellView *cellview = GTK_CELL_VIEW (layout);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
620
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
621 g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
622 g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
623 g_return_if_fail (!gtk_cell_view_get_cell_info (cellview, renderer));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
624
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
625 g_object_ref (G_OBJECT (renderer));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
626 gtk_object_sink (GTK_OBJECT (renderer));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
627
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
628 info = g_new0 (GtkCellViewCellInfo, 1);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
629 info->cell = renderer;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
630 info->expand = expand ? TRUE : FALSE;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
631 info->pack = GTK_PACK_END;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
632
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
633 cellview->priv->cell_list = g_list_append (cellview->priv->cell_list, info);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
634 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
635
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
636 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
637 gtk_cell_view_cell_layout_add_attribute (GtkCellLayout *layout,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
638 GtkCellRenderer *renderer,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
639 const gchar *attribute,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
640 gint column)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
641 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
642 GtkCellViewCellInfo *info;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
643 GtkCellView *cellview = GTK_CELL_VIEW (layout);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
644
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
645 g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
646 info = gtk_cell_view_get_cell_info (cellview, renderer);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
647 g_return_if_fail (info != NULL);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
648
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
649 info->attributes = g_slist_prepend (info->attributes,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
650 GINT_TO_POINTER (column));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
651 info->attributes = g_slist_prepend (info->attributes,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
652 g_strdup (attribute));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
653 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
654
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
655 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
656 gtk_cell_view_cell_layout_clear (GtkCellLayout *layout)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
657 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
658 GtkCellView *cellview = GTK_CELL_VIEW (layout);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
659
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
660 g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
661
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
662 while (cellview->priv->cell_list)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
663 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
664 GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)cellview->priv->cell_list->data;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
665
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
666 gtk_cell_view_cell_layout_clear_attributes (layout, info->cell);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
667 g_object_unref (G_OBJECT (info->cell));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
668 g_free (info);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
669 cellview->priv->cell_list = g_list_delete_link (cellview->priv->cell_list,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
670 cellview->priv->cell_list);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
671 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
672 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
673
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
674 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
675 gtk_cell_view_cell_layout_set_cell_data_func (GtkCellLayout *layout,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
676 GtkCellRenderer *cell,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
677 GtkCellLayoutDataFunc func,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
678 gpointer func_data,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
679 GDestroyNotify destroy)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
680 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
681 GtkCellView *cellview = GTK_CELL_VIEW (layout);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
682 GtkCellViewCellInfo *info;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
683
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
684 g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
685
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
686 info = gtk_cell_view_get_cell_info (cellview, cell);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
687 g_return_if_fail (info != NULL);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
688
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
689 if (info->destroy)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
690 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
691 GDestroyNotify d = info->destroy;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
692
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
693 info->destroy = NULL;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
694 d (info->func_data);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
695 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
696
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
697 info->func = func;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
698 info->func_data = func_data;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
699 info->destroy = destroy;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
700 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
701
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
702 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
703 gtk_cell_view_cell_layout_clear_attributes (GtkCellLayout *layout,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
704 GtkCellRenderer *renderer)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
705 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
706 GtkCellViewCellInfo *info;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
707 GtkCellView *cellview = GTK_CELL_VIEW (layout);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
708 GSList *list;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
709
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
710 g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
711 g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
712
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
713 info = gtk_cell_view_get_cell_info (cellview, renderer);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
714 if (info != NULL)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
715 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
716 list = info->attributes;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
717 while (list && list->next)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
718 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
719 g_free (list->data);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
720 list = list->next->next;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
721 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
722
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
723 g_slist_free (info->attributes);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
724 info->attributes = NULL;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
725 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
726 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
727
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
728 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
729 gtk_cell_view_cell_layout_reorder (GtkCellLayout *layout,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
730 GtkCellRenderer *cell,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
731 gint position)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
732 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
733 GList *link;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
734 GtkCellViewCellInfo *info;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
735 GtkCellView *cellview = GTK_CELL_VIEW (layout);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
736
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
737 g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
738 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
739
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
740 info = gtk_cell_view_get_cell_info (cellview, cell);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
741
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
742 g_return_if_fail (info != NULL);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
743 g_return_if_fail (position >= 0);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
744
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
745 link = g_list_find (cellview->priv->cell_list, info);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
746
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
747 g_return_if_fail (link != NULL);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
748
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
749 cellview->priv->cell_list = g_list_remove_link (cellview->priv->cell_list,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
750 link);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
751 cellview->priv->cell_list = g_list_insert (cellview->priv->cell_list,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
752 info, position);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
753
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
754 gtk_widget_queue_draw (GTK_WIDGET (cellview));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
755 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
756
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
757 /* public API */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
758 GtkWidget *
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
759 gtk_cell_view_new (void)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
760 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
761 GtkCellView *cellview;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
762
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
763 cellview = GTK_CELL_VIEW (g_object_new (gtk_cell_view_get_type (), NULL));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
764
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
765 return GTK_WIDGET (cellview);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
766 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
767
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
768 GtkWidget *
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
769 gtk_cell_view_new_with_text (const gchar *text)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
770 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
771 GtkCellView *cellview;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
772 GtkCellRenderer *renderer;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
773 GValue value = {0, };
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
774
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
775 cellview = GTK_CELL_VIEW (gtk_cell_view_new ());
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
776
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
777 renderer = gtk_cell_renderer_text_new ();
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
778 gtk_cell_view_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview),
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
779 renderer, TRUE);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
780
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
781 g_value_init (&value, G_TYPE_STRING);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
782 g_value_set_string (&value, text);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
783 gtk_cell_view_set_values (cellview, renderer, "text", &value, NULL);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
784 g_value_unset (&value);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
785
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
786 return GTK_WIDGET (cellview);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
787 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
788
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
789 GtkWidget *
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
790 gtk_cell_view_new_with_markup (const gchar *markup)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
791 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
792 GtkCellView *cellview;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
793 GtkCellRenderer *renderer;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
794 GValue value = {0, };
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
795
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
796 cellview = GTK_CELL_VIEW (gtk_cell_view_new ());
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
797
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
798 renderer = gtk_cell_renderer_text_new ();
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
799 gtk_cell_view_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview),
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
800 renderer, TRUE);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
801
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
802 g_value_init (&value, G_TYPE_STRING);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
803 g_value_set_string (&value, markup);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
804 gtk_cell_view_set_values (cellview, renderer, "markup", &value, NULL);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
805 g_value_unset (&value);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
806
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
807 return GTK_WIDGET (cellview);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
808 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
809
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
810 GtkWidget *
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
811 gtk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
812 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
813 GtkCellView *cellview;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
814 GtkCellRenderer *renderer;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
815 GValue value = {0, };
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
816
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
817 cellview = GTK_CELL_VIEW (gtk_cell_view_new ());
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
818
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
819 renderer = gtk_cell_renderer_pixbuf_new ();
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
820 gtk_cell_view_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview),
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
821 renderer, TRUE);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
822
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
823 g_value_init (&value, GDK_TYPE_PIXBUF);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
824 g_value_set_object (&value, pixbuf);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
825 gtk_cell_view_set_values (cellview, renderer, "pixbuf", &value, NULL);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
826 g_value_unset (&value);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
827
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
828 return GTK_WIDGET (cellview);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
829 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
830
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
831 void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
832 gtk_cell_view_set_value (GtkCellView *cell_view,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
833 GtkCellRenderer *renderer,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
834 gchar *property,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
835 GValue *value)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
836 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
837 g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
838 g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
839
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
840 g_object_set_property (G_OBJECT (renderer), property, value);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
841
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
842 /* force resize and redraw */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
843 gtk_widget_queue_resize (GTK_WIDGET (cell_view));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
844 gtk_widget_queue_draw (GTK_WIDGET (cell_view));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
845 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
846
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
847 static void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
848 gtk_cell_view_set_valuesv (GtkCellView *cell_view,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
849 GtkCellRenderer *renderer,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
850 va_list args)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
851 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
852 gchar *attribute;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
853 GValue *value;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
854
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
855 attribute = va_arg (args, gchar *);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
856
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
857 while (attribute)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
858 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
859 value = va_arg (args, GValue *);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
860 gtk_cell_view_set_value (cell_view, renderer, attribute, value);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
861 attribute = va_arg (args, gchar *);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
862 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
863 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
864
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
865 void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
866 gtk_cell_view_set_values (GtkCellView *cell_view,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
867 GtkCellRenderer *renderer,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
868 ...)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
869 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
870 va_list args;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
871
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
872 g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
873 g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
874 g_return_if_fail (gtk_cell_view_get_cell_info (cell_view, renderer));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
875
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
876 va_start (args, renderer);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
877 gtk_cell_view_set_valuesv (cell_view, renderer, args);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
878 va_end (args);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
879 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
880
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
881 void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
882 gtk_cell_view_set_model (GtkCellView *cell_view,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
883 GtkTreeModel *model)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
884 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
885 g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
886 g_return_if_fail (GTK_IS_TREE_MODEL (model));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
887
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
888 if (cell_view->priv->model)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
889 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
890 if (cell_view->priv->displayed_row)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
891 gtk_tree_row_reference_free (cell_view->priv->displayed_row);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
892 cell_view->priv->displayed_row = NULL;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
893
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
894 g_object_unref (G_OBJECT (cell_view->priv->model));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
895 cell_view->priv->model = NULL;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
896 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
897
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
898 cell_view->priv->model = model;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
899
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
900 if (cell_view->priv->model)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
901 g_object_ref (G_OBJECT (cell_view->priv->model));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
902 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
903
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
904 /**
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
905 * gtk_cell_view_set_displayed_row:
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
906 * @cell_view: a #GtkCellView
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
907 * @path: a #GtkTreePath or %NULL to unset.
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
908 *
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
909 * Sets the row of the model that is currently displayed
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
910 * by the #GtkCellView. If the path is unset, then the
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
911 * contents of the cellview "stick" at their last value;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
912 * this is not normally a desired result, but may be
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
913 * a needed intermediate state if say, the model for
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
914 * the #GtkCellView becomes temporarily empty.
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
915 **/
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
916 void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
917 gtk_cell_view_set_displayed_row (GtkCellView *cell_view,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
918 GtkTreePath *path)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
919 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
920 g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
921 g_return_if_fail (GTK_IS_TREE_MODEL (cell_view->priv->model));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
922
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
923 if (cell_view->priv->displayed_row)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
924 gtk_tree_row_reference_free (cell_view->priv->displayed_row);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
925
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
926 if (path)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
927 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
928 cell_view->priv->displayed_row =
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
929 gtk_tree_row_reference_new (cell_view->priv->model, path);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
930 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
931 else
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
932 cell_view->priv->displayed_row = NULL;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
933
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
934 /* force resize and redraw */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
935 gtk_widget_queue_resize (GTK_WIDGET (cell_view));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
936 gtk_widget_queue_draw (GTK_WIDGET (cell_view));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
937 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
938
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
939 GtkTreePath *
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
940 gtk_cell_view_get_displayed_row (GtkCellView *cell_view)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
941 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
942 g_return_val_if_fail (GTK_IS_CELL_VIEW (cell_view), NULL);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
943
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
944 if (!cell_view->priv->displayed_row)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
945 return NULL;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
946
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
947 return gtk_tree_row_reference_get_path (cell_view->priv->displayed_row);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
948 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
949
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
950 gboolean
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
951 gtk_cell_view_get_size_of_row (GtkCellView *cell_view,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
952 GtkTreePath *path,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
953 GtkRequisition *requisition)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
954 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
955 GtkTreeRowReference *tmp;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
956 GtkRequisition req;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
957
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
958 g_return_val_if_fail (GTK_IS_CELL_VIEW (cell_view), FALSE);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
959 g_return_val_if_fail (path != NULL, FALSE);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
960 g_return_val_if_fail (requisition != NULL, FALSE);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
961
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
962 tmp = cell_view->priv->displayed_row;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
963 cell_view->priv->displayed_row =
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
964 gtk_tree_row_reference_new (cell_view->priv->model, path);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
965
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
966 gtk_cell_view_size_request (GTK_WIDGET (cell_view), requisition);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
967
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
968 gtk_tree_row_reference_free (cell_view->priv->displayed_row);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
969 cell_view->priv->displayed_row = tmp;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
970
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
971 /* restore actual size info */
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
972 gtk_cell_view_size_request (GTK_WIDGET (cell_view), &req);
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
973
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
974 return TRUE;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
975 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
976
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
977 void
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
978 gtk_cell_view_set_background_color (GtkCellView *view,
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
979 const GdkColor *color)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
980 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
981 g_return_if_fail (GTK_IS_CELL_VIEW (view));
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
982
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
983 if (color)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
984 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
985 if (!view->priv->background_set)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
986 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
987 view->priv->background_set = TRUE;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
988 g_object_notify (G_OBJECT (view), "background_set");
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
989 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
990
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
991 view->priv->background = *color;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
992 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
993 else
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
994 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
995 if (view->priv->background_set)
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
996 {
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
997 view->priv->background_set = FALSE;
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
998 g_object_notify (G_OBJECT (view), "background_set");
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
999 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1000 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1001 }
d0d1d631ed49 [gaim-migrate @ 12297]
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1002 #endif /* Gtk 2.6 */