Merge lp:~attente/indicator-keyboard/1237749 into lp:indicator-keyboard

Proposed by William Hua
Status: Merged
Approved by: Lars Karlitski
Approved revision: 283
Merged at revision: 285
Proposed branch: lp:~attente/indicator-keyboard/1237749
Merge into: lp:indicator-keyboard
Diff against target: 61 lines (+22/-11)
2 files modified
lib/main.vala (+20/-0)
lib/source.vala (+2/-11)
To merge this branch: bzr merge lp:~attente/indicator-keyboard/1237749
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+208452@code.launchpad.net

Commit message

Update icons when icon theme changes.

Description of the change

Update icons when icon theme changes.

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
Lars Karlitski (larsu) wrote :

Looks good to me, thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/main.vala'
2--- lib/main.vala 2014-02-20 16:16:26 +0000
3+++ lib/main.vala 2014-02-26 18:28:50 +0000
4@@ -59,6 +59,26 @@
5
6 if (use_gtk) {
7 use_gtk = Gtk.init_check (ref args);
8+
9+ Gtk.IconTheme? icon_theme = Gtk.IconTheme.get_default ();
10+
11+ if (icon_theme != null) {
12+ ((!) icon_theme).changed.connect (() => {
13+ if (sources != null) {
14+ foreach (var source in (!) sources) {
15+ source.icon = null;
16+ }
17+ }
18+
19+ if (sources_menu != null) {
20+ update_sources_menu ();
21+ }
22+
23+ if (indicator_action != null) {
24+ update_indicator_action ();
25+ }
26+ });
27+ }
28 } else {
29 Gdk.init (ref args);
30 }
31
32=== modified file 'lib/source.vala'
33--- lib/source.vala 2014-02-19 16:10:54 +0000
34+++ lib/source.vala 2014-02-26 18:28:50 +0000
35@@ -51,7 +51,7 @@
36
37 public Icon? icon {
38 get { if (_icon == null) { _icon = _get_icon (); } return _icon; }
39- private set { _icon = value; }
40+ set { _icon = value; }
41 }
42
43 public uint subscript {
44@@ -424,16 +424,7 @@
45 Gtk.IconInfo? icon_info = icon_theme.lookup_icon (icon_name, 22, 0);
46
47 if (icon_info != null) {
48- string? file_name = ((!) icon_info).get_filename ();
49- var has_file_name = file_name != null && ((!) file_name).get_char () != '\0';
50-
51- if (has_file_name) {
52- try {
53- icon = Icon.new_for_string ((!) file_name);
54- } catch (Error error) {
55- warning ("error: %s", error.message);
56- }
57- }
58+ icon = new ThemedIcon (icon_name);
59 }
60 } else {
61 icon = new ThemedIcon (icon_name);

Subscribers

People subscribed via source and target branches

to all changes: