Merge lp:~cjcurran/indicator-sound/wide-playlist-title into lp:indicator-sound/fourth

Proposed by Conor Curran
Status: Merged
Merged at revision: 280
Proposed branch: lp:~cjcurran/indicator-sound/wide-playlist-title
Merge into: lp:indicator-sound/fourth
Diff against target: 57 lines (+18/-4)
1 file modified
src/playlists-menu-item.vala (+18/-4)
To merge this branch: bzr merge lp:~cjcurran/indicator-sound/wide-playlist-title
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+80251@code.launchpad.net

Description of the change

Fixes attached bug

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/playlists-menu-item.vala'
--- src/playlists-menu-item.vala 2011-09-09 17:47:00 +0000
+++ src/playlists-menu-item.vala 2011-10-24 19:01:24 +0000
@@ -49,7 +49,8 @@
49 continue;49 continue;
50 50
51 Dbusmenu.Menuitem menuitem = new Menuitem();51 Dbusmenu.Menuitem menuitem = new Menuitem();
52 menuitem.property_set (MENUITEM_PROP_LABEL, detail.name);52 menuitem.property_set (MENUITEM_PROP_LABEL,
53 truncate_item_label_if_needs_be (detail.name));
53 menuitem.property_set (MENUITEM_PROP_ICON_NAME, "playlist-symbolic");54 menuitem.property_set (MENUITEM_PROP_ICON_NAME, "playlist-symbolic");
5455
55 menuitem.property_set (MENUITEM_PATH, (string)detail.path);56 menuitem.property_set (MENUITEM_PATH, (string)detail.path);
@@ -86,12 +87,14 @@
86 {87 {
87 foreach ( Dbusmenu.Menuitem item in this.current_playlists.values ){88 foreach ( Dbusmenu.Menuitem item in this.current_playlists.values ){
88 if (new_detail.path == item.property_get (MENUITEM_PATH)){89 if (new_detail.path == item.property_get (MENUITEM_PATH)){
89 item.property_set (MENUITEM_PROP_LABEL, new_detail.name);90 item.property_set (MENUITEM_PROP_LABEL,
91 truncate_item_label_if_needs_be (new_detail.name));
90 }92 }
91 }93 }
92 // If its active make sure the name is updated on the root item.94 // If its active make sure the name is updated on the root item.
93 if (this.root_item.property_get (MENUITEM_PATH) == new_detail.path) {95 if (this.root_item.property_get (MENUITEM_PATH) == new_detail.path) {
94 this.root_item.property_set (MENUITEM_PROP_LABEL, new_detail.name); 96 this.root_item.property_set (MENUITEM_PROP_LABEL,
97 truncate_item_label_if_needs_be (new_detail.name));
95 }98 }
96 }99 }
97 100
@@ -115,7 +118,8 @@
115 {118 {
116 var update = detail.name; 119 var update = detail.name;
117 if ( update == "" ) update = _("Choose Playlist");120 if ( update == "" ) update = _("Choose Playlist");
118 this.root_item.property_set (MENUITEM_PROP_LABEL, update); 121 this.root_item.property_set (MENUITEM_PROP_LABEL,
122 truncate_item_label_if_needs_be(update));
119 this.root_item.property_set (MENUITEM_PATH, detail.path); 123 this.root_item.property_set (MENUITEM_PATH, detail.path);
120 }124 }
121 125
@@ -129,6 +133,16 @@
129 this.owner.mpris_bridge.activate_playlist ( (GLib.ObjectPath)this.current_playlists[menu_item_id].property_get (MENUITEM_PATH) );133 this.owner.mpris_bridge.activate_playlist ( (GLib.ObjectPath)this.current_playlists[menu_item_id].property_get (MENUITEM_PATH) );
130 }134 }
131 135
136 private string truncate_item_label_if_needs_be(string item_label)
137 {
138 var result = item_label;
139 if (item_label.char_count(-1) > 17){
140 result = item_label.slice ((long)0, (long)15);
141 result += "…";
142 }
143 return result;
144 }
145
132 public static HashSet<string> attributes_format()146 public static HashSet<string> attributes_format()
133 {147 {
134 HashSet<string> attrs = new HashSet<string>(); 148 HashSet<string> attrs = new HashSet<string>();

Subscribers

People subscribed via source and target branches