[california/wip/725786-edit-recurring: 1/2] Plumbing



commit 27ca2807b4657e66dd895dd0a9d1fb9a2210d095
Author: Jim Nelson <jim yorba org>
Date:   Tue Jul 8 17:42:40 2014 -0700

    Plumbing

 src/Makefile.am                            |    2 +
 src/california-resources.xml               |    3 ++
 src/host/host-create-update-event.vala     |    5 ++++
 src/host/host-create-update-recurring.vala |   29 +++++++++++++++++++++++++
 src/host/host-main-window.vala             |   22 ++++++++++++++----
 src/rc/create-update-event.ui              |   18 ++++++++++++++-
 src/rc/create-update-recurring.ui          |   32 ++++++++++++++++++++++++++++
 7 files changed, 105 insertions(+), 6 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index f4c5fd0..e304026 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -92,6 +92,7 @@ california_VALASOURCES = \
        host/host.vala \
        host/host-calendar-list-item.vala \
        host/host-create-update-event.vala \
+       host/host-create-update-recurring.vala \
        host/host-import-calendar.vala \
        host/host-main-window.vala \
        host/host-quick-create-event.vala \
@@ -175,6 +176,7 @@ california_RC = \
        rc/calendar-manager-list.ui \
        rc/calendar-manager-list-item.ui \
        rc/create-update-event.ui \
+       rc/create-update-recurring.ui \
        rc/google-authenticating.ui \
        rc/google-calendar-list.ui \
        rc/google-login.ui \
diff --git a/src/california-resources.xml b/src/california-resources.xml
index e52d60d..edf38ea 100644
--- a/src/california-resources.xml
+++ b/src/california-resources.xml
@@ -22,6 +22,9 @@
         <file compressed="false">rc/create-update-event.ui</file>
     </gresource>
     <gresource prefix="/org/yorba/california">
+        <file compressed="false">rc/create-update-recurring.ui</file>
+    </gresource>
+    <gresource prefix="/org/yorba/california">
         <file compressed="true">rc/google-authenticating.ui</file>
     </gresource>
     <gresource prefix="/org/yorba/california">
diff --git a/src/host/host-create-update-event.vala b/src/host/host-create-update-event.vala
index 77694f7..f3e8cfa 100644
--- a/src/host/host-create-update-event.vala
+++ b/src/host/host-create-update-event.vala
@@ -231,6 +231,11 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
     }
     
     [GtkCallback]
+    private void on_recurring_button_clicked() {
+        jump_to_card_by_name(CreateUpdateRecurring.ID, event);
+    }
+    
+    [GtkCallback]
     private void on_accept_clicked() {
         if (calendar_model.active == null)
             return;
diff --git a/src/host/host-create-update-recurring.vala b/src/host/host-create-update-recurring.vala
new file mode 100644
index 0000000..deb6c0a
--- /dev/null
+++ b/src/host/host-create-update-recurring.vala
@@ -0,0 +1,29 @@
+/* Copyright 2014 Yorba Foundation
+ *
+ * This software is licensed under the GNU Lesser General Public License
+ * (version 2.1 or later).  See the COPYING file in this distribution.
+ */
+
+namespace California.Host {
+
+[GtkTemplate (ui = "/org/yorba/california/rc/create-update-recurring.ui")]
+public class CreateUpdateRecurring : Gtk.Grid, Toolkit.Card {
+    public const string ID = "CreateUpdateRecurring";
+    
+    public string card_id { get { return ID; } }
+    
+    public string? title { get { return null; } }
+    
+    public Gtk.Widget? default_widget { get { return null; } }
+    
+    public Gtk.Widget? initial_focus { get { return null; } }
+    
+    public CreateUpdateRecurring() {
+    }
+    
+    public void jumped_to(Toolkit.Card? from, Value? message) {
+    }
+}
+
+}
+
diff --git a/src/host/host-main-window.vala b/src/host/host-main-window.vala
index 71a2cac..72327bb 100644
--- a/src/host/host-main-window.vala
+++ b/src/host/host-main-window.vala
@@ -425,11 +425,17 @@ public class MainWindow : Gtk.ApplicationWindow {
     
     private void quick_create_event(Component.Event? initial, Gtk.Widget relative_to, Gdk.Point? 
for_location) {
         QuickCreateEvent quick_create = new QuickCreateEvent(initial);
+        
         CreateUpdateEvent create_update = new CreateUpdateEvent();
         create_update.is_update = false;
         
+        CreateUpdateRecurring create_update_recurring = new CreateUpdateRecurring();
+        
         Toolkit.Deck deck = new Toolkit.Deck();
-        deck.add_cards(iterate<Toolkit.Card>(quick_create, create_update).to_array_list());
+        deck.add_cards(
+            iterate<Toolkit.Card>(quick_create, create_update, create_update_recurring)
+            .to_array_list()
+        );
         
         show_deck(relative_to, for_location, deck);
     }
@@ -438,12 +444,18 @@ public class MainWindow : Gtk.ApplicationWindow {
         Gdk.Point? for_location) {
         ShowEvent show_event = new ShowEvent();
         
-        CreateUpdateEvent create_update_event = new CreateUpdateEvent();
-        create_update_event.is_update = true;
+        CreateUpdateEvent create_update = new CreateUpdateEvent();
+        create_update.is_update = true;
+        
+        CreateUpdateRecurring create_update_recurring = new CreateUpdateRecurring();
         
         Toolkit.Deck deck = new Toolkit.Deck();
-        deck.add_card(show_event);
-        deck.add_card(create_update_event);
+        deck.add_cards(
+            iterate<Toolkit.Card>(show_event, create_update, create_update_recurring)
+            .to_array_list()
+        );
+        
+        // "initialize" the Deck with the requested Event (because ShowEvent is first, it's home)
         deck.go_home(event);
         
         show_deck(relative_to, for_location, deck);
diff --git a/src/rc/create-update-event.ui b/src/rc/create-update-event.ui
index e12c832..885be53 100644
--- a/src/rc/create-update-event.ui
+++ b/src/rc/create-update-event.ui
@@ -127,10 +127,26 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="pack_type">end</property>
             <property name="position">6</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkButton" id="recurring_button">
+            <property name="label" translatable="yes">Re_peats...</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="margin_left">8</property>
+            <property name="use_underline">True</property>
+            <signal name="clicked" handler="on_recurring_button_clicked" 
object="CaliforniaHostCreateUpdateEvent" swapped="no"/>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">7</property>
+          </packing>
+        </child>
       </object>
       <packing>
         <property name="left_attach">0</property>
diff --git a/src/rc/create-update-recurring.ui b/src/rc/create-update-recurring.ui
new file mode 100644
index 0000000..70536bf
--- /dev/null
+++ b/src/rc/create-update-recurring.ui
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface>
+  <requires lib="gtk+" version="3.10"/>
+  <template class="CaliforniaHostCreateUpdateRecurring" parent="GtkGrid">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="margin_left">8</property>
+    <property name="margin_right">8</property>
+    <property name="margin_top">8</property>
+    <property name="margin_bottom">8</property>
+    <property name="row_homogeneous">True</property>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+  </template>
+</interface>


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