Merge lp:~victored/pantheon-files/hidden-source-list-expanders into lp:~elementary-apps/pantheon-files/trunk

Proposed by Victor Martinez
Status: Superseded
Proposed branch: lp:~victored/pantheon-files/hidden-source-list-expanders
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 97 lines (+28/-1)
2 files modified
src/gossip-cell-renderer-expander.c (+26/-1)
src/marlin-places-sidebar.c (+2/-0)
To merge this branch: bzr merge lp:~victored/pantheon-files/hidden-source-list-expanders
Reviewer Review Type Date Requested Status
Victor Martinez (community) Disapprove
Cody Garver (community) Needs Information
Review via email: mp+159920@code.launchpad.net

This proposal has been superseded by a proposal from 2013-04-21.

Description of the change

Only show source list expanders on hover.

To post a comment you must log in.
1155. By Victor Martinez

remove dummy function prototype

1156. By Victor Martinez

coding style fix

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

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

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

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

Unmerged revisions

1156. By Victor Martinez

coding style fix

1155. By Victor Martinez

remove dummy function prototype

1154. By Victor Martinez

Only draw source-list expanders when hovering over them.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/gossip-cell-renderer-expander.c'
2--- src/gossip-cell-renderer-expander.c 2011-01-12 14:15:32 +0000
3+++ src/gossip-cell-renderer-expander.c 2013-04-20 10:09:26 +0000
4@@ -72,7 +72,8 @@
5 PROP_0,
6 PROP_EXPANDER_STYLE,
7 PROP_EXPANDER_SIZE,
8- PROP_ACTIVATABLE
9+ PROP_ACTIVATABLE,
10+ PROP_ONLY_DRAW_ON_HOVER
11 };
12
13 typedef struct _GossipCellRendererExpanderPriv GossipCellRendererExpanderPriv;
14@@ -89,6 +90,7 @@
15
16 guint activatable : 1;
17 guint animation_expanding : 1;
18+ guint only_draw_on_hover : 1;
19 };
20
21 G_DEFINE_TYPE (GossipCellRendererExpander, gossip_cell_renderer_expander, GTK_TYPE_CELL_RENDERER)
22@@ -104,6 +106,7 @@
23 priv->expander_size = 12;
24 priv->activatable = TRUE;
25 priv->animation_node = NULL;
26+ priv->only_draw_on_hover = FALSE;
27
28 gtk_cell_renderer_set_padding (GTK_CELL_RENDERER (expander), 2, 2);
29 g_object_set (expander,
30@@ -156,6 +159,14 @@
31 TRUE,
32 G_PARAM_READWRITE));
33
34+ g_object_class_install_property (object_class,
35+ PROP_ONLY_DRAW_ON_HOVER,
36+ g_param_spec_boolean ("only-draw-on-hover",
37+ "Only Draw On Hover",
38+ "Whether to only draw expander when the renderer is hovered",
39+ FALSE,
40+ G_PARAM_READWRITE));
41+
42 g_type_class_add_private (object_class, sizeof (GossipCellRendererExpanderPriv));
43 }
44
45@@ -184,6 +195,10 @@
46 g_value_set_boolean (value, priv->activatable);
47 break;
48
49+ case PROP_ONLY_DRAW_ON_HOVER:
50+ g_value_set_boolean (value, priv->only_draw_on_hover);
51+ break;
52+
53 default:
54 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
55 break;
56@@ -215,6 +230,10 @@
57 priv->activatable = g_value_get_boolean (value);
58 break;
59
60+ case PROP_ONLY_DRAW_ON_HOVER:
61+ priv->only_draw_on_hover = g_value_get_boolean (value);
62+ break;
63+
64 default:
65 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
66 break;
67@@ -305,10 +324,16 @@
68 GtkExpanderStyle expander_style;
69 gint x_offset, y_offset;
70 gint xpad, ypad;
71+ gboolean hovered;
72
73 expander = (GossipCellRendererExpander*) cell;
74 priv = GET_PRIV (expander);
75
76+ hovered = (flags & GTK_CELL_RENDERER_PRELIT) != 0;
77+
78+ if (priv->only_draw_on_hover && !hovered)
79+ return;
80+
81 if (priv->animation_node) {
82 GtkTreePath *path;
83 GdkRectangle rect;
84
85=== modified file 'src/marlin-places-sidebar.c'
86--- src/marlin-places-sidebar.c 2013-02-05 23:40:22 +0000
87+++ src/marlin-places-sidebar.c 2013-04-20 10:09:26 +0000
88@@ -2921,7 +2921,9 @@
89 /* Expander */
90
91 cell = gossip_cell_renderer_expander_new ();
92+ g_object_set (cell, "only-draw-on-hover", TRUE, NULL);
93 sidebar->expander_renderer = cell;
94+
95 /* align expander with eject buttons */
96 gint exp_size;
97 g_object_get (cell, "expander-size", &exp_size, NULL);

Subscribers

People subscribed via source and target branches

to all changes: