[california] Support event location: Bug #725773



commit 916b3ede7fc9539eadc9ed948fc1ddfa9c528161
Author: Jim Nelson <jim yorba org>
Date:   Tue Jun 3 18:06:16 2014 -0700

    Support event location: Bug #725773
    
    Event location can be edited in Create/Update dialog and is displayed
    in the Show Event dialog.  Quick Add parser already has support for
    location.

 src/host/host-create-update-event.vala |    5 +
 src/host/host-show-event.vala          |    4 +
 src/rc/create-update-event.ui          |  154 ++++++++++++++++++++------------
 3 files changed, 105 insertions(+), 58 deletions(-)
---
diff --git a/src/host/host-create-update-event.vala b/src/host/host-create-update-event.vala
index 6fbb06b..468ce89 100644
--- a/src/host/host-create-update-event.vala
+++ b/src/host/host-create-update-event.vala
@@ -47,6 +47,9 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
     private Gtk.CheckButton all_day_toggle;
     
     [GtkChild]
+    private Gtk.Entry location_entry;
+    
+    [GtkChild]
     private Gtk.TextView description_textview;
     
     [GtkChild]
@@ -183,6 +186,7 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
             is_update = false;
         }
         
+        location_entry.text = event.location ?? "";
         description_textview.buffer.text = event.description ?? "";
         
         accept_button.label = is_update ? _("_Update") : _("C_reate");
@@ -233,6 +237,7 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
         
         event.calendar_source = calendar_model.active;
         event.summary = summary_entry.text;
+        event.location = location_entry.text;
         event.description = description_textview.buffer.text;
         
         if (all_day_toggle.active) {
diff --git a/src/host/host-show-event.vala b/src/host/host-show-event.vala
index 67cece1..07742ac 100644
--- a/src/host/host-show-event.vala
+++ b/src/host/host-show-event.vala
@@ -63,6 +63,10 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
         if (!String.is_empty(event.summary))
             add_lf_lf(builder).append_printf("<b>%s</b>", Markup.escape_text(event.summary));
         
+        // location
+        if (!String.is_empty(event.location))
+            add_lf_lf(builder).append_printf(_("Location: %s"), Markup.escape_text(event.location));
+        
         // description
         if (!String.is_empty(event.description))
             add_lf_lf(builder).append_printf("%s", Markup.escape_text(event.description));
diff --git a/src/rc/create-update-event.ui b/src/rc/create-update-event.ui
index ccf3716..19d5949 100644
--- a/src/rc/create-update-event.ui
+++ b/src/rc/create-update-event.ui
@@ -140,81 +140,62 @@
       </packing>
     </child>
     <child>
-      <object class="GtkButtonBox" id="button_box">
+      <object class="GtkGrid" id="grid1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="valign">end</property>
-        <property name="margin_top">8</property>
-        <property name="vexpand">True</property>
-        <property name="spacing">8</property>
-        <property name="homogeneous">True</property>
-        <property name="layout_style">end</property>
+        <property name="row_spacing">6</property>
+        <property name="column_spacing">6</property>
         <child>
-          <object class="GtkButton" id="cancel_button">
-            <property name="label" translatable="yes">_Cancel</property>
+          <object class="GtkLabel" id="location_label">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="can_default">True</property>
-            <property name="receives_default">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">_Location</property>
             <property name="use_underline">True</property>
-            <property name="image_position">bottom</property>
-            <signal name="clicked" handler="on_cancel_button_clicked" 
object="CaliforniaHostCreateUpdateEvent" swapped="no"/>
+            <property name="mnemonic_widget">location_entry</property>
+            <property name="single_line_mode">True</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
           </object>
           <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
+            <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="GtkButton" id="accept_button">
-            <property name="label" translatable="yes">C_reate</property>
+          <object class="GtkEntry" id="location_entry">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="can_default">True</property>
-            <property name="has_default">True</property>
-            <property name="receives_default">True</property>
-            <property name="use_underline">True</property>
-            <property name="image_position">bottom</property>
-            <signal name="clicked" handler="on_accept_clicked" object="CaliforniaHostCreateUpdateEvent" 
swapped="no"/>
-            <style>
-              <class name="suggested-action"/>
-            </style>
           </object>
           <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">1</property>
+            <property name="left_attach">1</property>
+            <property name="top_attach">0</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
           </packing>
         </child>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">5</property>
-        <property name="width">2</property>
-        <property name="height">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkBox" id="description_box">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="spacing">8</property>
         <child>
           <object class="GtkLabel" id="description_label">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="xalign">1</property>
             <property name="yalign">0</property>
-            <property name="label" translatable="yes">Description</property>
+            <property name="label" translatable="yes">_Description</property>
+            <property name="use_underline">True</property>
+            <property name="wrap">True</property>
+            <property name="mnemonic_widget">description_textview</property>
             <style>
               <class name="dim-label"/>
             </style>
           </object>
           <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
           </packing>
         </child>
         <child>
@@ -231,6 +212,8 @@
                   <object class="GtkTextView" id="description_textview">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
                     <property name="wrap_mode">word</property>
                   </object>
                 </child>
@@ -238,15 +221,19 @@
             </child>
           </object>
           <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
           </packing>
         </child>
+        <style>
+          <class name="dim-label"/>
+        </style>
       </object>
       <packing>
         <property name="left_attach">0</property>
-        <property name="top_attach">3</property>
+        <property name="top_attach">2</property>
         <property name="width">2</property>
         <property name="height">1</property>
       </packing>
@@ -258,16 +245,67 @@
       </object>
       <packing>
         <property name="left_attach">0</property>
-        <property name="top_attach">4</property>
+        <property name="top_attach">3</property>
         <property name="width">2</property>
         <property name="height">1</property>
       </packing>
     </child>
     <child>
-      <placeholder/>
-    </child>
-    <child>
-      <placeholder/>
+      <object class="GtkButtonBox" id="button_box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="valign">end</property>
+        <property name="margin_top">8</property>
+        <property name="vexpand">True</property>
+        <property name="spacing">6</property>
+        <property name="homogeneous">True</property>
+        <property name="layout_style">end</property>
+        <child>
+          <object class="GtkButton" id="cancel_button">
+            <property name="label" translatable="yes">_Cancel</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="can_default">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_underline">True</property>
+            <property name="image_position">bottom</property>
+            <signal name="clicked" handler="on_cancel_button_clicked" 
object="CaliforniaHostCreateUpdateEvent" swapped="no"/>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="accept_button">
+            <property name="label" translatable="yes">C_reate</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="can_default">True</property>
+            <property name="has_default">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_underline">True</property>
+            <property name="image_position">bottom</property>
+            <signal name="clicked" handler="on_accept_clicked" object="CaliforniaHostCreateUpdateEvent" 
swapped="no"/>
+            <style>
+              <class name="suggested-action"/>
+            </style>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">4</property>
+        <property name="width">2</property>
+        <property name="height">1</property>
+      </packing>
     </child>
   </template>
 </interface>


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