[california] Remove Cancel / Close buttons from popovers



commit 0727a3c63b75d1e9aae181043bfb88acd6638a6e
Author: Jim Nelson <jim yorba org>
Date:   Wed Aug 20 15:01:12 2014 -0700

    Remove Cancel / Close buttons from popovers
    
    Since user can easily dismiss popovers merely by clicking off of them,
    no need for extraneous dismissal buttons.

 src/host/host-quick-create-event.vala |    5 -----
 src/host/host-show-event.vala         |   24 ++++++------------------
 src/rc/quick-create-event.ui          |   31 +------------------------------
 3 files changed, 7 insertions(+), 53 deletions(-)
---
diff --git a/src/host/host-quick-create-event.vala b/src/host/host-quick-create-event.vala
index bcde5e4..fe7a89a 100644
--- a/src/host/host-quick-create-event.vala
+++ b/src/host/host-quick-create-event.vala
@@ -100,11 +100,6 @@ public class QuickCreateEvent : Gtk.Grid, Toolkit.Card {
     }
     
     [GtkCallback]
-    private void on_cancel_button_clicked() {
-        notify_user_closed();
-    }
-    
-    [GtkCallback]
     private void on_create_button_clicked() {
         // shouldn't be sensitive if no text
         string details = details_entry.text.strip();
diff --git a/src/host/host-show-event.vala b/src/host/host-show-event.vala
index 9179a95..2bd4534 100644
--- a/src/host/host-show-event.vala
+++ b/src/host/host-show-event.vala
@@ -21,9 +21,9 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
     
     public string? title { get { return null; } }
     
-    public Gtk.Widget? default_widget { get { return close_button; } }
+    public Gtk.Widget? default_widget { get { return null; } }
     
-    public Gtk.Widget? initial_focus { get { return close_button; } }
+    public Gtk.Widget? initial_focus { get { return null; } }
     
     public bool edit_requested { get; private set; default = false; }
     
@@ -61,7 +61,6 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
     
     private Toolkit.RotatingButtonBox rotating_button_box = new Toolkit.RotatingButtonBox();
     
-    private Gtk.Button close_button = new Gtk.Button.with_mnemonic(_("_Close"));
     private Gtk.Button update_button = new Gtk.Button.with_mnemonic(_("_Edit"));
     private Gtk.Button remove_button = new Gtk.Button.with_mnemonic(_("_Delete"));
     private Gtk.Label delete_label = new Gtk.Label(_("Delete"));
@@ -75,15 +74,11 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
         Calendar.System.instance.is_24hr_changed.connect(build_display);
         Calendar.System.instance.today_changed.connect(build_display);
         
-        close_button.can_default = true;
-        close_button.has_default = true;
-        
         remove_button.get_style_context().add_class("destructive-action");
         remove_this_button.get_style_context().add_class("destructive-action");
         remove_this_future_button.get_style_context().add_class("destructive-action");
         remove_all_button.get_style_context().add_class("destructive-action");
         
-        close_button.clicked.connect(on_close_button_clicked);
         update_button.clicked.connect(on_update_button_clicked);
         remove_button.clicked.connect(on_remove_button_clicked);
         remove_all_button.clicked.connect(on_remove_all_button_clicked);
@@ -93,7 +88,6 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
         
         rotating_button_box.pack_end(FAMILY_NORMAL, remove_button);
         rotating_button_box.pack_end(FAMILY_NORMAL, update_button);
-        rotating_button_box.pack_end(FAMILY_NORMAL, close_button);
         
         delete_label.xalign = 1.0f;
         delete_label.get_style_context().add_class(Gtk.STYLE_CLASS_DIM_LABEL);
@@ -151,13 +145,11 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
         // description
         set_label(null, description_text, Markup.linkify(escape(event.description), linkify_delegate));
         
+        // if read-only, don't show Delete or Edit buttons; since they're the only two, don't show
+        // the entire button box
         bool read_only = event.calendar_source != null && event.calendar_source.read_only;
-        
-        update_button.visible = !read_only;
-        update_button.no_show_all = read_only;
-        
-        remove_button.visible = !read_only;
-        remove_button.no_show_all = read_only;
+        rotating_button_box.visible = !read_only;
+        rotating_button_box.no_show_all = read_only;
     }
     
     private string? escape(string? plain) {
@@ -231,10 +223,6 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
         notify_user_closed();
     }
     
-    private void on_close_button_clicked() {
-        notify_user_closed();
-    }
-    
     private async void remove_events_async(Component.DateTime? rid,
         Backing.CalendarSource.AffectedInstances affected) {
         Gdk.Cursor? cursor = Toolkit.set_busy(this);
diff --git a/src/rc/quick-create-event.ui b/src/rc/quick-create-event.ui
index 407fde4..d310c07 100644
--- a/src/rc/quick-create-event.ui
+++ b/src/rc/quick-create-event.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.18.3 -->
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <template class="CaliforniaHostQuickCreateEvent" parent="GtkGrid">
@@ -23,7 +23,6 @@
         <property name="left_attach">0</property>
         <property name="top_attach">0</property>
         <property name="width">2</property>
-        <property name="height">1</property>
       </packing>
     </child>
     <child>
@@ -37,8 +36,6 @@
       <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>
@@ -55,8 +52,6 @@
       <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>
@@ -100,8 +95,6 @@
       <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>
@@ -119,8 +112,6 @@
       <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>
@@ -132,8 +123,6 @@
       <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>
     <child>
@@ -150,8 +139,6 @@
       <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>
@@ -181,21 +168,6 @@
           </packing>
         </child>
         <child>
-          <object class="GtkButton" id="cancel_button">
-            <property name="label" translatable="yes">C_ancel</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">True</property>
-            <property name="use_underline">True</property>
-            <signal name="clicked" handler="on_cancel_button_clicked" 
object="CaliforniaHostQuickCreateEvent" swapped="no"/>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
           <object class="GtkButton" id="edit_button">
             <property name="label" translatable="yes">_Edit</property>
             <property name="visible">True</property>
@@ -235,7 +207,6 @@
         <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>


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