+2009-02-25 Alberto Garcia <agarcia@igalia.com>
+
+ * doc/hildon-sections.txt
+ * src/hildon-picker-button.h
+ * src/hildon-picker-button.c (+hildon_picker_button_value_changed)
+ (_selection_changed, hildon_picker_button_on_dialog_response)
+ (hildon_picker_button_class_init, hildon_picker_button_set_selector):
+ New hildon_picker_button_value_changed() method.
+
+ * src/Makefile.am
+ * src/hildon-picker-button-private.h
+ * src/hildon-picker-button.c (hildon_picker_button_init)
+ (+hildon_picker_button_disable_value_changed): Add protected
+ function for disabling the "value-changed" signal.
+
+ * src/hildon-date-button.c (hildon_date_button_set_date):
+ Don't emit "value-changed" for each one of the three columns.
+
+ Fixes: NB#103242 ("HildonPickerButton:value-changed" is emitted
+ before actual change of values)
+
2009-02-24 Alejandro G. Castro <alex@igalia.com>
* src/hildon-pannable-area.c,
hildon_picker_button_get_active
hildon_picker_button_get_done_button_text
hildon_picker_button_set_done_button_text
+hildon_picker_button_value_changed
<SUBSECTION Standard>
HILDON_PICKER_BUTTON
HILDON_IS_PICKER_BUTTON
hildon-private.h \
hildon-caption-private.h \
hildon-code-dialog-private.h \
+ hildon-picker-button-private.h \
hildon-color-button-private.h \
hildon-color-chooser-dialog-private.h \
hildon-color-chooser-private.h \
#include "hildon-date-button.h"
#include "hildon-date-selector.h"
#include "hildon-touch-selector.h"
+#include "hildon-picker-button-private.h"
#define _(String) \
dgettext("hildon-libs", String)
selector = hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (button));
+ hildon_picker_button_disable_value_changed (HILDON_PICKER_BUTTON (button), TRUE);
hildon_date_selector_select_current_date (HILDON_DATE_SELECTOR (selector),
year, month, day);
+ hildon_picker_button_disable_value_changed (HILDON_PICKER_BUTTON (button), FALSE);
+
date = hildon_touch_selector_get_current_text (HILDON_TOUCH_SELECTOR (selector));
hildon_button_set_value (HILDON_BUTTON (button), date);
g_free (date);
+
+ hildon_picker_button_value_changed (HILDON_PICKER_BUTTON (button));
}
--- /dev/null
+/*
+ * This file is a part of hildon
+ *
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser Public License for more details.
+ *
+ */
+
+#ifndef __HILDON_PICKER_BUTTON_PRIVATE__
+#define __HILDON_PICKER_BUTTON_PRIVATE__
+
+#include "hildon-picker-button.h"
+
+G_BEGIN_DECLS
+
+G_GNUC_INTERNAL void
+hildon_picker_button_disable_value_changed (HildonPickerButton *button,
+ gboolean disable);
+
+G_END_DECLS
+
+#endif /* __HILDON_PICKER_BUTTON_PRIVATE__ */
*/
#include "hildon-picker-button.h"
+#include "hildon-picker-button-private.h"
#include "hildon-picker-dialog.h"
G_DEFINE_TYPE (HildonPickerButton, hildon_picker_button, HILDON_TYPE_BUTTON)
GtkWidget *selector;
GtkWidget *dialog;
gchar *done_button_text;
+ guint disable_value_changed : 1;
};
/* Signals */
G_OBJECT_CLASS (hildon_picker_button_parent_class)->finalize (object);
}
+/**
+ * hildon_picker_button_value_changed:
+ * @button: a #HildonPickerButton
+ *
+ * Emits a "#HildonPickerButton::value-changed" signal to the given
+ * #HildonPickerButton
+ **/
+void
+hildon_picker_button_value_changed (HildonPickerButton *button)
+{
+ HildonPickerButtonPrivate *priv;
+ g_return_if_fail (HILDON_IS_PICKER_BUTTON (button));
+ priv = GET_PRIVATE (button);
+
+ if (!priv->disable_value_changed)
+ g_signal_emit (button, picker_button_signals[VALUE_CHANGED], 0);
+}
+
+G_GNUC_INTERNAL void
+hildon_picker_button_disable_value_changed (HildonPickerButton *button,
+ gboolean disable)
+{
+ HildonPickerButtonPrivate *priv;
+ g_return_if_fail (HILDON_IS_PICKER_BUTTON (button));
+ priv = GET_PRIVATE (button);
+
+ priv->disable_value_changed = disable;
+}
+
static void
_selection_changed (HildonPickerButton *button)
{
if (value) {
hildon_button_set_value (HILDON_BUTTON (button), value);
g_free (value);
- g_signal_emit (button, picker_button_signals[VALUE_CHANGED], 0);
+ hildon_picker_button_value_changed (button);
}
}
}
(HILDON_TOUCH_SELECTOR (priv->selector));
hildon_button_set_value (HILDON_BUTTON (button), value);
g_free (value);
- g_signal_emit (button, picker_button_signals[VALUE_CHANGED], 0);
+ hildon_picker_button_value_changed (button);
}
gtk_widget_hide (GTK_WIDGET (dialog));
button_class->clicked = hildon_picker_button_clicked;
+ klass->value_changed = NULL;
+
g_object_class_install_property (object_class,
PROP_SELECTOR,
g_param_spec_object ("touch-selector",
g_signal_new ("value-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- 0,
+ G_STRUCT_OFFSET (HildonPickerButtonClass, value_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, NULL);
}
priv->dialog = NULL;
priv->selector = NULL;
priv->done_button_text = NULL;
+ priv->disable_value_changed = FALSE;
hildon_button_set_style (HILDON_BUTTON (self),
HILDON_BUTTON_STYLE_PICKER);
if (value) {
hildon_button_set_value (HILDON_BUTTON (button), value);
g_free (value);
- g_signal_emit (HILDON_PICKER_BUTTON (button),
- picker_button_signals[VALUE_CHANGED], 0);
+ hildon_picker_button_value_changed (button);
}
}
struct _HildonPickerButtonClass
{
HildonButtonClass parent_class;
+
+ void (* value_changed) (HildonPickerButton *button);
};
GType
hildon_picker_button_set_done_button_text (HildonPickerButton *button,
const gchar *done_button_text);
+void
+hildon_picker_button_value_changed (HildonPickerButton *button);
+
G_END_DECLS
#endif /* __HILDON_PICKER_BUTTON__ */