[empathy] dialpad-widget: store buttons in a hash table
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] dialpad-widget: store buttons in a hash table
- Date: Mon, 9 Jul 2012 08:16:52 +0000 (UTC)
commit 7a2248d5a003ca685116076abb898857a8b40a60
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Fri Jul 6 14:28:32 2012 +0200
dialpad-widget: store buttons in a hash table
https://bugzilla.gnome.org/show_bug.cgi?id=679396
libempathy-gtk/empathy-dialpad-widget.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-dialpad-widget.c b/libempathy-gtk/empathy-dialpad-widget.c
index 1782dc8..4ffd5ac 100644
--- a/libempathy-gtk/empathy-dialpad-widget.c
+++ b/libempathy-gtk/empathy-dialpad-widget.c
@@ -40,13 +40,31 @@ static guint signals[NUM_SIGNALS] = { 0, };
struct _EmpathyDialpadWidgetPrivate
{
GtkWidget *entry;
+
+ /* gchar representing the button (like '7') -> GtkButton */
+ GHashTable *buttons;
};
static void
+empathy_dialpad_widget_dispose (GObject *object)
+{
+ EmpathyDialpadWidget *self = EMPATHY_DIALPAD_WIDGET (object);
+ void (*chain_up) (GObject *) =
+ ((GObjectClass *) empathy_dialpad_widget_parent_class)->dispose;
+
+ g_hash_table_unref (self->priv->buttons);
+
+ if (chain_up != NULL)
+ chain_up (object);
+}
+
+static void
empathy_dialpad_widget_class_init (EmpathyDialpadWidgetClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->dispose = empathy_dialpad_widget_dispose;
+
signals[START_TONE] = g_signal_new ("start-tone",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -138,6 +156,8 @@ empathy_dialpad_widget_init (EmpathyDialpadWidget *self)
gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
+ self->priv->buttons = g_hash_table_new (NULL, NULL);
+
for (i = 0; dtmfbuttons[i].label != NULL; i++)
{
GtkWidget *vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
@@ -178,6 +198,9 @@ empathy_dialpad_widget_init (EmpathyDialpadWidget *self)
G_CALLBACK (dtmf_dialpad_button_pressed_cb), self);
g_signal_connect (G_OBJECT (button), "button-release-event",
G_CALLBACK (dtmf_dialpad_button_released_cb), self);
+
+ g_hash_table_insert (self->priv->buttons,
+ GUINT_TO_POINTER (dtmfbuttons[i].label[0]), button);
}
gtk_box_pack_start (GTK_BOX (self), grid, FALSE, FALSE, 3);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]