[california/wip/731543-attendees] Attendee editor -- first pass, plumbing in place



commit 9a12ebbabf48d0db2478077041bf422251cb7a73
Author: Jim Nelson <jim yorba org>
Date:   Fri Nov 7 17:42:13 2014 -0800

    Attendee editor -- first pass, plumbing in place

 src/Makefile.am                        |    2 +
 src/california-resources.xml           |    3 +
 src/host/host-attendees-editor.vala    |   35 +++++++
 src/host/host-create-update-event.vala |   10 ++
 src/host/host-main-window.vala         |    5 +-
 src/rc/attendees-editor.ui             |  154 ++++++++++++++++++++++++++++++++
 src/rc/create-update-event.ui          |   80 ++++++++++++++--
 7 files changed, 278 insertions(+), 11 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index d4dc27a..f5fc807 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -97,6 +97,7 @@ california_VALASOURCES = \
        component/component-vtype.vala \
        \
        host/host.vala \
+       host/host-attendees-editor.vala \
        host/host-calendar-list-item.vala \
        host/host-create-update-event.vala \
        host/host-create-update-recurring.vala \
@@ -192,6 +193,7 @@ california_SOURCES = \
 california_RC = \
        rc/activator-list.ui \
        rc/app-menu.interface \
+       rc/attendees-editor.ui \
        rc/calendar-import.ui \
        rc/calendar-list-item.ui \
        rc/calendar-manager-list.ui \
diff --git a/src/california-resources.xml b/src/california-resources.xml
index c09f7c7..dd29fad 100644
--- a/src/california-resources.xml
+++ b/src/california-resources.xml
@@ -7,6 +7,9 @@
         <file compressed="true">rc/app-menu.interface</file>
     </gresource>
     <gresource prefix="/org/yorba/california">
+        <file compressed="true">rc/attendees-editor.ui</file>
+    </gresource>
+    <gresource prefix="/org/yorba/california">
         <file compressed="true">rc/calendar-import.ui</file>
     </gresource>
     <gresource prefix="/org/yorba/california">
diff --git a/src/host/host-attendees-editor.vala b/src/host/host-attendees-editor.vala
new file mode 100644
index 0000000..79c472a
--- /dev/null
+++ b/src/host/host-attendees-editor.vala
@@ -0,0 +1,35 @@
+/* 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/attendees-editor.ui")]
+public class AttendeesEditor : Gtk.Box, Toolkit.Card {
+    public const string ID = "CaliforniaHostAttendeesEditor";
+    
+    public string card_id { get { return ID; } }
+    
+    public string? title { get { return null; } }
+    
+    public Gtk.Widget? default_widget { get { return accept_button; } }
+    
+    public Gtk.Widget? initial_focus { get { return add_guest_entry; } }
+    
+    [GtkChild]
+    private Gtk.Entry add_guest_entry;
+    
+    [GtkChild]
+    private Gtk.Button accept_button;
+    
+    public AttendeesEditor() {
+    }
+    
+    public void jumped_to(Toolkit.Card? from, Toolkit.Card.Jump reason, Value? message) {
+    }
+}
+
+}
+
diff --git a/src/host/host-create-update-event.vala b/src/host/host-create-update-event.vala
index f6dd38b..2442771 100644
--- a/src/host/host-create-update-event.vala
+++ b/src/host/host-create-update-event.vala
@@ -42,6 +42,9 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
     private Gtk.Entry location_entry;
     
     [GtkChild]
+    private Gtk.Label attendees_text;
+    
+    [GtkChild]
     private Gtk.TextView description_textview;
     
     [GtkChild]
@@ -154,6 +157,8 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
         
         location_entry.text = event.location ?? "";
         description_textview.buffer.text = event.description ?? "";
+        attendees_text.label = traverse<Component.Person>(event.attendees)
+            .to_string((person, on_first, on_last) => person.full_mailbox + ", ");
         
         Component.Event master = event.is_master_instance ? event : (Component.Event) event.master;
         
@@ -207,6 +212,11 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
         jump_to_card_by_name(EventTimeSettings.ID, dt);
     }
     
+    [GtkCallback]
+    private void on_attendees_button_clicked() {
+        jump_to_card_by_name(AttendeesEditor.ID, event);
+    }
+    
     private void on_accept_button_clicked() {
         if (calendar_model.active == null)
             return;
diff --git a/src/host/host-main-window.vala b/src/host/host-main-window.vala
index 9ed6bb9..55ad35f 100644
--- a/src/host/host-main-window.vala
+++ b/src/host/host-main-window.vala
@@ -516,9 +516,12 @@ public class MainWindow : Gtk.ApplicationWindow {
         
         EventTimeSettings event_time_settings = new EventTimeSettings();
         
+        AttendeesEditor attendees_editor = new AttendeesEditor();
+        
         Toolkit.Deck deck = new Toolkit.Deck();
         deck.add_cards(
-            iterate<Toolkit.Card>(create_update, create_update_recurring, event_time_settings)
+            iterate<Toolkit.Card>(create_update, create_update_recurring, event_time_settings,
+                attendees_editor)
             .to_array_list()
         );
         
diff --git a/src/rc/attendees-editor.ui b/src/rc/attendees-editor.ui
new file mode 100644
index 0000000..e2b3143
--- /dev/null
+++ b/src/rc/attendees-editor.ui
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <template class="CaliforniaHostAttendeesEditor" parent="GtkBox">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">8</property>
+    <child>
+      <object class="GtkLabel" id="label1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">Add / remove guests</property>
+        <attributes>
+          <attribute name="weight" value="bold"/>
+        </attributes>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkBox" id="box2">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">4</property>
+        <child>
+          <object class="GtkEntry" id="add_guest_entry">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="placeholder_text" translatable="yes">Email address</property>
+            <property name="input_purpose">email</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="add_guest_button">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="xalign">0.60000002384185791</property>
+            <child>
+              <object class="GtkImage" id="image1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="icon_name">list-add-symbolic</property>
+              </object>
+            </child>
+          </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="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkListBox" id="guest_listbox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="activate_on_single_click">False</property>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkButton" id="remove_guest_button">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">True</property>
+        <property name="halign">end</property>
+        <child>
+          <object class="GtkImage" id="image2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="icon_name">list-remove-symbolic</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkButtonBox" id="buttonbox1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">end</property>
+        <property name="valign">end</property>
+        <property name="margin_top">8</property>
+        <property name="spacing">8</property>
+        <property name="layout_style">start</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="receives_default">True</property>
+            <property name="use_underline">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</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">_Accept</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>
+            <style>
+              <class name="suggested-action"/>
+            </style>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">4</property>
+      </packing>
+    </child>
+  </template>
+</interface>
diff --git a/src/rc/create-update-event.ui b/src/rc/create-update-event.ui
index 895cf49..c2a4a74 100644
--- a/src/rc/create-update-event.ui
+++ b/src/rc/create-update-event.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.16.1 -->
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <template class="CaliforniaHostCreateUpdateEvent" parent="GtkGrid">
@@ -23,6 +23,8 @@
       <packing>
         <property name="left_attach">1</property>
         <property name="top_attach">0</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
       </packing>
     </child>
     <child>
@@ -38,6 +40,8 @@
       <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>
@@ -53,6 +57,8 @@
       <packing>
         <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>
@@ -99,6 +105,8 @@
       <packing>
         <property name="left_attach">1</property>
         <property name="top_attach">1</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
       </packing>
     </child>
     <child>
@@ -114,6 +122,8 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">2</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
       </packing>
     </child>
     <child>
@@ -160,6 +170,8 @@
       <packing>
         <property name="left_attach">1</property>
         <property name="top_attach">2</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
       </packing>
     </child>
     <child>
@@ -177,6 +189,7 @@
         <property name="left_attach">0</property>
         <property name="top_attach">7</property>
         <property name="width">2</property>
+        <property name="height">1</property>
       </packing>
     </child>
     <child>
@@ -192,6 +205,8 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">6</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
       </packing>
     </child>
     <child>
@@ -203,6 +218,8 @@
       <packing>
         <property name="left_attach">1</property>
         <property name="top_attach">6</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
       </packing>
     </child>
     <child>
@@ -222,6 +239,8 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">5</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
       </packing>
     </child>
     <child>
@@ -249,6 +268,8 @@
       <packing>
         <property name="left_attach">1</property>
         <property name="top_attach">5</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
       </packing>
     </child>
     <child>
@@ -266,6 +287,8 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">4</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
       </packing>
     </child>
     <child>
@@ -277,16 +300,18 @@
       <packing>
         <property name="left_attach">1</property>
         <property name="top_attach">4</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
       </packing>
     </child>
     <child>
       <object class="GtkLabel" id="attendees_label">
+        <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="no_show_all">True</property>
         <property name="xalign">1</property>
         <property name="label" translatable="yes">_Guests</property>
         <property name="use_underline">True</property>
-        <property name="mnemonic_widget">attendees_entry</property>
         <style>
           <class name="dim-label"/>
         </style>
@@ -294,21 +319,56 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">3</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
       </packing>
     </child>
     <child>
-      <object class="GtkEntry" id="attendees_entry">
-        <property name="can_focus">True</property>
-        <property name="no_show_all">True</property>
-        <property name="tooltip_text" translatable="yes">For example:
-alice example com, bob example com</property>
-        <property name="activates_default">True</property>
-        <property name="caps_lock_warning">False</property>
-        <property name="placeholder_text" translatable="yes">Email address(es)</property>
+      <object class="GtkBox" id="attendees_box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">4</property>
+        <child>
+          <object class="GtkLabel" id="attendees_text">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">0</property>
+            <property name="label">(none)</property>
+            <property name="ellipsize">end</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="attendees_button">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="relief">none</property>
+            <signal name="clicked" handler="on_attendees_button_clicked" 
object="CaliforniaHostCreateUpdateEvent" swapped="no"/>
+            <child>
+              <object class="GtkImage" id="image3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="icon_name">mail-unread-symbolic</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
       </object>
       <packing>
         <property name="left_attach">1</property>
         <property name="top_attach">3</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
       </packing>
     </child>
   </template>


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