diff options
author | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2011-10-19 13:40:22 +0800 |
---|---|---|
committer | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2011-10-19 13:40:22 +0800 |
commit | c68091255ef12850aade51ce317292179515377f (patch) | |
tree | 86eb70ee78214f07e0d0c80c8a073991c1e9c0a7 /libempathy-gtk/empathy-ui-utils.c | |
parent | 4df0759871f6539af24a5e88650f0c219cd0505a (diff) | |
download | gsoc2013-empathy-c68091255ef12850aade51ce317292179515377f.tar gsoc2013-empathy-c68091255ef12850aade51ce317292179515377f.tar.gz gsoc2013-empathy-c68091255ef12850aade51ce317292179515377f.tar.bz2 gsoc2013-empathy-c68091255ef12850aade51ce317292179515377f.tar.lz gsoc2013-empathy-c68091255ef12850aade51ce317292179515377f.tar.xz gsoc2013-empathy-c68091255ef12850aade51ce317292179515377f.tar.zst gsoc2013-empathy-c68091255ef12850aade51ce317292179515377f.zip |
Move dialpad into a widget of its own
Let's face it, the whole thing was getting a little unwieldly there in the
UI utils, and if we're going to be using it in more places, let's start by
abstracting it into a widget.
Diffstat (limited to 'libempathy-gtk/empathy-ui-utils.c')
-rw-r--r-- | libempathy-gtk/empathy-ui-utils.c | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 32ad451a1..b52d9ef94 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -2099,108 +2099,6 @@ empathy_individual_match_string (FolksIndividual *individual, return retval; } -static gboolean -dtmf_dialpad_button_pressed_cb (GObject *button, - GtkEntry *entry) -{ - GtkEntryBuffer *buffer = gtk_entry_get_buffer (entry); - const gchar *label; - - label = g_object_get_data (button, "label"); - gtk_entry_buffer_insert_text (buffer, -1, label, -1); - - return FALSE; -} - -GtkWidget * -empathy_create_dtmf_dialpad (GObject *self, - GCallback dtmf_button_pressed_cb, - GCallback dtmf_button_released_cb) -{ - GtkWidget *box, *entry, *table; - int i; - GQuark button_quark; - struct { - const gchar *label; - const gchar *sublabel; - TpDTMFEvent event; - } dtmfbuttons[] = { { "1", "", TP_DTMF_EVENT_DIGIT_1 }, - { "2", "abc", TP_DTMF_EVENT_DIGIT_2 }, - { "3", "def", TP_DTMF_EVENT_DIGIT_3 }, - { "4", "ghi", TP_DTMF_EVENT_DIGIT_4 }, - { "5", "jkl", TP_DTMF_EVENT_DIGIT_5 }, - { "6", "mno", TP_DTMF_EVENT_DIGIT_6 }, - { "7", "pqrs", TP_DTMF_EVENT_DIGIT_7 }, - { "8", "tuv", TP_DTMF_EVENT_DIGIT_8 }, - { "9", "wxyz", TP_DTMF_EVENT_DIGIT_9 }, - { "#", "", TP_DTMF_EVENT_HASH }, - { "0", "", TP_DTMF_EVENT_DIGIT_0 }, - { "*", "", TP_DTMF_EVENT_ASTERISK }, - { NULL, } }; - - box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); - - entry = gtk_entry_new (); - gtk_editable_set_editable (GTK_EDITABLE (entry), FALSE); - - gtk_box_pack_start (GTK_BOX (box), entry, FALSE, FALSE, 3); - - 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 *vbox = gtk_vbox_new (FALSE, 0); - GtkWidget *button = gtk_button_new (); - GtkWidget *label; - gchar *str; - - gtk_container_add (GTK_CONTAINER (button), vbox); - - /* main label */ - label = gtk_label_new (""); - str = g_strdup_printf ("<span size='x-large'>%s</span>", - dtmfbuttons[i].label); - gtk_label_set_markup (GTK_LABEL (label), str); - g_free (str); - - g_object_set_data (G_OBJECT (button), "label", - (gpointer) dtmfbuttons[i].label); - - gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 3); - - /* sub label */ - label = gtk_label_new (""); - str = g_strdup_printf ( - "<span foreground='#555555'>%s</span>", - dtmfbuttons[i].sublabel); - gtk_label_set_markup (GTK_LABEL (label), str); - g_free (str); - - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0); - - 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)); - - /* To update the GtkEntry */ - g_signal_connect (G_OBJECT (button), "pressed", - G_CALLBACK (dtmf_dialpad_button_pressed_cb), entry); - - g_signal_connect (G_OBJECT (button), "pressed", - dtmf_button_pressed_cb, self); - g_signal_connect (G_OBJECT (button), "released", - dtmf_button_released_cb, self); - } - - gtk_box_pack_start (GTK_BOX (box), table, FALSE, FALSE, 3); - - return box; -} - void empathy_launch_program (const gchar *dir, const gchar *name, |