comparison pidgin/gtkcellrendererprogress.c @ 25415:584063555949

Remove trailing whitespace
author Mark Doliner <mark@kingant.net>
date Mon, 26 Jan 2009 06:44:00 +0000
parents 6bf32c9e15a7
children
comparison
equal deleted inserted replaced
25414:7fc110f70662 25415:584063555949
16 * 16 *
17 * This program is distributed in the hope that it will be useful, 17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details. 20 * GNU General Public License for more details.
21 * 21 *
22 * You should have received a copy of the GNU General Public License 22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software 23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 * 25 *
26 */ 26 */
27 27
28 /* This is taken largely from GtkCellRenderer[Text|Pixbuf|Toggle] by 28 /* This is taken largely from GtkCellRenderer[Text|Pixbuf|Toggle] by
29 * Jonathon Blandford <jrb@redhat.com> for RedHat, Inc. 29 * Jonathon Blandford <jrb@redhat.com> for RedHat, Inc.
30 */ 30 */
31 31
32 #include "gtkcellrendererprogress.h" 32 #include "gtkcellrendererprogress.h"
33 33
74 PROP_0, 74 PROP_0,
75 PROP_PERCENTAGE, 75 PROP_PERCENTAGE,
76 PROP_TEXT, 76 PROP_TEXT,
77 PROP_SHOW_TEXT 77 PROP_SHOW_TEXT
78 }; 78 };
79 79
80 static gpointer parent_class; 80 static gpointer parent_class;
81 /* static guint progress_cell_renderer_signals [LAST_SIGNAL]; */ 81 /* static guint progress_cell_renderer_signals [LAST_SIGNAL]; */
82 82
83 GType pidgin_cell_renderer_progress_get_type (void) 83 GType pidgin_cell_renderer_progress_get_type (void)
84 { 84 {
85 static GType cell_progress_type = 0; 85 static GType cell_progress_type = 0;
86 86
87 if (!cell_progress_type) 87 if (!cell_progress_type)
88 { 88 {
89 static const GTypeInfo cell_progress_info = 89 static const GTypeInfo cell_progress_info =
90 { 90 {
91 sizeof (PidginCellRendererProgressClass), 91 sizeof (PidginCellRendererProgressClass),
97 sizeof (PidginCellRendererProgress), 97 sizeof (PidginCellRendererProgress),
98 0, /* n_preallocs */ 98 0, /* n_preallocs */
99 (GInstanceInitFunc) pidgin_cell_renderer_progress_init, 99 (GInstanceInitFunc) pidgin_cell_renderer_progress_init,
100 NULL /* value_table */ 100 NULL /* value_table */
101 }; 101 };
102 102
103 cell_progress_type = 103 cell_progress_type =
104 g_type_register_static (GTK_TYPE_CELL_RENDERER, 104 g_type_register_static (GTK_TYPE_CELL_RENDERER,
105 "PidginCellRendererProgress", 105 "PidginCellRendererProgress",
106 &cell_progress_info, 0); 106 &cell_progress_info, 0);
107 } 107 }
108 108
109 return cell_progress_type; 109 return cell_progress_type;
110 } 110 }
111 111
112 static void pidgin_cell_renderer_progress_init (PidginCellRendererProgress *cellprogress) 112 static void pidgin_cell_renderer_progress_init (PidginCellRendererProgress *cellprogress)
113 { 113 {
118 118
119 static void pidgin_cell_renderer_progress_class_init (PidginCellRendererProgressClass *class) 119 static void pidgin_cell_renderer_progress_class_init (PidginCellRendererProgressClass *class)
120 { 120 {
121 GObjectClass *object_class = G_OBJECT_CLASS(class); 121 GObjectClass *object_class = G_OBJECT_CLASS(class);
122 GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS(class); 122 GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS(class);
123 123
124 parent_class = g_type_class_peek_parent (class); 124 parent_class = g_type_class_peek_parent (class);
125 object_class->finalize = pidgin_cell_renderer_progress_finalize; 125 object_class->finalize = pidgin_cell_renderer_progress_finalize;
126 126
127 object_class->get_property = pidgin_cell_renderer_progress_get_property; 127 object_class->get_property = pidgin_cell_renderer_progress_get_property;
128 object_class->set_property = pidgin_cell_renderer_progress_set_property; 128 object_class->set_property = pidgin_cell_renderer_progress_set_property;
129 129
130 cell_class->get_size = pidgin_cell_renderer_progress_get_size; 130 cell_class->get_size = pidgin_cell_renderer_progress_get_size;
131 cell_class->render = pidgin_cell_renderer_progress_render; 131 cell_class->render = pidgin_cell_renderer_progress_render;
132 132
133 g_object_class_install_property (object_class, 133 g_object_class_install_property (object_class,
134 PROP_PERCENTAGE, 134 PROP_PERCENTAGE,
135 g_param_spec_double ("percentage", 135 g_param_spec_double ("percentage",
136 "Percentage", 136 "Percentage",
137 "The fractional progress to display", 137 "The fractional progress to display",
226 gint *width, 226 gint *width,
227 gint *height) 227 gint *height)
228 { 228 {
229 gint calc_width; 229 gint calc_width;
230 gint calc_height; 230 gint calc_height;
231 231
232 calc_width = (gint) cell->xpad * 2 + 50; 232 calc_width = (gint) cell->xpad * 2 + 50;
233 calc_height = (gint) cell->ypad * 2 + 12; 233 calc_height = (gint) cell->ypad * 2 + 12;
234 234
235 if (width) 235 if (width)
236 *width = calc_width; 236 *width = calc_width;
237 237
238 if (height) 238 if (height)
239 *height = calc_height; 239 *height = calc_height;
240 240
241 if (cell_area) 241 if (cell_area)
242 { 242 {
243 if (x_offset) 243 if (x_offset)
244 { 244 {
245 *x_offset = cell->xalign * (cell_area->width - calc_width); 245 *x_offset = cell->xalign * (cell_area->width - calc_width);
261 GdkRectangle *cell_area, 261 GdkRectangle *cell_area,
262 GdkRectangle *expose_area, 262 GdkRectangle *expose_area,
263 guint flags) 263 guint flags)
264 { 264 {
265 PidginCellRendererProgress *cellprogress = (PidginCellRendererProgress *) cell; 265 PidginCellRendererProgress *cellprogress = (PidginCellRendererProgress *) cell;
266 266
267 gint width, height; 267 gint width, height;
268 GtkStateType state; 268 GtkStateType state;
269 269
270 width = cell_area->width; 270 width = cell_area->width;
271 height = cell_area->height; 271 height = cell_area->height;
272 272
273 if (GTK_WIDGET_HAS_FOCUS (widget)) 273 if (GTK_WIDGET_HAS_FOCUS (widget))
274 state = GTK_STATE_ACTIVE; 274 state = GTK_STATE_ACTIVE;
275 else 275 else
276 state = GTK_STATE_NORMAL; 276 state = GTK_STATE_NORMAL;
277 277
278 width -= cell->xpad*2; 278 width -= cell->xpad*2;
279 height -= cell->ypad*2; 279 height -= cell->ypad*2;
280 280
281 gtk_paint_box (widget->style, 281 gtk_paint_box (widget->style,
282 window, 282 window,
283 GTK_STATE_NORMAL, GTK_SHADOW_IN, 283 GTK_STATE_NORMAL, GTK_SHADOW_IN,
284 NULL, widget, "trough", 284 NULL, widget, "trough",
285 cell_area->x + cell->xpad, 285 cell_area->x + cell->xpad,
286 cell_area->y + cell->ypad, 286 cell_area->y + cell->ypad,
287 width - 1, height - 1); 287 width - 1, height - 1);
288 gtk_paint_box (widget->style, 288 gtk_paint_box (widget->style,