/pidgin/main: e498a88e7c00: Factor out video widget creation int...

Jakub Adam <[email protected]>
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: e498a88e7c00a77067570e92dd7ac59587fbfeef
Author:	 Jakub Adam <[email protected]>
Date:	 2016-03-17 17:52 +0100
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/e498a88e7c00

Description:

Factor out video widget creation into pidgin_create_video_widget()

diffstat:

 pidgin/gtkmedia.c |   8 ++------
 pidgin/gtkprefs.c |   6 ++----
 pidgin/gtkutils.c |  12 ++++++++++++
 pidgin/gtkutils.h |   7 +++++++
 4 files changed, 23 insertions(+), 10 deletions(-)

diffs (95 lines):

diff --git a/pidgin/gtkmedia.c b/pidgin/gtkmedia.c
--- a/pidgin/gtkmedia.c
+++ b/pidgin/gtkmedia.c
@@ -922,7 +922,6 @@ pidgin_media_ready_cb(PurpleMedia *media
 		PidginMediaRealizeData *data;
 		GtkWidget *aspect;
 		GtkWidget *remote_video;
-		GdkRGBA color = {0.0, 0.0, 0.0, 1.0};
 
 		aspect = gtk_aspect_frame_new(NULL, 0, 0, 4.0/3.0, FALSE);
 		gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN);
@@ -933,8 +932,7 @@ pidgin_media_ready_cb(PurpleMedia *media
 		data->session_id = g_strdup(sid);
 		data->participant = g_strdup(gtkmedia->priv->screenname);
 
-		remote_video = gtk_drawing_area_new();
-		gtk_widget_override_background_color(remote_video, GTK_STATE_FLAG_NORMAL, &color);
+		remote_video = pidgin_create_video_widget();
 		g_signal_connect(G_OBJECT(remote_video), "realize",
 				G_CALLBACK(realize_cb), data);
 		gtk_container_add(GTK_CONTAINER(aspect), remote_video);
@@ -953,7 +951,6 @@ pidgin_media_ready_cb(PurpleMedia *media
 		PidginMediaRealizeData *data;
 		GtkWidget *aspect;
 		GtkWidget *local_video;
-		GdkRGBA color = {0.0, 0.0, 0.0, 1.0};
 
 		aspect = gtk_aspect_frame_new(NULL, 0, 0, 4.0/3.0, TRUE);
 		gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN);
@@ -964,8 +961,7 @@ pidgin_media_ready_cb(PurpleMedia *media
 		data->session_id = g_strdup(sid);
 		data->participant = NULL;
 
-		local_video = gtk_drawing_area_new();
-		gtk_widget_override_background_color(local_video, GTK_STATE_FLAG_NORMAL, &color);
+		local_video = pidgin_create_video_widget();
 		g_signal_connect(G_OBJECT(local_video), "realize",
 				G_CALLBACK(realize_cb), data);
 		gtk_container_add(GTK_CONTAINER(aspect), local_video);
diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c
--- a/pidgin/gtkprefs.c
+++ b/pidgin/gtkprefs.c
@@ -3809,11 +3809,9 @@ make_video_test(GtkWidget *vbox)
 {
 	GtkWidget *test;
 	GtkWidget *video;
-	GdkRGBA color = {0.0, 0.0, 0.0, 1.0};
-
-	video_drawing_area = video = gtk_drawing_area_new();
+
+	video_drawing_area = video = pidgin_create_video_widget();
 	gtk_box_pack_start(GTK_BOX(vbox), video, TRUE, TRUE, 0);
-	gtk_widget_override_background_color(video, GTK_STATE_FLAG_NORMAL, &color);
 	gtk_widget_set_size_request(GTK_WIDGET(video), 240, 180);
 
 	test = gtk_toggle_button_new_with_label(_("Test Video"));
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -228,6 +228,18 @@ pidgin_create_dialog(const char *title, 
 }
 
 GtkWidget *
+pidgin_create_video_widget(void)
+{
+	GtkWidget *video = NULL;
+	GdkRGBA color = {0.0, 0.0, 0.0, 1.0};
+
+	video = gtk_drawing_area_new();
+	gtk_widget_override_background_color(video, GTK_STATE_FLAG_NORMAL, &color);
+
+	return video;
+}
+
+GtkWidget *
 pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, gint spacing)
 {
 	GtkBox *vbox = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog)));
diff --git a/pidgin/gtkutils.h b/pidgin/gtkutils.h
--- a/pidgin/gtkutils.h
+++ b/pidgin/gtkutils.h
@@ -141,6 +141,13 @@ GtkWidget *pidgin_create_window(const ch
 GtkWidget *pidgin_create_dialog(const char *title, guint border_width, const char *role, gboolean resizable);
 
 /**
+ * pidgin_create_video_widget:
+ *
+ * Creates a new drawing area suitable for displaying a video
+ */
+GtkWidget *pidgin_create_video_widget(void);
+
+/**
  * pidgin_dialog_get_vbox_with_properties:
  * @dialog:       The dialog window
  * @homogeneous:  TRUE if all children are to be given equal space allotments.

_______________________________________________
Commits mailing list
[email protected]
https://pidgin.im/cgi-bin/mailman/listinfo/commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.