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

Proposed by Corentin Noël
Status: Merged
Approved by: Djax
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 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.
Revision history for this message
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
=== modified file 'src/AyatanaIndicator.vala'
--- src/AyatanaIndicator.vala 2016-06-09 20:00:44 +0000
+++ src/AyatanaIndicator.vala 2016-07-18 15:35:35 +0000
@@ -33,25 +33,23 @@
33 const int MAX_ICON_SIZE = 24;33 const int MAX_ICON_SIZE = 24;
3434
35 public Indicator (IndicatorAyatana.ObjectEntry entry, IndicatorAyatana.Object obj, IndicatorIface indicator) {35 public Indicator (IndicatorAyatana.ObjectEntry entry, IndicatorAyatana.Object obj, IndicatorIface indicator) {
36 Object (code_name: "%s%s".printf ("ayatana-", entry.name_hint),36 string name_hint = entry.name_hint;
37 display_name: "%s%s".printf ("ayatana-", entry.name_hint),37 if (name_hint == null) {
38 var rand = new GLib.Rand ();
39 name_hint = rand.next_int ().to_string ();
40 }
41
42 Object (code_name: "%s%s".printf ("ayatana-", name_hint),
43 display_name: "%s%s".printf ("ayatana-", name_hint),
38 description: _("Ayatana compatibility indicator"));44 description: _("Ayatana compatibility indicator"));
39 this.entry = entry;45 this.entry = entry;
40 this.indicator = indicator;46 this.indicator = indicator;
41 this.parent_object = obj;47 this.parent_object = obj;
42 this.menu_map = new Gee.HashMap<Gtk.Widget, Gtk.Widget> ();48 this.menu_map = new Gee.HashMap<Gtk.Widget, Gtk.Widget> ();
4349 entry_name_hint = name_hint;
44 unowned string name_hint = entry.name_hint;
45
46 if (name_hint == null) {
47 warning ("NULL name hint");
48 }
49
50 entry_name_hint = name_hint != null ? name_hint.dup () : "";
5150
52 if (entry.menu == null) {51 if (entry.menu == null) {
53 critical ("Indicator: %s has no menu widget.", entry_name_hint);52 critical ("Indicator: %s has no menu widget.", entry_name_hint);
54
55 return;53 return;
56 }54 }
5755
@@ -325,4 +323,4 @@
325 MAX_ICON_SIZE, Gdk.InterpType.HYPER);323 MAX_ICON_SIZE, Gdk.InterpType.HYPER);
326 }324 }
327 }325 }
328}
329\ No newline at end of file326\ No newline at end of file
327}
330328
=== modified file 'src/IndicatorObject.vala'
--- src/IndicatorObject.vala 2015-05-05 19:47:59 +0000
+++ src/IndicatorObject.vala 2016-07-18 15:35:35 +0000
@@ -32,11 +32,6 @@
32 object.entry_removed.connect (on_entry_removed);32 object.entry_removed.connect (on_entry_removed);
33 }33 }
3434
35 ~IndicatorObject () {
36 object.entry_added.disconnect (on_entry_added);
37 object.entry_removed.disconnect (on_entry_removed);
38 }
39
40 public string get_name () {35 public string get_name () {
41 return name;36 return name;
42 }37 }

Subscribers

People subscribed via source and target branches

to all changes: