aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-07-26 18:08:04 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-08-04 17:10:19 +0800
commit622e7763577c4757aa0cc76a3b802ca12f727afa (patch)
tree2f657375962aec4e5f0450d65974988ec0841b79 /libempathy-gtk
parentb4edfbf863ba2d74cec7fbf7375c53237f20cd84 (diff)
downloadgsoc2013-empathy-622e7763577c4757aa0cc76a3b802ca12f727afa.tar
gsoc2013-empathy-622e7763577c4757aa0cc76a3b802ca12f727afa.tar.gz
gsoc2013-empathy-622e7763577c4757aa0cc76a3b802ca12f727afa.tar.bz2
gsoc2013-empathy-622e7763577c4757aa0cc76a3b802ca12f727afa.tar.lz
gsoc2013-empathy-622e7763577c4757aa0cc76a3b802ca12f727afa.tar.xz
gsoc2013-empathy-622e7763577c4757aa0cc76a3b802ca12f727afa.tar.zst
gsoc2013-empathy-622e7763577c4757aa0cc76a3b802ca12f727afa.zip
Dialpad: show an entry with the entered numbers
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-ui-utils.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 810bbfc26..322f836ae 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -2013,12 +2013,25 @@ 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 *table;
+ GtkWidget *box, *entry, *table;
int i;
GQuark button_quark;
struct {
@@ -2039,6 +2052,13 @@ empathy_create_dtmf_dialpad (GObject *self,
{ "*", "", 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);
@@ -2059,6 +2079,9 @@ empathy_create_dtmf_dialpad (GObject *self,
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 */
@@ -2077,11 +2100,17 @@ empathy_create_dtmf_dialpad (GObject *self,
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);
}
- return table;
+ gtk_box_pack_start (GTK_BOX (box), table, FALSE, FALSE, 3);
+
+ return box;
}