Merge lp:~victored/pantheon-files/places-sidebar-granite-expanders into lp:~elementary-apps/pantheon-files/trunk

Proposed by Victor Martinez
Status: Merged
Merged at revision: 1172
Proposed branch: lp:~victored/pantheon-files/places-sidebar-granite-expanders
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 662 lines (+15/-585)
4 files modified
src/CMakeLists.txt (+0/-1)
src/gossip-cell-renderer-expander.c (+0/-518)
src/gossip-cell-renderer-expander.h (+0/-57)
src/marlin-places-sidebar.c (+15/-9)
To merge this branch: bzr merge lp:~victored/pantheon-files/places-sidebar-granite-expanders
Reviewer Review Type Date Requested Status
Cody Garver (community) Approve
elementary Apps team Pending
Review via email: mp+159984@code.launchpad.net

This proposal supersedes a proposal from 2013-04-20.

Description of the change

Use Granite's Expander renderer and add "source-list" style class.

The purpose of this branch is inheriting the theming and behavior of the expanders from Granite.SourceList without porting files to it.

To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) wrote : Posted in a previous version of this proposal

I thought Dan was going to accomplish this using the theme.

review: Needs Information
Revision history for this message
Victor Martinez (victored) wrote : Posted in a previous version of this proposal

Now that I think more about it, that sounds like a better idea. Specially if Daniel ever wants animations.

I'll modify Granite's expander renderer to use an special style class for the expanders in main categories, and use Granite's renderer from Files, dropping gossip-cell-renderer-expander.* along the way.

Let's leave this as a proof-of-concept.

review: Disapprove
1155. By Victor Martinez

Move variable declarations to the beginning of marlin_places_sidebar_init()

Revision history for this message
Cody Garver (codygarver) wrote :

[ 83%] Building C object src/CMakeFiles/pantheon-files.dir/View/Chrome/ImgEventBox.c.o
Linking C executable pantheon-files
CMakeFiles/pantheon-files.dir/marlin-places-sidebar.c.o: In function `marlin_places_sidebar_init':
marlin-places-sidebar.c:(.text+0xb48): undefined reference to `granite_widgets_cell_renderer_expander_set_is_category_expander'
collect2: ld returned 1 exit status
make[2]: *** [src/pantheon-files] Error 1
make[1]: *** [src/CMakeFiles/pantheon-files.dir/all] Error 2
make: *** [all] Error 2

Am I missing a Granite branch?

review: Needs Information
Revision history for this message
Victor Martinez (victored) wrote :

Hey Cody, sorry for that.

I forgot to mention that lp:~victored/granite/category-expander is a pre-requisite branch. Please install the granite version from that branch and try again :)

Revision history for this message
Cody Garver (codygarver) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2012-11-25 01:19:24 +0000
+++ src/CMakeLists.txt 2013-04-21 19:29:27 +0000
@@ -84,7 +84,6 @@
84add_executable(pantheon-files84add_executable(pantheon-files
85 eel-editable-label.c85 eel-editable-label.c
86 marlin-application.c86 marlin-application.c
87 gossip-cell-renderer-expander.c
88 marlin-enum-types.c87 marlin-enum-types.c
89 marlin-bookmark.c88 marlin-bookmark.c
90 marlin-bookmark-list.c89 marlin-bookmark-list.c
9190
=== removed file 'src/gossip-cell-renderer-expander.c'
--- src/gossip-cell-renderer-expander.c 2011-01-12 14:15:32 +0000
+++ src/gossip-cell-renderer-expander.c 1970-01-01 00:00:00 +0000
@@ -1,518 +0,0 @@
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2/*
3 * Copyright (C) 2006 Kristian Rietveld <kris@babi-pangang.org>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
19 */
20
21/* To do:
22 * - should probably cancel animation if model changes
23 * - need to handle case where node-in-animation is removed
24 * - it only handles a single animation at a time; but I guess users
25 * aren't fast enough to trigger two or more animations at once anyway :P
26 * (could guard for this by just cancelling the "old" animation, and
27 * start the new one).
28 */
29
30#include "config.h"
31
32#include <gtk/gtk.h>
33
34#include "gossip-cell-renderer-expander.h"
35
36#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GOSSIP_TYPE_CELL_RENDERER_EXPANDER, GossipCellRendererExpanderPriv))
37
38static void gossip_cell_renderer_expander_init (GossipCellRendererExpander *expander);
39static void gossip_cell_renderer_expander_class_init (GossipCellRendererExpanderClass *klass);
40static void gossip_cell_renderer_expander_get_property (GObject *object,
41 guint param_id,
42 GValue *value,
43 GParamSpec *pspec);
44static void gossip_cell_renderer_expander_set_property (GObject *object,
45 guint param_id,
46 const GValue *value,
47 GParamSpec *pspec);
48static void gossip_cell_renderer_expander_finalize (GObject *object);
49static void gossip_cell_renderer_expander_get_size (GtkCellRenderer *cell,
50 GtkWidget *widget,
51 const GdkRectangle *cell_area,
52 gint *x_offset,
53 gint *y_offset,
54 gint *width,
55 gint *height);
56static void gossip_cell_renderer_expander_render (GtkCellRenderer *cell,
57 cairo_t *cr,
58 GtkWidget *widget,
59 const GdkRectangle *background_area,
60 const GdkRectangle *cell_area,
61 GtkCellRendererState flags);
62static gboolean gossip_cell_renderer_expander_activate (GtkCellRenderer *cell,
63 GdkEvent *event,
64 GtkWidget *widget,
65 const gchar *path,
66 const GdkRectangle *background_area,
67 const GdkRectangle *cell_area,
68 GtkCellRendererState flags);
69
70/* Properties */
71enum {
72 PROP_0,
73 PROP_EXPANDER_STYLE,
74 PROP_EXPANDER_SIZE,
75 PROP_ACTIVATABLE
76};
77
78typedef struct _GossipCellRendererExpanderPriv GossipCellRendererExpanderPriv;
79
80struct _GossipCellRendererExpanderPriv {
81 GtkExpanderStyle expander_style;
82 gint expander_size;
83
84 GtkTreeView *animation_view;
85 GtkTreeRowReference *animation_node;
86 GtkExpanderStyle animation_style;
87 guint animation_timeout;
88 GdkRectangle animation_area;
89
90 guint activatable : 1;
91 guint animation_expanding : 1;
92};
93
94G_DEFINE_TYPE (GossipCellRendererExpander, gossip_cell_renderer_expander, GTK_TYPE_CELL_RENDERER)
95
96static void
97gossip_cell_renderer_expander_init (GossipCellRendererExpander *expander)
98{
99 GossipCellRendererExpanderPriv *priv;
100
101 priv = GET_PRIV (expander);
102
103 priv->expander_style = GTK_EXPANDER_COLLAPSED;
104 priv->expander_size = 12;
105 priv->activatable = TRUE;
106 priv->animation_node = NULL;
107
108 gtk_cell_renderer_set_padding (GTK_CELL_RENDERER (expander), 2, 2);
109 g_object_set (expander,
110 "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
111 NULL);
112}
113
114static void
115gossip_cell_renderer_expander_class_init (GossipCellRendererExpanderClass *klass)
116{
117 GObjectClass *object_class;
118 GtkCellRendererClass *cell_class;
119
120 object_class = G_OBJECT_CLASS (klass);
121 cell_class = GTK_CELL_RENDERER_CLASS (klass);
122
123 object_class->finalize = gossip_cell_renderer_expander_finalize;
124
125 object_class->get_property = gossip_cell_renderer_expander_get_property;
126 object_class->set_property = gossip_cell_renderer_expander_set_property;
127
128 cell_class->get_size = gossip_cell_renderer_expander_get_size;
129 cell_class->render = gossip_cell_renderer_expander_render;
130 cell_class->activate = gossip_cell_renderer_expander_activate;
131
132 g_object_class_install_property (object_class,
133 PROP_EXPANDER_STYLE,
134 g_param_spec_enum ("expander-style",
135 "Expander Style",
136 "Style to use when painting the expander",
137 GTK_TYPE_EXPANDER_STYLE,
138 GTK_EXPANDER_COLLAPSED,
139 G_PARAM_READWRITE));
140
141 g_object_class_install_property (object_class,
142 PROP_EXPANDER_SIZE,
143 g_param_spec_int ("expander-size",
144 "Expander Size",
145 "The size of the expander",
146 0,
147 G_MAXINT,
148 12,
149 G_PARAM_READWRITE));
150
151 g_object_class_install_property (object_class,
152 PROP_ACTIVATABLE,
153 g_param_spec_boolean ("activatable",
154 "Activatable",
155 "The expander can be activated",
156 TRUE,
157 G_PARAM_READWRITE));
158
159 g_type_class_add_private (object_class, sizeof (GossipCellRendererExpanderPriv));
160}
161
162static void
163gossip_cell_renderer_expander_get_property (GObject *object,
164 guint param_id,
165 GValue *value,
166 GParamSpec *pspec)
167{
168 GossipCellRendererExpander *expander;
169 GossipCellRendererExpanderPriv *priv;
170
171 expander = GOSSIP_CELL_RENDERER_EXPANDER (object);
172 priv = GET_PRIV (expander);
173
174 switch (param_id) {
175 case PROP_EXPANDER_STYLE:
176 g_value_set_enum (value, priv->expander_style);
177 break;
178
179 case PROP_EXPANDER_SIZE:
180 g_value_set_int (value, priv->expander_size);
181 break;
182
183 case PROP_ACTIVATABLE:
184 g_value_set_boolean (value, priv->activatable);
185 break;
186
187 default:
188 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
189 break;
190 }
191}
192
193static void
194gossip_cell_renderer_expander_set_property (GObject *object,
195 guint param_id,
196 const GValue *value,
197 GParamSpec *pspec)
198{
199 GossipCellRendererExpander *expander;
200 GossipCellRendererExpanderPriv *priv;
201
202 expander = GOSSIP_CELL_RENDERER_EXPANDER (object);
203 priv = GET_PRIV (expander);
204
205 switch (param_id) {
206 case PROP_EXPANDER_STYLE:
207 priv->expander_style = g_value_get_enum (value);
208 break;
209
210 case PROP_EXPANDER_SIZE:
211 priv->expander_size = g_value_get_int (value);
212 break;
213
214 case PROP_ACTIVATABLE:
215 priv->activatable = g_value_get_boolean (value);
216 break;
217
218 default:
219 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
220 break;
221 }
222}
223
224static void
225gossip_cell_renderer_expander_finalize (GObject *object)
226{
227 GossipCellRendererExpanderPriv *priv;
228
229 priv = GET_PRIV (object);
230
231 if (priv->animation_timeout) {
232 g_source_remove (priv->animation_timeout);
233 priv->animation_timeout = 0;
234 }
235
236 if (priv->animation_node) {
237 gtk_tree_row_reference_free (priv->animation_node);
238 }
239
240 (* G_OBJECT_CLASS (gossip_cell_renderer_expander_parent_class)->finalize) (object);
241}
242
243GtkCellRenderer *
244gossip_cell_renderer_expander_new (void)
245{
246 return g_object_new (GOSSIP_TYPE_CELL_RENDERER_EXPANDER, NULL);
247}
248
249static void
250gossip_cell_renderer_expander_get_size (GtkCellRenderer *cell,
251 GtkWidget *widget,
252 const GdkRectangle *cell_area,
253 gint *x_offset,
254 gint *y_offset,
255 gint *width,
256 gint *height)
257{
258 GossipCellRendererExpander *expander;
259 GossipCellRendererExpanderPriv *priv;
260 gint xpad, ypad;
261 gfloat xalign, yalign;
262
263 expander = (GossipCellRendererExpander*) cell;
264 priv = GET_PRIV (expander);
265 gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
266
267 if (cell_area) {
268
269 gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
270
271 if (x_offset) {
272 *x_offset = xalign * (cell_area->width - (priv->expander_size + (2 * xpad)));
273 *x_offset = MAX (*x_offset, 0);
274 }
275
276 if (y_offset) {
277 *y_offset = yalign * (cell_area->height - (priv->expander_size + (2 * ypad)));
278 *y_offset = MAX (*y_offset, 0);
279 }
280 } else {
281 if (x_offset)
282 *x_offset = 0;
283
284 if (y_offset)
285 *y_offset = 0;
286 }
287
288 if (width)
289 *width = xpad * 2 + priv->expander_size;
290
291 if (height)
292 *height = ypad * 2 + priv->expander_size;
293}
294
295static void
296gossip_cell_renderer_expander_render (GtkCellRenderer *cell,
297 cairo_t *cr,
298 GtkWidget *widget,
299 const GdkRectangle *background_area,
300 const GdkRectangle *cell_area,
301 GtkCellRendererState flags)
302{
303 GossipCellRendererExpander *expander;
304 GossipCellRendererExpanderPriv *priv;
305 GtkExpanderStyle expander_style;
306 gint x_offset, y_offset;
307 gint xpad, ypad;
308
309 expander = (GossipCellRendererExpander*) cell;
310 priv = GET_PRIV (expander);
311
312 if (priv->animation_node) {
313 GtkTreePath *path;
314 GdkRectangle rect;
315
316 /* Not sure if I like this ... */
317 path = gtk_tree_row_reference_get_path (priv->animation_node);
318 gtk_tree_view_get_background_area (priv->animation_view, path,
319 NULL, &rect);
320 gtk_tree_path_free (path);
321
322 if (background_area->y == rect.y)
323 expander_style = priv->animation_style;
324 else
325 expander_style = priv->expander_style;
326 } else
327 expander_style = priv->expander_style;
328
329 gossip_cell_renderer_expander_get_size (cell, widget, cell_area,
330 &x_offset, &y_offset,
331 NULL, NULL);
332 gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
333
334 gtk_paint_expander (gtk_widget_get_style (widget),
335 cr,
336 GTK_STATE_NORMAL,
337 widget,
338 "treeview",
339 cell_area->x + x_offset + xpad + priv->expander_size / 2,
340 cell_area->y + y_offset + ypad + priv->expander_size / 2,
341 expander_style);
342}
343
344static void
345invalidate_node (GtkTreeView *tree_view,
346 GtkTreePath *path)
347{
348 GtkAllocation allocation;
349 GdkWindow *bin_window;
350 GdkRectangle rect;
351
352 bin_window = gtk_tree_view_get_bin_window (tree_view);
353
354 gtk_tree_view_get_background_area (tree_view, path, NULL, &rect);
355 gtk_widget_get_allocation (GTK_WIDGET (tree_view), &allocation);
356
357 rect.x = 0;
358 rect.width = allocation.width;
359
360 gdk_window_invalidate_rect (bin_window, &rect, TRUE);
361}
362
363static gboolean
364do_animation (GossipCellRendererExpander *expander)
365{
366 GossipCellRendererExpanderPriv *priv;
367 GtkTreePath *path;
368 gboolean done = FALSE;
369
370 priv = GET_PRIV (expander);
371
372 if (priv->animation_expanding) {
373 if (priv->animation_style == GTK_EXPANDER_SEMI_COLLAPSED)
374 priv->animation_style = GTK_EXPANDER_SEMI_EXPANDED;
375 else if (priv->animation_style == GTK_EXPANDER_SEMI_EXPANDED) {
376 priv->animation_style = GTK_EXPANDER_EXPANDED;
377 done = TRUE;
378 }
379 } else {
380 if (priv->animation_style == GTK_EXPANDER_SEMI_EXPANDED)
381 priv->animation_style = GTK_EXPANDER_SEMI_COLLAPSED;
382 else if (priv->animation_style == GTK_EXPANDER_SEMI_COLLAPSED) {
383 priv->animation_style = GTK_EXPANDER_COLLAPSED;
384 done = TRUE;
385 }
386 }
387
388 if (priv->animation_node) {
389 path = gtk_tree_row_reference_get_path (priv->animation_node);
390 invalidate_node (priv->animation_view, path);
391 gtk_tree_path_free (path);
392 }
393
394 if (done) {
395 gtk_tree_row_reference_free (priv->animation_node);
396 priv->animation_node = NULL;
397 priv->animation_timeout = 0;
398 }
399
400 return !done;
401}
402
403static gboolean
404animation_timeout (gpointer data)
405{
406 gboolean retval;
407
408 GDK_THREADS_ENTER ();
409
410 retval = do_animation (data);
411
412 GDK_THREADS_LEAVE ();
413
414 return retval;
415}
416
417static void
418gossip_cell_renderer_expander_start_animation (GossipCellRendererExpander *expander,
419 GtkTreeView *tree_view,
420 GtkTreePath *path,
421 gboolean expanding,
422 const GdkRectangle *background_area)
423{
424 GossipCellRendererExpanderPriv *priv;
425
426 priv = GET_PRIV (expander);
427
428 if (expanding) {
429 priv->animation_style = GTK_EXPANDER_SEMI_COLLAPSED;
430 } else {
431 priv->animation_style = GTK_EXPANDER_SEMI_EXPANDED;
432 }
433
434 invalidate_node (tree_view, path);
435
436 priv->animation_expanding = expanding;
437 priv->animation_view = tree_view;
438 priv->animation_node = gtk_tree_row_reference_new (gtk_tree_view_get_model (tree_view), path);
439 priv->animation_timeout = g_timeout_add (50, animation_timeout, expander);
440}
441
442static gboolean
443gossip_cell_renderer_expander_activate (GtkCellRenderer *cell,
444 GdkEvent *event,
445 GtkWidget *widget,
446 const gchar *path_string,
447 const GdkRectangle *background_area,
448 const GdkRectangle *cell_area,
449 GtkCellRendererState flags)
450{
451 GossipCellRendererExpander *expander;
452 GossipCellRendererExpanderPriv *priv;
453 GtkTreePath *path;
454 GtkSettings *settings;
455 gboolean animate = FALSE;
456 gboolean expanding;
457 gboolean in_cell;
458 int mouse_x;
459 int mouse_y;
460
461 expander = GOSSIP_CELL_RENDERER_EXPANDER (cell);
462 priv = GET_PRIV (cell);
463
464 if (!GTK_IS_TREE_VIEW (widget) || !priv->activatable)
465 return FALSE;
466
467 path = gtk_tree_path_new_from_string (path_string);
468
469 gtk_widget_get_pointer (widget, &mouse_x, &mouse_y);
470 gtk_tree_view_convert_widget_to_bin_window_coords (GTK_TREE_VIEW (widget),
471 mouse_x, mouse_y,
472 &mouse_x, &mouse_y);
473
474 /* check if click is within the cell */
475 if (mouse_x - cell_area->x >= 0
476 && mouse_x - cell_area->x <= cell_area->width) {
477 in_cell = TRUE;
478 } else {
479 in_cell = FALSE;
480 }
481
482 if (! in_cell) {
483 return FALSE;
484 }
485
486#if 0
487 if (gtk_tree_path_get_depth (path) > 1) {
488 gtk_tree_path_free (path);
489 return TRUE;
490 }
491#endif
492 settings = gtk_widget_get_settings (GTK_WIDGET (widget));
493 if (g_object_class_find_property (G_OBJECT_GET_CLASS (settings), "gtk-enable-animations")) {
494 g_object_get (settings,
495 "gtk-enable-animations", &animate,
496 NULL);
497 }
498
499 if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (widget), path)) {
500 gtk_tree_view_collapse_row (GTK_TREE_VIEW (widget), path);
501 expanding = FALSE;
502 } else {
503 gtk_tree_view_expand_row (GTK_TREE_VIEW (widget), path, FALSE);
504 expanding = TRUE;
505 }
506
507 if (animate) {
508 gossip_cell_renderer_expander_start_animation (expander,
509 GTK_TREE_VIEW (widget),
510 path,
511 expanding,
512 background_area);
513 }
514
515 gtk_tree_path_free (path);
516
517 return TRUE;
518}
5190
=== removed file 'src/gossip-cell-renderer-expander.h'
--- src/gossip-cell-renderer-expander.h 2010-12-02 11:36:38 +0000
+++ src/gossip-cell-renderer-expander.h 1970-01-01 00:00:00 +0000
@@ -1,57 +0,0 @@
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2/*
3 * Copyright (C) 2006 Kristian Rietveld <kris@babi-pangang.org>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
19 */
20
21#ifndef __GOSSIP_CELL_RENDERER_EXPANDER_H__
22#define __GOSSIP_CELL_RENDERER_EXPANDER_H__
23
24#include <gtk/gtk.h>
25
26G_BEGIN_DECLS
27
28#define GOSSIP_TYPE_CELL_RENDERER_EXPANDER (gossip_cell_renderer_expander_get_type ())
29#define GOSSIP_CELL_RENDERER_EXPANDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GOSSIP_TYPE_CELL_RENDERER_EXPANDER, GossipCellRendererExpander))
30#define GOSSIP_CELL_RENDERER_EXPANDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GOSSIP_TYPE_CELL_RENDERER_EXPANDER, GossipCellRendererExpanderClass))
31#define GOSSIP_IS_CELL_RENDERER_EXPANDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GOSSIP_TYPE_CELL_RENDERER_EXPANDER))
32#define GOSSIP_IS_CELL_RENDERER_EXPANDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GOSSIP_TYPE_CELL_RENDERER_EXPANDER))
33#define GOSSIP_CELL_RENDERER_EXPANDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GOSSIP_TYPE_CELL_RENDERER_EXPANDER, GossipCellRendererExpanderClass))
34
35typedef struct _GossipCellRendererExpander GossipCellRendererExpander;
36typedef struct _GossipCellRendererExpanderClass GossipCellRendererExpanderClass;
37
38struct _GossipCellRendererExpander {
39 GtkCellRenderer parent;
40};
41
42struct _GossipCellRendererExpanderClass {
43 GtkCellRendererClass parent_class;
44
45 /* Padding for future expansion */
46 void (*_gtk_reserved1) (void);
47 void (*_gtk_reserved2) (void);
48 void (*_gtk_reserved3) (void);
49 void (*_gtk_reserved4) (void);
50};
51
52GType gossip_cell_renderer_expander_get_type (void) G_GNUC_CONST;
53GtkCellRenderer *gossip_cell_renderer_expander_new (void);
54
55G_END_DECLS
56
57#endif /* __GOSSIP_CELL_RENDERER_EXPANDER_H__ */
580
=== modified file 'src/marlin-places-sidebar.c'
--- src/marlin-places-sidebar.c 2013-02-05 23:40:22 +0000
+++ src/marlin-places-sidebar.c 2013-04-21 19:29:27 +0000
@@ -26,7 +26,6 @@
26#include "eel-fcts.h"26#include "eel-fcts.h"
27#include "eel-gtk-extensions.h"27#include "eel-gtk-extensions.h"
28#include "eel-gio-extensions.h"28#include "eel-gio-extensions.h"
29#include "gossip-cell-renderer-expander.h"
30#include <gdk/gdkkeysyms.h>29#include <gdk/gdkkeysyms.h>
31#include <glib/gi18n.h>30#include <glib/gi18n.h>
32#include <gio/gio.h>31#include <gio/gio.h>
@@ -2749,10 +2748,7 @@
2749 row_expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (gtk_tree_view_column_get_tree_view (tree_column)), path);2748 row_expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (gtk_tree_view_column_get_tree_view (tree_column)), path);
2750 gtk_tree_path_free (path);2749 gtk_tree_path_free (path);
27512750
2752 g_object_set (sidebar->expander_renderer,2751 g_object_set (sidebar->expander_renderer, "visible", TRUE, NULL);
2753 "visible", TRUE,
2754 "expander-style", row_expanded ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED,
2755 NULL);
2756 } else {2752 } else {
2757 g_object_set (sidebar->expander_renderer, "visible", FALSE, NULL);2753 g_object_set (sidebar->expander_renderer, "visible", FALSE, NULL);
2758 }2754 }
@@ -2819,6 +2815,8 @@
2819 GtkTreeViewColumn *expcol;2815 GtkTreeViewColumn *expcol;
2820 GtkCellRenderer *cell;2816 GtkCellRenderer *cell;
2821 GtkTreeSelection *selection;2817 GtkTreeSelection *selection;
2818 GtkStyleContext *style_context;
2819 GraniteWidgetsCellRendererExpander *expander_renderer;
28222820
2823 sidebar->uri = NULL;2821 sidebar->uri = NULL;
2824 sidebar->volume_monitor = g_volume_monitor_get ();2822 sidebar->volume_monitor = g_volume_monitor_get ();
@@ -2919,12 +2917,18 @@
2919 g_object_set (tree_view, "show-expanders", FALSE, NULL);2917 g_object_set (tree_view, "show-expanders", FALSE, NULL);
29202918
2921 /* Expander */2919 /* Expander */
2920 expander_renderer = granite_widgets_cell_renderer_expander_new ();
29222921
2923 cell = gossip_cell_renderer_expander_new ();
2924 sidebar->expander_renderer = cell;
2925 /* align expander with eject buttons */2922 /* align expander with eject buttons */
2926 gint exp_size;2923 gint exp_size;
2927 g_object_get (cell, "expander-size", &exp_size, NULL);2924 exp_size = GRANITE_WIDGETS_CELL_RENDERER_EXPANDER_GET_CLASS (expander_renderer)->get_arrow_size (expander_renderer,
2925 GTK_WIDGET (tree_view));
2926
2927 granite_widgets_cell_renderer_expander_set_is_category_expander (expander_renderer, TRUE);
2928
2929 cell = GTK_CELL_RENDERER (expander_renderer);
2930 sidebar->expander_renderer = cell;
2931
2928 g_object_set (cell, "xpad", ABS (16 - exp_size) + EJECT_BUTTON_XPAD - 2, "xalign", 1.0, NULL);2932 g_object_set (cell, "xpad", ABS (16 - exp_size) + EJECT_BUTTON_XPAD - 2, "xalign", 1.0, NULL);
2929 gtk_tree_view_column_pack_end (col, cell, FALSE);2933 gtk_tree_view_column_pack_end (col, cell, FALSE);
2930 gtk_tree_view_column_set_cell_data_func (col, 2934 gtk_tree_view_column_set_cell_data_func (col,
@@ -2945,7 +2949,9 @@
29452949
2946 gtk_container_add (GTK_CONTAINER (sidebar), GTK_WIDGET (tree_view));2950 gtk_container_add (GTK_CONTAINER (sidebar), GTK_WIDGET (tree_view));
29472951
2948 gtk_style_context_add_class(gtk_widget_get_style_context(GTK_WIDGET(tree_view)), "sidebar");2952 style_context = gtk_widget_get_style_context (GTK_WIDGET (tree_view));
2953 gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_SIDEBAR);
2954 gtk_style_context_add_class (style_context, GRANITE_STYLE_CLASS_SOURCE_LIST);
29492955
2950 gtk_widget_show (GTK_WIDGET (tree_view));2956 gtk_widget_show (GTK_WIDGET (tree_view));
2951 gtk_widget_show (GTK_WIDGET (sidebar));2957 gtk_widget_show (GTK_WIDGET (sidebar));

Subscribers

People subscribed via source and target branches

to all changes: