Merge lp:~mhr3/unity-lens-applications/colorize-scopes into lp:unity-lens-applications

Proposed by Michal Hruby
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 363
Merged at revision: 362
Proposed branch: lp:~mhr3/unity-lens-applications/colorize-scopes
Merge into: lp:unity-lens-applications
Diff against target: 142 lines (+35/-37)
3 files modified
configure.ac (+1/-1)
debian/control (+1/-1)
src/scopes-scope.vala (+33/-35)
To merge this branch: bzr merge lp:~mhr3/unity-lens-applications/colorize-scopes
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+182577@code.launchpad.net

Commit message

Colorize scope icons - use orange color for enabled scopes and dim disabled ones.

Description of the change

Colorize scope icons - use orange color for enabled scopes and dim disabled ones.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Paweł Stołowski (stolowski) wrote :

43 + anno_icon.set_colorize_rgba (1.0, 1.0, 1.0, 0.5);
44 + else
45 + anno_icon.set_colorize_rgba (0.86666, 0.28235, 0.07843, 1.0);

Can you add comments about what are the resulting colors (white / orange), including hex value of the orange variant?

Otherwise looking good.

review: Needs Fixing
363. By Michal Hruby

Add a comment about used colors

Revision history for this message
Michal Hruby (mhr3) wrote :

> Can you add comments about what are the resulting colors (white / orange),
> including hex value of the orange variant?

Added.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Paweł Stołowski (stolowski) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2013-07-26 09:36:11 +0000
3+++ configure.ac 2013-08-28 11:43:23 +0000
4@@ -78,7 +78,7 @@
5 dee-1.0 >= 0.5.16
6 zeitgeist-1.0 >= 0.3.8
7 libcolumbus0 >= 0.4.0
8- unity >= 7.0.0
9+ unity >= 7.1.0
10 unity-protocol-private
11 libgnome-menu-3.0 >= 3.6.0)
12
13
14=== modified file 'debian/control'
15--- debian/control 2013-07-15 10:33:36 +0000
16+++ debian/control 2013-08-28 11:43:23 +0000
17@@ -11,7 +11,7 @@
18 libgee-dev,
19 libdee-dev (>= 0.5.16),
20 libzeitgeist-dev (>= 0.3.8),
21- libunity-dev (>= 7.0.0),
22+ libunity-dev (>= 7.1.0),
23 libgnome-menu-3-dev,
24 dh-autoreconf,
25 libxapian-dev,
26
27=== modified file 'src/scopes-scope.vala'
28--- src/scopes-scope.vala 2013-08-08 16:21:51 +0000
29+++ src/scopes-scope.vala 2013-08-28 11:43:23 +0000
30@@ -260,6 +260,28 @@
31 callback (this);
32 }
33
34+ private string get_scope_icon (string icon_hint, bool is_disabled)
35+ {
36+ try
37+ {
38+ Icon base_icon = icon_hint == null || icon_hint == "" ?
39+ ScopesScope.get_default_icon () : Icon.new_for_string (icon_hint);
40+ var anno_icon = new AnnotatedIcon (base_icon);
41+ anno_icon.size_hint = IconSizeHint.SMALL;
42+ // dim disabled icons by decreasing their alpha, tint enabled ones
43+ // to brand orange #dd4814
44+ if (is_disabled)
45+ anno_icon.set_colorize_rgba (1.0, 1.0, 1.0, 0.5);
46+ else
47+ anno_icon.set_colorize_rgba (0.86666, 0.28235, 0.07843, 1.0);
48+ return anno_icon.to_string ();
49+ }
50+ catch (Error err)
51+ {
52+ return "";
53+ }
54+ }
55+
56 private void add_local_results (string search_query, Unity.ResultSet result_set)
57 {
58 bool has_search = !Utils.is_search_empty (search_query);
59@@ -275,13 +297,15 @@
60 {
61 /* Don't include master scopes in the search results. This is
62 * performed after deduping so the master scopes don't just
63- * move to hte "available" category. */
64+ * move to the "available" category. */
65 if (info.is_master_scope)
66 continue;
67
68+ bool is_disabled = info.desktop_file in scope.disabled_scope_ids;
69 var result = Unity.ScopeResult ();
70 result.uri = @"scope://$(info.desktop_file)";
71 result.category = 0;
72+ result.icon_hint = get_scope_icon (info.icon, is_disabled);
73 result.result_type = Unity.ResultType.DEFAULT;
74 result.mimetype = "application/x-unity-scope";
75 result.title = info.application_name;
76@@ -290,22 +314,7 @@
77 result.comment = "";
78 result.dnd_uri = "";
79 result.metadata = new HashTable<string, Variant> (str_hash, str_equal);
80- result.metadata["scope_disabled"] = new Variant.uint32 (info.desktop_file in scope.disabled_scope_ids ? 1 : 0);
81-
82- var icon_hint = info.icon;
83- try
84- {
85- Icon base_icon = icon_hint == null || icon_hint == "" ?
86- ScopesScope.get_default_icon () : Icon.new_for_string (icon_hint);
87- var anno_icon = new AnnotatedIcon (base_icon);
88- anno_icon.size_hint = IconSizeHint.SMALL;
89- icon_hint = anno_icon.to_string ();
90- }
91- catch (Error err)
92- {
93- icon_hint = "";
94- }
95- result.icon_hint = icon_hint;
96+ result.metadata["scope_disabled"] = new Variant.uint32 (is_disabled ? 1 : 0);
97
98 result_set.add_result (result);
99 }
100@@ -317,11 +326,16 @@
101 scope.scopes_index, scope.analyzer, search_query);
102 foreach (var iter in results)
103 {
104- var result = Unity.ScopeResult ();
105 unowned string scope_id =
106 scope.remote_scopes_model.get_string (iter, RemoteScopesColumn.SCOPE_ID);
107+ unowned string icon_hint =
108+ scope.remote_scopes_model.get_string (iter, RemoteScopesColumn.ICON_HINT);
109+ bool is_disabled = scope_id in scope.disabled_scope_ids;
110+
111+ var result = Unity.ScopeResult ();
112 result.uri = @"scope://$(scope_id)";
113 result.category = 0;
114+ result.icon_hint = get_scope_icon (icon_hint, is_disabled);
115 result.result_type = Unity.ResultType.DEFAULT;
116 result.mimetype = "application/x-unity-scope";
117 result.title =
118@@ -329,23 +343,7 @@
119 result.comment = "";
120 result.dnd_uri = "";
121 result.metadata = new HashTable<string, Variant> (str_hash, str_equal);
122- result.metadata["scope_disabled"] = new Variant.uint32 (scope_id in scope.disabled_scope_ids ? 1 : 0);
123-
124- var icon_hint =
125- scope.remote_scopes_model.get_string (iter, RemoteScopesColumn.ICON_HINT);
126- try
127- {
128- Icon base_icon = icon_hint == null || icon_hint == "" ?
129- ScopesScope.get_default_icon () : Icon.new_for_string (icon_hint);
130- var anno_icon = new AnnotatedIcon (base_icon);
131- anno_icon.size_hint = IconSizeHint.SMALL;
132- icon_hint = anno_icon.to_string ();
133- }
134- catch (Error err)
135- {
136- icon_hint = "";
137- }
138- result.icon_hint = icon_hint;
139+ result.metadata["scope_disabled"] = new Variant.uint32 (is_disabled ? 1 : 0);
140
141 result_set.add_result (result);
142 }

Subscribers

People subscribed via source and target branches