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

Subscribers

People subscribed via source and target branches

to all changes: