[california] Use Toolkit.RotatingButtonBox for remove recurring btns: Bug #732712
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [california] Use Toolkit.RotatingButtonBox for remove recurring btns: Bug #732712
- Date: Fri, 18 Jul 2014 00:31:38 +0000 (UTC)
commit c22c7241553886c6f845aab5d99b9609d51fe7da
Author: Jim Nelson <jim yorba org>
Date: Thu Jul 17 17:29:54 2014 -0700
Use Toolkit.RotatingButtonBox for remove recurring btns: Bug #732712
RotatingButtonBox uses a GtkStack for animating the slide, a better
choice than GtkRevealers. This also fixes the bug where the buttons
appeared on the wrong side of the dialog (bug #732929).
src/host/host-show-event.vala | 66 ++++++++----
src/rc/show-event.ui | 226 ++++-------------------------------------
2 files changed, 63 insertions(+), 229 deletions(-)
---
diff --git a/src/host/host-show-event.vala b/src/host/host-show-event.vala
index 21c5db0..0f82cdf 100644
--- a/src/host/host-show-event.vala
+++ b/src/host/host-show-event.vala
@@ -14,6 +14,9 @@ namespace California.Host {
public class ShowEvent : Gtk.Grid, Toolkit.Card {
public const string ID = "ShowEvent";
+ private const string FAMILY_NORMAL = "normal";
+ private const string FAMILY_REMOVING = "removing";
+
public string card_id { get { return ID; } }
public string? title { get { return null; } }
@@ -41,25 +44,51 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
private Gtk.Label description_text;
[GtkChild]
- private Gtk.Button update_button;
-
- [GtkChild]
- private Gtk.Button remove_button;
+ private Gtk.Box rotating_button_box_container;
- [GtkChild]
- private Gtk.Button close_button;
-
- [GtkChild]
- private Gtk.Revealer button_box_revealer;
+ private new Component.Event event;
- [GtkChild]
- private Gtk.Revealer remove_recurring_revealer;
+ private Toolkit.RotatingButtonBox rotating_button_box = new Toolkit.RotatingButtonBox();
- private new Component.Event event;
+ private Gtk.Button close_button = new Gtk.Button.with_mnemonic(_("_Close"));
+ private Gtk.Button update_button = new Gtk.Button.with_mnemonic(_("_Update"));
+ private Gtk.Button remove_button = new Gtk.Button.with_mnemonic(_("_Remove"));
+ private Gtk.Button remove_all_button = new Gtk.Button.with_mnemonic(_("Remove A_ll Events"));
+ private Gtk.Button remove_this_button = new Gtk.Button.with_mnemonic(_("Remove _This Event"));
+ private Gtk.Button remove_this_future_button = new Gtk.Button.with_mnemonic(
+ _("Remove This and _Future Events"));
+ private Gtk.Button cancel_remove_button = new Gtk.Button.with_mnemonic(_("_Cancel"));
public ShowEvent() {
Calendar.System.instance.is_24hr_changed.connect(build_display);
Calendar.System.instance.today_changed.connect(build_display);
+
+ 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);
+ remove_this_button.clicked.connect(on_remove_this_button_clicked);
+ remove_this_future_button.clicked.connect(on_remove_future_button_clicked);
+ cancel_remove_button.clicked.connect(on_cancel_remove_recurring_button_clicked);
+
+ 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);
+
+ rotating_button_box.pack_end(FAMILY_REMOVING, remove_this_button);
+ rotating_button_box.pack_end(FAMILY_REMOVING, remove_this_future_button);
+ rotating_button_box.pack_end(FAMILY_REMOVING, remove_all_button);
+ rotating_button_box.pack_end(FAMILY_REMOVING, cancel_remove_button);
+
+ rotating_button_box.expand = true;
+ rotating_button_box.halign = Gtk.Align.FILL;
+ rotating_button_box.valign = Gtk.Align.END;
+ rotating_button_box_container.add(rotating_button_box);
}
~ShowEvent() {
@@ -137,7 +166,6 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
}
}
- [GtkCallback]
private void on_remove_button_clicked() {
// If recurring (and so this is a generated instance of the VEVENT, not the VEVENT itself),
// reveal additional remove buttons
@@ -145,8 +173,7 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
// TODO: Gtk.Stack would be a better widget for this animation, but it's unavailable in
// Glade as of GTK+ 3.12.
if (event.is_generated_instance) {
- button_box_revealer.reveal_child = false;
- remove_recurring_revealer.reveal_child = true;
+ rotating_button_box.family = FAMILY_REMOVING;
return;
}
@@ -154,28 +181,22 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
remove_events_async.begin(null, Backing.CalendarSource.AffectedInstances.ALL);
}
- [GtkCallback]
private void on_cancel_remove_recurring_button_clicked() {
- button_box_revealer.reveal_child = true;
- remove_recurring_revealer.reveal_child = false;
+ rotating_button_box.family = FAMILY_NORMAL;
}
- [GtkCallback]
private void on_remove_this_button_clicked() {
remove_events_async.begin(event.rid, Backing.CalendarSource.AffectedInstances.THIS);
}
- [GtkCallback]
private void on_remove_future_button_clicked() {
remove_events_async.begin(event.rid, Backing.CalendarSource.AffectedInstances.THIS_AND_FUTURE);
}
- [GtkCallback]
private void on_remove_all_button_clicked() {
remove_events_async.begin(null, Backing.CalendarSource.AffectedInstances.ALL);
}
- [GtkCallback]
private void on_update_button_clicked() {
// pass a clone of the existing event for editing
try {
@@ -185,7 +206,6 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
}
}
- [GtkCallback]
private void on_close_button_clicked() {
notify_user_closed();
}
diff --git a/src/rc/show-event.ui b/src/rc/show-event.ui
index a164ec2..561e38a 100644
--- a/src/rc/show-event.ui
+++ b/src/rc/show-event.ui
@@ -1,14 +1,10 @@
<?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="CaliforniaHostShowEvent" 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_spacing">6</property>
<child>
<object class="GtkLabel" id="summary_text">
@@ -26,6 +22,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>
@@ -66,6 +64,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>
@@ -88,6 +88,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>
@@ -104,6 +106,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>
@@ -118,6 +122,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>
@@ -132,227 +138,35 @@
<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>
</object>
<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>
- <object class="GtkBox" id="box2">
+ <object class="GtkBox" id="rotating_button_box_container">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkRevealer" id="remove_recurring_revealer">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="transition_type">slide-right</property>
- <property name="transition_duration">500</property>
- <child>
- <object class="GtkBox" id="box1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">4</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">Remove in this series:</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButtonBox" id="remove_recurring_button_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">8</property>
- <property name="baseline_position">bottom</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="remove_this_button">
- <property name="label" translatable="yes">_This Event</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_remove_this_button_clicked"
object="CaliforniaHostShowEvent" swapped="no"/>
- <style>
- <class name="destructive-action"/>
- </style>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="remove_future_button">
- <property name="label" translatable="yes">This and _Future Events</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_remove_future_button_clicked"
object="CaliforniaHostShowEvent" swapped="no"/>
- <style>
- <class name="destructive-action"/>
- </style>
- </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_all_button">
- <property name="label" translatable="yes">_All Events</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <property name="xalign">0.56000000238418579</property>
- <property name="yalign">0.51999998092651367</property>
- <signal name="clicked" handler="on_remove_all_button_clicked"
object="CaliforniaHostShowEvent" swapped="no"/>
- <style>
- <class name="destructive-action"/>
- </style>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="cancel_remove_recurring_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>
- <signal name="clicked" handler="on_cancel_remove_recurring_button_clicked"
object="CaliforniaHostShowEvent" swapped="no"/>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">4</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
+ <placeholder/>
</child>
<child>
- <object class="GtkRevealer" id="button_box_revealer">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="transition_type">slide-left</property>
- <property name="transition_duration">500</property>
- <property name="reveal_child">True</property>
- <child>
- <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="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="spacing">8</property>
- <property name="baseline_position">bottom</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="remove_button">
- <property name="label" translatable="yes">_Remove</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="image_position">bottom</property>
- <signal name="clicked" handler="on_remove_button_clicked"
object="CaliforniaHostShowEvent" swapped="no"/>
- <style>
- <class name="destructive-action"/>
- </style>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="update_button">
- <property name="label" translatable="yes">_Update</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_update_button_clicked"
object="CaliforniaHostShowEvent" 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="close_button">
- <property name="label" translatable="yes">_Close</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_close_button_clicked"
object="CaliforniaHostShowEvent" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
+ <placeholder/>
</child>
</object>
<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>
- <placeholder/>
- </child>
</template>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]