/pidgin/main: fce72d79861f: Merge with mainline.

Elliott Sales de Andrade qulogic at pidgin.im
Tue Jul 24 04:03:52 EDT 2012


Changeset: fce72d79861fe0285424b47871f4e4087ab1a7de
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2012-07-23 04:09 -0400
Branch:	 cpw.qulogic.gtk3-required
URL: http://hg.pidgin.im/pidgin/main/rev/fce72d79861f

Description:

Merge with mainline.

diffstat:

 pidgin/gtkblist.c      |   3 +++
 pidgin/gtkblist.h      |   2 +-
 pidgin/gtkdebug.c      |  14 ++++++++++----
 pidgin/gtkdialogs.h    |   3 ---
 pidgin/gtkmenutray.c   |  11 ++---------
 pidgin/gtkwebview.c    |  39 ++++++++++++++++++++++++++++++++-------
 pidgin/gtkwhiteboard.c |  43 +++++++++++++++++++++++--------------------
 pidgin/gtkwhiteboard.h |  21 +++++++++++++--------
 8 files changed, 84 insertions(+), 52 deletions(-)

diffs (truncated from 391 to 300 lines):

diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c
--- a/pidgin/gtkblist.c
+++ b/pidgin/gtkblist.c
@@ -125,6 +125,9 @@
 #define PIDGIN_BUDDY_LIST_GET_PRIVATE(list) \
 	((PidginBuddyListPrivate *)((list)->priv))
 
+#define PIDGIN_WINDOW_ICONIFIED(x) \
+	(gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(x))) & GDK_WINDOW_STATE_ICONIFIED)
+
 static GtkWidget *accountmenu = NULL;
 
 static guint visibility_manager_count = 0;
diff --git a/pidgin/gtkblist.h b/pidgin/gtkblist.h
--- a/pidgin/gtkblist.h
+++ b/pidgin/gtkblist.h
@@ -104,7 +104,7 @@
 	PurpleBlistNode *selected_node;    /**< The currently selected node */
 
 	GtkWidget *scrollbook;          /**< Scrollbook for alerts */
-	GtkWidget *headline;            /**< Hbox for headline notification */
+	GtkWidget *headline;            /**< Widget for headline notifications */
 	GtkWidget *headline_label;      /**< Label for headline notifications */
 	GtkWidget *headline_image;      /**< Image for headline notifications */
 	GCallback headline_callback;    /**< Callback for headline notifications */
diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c
--- a/pidgin/gtkdebug.c
+++ b/pidgin/gtkdebug.c
@@ -74,7 +74,7 @@
 	/* Regex */ \
 	"div.hide{display:none;}" \
 	"span.regex{background-color:#ffafaf;font-weight:bold;}" \
-	"</style></head></html>"
+	"</style></head><body class=l%d></body></html>"
 
 static DebugWindow *debug_win = NULL;
 static guint debug_enabled_timer = 0;
@@ -148,7 +148,13 @@
 static void
 clear_cb(GtkWidget *w, DebugWindow *win)
 {
-	gtk_webview_load_html_string(GTK_WEBVIEW(win->text), EMPTY_HTML);
+	char *tmp;
+	int level;
+
+	level = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel");
+	tmp = g_strdup_printf(EMPTY_HTML, level);
+	gtk_webview_load_html_string(GTK_WEBVIEW(win->text), tmp);
+	g_free(tmp);
 }
 
 static void
@@ -611,7 +617,7 @@
 
 	gtk_widget_show_all(menu);
 
-	gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time());
+	gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
 	return FALSE;
 }
 
@@ -805,7 +811,7 @@
 	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
 	gtk_widget_show(frame);
 
-	gtk_webview_load_html_string(GTK_WEBVIEW(win->text), EMPTY_HTML);
+	clear_cb(NULL, win);
 
 	gtk_widget_show_all(win->window);
 
diff --git a/pidgin/gtkdialogs.h b/pidgin/gtkdialogs.h
--- a/pidgin/gtkdialogs.h
+++ b/pidgin/gtkdialogs.h
@@ -52,9 +52,6 @@
 void pidgin_dialogs_remove_contact(PurpleContact *);
 void pidgin_dialogs_merge_groups(PurpleGroup *, const char *);
 
-/* This macro should probably be moved elsewhere */
-#define PIDGIN_WINDOW_ICONIFIED(x) (gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(x))) & GDK_WINDOW_STATE_ICONIFIED)
-
 G_END_DECLS
 
 #endif /* _PIDGINDIALOGS_H_ */
diff --git a/pidgin/gtkmenutray.c b/pidgin/gtkmenutray.c
--- a/pidgin/gtkmenutray.c
+++ b/pidgin/gtkmenutray.c
@@ -93,6 +93,8 @@
 pidgin_menu_tray_finalize(GObject *obj)
 {
 #if 0
+	PidginMenuTray *tray = PIDGIN_MENU_TRAY(obj);
+
 	/* This _might_ be leaking, but I have a sneaking suspicion that the widget is
 	 * getting destroyed in GtkContainer's finalize function.  But if were are
 	 * leaking here, be sure to figure out why this causes a crash.
@@ -233,11 +235,6 @@
 void
 pidgin_menu_tray_set_tooltip(PidginMenuTray *menu_tray, GtkWidget *widget, const char *tooltip)
 {
-#if !GTK_CHECK_VERSION(2,12,0)
-	if (!menu_tray->tooltips)
-		menu_tray->tooltips = gtk_tooltips_new();
-#endif
-
 	/* Should we check whether widget is a child of menu_tray? */
 
 	/*
@@ -250,10 +247,6 @@
 	if (!gtk_widget_get_has_window(widget))
 		widget = gtk_widget_get_parent(widget);
 
-#if GTK_CHECK_VERSION(2,12,0)
 	gtk_widget_set_tooltip_text(widget, tooltip);
-#else
-	gtk_tooltips_set_tip(menu_tray->tooltips, widget, tooltip, NULL);
-#endif
 }
 
diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c
--- a/pidgin/gtkwebview.c
+++ b/pidgin/gtkwebview.c
@@ -55,7 +55,8 @@
 typedef struct _GtkWebViewPriv {
 	gboolean empty;     /**< whether anything has been appended **/
 
-	/* JS execute queue */
+	/* Processing queues */
+	GQueue *html_queue;
 	GQueue *js_queue;
 	gboolean is_loading;
 
@@ -141,6 +142,29 @@
 	return TRUE; /* there may be more for now */
 }
 
+static gboolean
+process_html_queue(GtkWebView *webview)
+{
+	GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
+	char *html;
+	WebKitDOMDocument *doc;
+	WebKitDOMHTMLElement *body;
+
+	if (priv->is_loading)
+		return FALSE;
+	if (!priv->html_queue || g_queue_is_empty(priv->html_queue))
+		return FALSE;
+
+	html = g_queue_pop_head(priv->html_queue);
+	doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview));
+	body = webkit_dom_document_get_body(doc);
+	webkit_dom_html_element_insert_adjacent_html(body, "beforeend", html, NULL);
+	g_free(html);
+	priv->empty = FALSE;
+
+	return TRUE;
+}
+
 static void
 webview_load_started(WebKitWebView *webview, WebKitWebFrame *frame,
                      gpointer userdata)
@@ -375,6 +399,10 @@
 	GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
 	gpointer temp;
 
+	while ((temp = g_queue_pop_head(priv->html_queue)))
+		g_free(temp);
+	g_queue_free(priv->html_queue);
+
 	while ((temp = g_queue_pop_head(priv->js_queue)))
 		g_free(temp);
 	g_queue_free(priv->js_queue);
@@ -460,6 +488,7 @@
 	GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
 
 	priv->empty = TRUE;
+	priv->html_queue = g_queue_new();
 	priv->js_queue = g_queue_new();
 
 	g_signal_connect(webview, "navigation-policy-decision-requested",
@@ -587,16 +616,12 @@
 gtk_webview_append_html(GtkWebView *webview, const char *html)
 {
 	GtkWebViewPriv *priv;
-	WebKitDOMDocument *doc;
-	WebKitDOMHTMLElement *body;
 
 	g_return_if_fail(webview != NULL);
 
 	priv = GTK_WEBVIEW_GET_PRIVATE(webview);
-	doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview));
-	body = webkit_dom_document_get_body(doc);
-	webkit_dom_html_element_insert_adjacent_html(body, "beforeend", html, NULL);
-	priv->empty = FALSE;
+	g_queue_push_tail(priv->html_queue, g_strdup(html));
+	g_idle_add((GSourceFunc)process_html_queue, webview);
 }
 
 void
diff --git a/pidgin/gtkwhiteboard.c b/pidgin/gtkwhiteboard.c
--- a/pidgin/gtkwhiteboard.c
+++ b/pidgin/gtkwhiteboard.c
@@ -28,6 +28,11 @@
 #include "gtkwhiteboard.h"
 #include "gtkutils.h"
 
+struct _PidginWhiteboardPrivate {
+	GdkPixbuf *pixbuf;
+	cairo_t   *cr;
+};
+
 /******************************************************************************
  * Prototypes
  *****************************************************************************/
@@ -123,6 +128,7 @@
 	GtkWidget *color_button;
 
 	PidginWhiteboard *gtkwb = g_new0(PidginWhiteboard, 1);
+	gtkwb->priv = g_new0(PidginWhiteboardPrivate, 1);
 
 	gtkwb->wb = wb;
 	purple_whiteboard_set_ui_data(wb, gtkwb);
@@ -280,13 +286,11 @@
 	/* TODO Ask if user wants to save picture before the session is closed */
 
 	/* Clear graphical memory */
-	if(gtkwb->pixbuf)
-	{
-		cairo_t *cr = g_object_get_data(G_OBJECT(gtkwb->pixbuf), "cairo-context");
+	if (gtkwb->priv->pixbuf) {
+		cairo_t *cr = gtkwb->priv->cr;
 		if (cr)
 			cairo_destroy(cr);
-		g_object_unref(gtkwb->pixbuf);
-		gtkwb->pixbuf = NULL;
+		g_object_unref(gtkwb->priv->pixbuf);
 	}
 
 	colour_dialog = g_object_get_data(G_OBJECT(gtkwb->window), "colour-dialog");
@@ -300,6 +304,8 @@
 		gtk_widget_destroy(gtkwb->window);
 		gtkwb->window = NULL;
 	}
+
+	g_free(gtkwb->priv);
 	g_free(gtkwb);
 	purple_whiteboard_set_ui_data(wb, NULL);
 }
@@ -356,13 +362,13 @@
 static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data)
 {
 	PidginWhiteboard *gtkwb = (PidginWhiteboard*)data;
-	GdkPixbuf *pixbuf = gtkwb->pixbuf;
+	GdkPixbuf *pixbuf = gtkwb->priv->pixbuf;
 	cairo_t *cr;
 	GdkWindow *window = gtk_widget_get_window(widget);
 	GtkAllocation allocation;
 
 	if (pixbuf) {
-		cr = g_object_get_data(G_OBJECT(pixbuf), "cairo-context");
+		cr = gtkwb->priv->cr;
 		if (cr)
 			cairo_destroy(cr);
 		g_object_unref(pixbuf);
@@ -374,10 +380,10 @@
 	    	                FALSE, gdk_visual_get_depth(GDK_VISUAL(window)),
 	    	                allocation.width, allocation.height);
 
-	gtkwb->pixbuf = pixbuf;
+	gtkwb->priv->pixbuf = pixbuf;
 
 	cr = gdk_cairo_create(gtk_widget_get_window(widget));
-	g_object_set_data(G_OBJECT(pixbuf), "cairo-context", cr);
+	gtkwb->priv->cr = cr;
 	gdk_cairo_set_source_color(cr, &gtk_widget_get_style(widget)->white);
 	cairo_rectangle(cr,
 	                0, 0,
@@ -390,7 +396,7 @@
 static gboolean pidgin_whiteboard_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
 {
 	PidginWhiteboard *gtkwb = (PidginWhiteboard*)(data);
-	GdkPixbuf *pixbuf = gtkwb->pixbuf;
+	GdkPixbuf *pixbuf = gtkwb->priv->pixbuf;
 	cairo_t *cr;
 
 	cr = gdk_cairo_create(gtk_widget_get_window(widget));
@@ -407,7 +413,7 @@
 static gboolean pidgin_whiteboard_brush_down(GtkWidget *widget, GdkEventButton *event, gpointer data)
 {
 	PidginWhiteboard *gtkwb = (PidginWhiteboard*)data;
-	GdkPixbuf *pixbuf = gtkwb->pixbuf;
+	GdkPixbuf *pixbuf = gtkwb->priv->pixbuf;
 
 	PurpleWhiteboard *wb = gtkwb->wb;
 	GList *draw_list = purple_whiteboard_get_draw_list(wb);
@@ -460,7 +466,7 @@
 	GdkModifierType state;
 
 	PidginWhiteboard *gtkwb = (PidginWhiteboard*)data;
-	GdkPixbuf *pixbuf = gtkwb->pixbuf;



More information about the Commits mailing list