diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-06 20:28:32 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-09 15:48:32 +0800 |
commit | 7a2248d5a003ca685116076abb898857a8b40a60 (patch) | |
tree | 72606c077f853b8bdd08db5fa5d9f8d0cef973ce /libempathy-gtk/empathy-dialpad-widget.c | |
parent | 1eb83c95020a883d01dca4dd09d1cf3e242866c1 (diff) | |
download | gsoc2013-empathy-7a2248d5a003ca685116076abb898857a8b40a60.tar gsoc2013-empathy-7a2248d5a003ca685116076abb898857a8b40a60.tar.gz gsoc2013-empathy-7a2248d5a003ca685116076abb898857a8b40a60.tar.bz2 gsoc2013-empathy-7a2248d5a003ca685116076abb898857a8b40a60.tar.lz gsoc2013-empathy-7a2248d5a003ca685116076abb898857a8b40a60.tar.xz gsoc2013-empathy-7a2248d5a003ca685116076abb898857a8b40a60.tar.zst gsoc2013-empathy-7a2248d5a003ca685116076abb898857a8b40a60.zip |
dialpad-widget: store buttons in a hash table
https://bugzilla.gnome.org/show_bug.cgi?id=679396
Diffstat (limited to 'libempathy-gtk/empathy-dialpad-widget.c')
-rw-r--r-- | 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 1782dc807..4ffd5ac7b 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); |