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
1=== modified file 'src/playlists-menu-item.vala'
2--- src/playlists-menu-item.vala 2011-09-09 17:47:00 +0000
3+++ src/playlists-menu-item.vala 2011-10-24 19:01:24 +0000
4@@ -49,7 +49,8 @@
5 continue;
6
7 Dbusmenu.Menuitem menuitem = new Menuitem();
8- menuitem.property_set (MENUITEM_PROP_LABEL, detail.name);
9+ menuitem.property_set (MENUITEM_PROP_LABEL,
10+ truncate_item_label_if_needs_be (detail.name));
11 menuitem.property_set (MENUITEM_PROP_ICON_NAME, "playlist-symbolic");
12
13 menuitem.property_set (MENUITEM_PATH, (string)detail.path);
14@@ -86,12 +87,14 @@
15 {
16 foreach ( Dbusmenu.Menuitem item in this.current_playlists.values ){
17 if (new_detail.path == item.property_get (MENUITEM_PATH)){
18- item.property_set (MENUITEM_PROP_LABEL, new_detail.name);
19+ item.property_set (MENUITEM_PROP_LABEL,
20+ truncate_item_label_if_needs_be (new_detail.name));
21 }
22 }
23 // If its active make sure the name is updated on the root item.
24 if (this.root_item.property_get (MENUITEM_PATH) == new_detail.path) {
25- this.root_item.property_set (MENUITEM_PROP_LABEL, new_detail.name);
26+ this.root_item.property_set (MENUITEM_PROP_LABEL,
27+ truncate_item_label_if_needs_be (new_detail.name));
28 }
29 }
30
31@@ -115,7 +118,8 @@
32 {
33 var update = detail.name;
34 if ( update == "" ) update = _("Choose Playlist");
35- this.root_item.property_set (MENUITEM_PROP_LABEL, update);
36+ this.root_item.property_set (MENUITEM_PROP_LABEL,
37+ truncate_item_label_if_needs_be(update));
38 this.root_item.property_set (MENUITEM_PATH, detail.path);
39 }
40
41@@ -129,6 +133,16 @@
42 this.owner.mpris_bridge.activate_playlist ( (GLib.ObjectPath)this.current_playlists[menu_item_id].property_get (MENUITEM_PATH) );
43 }
44
45+ private string truncate_item_label_if_needs_be(string item_label)
46+ {
47+ var result = item_label;
48+ if (item_label.char_count(-1) > 17){
49+ result = item_label.slice ((long)0, (long)15);
50+ result += "…";
51+ }
52+ return result;
53+ }
54+
55 public static HashSet<string> attributes_format()
56 {
57 HashSet<string> attrs = new HashSet<string>();

Subscribers

People subscribed via source and target branches