[gnome-calendar] window: replace New Event with Today button
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] window: replace New Event with Today button
- Date: Thu, 4 Dec 2014 22:39:30 +0000 (UTC)
commit defb99d8a826afccba5418cf3adf86e96ecdf884
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Tue Oct 21 00:59:46 2014 -0400
window: replace New Event with Today button
As Lapo rightfully explain, providing a button there for creating a new
event is way to prominently and might divert users of the intended click
on a cell behavior to create an event.
New event will be also accessible from the hamburger icon on the left of
the header-bar and Ctrl-N key shortcut.
Also as Lapo suggestion Today button fall better on the header bar than
between the navigation buttons.
data/ui/nav_bar.ui | 24 +-----------------------
src/gcal-nav-bar.c | 11 -----------
src/gcal-nav-bar.h | 2 --
src/gcal-window.c | 23 ++++++++++-------------
4 files changed, 11 insertions(+), 49 deletions(-)
---
diff --git a/data/ui/nav_bar.ui b/data/ui/nav_bar.ui
index b5af6fb..054830c 100644
--- a/data/ui/nav_bar.ui
+++ b/data/ui/nav_bar.ui
@@ -38,28 +38,6 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="today_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <style>
- <class name="nav-button"/>
- </style>
- <child>
- <object class="GtkLabel" id="today_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Today</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
<object class="GtkButton" id="forward_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -78,7 +56,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
diff --git a/src/gcal-nav-bar.c b/src/gcal-nav-bar.c
index 0fb7dfd..f59c686 100644
--- a/src/gcal-nav-bar.c
+++ b/src/gcal-nav-bar.c
@@ -26,7 +26,6 @@
typedef struct
{
GtkWidget *back_button;
- GtkWidget *today_button;
GtkWidget *forward_button;
GtkWidget *left_label;
@@ -89,7 +88,6 @@ gcal_nav_bar_class_init (GcalNavBarClass *klass)
/* Bind internals widgets */
gtk_widget_class_bind_template_child_private (widget_class, GcalNavBar, back_button);
- gtk_widget_class_bind_template_child_private (widget_class, GcalNavBar, today_button);
gtk_widget_class_bind_template_child_private (widget_class, GcalNavBar, forward_button);
gtk_widget_class_bind_template_child_private (widget_class, GcalNavBar, left_label);
gtk_widget_class_bind_template_child_private (widget_class, GcalNavBar, right_label);
@@ -177,15 +175,6 @@ gcal_nav_bar_get_prev_button (GcalNavBar *nav_bar)
}
GtkWidget*
-gcal_nav_bar_get_today_button (GcalNavBar *nav_bar)
-{
- GcalNavBarPrivate *priv;
-
- priv = gcal_nav_bar_get_instance_private (nav_bar);
- return priv->today_button;
-}
-
-GtkWidget*
gcal_nav_bar_get_next_button (GcalNavBar *nav_bar)
{
GcalNavBarPrivate *priv;
diff --git a/src/gcal-nav-bar.h b/src/gcal-nav-bar.h
index 9ed3f16..076ef40 100644
--- a/src/gcal-nav-bar.h
+++ b/src/gcal-nav-bar.h
@@ -50,8 +50,6 @@ GtkWidget* gcal_nav_bar_new (void);
GtkWidget* gcal_nav_bar_get_prev_button (GcalNavBar *nav_bar);
-GtkWidget* gcal_nav_bar_get_today_button (GcalNavBar *nav_bar);
-
GtkWidget* gcal_nav_bar_get_next_button (GcalNavBar *nav_bar);
G_END_DECLS
diff --git a/src/gcal-window.c b/src/gcal-window.c
index d1d684e..7e42f20 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -66,7 +66,7 @@ typedef struct
GtkWidget *popover; /* short-lived */
/* header_bar widets */
- GtkWidget *new_button;
+ GtkWidget *today_button;
GtkWidget *search_entry;
GtkWidget *views_switcher;
@@ -251,7 +251,7 @@ date_updated (GtkButton *button,
priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
- move_today = gcal_nav_bar_get_today_button (GCAL_NAV_BAR (priv->nav_bar)) == (GtkWidget*) button;
+ move_today = priv->today_button == (GtkWidget*) button;
move_back = gcal_nav_bar_get_prev_button (GCAL_NAV_BAR (priv->nav_bar)) == (GtkWidget*) button;
if (move_today)
@@ -887,11 +887,8 @@ gcal_window_constructed (GObject *object)
priv->header_bar = gtk_header_bar_new ();
/* header_bar: new */
- priv->new_button = gtk_button_new_with_label (_("New Event"));
- gtk_style_context_add_class (
- gtk_widget_get_style_context (priv->new_button),
- "suggested-action");
- gtk_header_bar_pack_start (GTK_HEADER_BAR (priv->header_bar), priv->new_button);
+ priv->today_button = gtk_button_new_with_label (_("Today"));
+ gtk_header_bar_pack_start (GTK_HEADER_BAR (priv->header_bar), priv->today_button);
priv->views_switcher = gtk_stack_switcher_new ();
g_object_ref_sink (priv->views_switcher);
@@ -1011,8 +1008,6 @@ gcal_window_constructed (GObject *object)
g_signal_connect (object, "key-press-event",
G_CALLBACK (key_pressed), object);
- g_signal_connect_swapped (priv->new_button, "clicked",
- G_CALLBACK (gcal_window_new_event), object);
for (i = 0; i < 4; ++i)
{
if (priv->views[i] != NULL)
@@ -1031,10 +1026,12 @@ gcal_window_constructed (GObject *object)
g_signal_connect (priv->views_stack, "notify::visible-child",
G_CALLBACK (view_changed), object);
+
+ g_signal_connect (priv->today_button, "clicked",
+ G_CALLBACK (date_updated), object);
+
g_signal_connect (gcal_nav_bar_get_prev_button (GCAL_NAV_BAR (priv->nav_bar)),
"clicked", G_CALLBACK (date_updated), object);
- g_signal_connect (gcal_nav_bar_get_today_button (GCAL_NAV_BAR (priv->nav_bar)),
- "clicked", G_CALLBACK (date_updated), object);
g_signal_connect (gcal_nav_bar_get_next_button (GCAL_NAV_BAR (priv->nav_bar)),
"clicked", G_CALLBACK (date_updated), object);
}
@@ -1177,7 +1174,7 @@ gcal_window_search_toggled (GObject *object,
g_debug ("Entering search mode");
/* update headder_bar widget */
- gtk_widget_hide (priv->new_button);
+ gtk_widget_hide (priv->today_button);
gtk_header_bar_set_custom_title (GTK_HEADER_BAR (priv->header_bar),
NULL);
/* _prepare_for_search */
@@ -1186,7 +1183,7 @@ gcal_window_search_toggled (GObject *object,
{
g_debug ("Leaving search mode");
/* update header_bar */
- gtk_widget_show (priv->new_button);
+ gtk_widget_show (priv->today_button);
gtk_header_bar_set_custom_title (GTK_HEADER_BAR (priv->header_bar),
priv->views_switcher);
/* return to last active_view */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]