aboutsummaryrefslogtreecommitdiffstats
path: root/src
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 /src
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 'src')
-rw-r--r--src/empathy-call-window.c53
-rw-r--r--src/empathy-streamed-media-window.c53
2 files changed, 8 insertions, 98 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 343c69244..92baf6de0 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -61,8 +61,6 @@
#include "empathy-video-src.h"
#include "ev-sidebar.h"
-#define BUTTON_ID "empathy-call-dtmf-button-id"
-
#define CONTENT_HBOX_BORDER_WIDTH 6
#define CONTENT_HBOX_SPACING 3
#define CONTENT_HBOX_CHILDREN_PACKING_PADDING 3
@@ -324,7 +322,7 @@ dtmf_button_pressed_cb (GtkButton *button, EmpathyCallWindow *window)
g_object_get (priv->handler, "call-channel", &call, NULL);
- button_quark = g_quark_from_static_string (BUTTON_ID);
+ button_quark = g_quark_from_static_string (EMPATHY_DTMF_BUTTON_ID);
event = GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (button),
button_quark));
@@ -347,51 +345,6 @@ dtmf_button_released_cb (GtkButton *button, EmpathyCallWindow *window)
}
static GtkWidget *
-empathy_call_window_create_dtmf (EmpathyCallWindow *self)
-{
- 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 (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",
- G_CALLBACK (dtmf_button_pressed_cb), self);
- g_signal_connect (G_OBJECT (button), "released",
- G_CALLBACK (dtmf_button_released_cb), self);
- }
-
- return table;
-}
-
-static GtkWidget *
empathy_call_window_create_video_input_add_slider (EmpathyCallWindow *self,
gchar *label_text, GtkWidget *bin)
{
@@ -1152,7 +1105,9 @@ empathy_call_window_init (EmpathyCallWindow *self)
ev_sidebar_add_page (EV_SIDEBAR (priv->sidebar), "video-input",
_("Video input"), page);
- priv->dtmf_panel = empathy_call_window_create_dtmf (self);
+ priv->dtmf_panel = empathy_create_dtmf_dialpad (G_OBJECT (self),
+ G_CALLBACK (dtmf_button_pressed_cb),
+ G_CALLBACK (dtmf_button_released_cb));
ev_sidebar_add_page (EV_SIDEBAR (priv->sidebar), "dialpad",
_("Dialpad"), priv->dtmf_panel);
diff --git a/src/empathy-streamed-media-window.c b/src/empathy-streamed-media-window.c
index 19b7b2fad..d60c0753b 100644
--- a/src/empathy-streamed-media-window.c
+++ b/src/empathy-streamed-media-window.c
@@ -54,8 +54,6 @@
#include "empathy-video-src.h"
#include "ev-sidebar.h"
-#define BUTTON_ID "empathy-call-dtmf-button-id"
-
#define CONTENT_HBOX_BORDER_WIDTH 6
#define CONTENT_HBOX_SPACING 3
#define CONTENT_HBOX_CHILDREN_PACKING_PADDING 3
@@ -346,7 +344,7 @@ dtmf_button_pressed_cb (GtkButton *button, EmpathyStreamedMediaWindow *window)
g_object_get (priv->handler, "tp-call", &call, NULL);
- button_quark = g_quark_from_static_string (BUTTON_ID);
+ button_quark = g_quark_from_static_string (EMPATHY_DTMF_BUTTON_ID);
event = GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (button),
button_quark));
@@ -369,51 +367,6 @@ dtmf_button_released_cb (GtkButton *button, EmpathyStreamedMediaWindow *window)
}
static GtkWidget *
-empathy_streamed_media_window_create_dtmf (EmpathyStreamedMediaWindow *self)
-{
- 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 (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",
- G_CALLBACK (dtmf_button_pressed_cb), self);
- g_signal_connect (G_OBJECT (button), "released",
- G_CALLBACK (dtmf_button_released_cb), self);
- }
-
- return table;
-}
-
-static GtkWidget *
empathy_streamed_media_window_create_video_input_add_slider (EmpathyStreamedMediaWindow *self,
gchar *label_text, GtkWidget *bin)
{
@@ -1180,7 +1133,9 @@ empathy_streamed_media_window_init (EmpathyStreamedMediaWindow *self)
ev_sidebar_add_page (EV_SIDEBAR (priv->sidebar), "video-input",
_("Video input"), page);
- priv->dtmf_panel = empathy_streamed_media_window_create_dtmf (self);
+ priv->dtmf_panel = empathy_create_dtmf_dialpad (G_OBJECT (self),
+ G_CALLBACK (dtmf_button_pressed_cb),
+ G_CALLBACK (dtmf_button_released_cb));
ev_sidebar_add_page (EV_SIDEBAR (priv->sidebar), "dialpad",
_("Dialpad"), priv->dtmf_panel);