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
=== modified 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 2013-04-20 10:09:26 +0000
@@ -72,7 +72,8 @@
72 PROP_0,72 PROP_0,
73 PROP_EXPANDER_STYLE,73 PROP_EXPANDER_STYLE,
74 PROP_EXPANDER_SIZE,74 PROP_EXPANDER_SIZE,
75 PROP_ACTIVATABLE75 PROP_ACTIVATABLE,
76 PROP_ONLY_DRAW_ON_HOVER
76};77};
7778
78typedef struct _GossipCellRendererExpanderPriv GossipCellRendererExpanderPriv;79typedef struct _GossipCellRendererExpanderPriv GossipCellRendererExpanderPriv;
@@ -89,6 +90,7 @@
8990
90 guint activatable : 1;91 guint activatable : 1;
91 guint animation_expanding : 1;92 guint animation_expanding : 1;
93 guint only_draw_on_hover : 1;
92};94};
9395
94G_DEFINE_TYPE (GossipCellRendererExpander, gossip_cell_renderer_expander, GTK_TYPE_CELL_RENDERER)96G_DEFINE_TYPE (GossipCellRendererExpander, gossip_cell_renderer_expander, GTK_TYPE_CELL_RENDERER)
@@ -104,6 +106,7 @@
104 priv->expander_size = 12;106 priv->expander_size = 12;
105 priv->activatable = TRUE;107 priv->activatable = TRUE;
106 priv->animation_node = NULL;108 priv->animation_node = NULL;
109 priv->only_draw_on_hover = FALSE;
107110
108 gtk_cell_renderer_set_padding (GTK_CELL_RENDERER (expander), 2, 2);111 gtk_cell_renderer_set_padding (GTK_CELL_RENDERER (expander), 2, 2);
109 g_object_set (expander,112 g_object_set (expander,
@@ -156,6 +159,14 @@
156 TRUE,159 TRUE,
157 G_PARAM_READWRITE));160 G_PARAM_READWRITE));
158161
162 g_object_class_install_property (object_class,
163 PROP_ONLY_DRAW_ON_HOVER,
164 g_param_spec_boolean ("only-draw-on-hover",
165 "Only Draw On Hover",
166 "Whether to only draw expander when the renderer is hovered",
167 FALSE,
168 G_PARAM_READWRITE));
169
159 g_type_class_add_private (object_class, sizeof (GossipCellRendererExpanderPriv));170 g_type_class_add_private (object_class, sizeof (GossipCellRendererExpanderPriv));
160}171}
161172
@@ -184,6 +195,10 @@
184 g_value_set_boolean (value, priv->activatable);195 g_value_set_boolean (value, priv->activatable);
185 break;196 break;
186197
198 case PROP_ONLY_DRAW_ON_HOVER:
199 g_value_set_boolean (value, priv->only_draw_on_hover);
200 break;
201
187 default:202 default:
188 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);203 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
189 break;204 break;
@@ -215,6 +230,10 @@
215 priv->activatable = g_value_get_boolean (value);230 priv->activatable = g_value_get_boolean (value);
216 break;231 break;
217232
233 case PROP_ONLY_DRAW_ON_HOVER:
234 priv->only_draw_on_hover = g_value_get_boolean (value);
235 break;
236
218 default:237 default:
219 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);238 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
220 break;239 break;
@@ -305,10 +324,16 @@
305 GtkExpanderStyle expander_style;324 GtkExpanderStyle expander_style;
306 gint x_offset, y_offset;325 gint x_offset, y_offset;
307 gint xpad, ypad;326 gint xpad, ypad;
327 gboolean hovered;
308328
309 expander = (GossipCellRendererExpander*) cell;329 expander = (GossipCellRendererExpander*) cell;
310 priv = GET_PRIV (expander);330 priv = GET_PRIV (expander);
311331
332 hovered = (flags & GTK_CELL_RENDERER_PRELIT) != 0;
333
334 if (priv->only_draw_on_hover && !hovered)
335 return;
336
312 if (priv->animation_node) {337 if (priv->animation_node) {
313 GtkTreePath *path;338 GtkTreePath *path;
314 GdkRectangle rect;339 GdkRectangle rect;
315340
=== 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-20 10:09:26 +0000
@@ -2921,7 +2921,9 @@
2921 /* Expander */2921 /* Expander */
29222922
2923 cell = gossip_cell_renderer_expander_new ();2923 cell = gossip_cell_renderer_expander_new ();
2924 g_object_set (cell, "only-draw-on-hover", TRUE, NULL);
2924 sidebar->expander_renderer = cell;2925 sidebar->expander_renderer = cell;
2926
2925 /* align expander with eject buttons */2927 /* align expander with eject buttons */
2926 gint exp_size;2928 gint exp_size;
2927 g_object_get (cell, "expander-size", &exp_size, NULL);2929 g_object_get (cell, "expander-size", &exp_size, NULL);

Subscribers

People subscribed via source and target branches

to all changes: