Merge lp:~tintou/wingpanel-indicator-ayatana/fix-duplicates-names into lp:~wingpanel-devs/wingpanel-indicator-ayatana/trunk

Proposed by Corentin Noël on 2016-07-18
Status: Merged
Approved by: Djax on 2016-07-19
Approved revision: 14
Merged at revision: 14
Proposed branch: lp:~tintou/wingpanel-indicator-ayatana/fix-duplicates-names
Merge into: lp:~wingpanel-devs/wingpanel-indicator-ayatana/trunk
Diff against target: 61 lines (+10/-17)
2 files modified
src/AyatanaIndicator.vala (+10/-12)
src/IndicatorObject.vala (+0/-5)
To merge this branch: bzr merge lp:~tintou/wingpanel-indicator-ayatana/fix-duplicates-names
Reviewer Review Type Date Requested Status
WingPanel Devs 2016-07-18 Pending
Review via email: mp+300344@code.launchpad.net

Commit message

catch null names from ayatana indicators

To post a comment you must log in.
Adam Bieńkowski (donadigo) wrote :

Hm, are you confident about using random numbers here? I think a simple static int current_id would be a better solution here.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/AyatanaIndicator.vala'
2--- src/AyatanaIndicator.vala 2016-06-09 20:00:44 +0000
3+++ src/AyatanaIndicator.vala 2016-07-18 15:35:35 +0000
4@@ -33,25 +33,23 @@
5 const int MAX_ICON_SIZE = 24;
6
7 public Indicator (IndicatorAyatana.ObjectEntry entry, IndicatorAyatana.Object obj, IndicatorIface indicator) {
8- Object (code_name: "%s%s".printf ("ayatana-", entry.name_hint),
9- display_name: "%s%s".printf ("ayatana-", entry.name_hint),
10+ string name_hint = entry.name_hint;
11+ if (name_hint == null) {
12+ var rand = new GLib.Rand ();
13+ name_hint = rand.next_int ().to_string ();
14+ }
15+
16+ Object (code_name: "%s%s".printf ("ayatana-", name_hint),
17+ display_name: "%s%s".printf ("ayatana-", name_hint),
18 description: _("Ayatana compatibility indicator"));
19 this.entry = entry;
20 this.indicator = indicator;
21 this.parent_object = obj;
22 this.menu_map = new Gee.HashMap<Gtk.Widget, Gtk.Widget> ();
23-
24- unowned string name_hint = entry.name_hint;
25-
26- if (name_hint == null) {
27- warning ("NULL name hint");
28- }
29-
30- entry_name_hint = name_hint != null ? name_hint.dup () : "";
31+ entry_name_hint = name_hint;
32
33 if (entry.menu == null) {
34 critical ("Indicator: %s has no menu widget.", entry_name_hint);
35-
36 return;
37 }
38
39@@ -325,4 +323,4 @@
40 MAX_ICON_SIZE, Gdk.InterpType.HYPER);
41 }
42 }
43-}
44\ No newline at end of file
45+}
46
47=== modified file 'src/IndicatorObject.vala'
48--- src/IndicatorObject.vala 2015-05-05 19:47:59 +0000
49+++ src/IndicatorObject.vala 2016-07-18 15:35:35 +0000
50@@ -32,11 +32,6 @@
51 object.entry_removed.connect (on_entry_removed);
52 }
53
54- ~IndicatorObject () {
55- object.entry_added.disconnect (on_entry_added);
56- object.entry_removed.disconnect (on_entry_removed);
57- }
58-
59 public string get_name () {
60 return name;
61 }

Subscribers

People subscribed via source and target branches

to all changes: