aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-ui-utils.c
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-05-13 11:19:49 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-07-26 23:45:34 +0800
commitc5c0cd8d6f433896b406287cf5be078670cb734d (patch)
tree9dd36d4d6d0bbd67e30f383aef7f4041c6f172f0 /libempathy-gtk/empathy-ui-utils.c
parentece8e76a9d3e39dbcf9f8efdeb5e12e6ba77461c (diff)
downloadgsoc2013-empathy-c5c0cd8d6f433896b406287cf5be078670cb734d.tar
gsoc2013-empathy-c5c0cd8d6f433896b406287cf5be078670cb734d.tar.gz
gsoc2013-empathy-c5c0cd8d6f433896b406287cf5be078670cb734d.tar.bz2
gsoc2013-empathy-c5c0cd8d6f433896b406287cf5be078670cb734d.tar.lz
gsoc2013-empathy-c5c0cd8d6f433896b406287cf5be078670cb734d.tar.xz
gsoc2013-empathy-c5c0cd8d6f433896b406287cf5be078670cb734d.tar.zst
gsoc2013-empathy-c5c0cd8d6f433896b406287cf5be078670cb734d.zip
Factor out dialpad into a utility function
The dialpad is shared between empathy-call and empathy-av. Really it would be nice to make the dialpad its own little widget that emits signals with DTMF event ids, but I've got things to get done. Conflicts: libempathy-gtk/empathy-ui-utils.c src/empathy-call-window.c src/empathy-streamed-media-window.c
Diffstat (limited to 'libempathy-gtk/empathy-ui-utils.c')
-rw-r--r--libempathy-gtk/empathy-ui-utils.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 7e4a82369..77a13394f 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -2011,3 +2011,50 @@ empathy_individual_match_string (FolksIndividual *individual,
* contact's vCard for example. */
return retval;
}
+
+GtkWidget *
+empathy_create_dtmf_dialpad (GObject *self,
+ GCallback dtmf_button_pressed_cb,
+ GCallback dtmf_button_released_cb)
+{
+ GtkWidget *table;
+ int i;
+ GQuark button_quark;
+ struct {
+ const gchar *label;
+ TpDTMFEvent event;
+ } dtmfbuttons[] = { { "1", TP_DTMF_EVENT_DIGIT_1 },
+ { "2", TP_DTMF_EVENT_DIGIT_2 },
+ { "3", TP_DTMF_EVENT_DIGIT_3 },
+ { "4", TP_DTMF_EVENT_DIGIT_4 },
+ { "5", TP_DTMF_EVENT_DIGIT_5 },
+ { "6", TP_DTMF_EVENT_DIGIT_6 },
+ { "7", TP_DTMF_EVENT_DIGIT_7 },
+ { "8", TP_DTMF_EVENT_DIGIT_8 },
+ { "9", TP_DTMF_EVENT_DIGIT_9 },
+ { "#", TP_DTMF_EVENT_HASH },
+ { "0", TP_DTMF_EVENT_DIGIT_0 },
+ { "*", TP_DTMF_EVENT_ASTERISK },
+ { NULL, } };
+
+ button_quark = g_quark_from_static_string (EMPATHY_DTMF_BUTTON_ID);
+
+ table = gtk_table_new (4, 3, TRUE);
+
+ for (i = 0; dtmfbuttons[i].label != NULL; i++)
+ {
+ GtkWidget *button = gtk_button_new_with_label (dtmfbuttons[i].label);
+ gtk_table_attach (GTK_TABLE (table), button, i % 3, i % 3 + 1,
+ i/3, i/3 + 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 1, 1);
+
+ g_object_set_qdata (G_OBJECT (button), button_quark,
+ GUINT_TO_POINTER (dtmfbuttons[i].event));
+
+ g_signal_connect (G_OBJECT (button), "pressed",
+ dtmf_button_pressed_cb, self);
+ g_signal_connect (G_OBJECT (button), "released",
+ dtmf_button_released_cb, self);
+ }
+
+ return table;
+}