Merge lp:~tintou/pantheon-photos/cleanup into lp:~pantheon-photos/pantheon-photos/trunk

Proposed by Corentin Noël
Status: Merged
Approved by: Cody Garver
Approved revision: 2918
Merged at revision: 2918
Proposed branch: lp:~tintou/pantheon-photos/cleanup
Merge into: lp:~pantheon-photos/pantheon-photos/trunk
Diff against target: 144 lines (+0/-134)
1 file modified
src/sidebar/Rating.vala (+0/-134)
To merge this branch: bzr merge lp:~tintou/pantheon-photos/cleanup
Reviewer Review Type Date Requested Status
Photos Devs Pending
Review via email: mp+292863@code.launchpad.net

Commit message

Remove unused PhotoCellRendererRating

Description of the change

Removing unused stuff

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/sidebar/Rating.vala'
2--- src/sidebar/Rating.vala 2014-08-14 05:30:11 +0000
3+++ src/sidebar/Rating.vala 2016-04-25 22:01:13 +0000
4@@ -269,140 +269,6 @@
5 }
6 }
7
8-/**
9- * This class makes setting the rating from a cell possible. Unlike the other widgets,
10- * it only allows doing so by clicking over a star.
11- *
12- * When the rating changes by activating (i.e. clicking) the cell renderer, it doesn't re-draw itself
13- * automatically and/or apply the new rating right away, since there could be client code wanting
14- * to check the new value. Instead, it passes the responsability off to the rating_changed signal handler.
15- * That signal handler ''must'' take care of setting the new rating on the proper cell, and only then
16- * the new value will take effect.
17- *
18- *
19- */
20-public class PhotoCellRendererRating : Gtk.CellRendererPixbuf {
21- /**
22- * New rating was set. It is only emmited when the rating changes by activating the renderer.
23- *
24- * @param new_rating new selected rating.
25- * @param widget Widget that captured the event (e.g. a {@link Gtk.TreeView}).
26- * @param path string representation of the tree path for the cell where the event occurred.
27- *
28- */
29- public signal void rating_changed (int new_rating, Gtk.Widget widget, string path);
30-
31- private PhotoRatingRenderer renderer;
32-
33- /**
34- * Creates a new rating cell renderer.
35- *
36- * @param icon_size Pixel size of the star icons
37- *
38- */
39- public PhotoCellRendererRating (int icon_size = 16) {
40- this.xalign = 0.0f;
41- this.mode = Gtk.CellRendererMode.ACTIVATABLE;
42-
43- renderer = new PhotoRatingRenderer (icon_size, true, null);
44-
45- // We'll only redraw from render() for performance reasons
46- renderer.delayed_render_mode = true;
47-
48- // Set rating to 1 star and render to init the 'width' property
49- rating = 1;
50- renderer.render ();
51- update_pixbuf ();
52- }
53-
54- /**
55- * Spacing inserted between star icons.
56- *
57- *
58- */
59- public int star_spacing {
60- get {
61- return renderer.star_spacing;
62- } set {
63- renderer.star_spacing = value;
64- }
65- }
66-
67- private uint _rating = 0;
68-
69-
70- /**
71- * Current displayed rating.
72- *
73- *
74- */
75- public uint rating {
76- get {
77- return _rating;
78- } set {
79- _rating = value;
80- renderer.rating = _rating;
81- }
82- }
83-
84- /**
85- * Total number of stars. It also represents the maximum rating possible.
86- * That is, possible ratings are between 0 and //n_stars//.
87- *
88- * Allowed values: >= 0. Default: 5.
89- *
90- */
91- public int n_stars {
92- get {
93- return renderer.n_stars;
94- } set {
95- renderer.n_stars = value;
96- }
97- }
98-
99- private void update_pixbuf () {
100- this.pixbuf = renderer.canvas;
101- this.set_fixed_size (this.pixbuf.width, this.pixbuf.height);
102- }
103-
104- public override void render (Cairo.Context ctx, Gtk.Widget widget,
105- Gdk.Rectangle background_area, Gdk.Rectangle cell_area,
106- Gtk.CellRendererState flags) {
107- var style_context = widget.get_style_context ();
108- var state = style_context.get_state ();
109- int old_n_stars = n_stars;
110-
111- // Only draw stars of 0-rating if the cursor is over the cell
112- if (_rating == 0 && (state & (Gtk.StateFlags.SELECTED | Gtk.StateFlags.PRELIGHT)) == 0)
113- return;
114-
115- // Only show the filled stars if the row is neither selected nor mouseovered
116- if (0 < _rating && (state & (Gtk.StateFlags.SELECTED | Gtk.StateFlags.PRELIGHT)) == 0)
117- n_stars = (int) rating;
118-
119- renderer.style_context = style_context;
120- renderer.render ();
121- update_pixbuf ();
122- base.render (ctx, widget, background_area, cell_area, flags);
123- n_stars = old_n_stars;
124- }
125-
126- public override bool activate (Gdk.Event event, Gtk.Widget widget, string path,
127- Gdk.Rectangle background_area, Gdk.Rectangle cell_area,
128- Gtk.CellRendererState flags) {
129- int old_rating = (int) rating;
130- int new_rating = renderer.get_new_rating (event.button.x - cell_area.x);
131-
132- // If the user clicks again over the same star, decrease the rating (i.e. "unset" the star)
133- if (new_rating == old_rating && new_rating > 0)
134- new_rating--;
135-
136- // emit signal
137- rating_changed (new_rating, widget, path);
138-
139- return true;
140- }
141-}
142
143 public class PhotoRatingRenderer : Object {
144 /**

Subscribers

People subscribed via source and target branches

to all changes: