diff -u unity-0.2.46/debian/libunity0.symbols unity-0.2.46/debian/libunity0.symbols --- unity-0.2.46/debian/libunity0.symbols +++ unity-0.2.46/debian/libunity0.symbols @@ -588,11 +588,13 @@ unity_places_place_search_bar_set_search_fail@Base 0.2.42 unity_places_place_search_entry_construct@Base 0.2.22 unity_places_place_search_entry_get_cursor_opacity@Base 0.2.30 + unity_places_place_search_entry_get_small_mode@Base 0.2.46-0ubuntu4 unity_places_place_search_entry_get_type@Base 0.2.22 unity_places_place_search_entry_new@Base 0.2.22 unity_places_place_search_entry_reset@Base 0.2.22 unity_places_place_search_entry_set_active_entry@Base 0.2.30 unity_places_place_search_entry_set_cursor_opacity@Base 0.2.30 + unity_places_place_search_entry_set_small_mode@Base 0.2.46-0ubuntu4 unity_places_place_search_extra_action_construct@Base 0.2.40 unity_places_place_search_extra_action_get_destroy_factor@Base 0.2.40 unity_places_place_search_extra_action_get_resize_factor@Base 0.2.40 @@ -606,11 +608,13 @@ unity_places_place_search_navigation_new@Base 0.2.22 unity_places_place_search_navigation_set_active_entry@Base 0.2.22 unity_places_place_search_sections_bar_construct@Base 0.2.22 + unity_places_place_search_sections_bar_get_small_mode@Base 0.2.46-0ubuntu4 unity_places_place_search_sections_bar_get_style@Base 0.2.22 unity_places_place_search_sections_bar_get_type@Base 0.2.22 unity_places_place_search_sections_bar_new@Base 0.2.22 unity_places_place_search_sections_bar_set_active_entry@Base 0.2.22 unity_places_place_search_sections_bar_set_active_section@Base 0.2.22 + unity_places_place_search_sections_bar_set_small_mode@Base 0.2.46-0ubuntu4 unity_places_place_search_sections_bar_set_style@Base 0.2.22 unity_places_place_set_online@Base 0.2.22 unity_places_place_view_construct@Base 0.2.22 diff -u unity-0.2.46/debian/changelog unity-0.2.46/debian/changelog --- unity-0.2.46/debian/changelog +++ unity-0.2.46/debian/changelog @@ -1,3 +1,13 @@ +unity (0.2.46-0ubuntu4) maverick; urgency=low + + * Cherry-picked from upstream: + - the Places and Applications tabs now caters for localized text + longer than the English ones (LP: #644275) + * debian/libunity0.symbols: + - updated for new symbols + + -- Didier Roche Fri, 01 Oct 2010 14:09:10 +0200 + unity (0.2.46-0ubuntu3) maverick; urgency=low * Cherry pick from upstream: only in patch2: unchanged: --- unity-0.2.46.orig/unity-private/places/places-place-search-entry.vala +++ unity-0.2.46/unity-private/places/places-place-search-entry.vala @@ -37,6 +37,18 @@ public Ctk.Text text; public CairoCanvas right_icon; + public bool _small_mode = false; + public bool small_mode { + get { + return _small_mode;; + } + set { + _small_mode = value; + hint_text.set_markup ("" + _("Search") + ""); + queue_relayout (); + } + } + private uint _cursor_blink_count = 0; private bool upward = true; @@ -88,7 +100,8 @@ { Object (orientation:Ctk.Orientation.HORIZONTAL, homogeneous:false, - spacing:0); + spacing:0, + small_mode:false); } ~PlaceSearchEntry () @@ -157,8 +170,16 @@ out float nat_width) { /* FIXME: Make these dependant on size of screen & font */ - min_width = 270.0f; - nat_width = 270.0f; + if (small_mode) + { + min_width = 135.0f; + nat_width = 135.0f; + } + else + { + min_width = 270.0f; + nat_width = 270.0f; + } } private void on_text_changed () @@ -253,7 +274,7 @@ { string name = ""; - if (entry is PlaceHomeEntry == false) + if (entry is PlaceHomeEntry == false && _small_mode == false) name = entry.name; hint_text.set_markup ("" + only in patch2: unchanged: --- unity-0.2.46.orig/unity-private/places/places-place-search-sections-bar.vala +++ unity-0.2.46/unity-private/places/places-place-search-sections-bar.vala @@ -45,6 +45,41 @@ } } + private bool _small_mode = false; + public bool small_mode { + get { return _small_mode; } + set { + if (_small_mode != value) + { + _small_mode = value; + + if (_small_mode) + { + padding = { 0.0f, 0.0f, 0.0f, 0.0f }; + + var secs = get_children (); + foreach (Clutter.Actor s in secs) + { + (s as Section).full_alloc_size = s.width; + (s as Section).text.ellipsize = Pango.EllipsizeMode.END; + } + } + else + { + padding = { 0.0f, PADDING, 0.0f, PADDING }; + var secs = get_children (); + foreach (Clutter.Actor s in secs) + { + (s as Section).text.ellipsize = Pango.EllipsizeMode.NONE; + s.queue_relayout (); + } + } + + bg.update (); + } + } + } + private PlaceEntry? active_entry = null; private Section? active_section = null; public uint active_section_n = 0; @@ -123,7 +158,6 @@ (actor as Section).dirty = true; } - active_entry = entry; var model = active_entry.sections_model; sections_model = model; @@ -173,6 +207,8 @@ model.row_added.connect (on_section_added); model.row_changed.connect (on_section_changed); model.row_removed.connect (on_section_removed); + + bg.update (); } private static int sort_sections (Section asec, Section bsec) @@ -184,7 +220,9 @@ private void on_section_added (Dee.Model model, Dee.ModelIter iter) { var section = new Section (model, iter); - pack (section, false, true); + if (small_mode) + section.text.ellipsize = Pango.EllipsizeMode.END; + pack (section, false, true); section.show (); section.button_release_event.connect (on_section_clicked); @@ -414,6 +452,8 @@ private float _last_width = 0.0f; private float _resize_width = 0.0f; + public float full_alloc_size = 0.0f; + public Section (Dee.Model model, Dee.ModelIter iter) { Object (reactive:true, @@ -465,6 +505,22 @@ base.get_preferred_width (for_height, out mw, out nw); + if (text.ellipsize != Pango.EllipsizeMode.NONE) + { + if (full_alloc_size < 10.0f || full_alloc_size > 75.0f) + { + min_width = 75.0f; + nat_width = 75.0f; + } + else + { + text.ellipsize = Pango.EllipsizeMode.NONE; + min_width = full_alloc_size; + nat_width = full_alloc_size; + } + return; + } + min_width = (mw + padding.right + padding.left) * _destroy_factor; nat_width = (nw + padding.right + padding.left) * _destroy_factor; only in patch2: unchanged: --- unity-0.2.46.orig/unity-private/places/places-place-search-bar.vala +++ unity-0.2.46/unity-private/places/places-place-search-bar.vala @@ -32,6 +32,7 @@ private PlaceSearchNavigation navigation; public PlaceSearchEntry entry; public PlaceSearchSectionsBar sections; + public Clutter.Rectangle space; public PlaceSearchExtraAction extra_action; private bool _search_fail = false; @@ -80,7 +81,7 @@ sections.show (); /* We need a dummy to be able to space the action label */ - var space = new Clutter.Rectangle.with_color ({255, 255, 255, 0}); + space = new Clutter.Rectangle.with_color ({255, 255, 255, 0}); pack (space, true, true); space.show (); @@ -111,6 +112,27 @@ return entry.text.text; } + private bool update_broken_views () + { + sections.small_mode = true; + entry.small_mode = true; + + sections.ref (); + extra_action.ref (); + + remove_actor (sections); + remove_actor (space); + remove_actor (extra_action); + + pack (sections, true, true); + pack (extra_action, false, true); + + extra_action.unref (); + sections.unref (); + + return false; + } + private override void allocate (Clutter.ActorBox box, Clutter.AllocationFlags flags) { @@ -119,6 +141,16 @@ base.allocate (box, flags); + float children_width = navigation.width + SPACING + + entry.width + SPACING + + sections.width + SPACING; + if (box.x2 - box.x1 < children_width) + { + /* Basically sections is too big */ + if (sections.small_mode == false) + Timeout.add (0, update_broken_views); + } + if (entry.x != ex || entry.width != ewidth) { /* After discussion with upstream Clutter guys, it seems like the @@ -139,6 +171,7 @@ float mheight, nheight; entry.get_preferred_height (RANDOM_TEXT_WIDTH, out mheight, out nheight); + min_height = mheight + SPACING * 3; nat_height = nheight + SPACING * 3; } @@ -181,6 +214,27 @@ */ public void set_active_entry_view (PlaceEntry entry, int x, uint section=0) { + if (sections.small_mode) + { + extra_action.ref (); + + remove_actor (sections); + remove_actor (extra_action); + + sections = new PlaceSearchSectionsBar (); + pack (sections, false, true); + sections.show (); + + /* We need a dummy to be able to space the action label */ + space = new Clutter.Rectangle.with_color ({255, 255, 255, 0}); + pack (space, true, true); + space.show (); + + pack (extra_action, false, true); + + extra_action.unref (); + } + active_entry = entry; bg.entry_position = x; sections.set_active_entry (entry); @@ -400,8 +454,11 @@ /* Cut out the search entry */ cr.set_operator (Cairo.Operator.CLEAR); - x = (int)search_entry.x; - y = (int)(search_entry.y) - 1; + if (search_entry.x < 1.0f) + x += width + 12; + else + x = (int)search_entry.x; + //y = (int)(search_entry.y) - 1; width = x + (int)search_entry.width; height = y + (int)search_entry.height +1;