/soc/2013/ankitkv/gobjectification: efe4b7c5218a: Merged default...

Ankit Vani a at nevitus.org
Thu Feb 13 11:31:00 EST 2014


Changeset: efe4b7c5218aa7b984a600835193cd1e3e74547e
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2014-02-13 21:59 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/efe4b7c5218a

Description:

Merged default branch

diffstat:

 finch/libgnt/gntprogressbar.h         |     1 +
 libpurple/Makefile.am                 |    13 +-
 libpurple/ciphers/aescipher.c         |     8 +-
 libpurple/cmds.h                      |     1 +
 libpurple/internal.h                  |     8 +
 libpurple/protocols/bonjour/jabber.c  |    23 +-
 pidgin/gtk3compat.h                   |    96 +
 pidgin/gtkconv.c                      |     2 +-
 pidgin/gtkutils.c                     |     6 +-
 pidgin/gtkwebviewtoolbar.c            |   342 ++-
 pidgin/gtkwhiteboard.c                |   410 ++--
 pidgin/gtkwhiteboard.h                |    45 +-
 pidgin/plugins/gestures/gestures.c    |     6 +-
 pidgin/plugins/gestures/stroke-draw.c |    72 +-
 pidgin/plugins/themeedit.c            |   103 +-
 po/da.po                              |  2888 +++++++++-----------------------
 16 files changed, 1415 insertions(+), 2609 deletions(-)

diffs (truncated from 7161 to 300 lines):

diff --git a/finch/libgnt/gntprogressbar.h b/finch/libgnt/gntprogressbar.h
--- a/finch/libgnt/gntprogressbar.h
+++ b/finch/libgnt/gntprogressbar.h
@@ -77,6 +77,7 @@ gnt_progress_bar_get_type (void);
  * gnt_progress_bar_new:
  *
  * Create a new GntProgressBar
+ *
  * Returns: The new GntProgressBar
  */
 GntWidget *
diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -38,15 +38,6 @@ pkgconfig_DATA = purple-3.pc
 
 SUBDIRS = $(GCONF_DIR) plugins protocols . tests example
 
-if USE_NSS
-AES_SOURCE = ciphers/aescipher.c
-AES_HEADER = aescipher.h
-endif
-if USE_GNUTLS
-AES_SOURCE = ciphers/aescipher.c
-AES_HEADER = aescipher.h
-endif
-
 purple_coresources = \
 	account.c \
 	accounts.c \
@@ -56,7 +47,7 @@ purple_coresources = \
 	buddylist.c \
 	buddyicon.c \
 	certificate.c \
-	$(AES_SOURCE) \
+	ciphers/aescipher.c \
 	ciphers/descipher.c \
 	ciphers/des3cipher.c \
 	ciphers/hmaccipher.c \
@@ -210,7 +201,7 @@ purple_mediaheaders = \
 	enum-types.h
 
 purple_cipherheaders = \
-	$(AES_HEADER) \
+	aescipher.h \
 	descipher.h \
 	des3cipher.h \
 	hmaccipher.h \
diff --git a/libpurple/ciphers/aescipher.c b/libpurple/ciphers/aescipher.c
--- a/libpurple/ciphers/aescipher.c
+++ b/libpurple/ciphers/aescipher.c
@@ -41,7 +41,7 @@
 #  include <pk11pub.h>
 #  include <prerror.h>
 #else
-#  error "No GnuTLS or NSS support"
+#  warning "No GnuTLS or NSS support"
 #endif
 
 /* 128bit */
@@ -438,7 +438,8 @@ purple_aes_cipher_encrypt(PurpleCipher *
 #elif defined(PURPLE_AES_USE_NSS)
 	encrypt_func = purple_aes_cipher_nss_encrypt;
 #else
-#  error "No matching encrypt_func"
+	purple_debug_error("cipher-aes", "No matching encrypt_func\n");
+	return -1;
 #endif
 
 	succ = encrypt_func(input_padded, output, out_len, priv->iv,
@@ -482,7 +483,8 @@ purple_aes_cipher_decrypt(PurpleCipher *
 #elif defined(PURPLE_AES_USE_NSS)
 	decrypt_func = purple_aes_cipher_nss_decrypt;
 #else
-#  error "No matching encrypt_func"
+	purple_debug_error("cipher-aes", "No matching decrypt_func\n");
+	return -1;
 #endif
 
 	succ = decrypt_func(input, output, in_len, priv->iv, priv->key,
diff --git a/libpurple/cmds.h b/libpurple/cmds.h
--- a/libpurple/cmds.h
+++ b/libpurple/cmds.h
@@ -256,6 +256,7 @@ GList *purple_cmd_help(PurpleConversatio
  * purple_cmds_get_handle:
  *
  * Get the handle for the commands API
+ *
  * Returns: The handle
  */
 gpointer purple_cmds_get_handle(void);
diff --git a/libpurple/internal.h b/libpurple/internal.h
--- a/libpurple/internal.h
+++ b/libpurple/internal.h
@@ -141,6 +141,14 @@
 
 #include <glib-object.h>
 
+typedef union
+{
+	struct sockaddr sa;
+	struct sockaddr_in in;
+	struct sockaddr_in6 in6;
+	struct sockaddr_storage storage;
+} common_sockaddr_t;
+
 #define PURPLE_WEBSITE "https://pidgin.im/"
 #define PURPLE_DEVEL_WEBSITE "https://developer.pidgin.im/"
 
diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c
--- a/libpurple/protocols/bonjour/jabber.c
+++ b/libpurple/protocols/bonjour/jabber.c
@@ -634,8 +634,8 @@ static void
 _server_socket_handler(gpointer data, int server_socket, PurpleInputCondition condition)
 {
 	BonjourJabber *jdata = data;
-	struct sockaddr_storage their_addr; /* connector's address information */
-	socklen_t sin_size = sizeof(struct sockaddr_storage);
+	common_sockaddr_t their_addr; /* connector's address information */
+	socklen_t sin_size = sizeof(common_sockaddr_t);
 	int client_socket;
 	int flags;
 #ifdef HAVE_INET_NTOP
@@ -652,7 +652,7 @@ static void
 
 	memset(&their_addr, 0, sin_size);
 
-	if ((client_socket = accept(server_socket, (struct sockaddr*)&their_addr, &sin_size)) == -1)
+	if ((client_socket = accept(server_socket, &their_addr.sa, &sin_size)) == -1)
 		return;
 
 	flags = fcntl(client_socket, F_GETFL);
@@ -663,18 +663,17 @@ static void
 
 	/* Look for the buddy that has opened the conversation and fill information */
 #ifdef HAVE_INET_NTOP
-	if (their_addr.ss_family == AF_INET6) {
-		address_text = inet_ntop(their_addr.ss_family, &((struct sockaddr_in6 *)&their_addr)->sin6_addr,
-			addrstr, sizeof(addrstr));
+	if (their_addr.sa.sa_family == AF_INET6) {
+		address_text = inet_ntop(their_addr.sa.sa_family,
+			&their_addr.in6.sin6_addr, addrstr, sizeof(addrstr));
 
-		append_iface_if_linklocal(addrstr,
-			((struct sockaddr_in6 *)&their_addr)->sin6_scope_id);
+		append_iface_if_linklocal(addrstr, their_addr.in6.sin6_scope_id);
+	} else {
+		address_text = inet_ntop(their_addr.sa.sa_family,
+			&their_addr.in.sin_addr, addrstr, sizeof(addrstr));
 	}
-	else
-		address_text = inet_ntop(their_addr.ss_family, &((struct sockaddr_in *)&their_addr)->sin_addr,
-			addrstr, sizeof(addrstr));
 #else
-	address_text = inet_ntoa(((struct sockaddr_in *)&their_addr)->sin_addr);
+	address_text = inet_ntoa(their_addr.in.sin_addr);
 #endif
 	purple_debug_info("bonjour", "Received incoming connection from %s.\n", address_text);
 	mbba = g_new0(struct _match_buddies_by_address_t, 1);
diff --git a/pidgin/gtk3compat.h b/pidgin/gtk3compat.h
--- a/pidgin/gtk3compat.h
+++ b/pidgin/gtk3compat.h
@@ -32,6 +32,79 @@
  */
 
 #include <gtk/gtk.h>
+#include <math.h>
+
+#if !GTK_CHECK_VERSION(3,4,0)
+
+#define gtk_color_chooser_dialog_new(title, parent) \
+	gtk_color_selection_dialog_new(title)
+#define GTK_COLOR_CHOOSER(widget) (GTK_WIDGET(widget))
+
+static inline void
+gtk_color_chooser_set_use_alpha(GtkWidget *widget, gboolean use_alpha)
+{
+	if (GTK_IS_COLOR_BUTTON(widget)) {
+		gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(widget),
+			use_alpha);
+	}
+}
+
+static inline void
+pidgin_color_chooser_set_rgb(GtkWidget *widget, const GdkColor *color)
+{
+	if (GTK_IS_COLOR_SELECTION_DIALOG(widget)) {
+		GtkWidget *colorsel;
+
+		colorsel = gtk_color_selection_dialog_get_color_selection(
+			GTK_COLOR_SELECTION_DIALOG(widget));
+		gtk_color_selection_set_current_color(
+			GTK_COLOR_SELECTION(colorsel), color);
+	} else
+		gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), color);
+}
+
+static inline void
+pidgin_color_chooser_get_rgb(GtkWidget *widget, GdkColor *color)
+{
+	if (GTK_IS_COLOR_SELECTION_DIALOG(widget)) {
+		GtkWidget *colorsel;
+
+		colorsel = gtk_color_selection_dialog_get_color_selection(
+			GTK_COLOR_SELECTION_DIALOG(widget));
+		gtk_color_selection_get_current_color(
+			GTK_COLOR_SELECTION(colorsel), color);
+	} else
+		gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), color);
+}
+
+#else
+
+static inline void
+pidgin_color_chooser_set_rgb(GtkColorChooser *chooser, const GdkColor *rgb)
+{
+	GdkRGBA rgba;
+
+	rgba.red = rgb->red / 65535.0;
+	rgba.green = rgb->green / 65535.0;
+	rgba.blue = rgb->blue / 65535.0;
+	rgba.alpha = 1.0;
+
+	gtk_color_chooser_set_rgba(chooser, &rgba);
+}
+
+static inline void
+pidgin_color_chooser_get_rgb(GtkColorChooser *chooser, GdkColor *rgb)
+{
+	GdkRGBA rgba;
+
+	gtk_color_chooser_get_rgba(chooser, &rgba);
+	rgb->red = (int)round(rgba.red * 65535.0);
+	rgb->green = (int)round(rgba.green * 65535.0);
+	rgb->blue = (int)round(rgba.blue * 65535.0);
+}
+
+#endif /* 3.4.0 and gtk_color_chooser_ */
+
 
 #if !GTK_CHECK_VERSION(3,2,0)
 
@@ -60,6 +133,29 @@ static inline GtkWidget * gtk_font_choos
 #define GDK_IS_QUARTZ_WINDOW(window) TRUE
 #endif
 
+static inline GdkPixbuf *
+gdk_pixbuf_get_from_surface(cairo_surface_t *surface, gint src_x, gint src_y,
+	gint width, gint height)
+{
+	GdkPixmap *pixmap;
+	GdkPixbuf *pixbuf;
+	cairo_t *cr;
+
+	pixmap = gdk_pixmap_new(NULL, width, height, 24);
+
+	cr = gdk_cairo_create(pixmap);
+	cairo_set_source_surface(cr, surface, -src_x, -src_y);
+	cairo_paint(cr);
+	cairo_destroy(cr);
+
+	pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap,
+		gdk_drawable_get_colormap(pixmap), 0, 0, 0, 0, width, height);
+
+	g_object_unref(pixmap);
+
+	return pixbuf;
+}
+
 static inline GtkWidget *
 gtk_box_new(GtkOrientation orientation, gint spacing)
 {
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -5664,7 +5664,7 @@ setup_common_pane(PidginConversation *gt
 
 	/* Setup the webkit widget */
 	frame = pidgin_create_webview(FALSE, &gtkconv->webview, &webview_sw);
-	gtk_widget_set_size_request(gtkconv->webview, -1, 0);
+	g_object_set(G_OBJECT(gtkconv->webview), "expand", TRUE, NULL);
 
 	load_conv_theme(gtkconv);
 
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -3570,14 +3570,18 @@ pidgin_make_scrollable(GtkWidget *child,
 		if (width != -1 || height != -1)
 			gtk_widget_set_size_request(sw, width, height);
 		if (child) {
+#if GTK_CHECK_VERSION(3,8,0)
+			gtk_container_add(GTK_CONTAINER(sw), child);
+#else
 #if GTK_CHECK_VERSION(3,0,0)
 			if (GTK_IS_SCROLLABLE(child))
 #else
 			if (GTK_WIDGET_GET_CLASS(child)->set_scroll_adjustments_signal)
-#endif
+#endif /* GTK_CHECK_VERSION(3,0,0) */



More information about the Commits mailing list