Merge lp:~meese/pantheon-photos/flag_icons into lp:~pantheon-photos/pantheon-photos/trunk

Proposed by meese
Status: Merged
Approved by: Cody Garver
Approved revision: 2592
Merged at revision: 2600
Proposed branch: lp:~meese/pantheon-photos/flag_icons
Merge into: lp:~pantheon-photos/pantheon-photos/trunk
Diff against target: 145 lines (+38/-17)
5 files modified
Makefile (+1/-4)
src/PhotoPage.vala (+1/-1)
src/Resources.vala (+31/-9)
src/SearchFilter.vala (+4/-2)
src/Thumbnail.vala (+1/-1)
To merge this branch: bzr merge lp:~meese/pantheon-photos/flag_icons
Reviewer Review Type Date Requested Status
meese Needs Resubmitting
Robert Roth (community) Needs Fixing
Danielle Foré ux Approve
elementary Apps team code Pending
Review via email: mp+231984@code.launchpad.net

Commit message

changes flag icons to get from theme

Description of the change

changes flag icons to get from theme

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

Is there a way to add like 3px padding inside the "trinket"?

Also on diff lines 120 and 121 lets use IconSize.Menu and 16px

lp:~meese/pantheon-photos/flag_icons updated
2590. By meese

adds padding to flag trinket icon and sets pixel size to 16 for search bar icon

Revision history for this message
meese (meese) wrote :

done, and pixel_size=16 needs to be called here too for the same reason as in the other icon MR

Revision history for this message
Danielle Foré (danrabbit) wrote :

Looks great!

review: Approve (ux)
Revision history for this message
Robert Roth (evfool) wrote :

See my comments and questions inline.

review: Needs Fixing
lp:~meese/pantheon-photos/flag_icons updated
2591. By meese

changed hardcoded strings to resource const

Revision history for this message
meese (meese) wrote :

Fixed the hardcoded strings.

>I'm not sure setting pixel size and icon_widget is required, setting icon-name on the
Lies! it is, the Tool Buttons will resize the image to whatever they want (32px which is the height of the entire bar which leaves no padding and looks awful) if pixel_size is not set

review: Needs Resubmitting
lp:~meese/pantheon-photos/flag_icons updated
2592. By meese

merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2014-08-25 06:04:50 +0000
3+++ Makefile 2014-08-27 06:23:23 +0000
4@@ -175,8 +175,6 @@
5 enhance.png \
6 five-star-filter.svg \
7 five-stars.svg \
8- flag-page.png \
9- flag-trinket.png \
10 four-star-filter-plus.svg \
11 four-stars.svg \
12 image-adjust.svg \
13@@ -198,8 +196,7 @@
14 two-star-filter-plus.svg \
15 two-stars.svg \
16 videos-page.png \
17- generic-plugin.png \
18- filter-flagged.png
19+ generic-plugin.png
20
21 HELP_FILES = \
22 edit-adjustments.page \
23
24=== removed file 'icons/filter-flagged.png'
25Binary files icons/filter-flagged.png 2011-03-14 23:41:40 +0000 and icons/filter-flagged.png 1970-01-01 00:00:00 +0000 differ
26=== removed file 'icons/flag-page.png'
27Binary files icons/flag-page.png 2010-12-09 22:17:15 +0000 and icons/flag-page.png 1970-01-01 00:00:00 +0000 differ
28=== removed file 'icons/flag-trinket.png'
29Binary files icons/flag-trinket.png 2010-12-09 22:17:15 +0000 and icons/flag-trinket.png 1970-01-01 00:00:00 +0000 differ
30=== modified file 'src/PhotoPage.vala'
31--- src/PhotoPage.vala 2014-08-27 03:08:01 +0000
32+++ src/PhotoPage.vala 2014-08-27 06:23:23 +0000
33@@ -2887,7 +2887,7 @@
34 if (!has_photo () || ! ((LibraryPhoto) get_photo ()).is_flagged ())
35 return null;
36
37- return Resources.get_icon (Resources.ICON_FLAGGED_TRINKET);
38+ return Resources.get_flag_trinket ();
39 }
40
41 private void on_slideshow () {
42
43=== modified file 'src/Resources.vala'
44--- src/Resources.vala 2014-08-25 06:04:50 +0000
45+++ src/Resources.vala 2014-08-27 06:23:23 +0000
46@@ -125,14 +125,10 @@
47 public const string ICON_MISSING_FILES = "process-stop";
48 public const string ICON_PHOTOS = "folder-pictures";
49 public const string ICON_SINGLE_PHOTO = "image-x-generic";
50-public const string ICON_FILTER_FLAGGED = "filter-flagged";
51-public const string ICON_FILTER_FLAGGED_DISABLED = "filter-flagged-disabled";
52 public const string ICON_TRASH_EMPTY = "user-trash";
53 public const string ICON_TRASH_FULL = "user-trash-full";
54 public const string ICON_VIDEOS_PAGE = "videos-page";
55-public const string ICON_FLAGGED_PAGE = "flag-page";
56-public const string ICON_FLAGGED_TRINKET = "flag-trinket.png";
57-public const string ICON_EDIT_FLAGGED = "filter-flagged";
58+public const string ICON_FLAGGED_PAGE = "edit-flag";
59
60 public const string ROTATE_CW_MENU = _("Rotate _Right");
61 public const string ROTATE_CW_LABEL = _("Rotate");
62@@ -633,6 +629,35 @@
63
64 }
65
66+private static Gdk.Pixbuf? flag_trinket_cache;
67+private static const int flag_padding = 2;
68+
69+public Gdk.Pixbuf? get_flag_trinket () {
70+ if (flag_trinket_cache != null)
71+ return flag_trinket_cache;
72+
73+ int size = 16;
74+ int padded_size = size + flag_padding * 2;
75+ Granite.Drawing.BufferSurface surface = new Granite.Drawing.BufferSurface (padded_size, padded_size);
76+ Cairo.Context cr = surface.context;
77+
78+ cr.set_source_rgba (0, 0, 0, 0.35);
79+ cr.rectangle (0, 0, padded_size, padded_size);
80+ cr.paint ();
81+
82+ Gdk.Pixbuf flag;
83+ Gtk.IconTheme icon_theme = get_icon_theme_engine ();
84+ try {
85+ flag = icon_theme.load_icon (ICON_FLAGGED_PAGE, size, Gtk.IconLookupFlags.FORCE_SIZE);
86+ } catch (Error e) {
87+ return null;
88+ }
89+
90+ Gdk.cairo_set_source_pixbuf (cr, flag, flag_padding, flag_padding);
91+ cr.paint ();
92+ flag_trinket_cache = surface.load_to_pixbuf ();
93+ return flag_trinket_cache;
94+}
95
96 private void generate_rating_strings () {
97 string menu_base = "%s";
98@@ -780,14 +805,11 @@
99 add_stock_icon (icons_dir.get_child ("enhance.png"), ENHANCE);
100 add_stock_icon (icons_dir.get_child ("crop-pivot-reticle.png"), CROP_PIVOT_RETICLE);
101 add_stock_icon (icons_dir.get_child ("merge.svg"), MERGE);
102- add_stock_icon_from_themed_icon (new GLib.ThemedIcon (ICON_FLAGGED_PAGE), ICON_FLAGGED_PAGE);
103+
104 add_stock_icon_from_themed_icon (new GLib.ThemedIcon (ICON_VIDEOS_PAGE), ICON_VIDEOS_PAGE);
105 add_stock_icon_from_themed_icon (new GLib.ThemedIcon (ICON_SINGLE_PHOTO), ICON_SINGLE_PHOTO);
106 add_stock_icon_from_themed_icon (new GLib.ThemedIcon (ICON_CAMERAS), ICON_CAMERAS);
107
108- add_stock_icon_from_themed_icon (new GLib.ThemedIcon (ICON_FILTER_FLAGGED),
109- ICON_FILTER_FLAGGED_DISABLED, dim_pixbuf);
110-
111 factory.add_default ();
112
113 generate_rating_strings ();
114
115=== modified file 'src/SearchFilter.vala'
116--- src/SearchFilter.vala 2014-08-24 02:52:40 +0000
117+++ src/SearchFilter.vala 2014-08-27 06:23:23 +0000
118@@ -411,10 +411,12 @@
119 toolbar.insert (label_flagged_item, -1);
120
121 toolbtn_flag = new Gtk.ToggleToolButton ();
122- toolbtn_flag.icon_name = Resources.ICON_FILTER_FLAGGED;
123+
124+ var flag_icon = new Gtk.Image.from_icon_name (Resources.ICON_FLAGGED_PAGE, Gtk.IconSize.MENU);
125+ flag_icon.pixel_size = 16;
126+ toolbtn_flag.set_icon_widget (flag_icon);
127 toolbtn_flag.tooltip_text = _ ("Flagged");
128 toolbtn_flag.toggled.connect (on_flagged_toggled);
129-
130 toolbar.insert (toolbtn_flag, -1);
131
132 // separator
133
134=== modified file 'src/Thumbnail.vala'
135--- src/Thumbnail.vala 2014-08-08 21:13:09 +0000
136+++ src/Thumbnail.vala 2014-08-27 06:23:23 +0000
137@@ -387,7 +387,7 @@
138 Flaggable? flaggable = media as Flaggable;
139
140 return (flaggable != null && flaggable.is_flagged ())
141- ? Resources.get_icon (Resources.ICON_FLAGGED_TRINKET) : null;
142+ ? Resources.get_flag_trinket () : null;
143 }
144
145 protected override Gdk.Pixbuf? get_bottom_left_trinket (int scale) {

Subscribers

People subscribed via source and target branches

to all changes: