[gnome-calendar] gcal-nav-bar: removed #GcalNavBar:move signal
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] gcal-nav-bar: removed #GcalNavBar:move signal
- Date: Thu, 4 Dec 2014 22:20:44 +0000 (UTC)
commit 0177641993f50aed4950a98d201c38638085ed85
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sun Jun 2 22:41:46 2013 -0400
gcal-nav-bar: removed #GcalNavBar:move signal
Use back/forward buttons :clicked signal
src/gcal-nav-bar.c | 57 ++++++++++++++++-----------------------------------
src/gcal-nav-bar.h | 7 +++--
src/gcal-window.c | 30 +++++++++++++++-----------
src/nav_bar.ui | 2 -
4 files changed, 39 insertions(+), 57 deletions(-)
---
diff --git a/src/gcal-nav-bar.c b/src/gcal-nav-bar.c
index 49aebc1..542b9c2 100644
--- a/src/gcal-nav-bar.c
+++ b/src/gcal-nav-bar.c
@@ -39,15 +39,6 @@ enum
PROP_RIGHT_HEADER
};
-/* Signal IDs */
-enum
- {
- MOVE,
- LAST_SIGNAL
- };
-
-static guint signals[LAST_SIGNAL];
-
static void gcal_nav_bar_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -58,9 +49,6 @@ static void gcal_nav_bar_get_property (GObject *object
GValue *value,
GParamSpec *pspec);
-static void gcal_nav_bar_btn_clicked (GtkButton *button,
- gpointer user_data);
-
G_DEFINE_TYPE(GcalNavBar, gcal_nav_bar, GTK_TYPE_GRID)
static void
@@ -93,17 +81,6 @@ gcal_nav_bar_class_init (GcalNavBarClass *klass)
G_PARAM_CONSTRUCT |
G_PARAM_READWRITE));
- signals[MOVE] = g_signal_new ("move",
- GCAL_TYPE_NAV_BAR,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GcalNavBarClass,
- move),
- NULL, NULL,
- g_cclosure_marshal_VOID__BOOLEAN,
- G_TYPE_NONE,
- 1,
- G_TYPE_BOOLEAN);
-
widget_class = GTK_WIDGET_CLASS (klass);
/* Setup the template GtkBuilder xml for this class */
@@ -115,9 +92,6 @@ gcal_nav_bar_class_init (GcalNavBarClass *klass)
gtk_widget_class_bind_child (widget_class, GcalNavBarPrivate, left_label);
gtk_widget_class_bind_child (widget_class, GcalNavBarPrivate, right_label);
- /* Bind callbacks */
- gtk_widget_class_bind_callback (widget_class, gcal_nav_bar_btn_clicked);
-
g_type_class_add_private ((gpointer)klass, sizeof (GcalNavBarPrivate));
}
@@ -182,19 +156,6 @@ gcal_nav_bar_get_property (GObject *object,
}
}
-static void
-gcal_nav_bar_btn_clicked (GtkButton *button,
- gpointer user_data)
-{
- GcalNavBarPrivate *priv;
- priv = GCAL_NAV_BAR (user_data)->priv;
-
- if ((GtkWidget*) button == priv->back_button)
- g_signal_emit (GCAL_NAV_BAR (user_data), signals[MOVE], 0, FALSE);
- else
- g_signal_emit (GCAL_NAV_BAR (user_data), signals[MOVE], 0, TRUE);
-}
-
/* Public API */
/**
* gcal_nav_bar_new:
@@ -208,3 +169,21 @@ gcal_nav_bar_new (void)
{
return g_object_new (GCAL_TYPE_NAV_BAR, NULL);
}
+
+GtkWidget*
+gcal_nav_bar_get_prev_button (GcalNavBar *nav_bar)
+{
+ GcalNavBarPrivate *priv;
+ priv = nav_bar->priv;
+
+ return priv->back_button;
+}
+
+GtkWidget*
+gcal_nav_bar_get_next_button (GcalNavBar *nav_bar)
+{
+ GcalNavBarPrivate *priv;
+ priv = nav_bar->priv;
+
+ return priv->forward_button;
+}
diff --git a/src/gcal-nav-bar.h b/src/gcal-nav-bar.h
index cd573ee..3f48d5a 100644
--- a/src/gcal-nav-bar.h
+++ b/src/gcal-nav-bar.h
@@ -46,15 +46,16 @@ struct _GcalNavBar
struct _GcalNavBarClass
{
GtkGridClass parent_class;
-
- /* signals */
- void (*move) (GcalNavBar *nav_bar, gboolean forward);
};
GType gcal_nav_bar_get_type (void);
GtkWidget* gcal_nav_bar_new (void);
+GtkWidget* gcal_nav_bar_get_prev_button (GcalNavBar *nav_bar);
+
+GtkWidget* gcal_nav_bar_get_next_button (GcalNavBar *nav_bar);
+
G_END_DECLS
#endif /* __GCAL_NAV_BAR_H__ */
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 0d654d2..7e7d0eb 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -112,8 +112,7 @@ static void gcal_window_search_toggled (GObject *o
static void gcal_window_search_changed (GtkEditable *editable,
gpointer user_data);
-static void gcal_window_view_updated (GcalNavBar *nav_bar,
- gboolean forward,
+static void gcal_window_view_updated (GtkButton *buttton,
gpointer user_data);
static void gcal_window_set_active_view (GcalWindow *window,
@@ -342,8 +341,11 @@ gcal_window_constructed (GObject *object)
G_CALLBACK (gcal_window_search_toggled), object);
g_signal_connect (priv->search_entry, "changed",
G_CALLBACK (gcal_window_search_changed), object);
- g_signal_connect (priv->nav_bar, "move",
- G_CALLBACK (gcal_window_view_updated), object);
+
+ g_signal_connect (gcal_nav_bar_get_prev_button (GCAL_NAV_BAR (priv->nav_bar)),
+ "clicked", G_CALLBACK (gcal_window_view_updated), object);
+ g_signal_connect (gcal_nav_bar_get_next_button (GCAL_NAV_BAR (priv->nav_bar)),
+ "clicked", G_CALLBACK (gcal_window_view_updated), object);
gtk_container_add (GTK_CONTAINER (object), priv->main_box);
gtk_widget_show_all (priv->main_box);
@@ -532,19 +534,21 @@ gcal_window_search_changed (GtkEditable *editable,
}
static void
-gcal_window_view_updated (GcalNavBar *nav_bar,
- gboolean forward,
+gcal_window_view_updated (GtkButton *button,
gpointer user_data)
{
- /* FIXME: reenable views updating */
- /* GcalWindowPrivate *priv; */
- /* icaltimetype *first_day; */
- /* icaltimetype *last_day; */
+ GcalWindowPrivate *priv;
+ priv = GCAL_WINDOW (user_data)->priv;
- if (! forward)
- g_debug ("Moved back");
+ if (gcal_nav_bar_get_prev_button (GCAL_NAV_BAR (priv->nav_bar)) ==
+ (GtkWidget*) button)
+ {
+ g_debug ("Moved back");
+ }
else
- g_debug ("Moved forward");
+ {
+ g_debug ("Moved forward");
+ }
/* FIXME: reenable views updating */
/* priv = GCAL_WINDOW (user_data)->priv; */
diff --git a/src/nav_bar.ui b/src/nav_bar.ui
index d24fbd8..d6335f6 100644
--- a/src/nav_bar.ui
+++ b/src/nav_bar.ui
@@ -23,7 +23,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
- <signal name="clicked" handler="gcal_nav_bar_btn_clicked" object="GcalNavBar" after="yes"
swapped="no" />
<style>
<class name="nav-button"/>
</style>
@@ -46,7 +45,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
- <signal name="clicked" handler="gcal_nav_bar_btn_clicked" object="GcalNavBar" after="yes"
swapped="no" />
<style>
<class name="nav-button"/>
</style>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]