[california] Make Calendar Manager list scrollable: Closes bno#727026



commit addcb2b89efa660ef0eaa2485a87a2e9046aec9e
Author: Jim Nelson <jim yorba org>
Date:   Fri Apr 4 16:32:21 2014 -0700

    Make Calendar Manager list scrollable: Closes bno#727026
    
    Also introduces a tooltip for each calendar if they've been
    ellipsized.

 src/manager/manager-calendar-list-item.vala |   12 ++++++
 src/rc/calendar-manager-list.ui             |   49 ++++++++++++++++++--------
 2 files changed, 46 insertions(+), 15 deletions(-)
---
diff --git a/src/manager/manager-calendar-list-item.vala b/src/manager/manager-calendar-list-item.vala
index 14983d5..41c924c 100644
--- a/src/manager/manager-calendar-list-item.vala
+++ b/src/manager/manager-calendar-list-item.vala
@@ -28,6 +28,8 @@ public class CalendarListItem : Gtk.Grid {
     public CalendarListItem(Backing.CalendarSource source) {
         this.source = source;
         
+        has_tooltip = true;
+        
         source.bind_property(Backing.Source.PROP_TITLE, title_label, "label",
             BindingFlags.SYNC_CREATE);
         source.bind_property(Backing.Source.PROP_VISIBLE, visible_check_button, "active",
@@ -37,6 +39,16 @@ public class CalendarListItem : Gtk.Grid {
         source.notify[Backing.Source.PROP_COLOR].connect(on_color_changed);
     }
     
+    public override bool query_tooltip(int x, int y, bool keyboard_mode, Gtk.Tooltip tooltip) {
+        // no tooltip if text is entirely shown
+        if (!title_label.get_layout().is_ellipsized())
+            return false;
+        
+        tooltip.set_text(source.title);
+        
+        return true;
+    }
+    
     private void on_color_changed() {
         color_button.set_color(source.color_as_rgb());
     }
diff --git a/src/rc/calendar-manager-list.ui b/src/rc/calendar-manager-list.ui
index 787736c..c61bc11 100644
--- a/src/rc/calendar-manager-list.ui
+++ b/src/rc/calendar-manager-list.ui
@@ -6,21 +6,6 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <child>
-      <object class="GtkListBox" id="calendar_list_box">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="hexpand">True</property>
-        <property name="vexpand">True</property>
-        <signal name="row-activated" handler="on_calendar_list_box_row_activated" 
object="CaliforniaManagerCalendarList" swapped="no"/>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">0</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
-      </packing>
-    </child>
-    <child>
       <object class="GtkButtonBox" id="calendar_list_button_box">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
@@ -54,5 +39,39 @@
         <property name="height">1</property>
       </packing>
     </child>
+    <child>
+      <object class="GtkScrolledWindow" id="calendar_list_scrolledwindow">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="hscrollbar_policy">never</property>
+        <property name="shadow_type">in</property>
+        <property name="min_content_width">200</property>
+        <property name="min_content_height">300</property>
+        <child>
+          <object class="GtkViewport" id="calendar_list_viewport">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkListBox" id="calendar_list_box">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="activate_on_single_click">False</property>
+                <signal name="row-activated" handler="on_calendar_list_box_row_activated" 
object="CaliforniaManagerCalendarList" swapped="no"/>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
+      </packing>
+    </child>
   </template>
 </interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]