/pidgin/main: abde619c77bf: Merge heads.

Elliott Sales de Andrade qulogic at pidgin.im
Mon Nov 5 18:16:01 EST 2012


Changeset: abde619c77bf8284c89aab67b3a08400d6e41c6f
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2012-10-07 00:01 -0400
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/abde619c77bf

Description:

Merge heads.

diffstat:

 .hgignore                               |   1 +
 configure.ac                            |  17 +++++++++++
 libpurple/protocols/jabber/namespaces.h |   3 ++
 libpurple/protocols/jabber/presence.c   |  27 +++++++++++++++++-
 libpurple/protocols/jabber/presence.h   |   1 +
 pidgin/Makefile.am                      |   2 +
 pidgin/gtkconv.c                        |  48 +++++++++++++++++++++++++++++++++
 pidgin/gtksmiley.c                      |  34 +++++++++++++++++++++++
 pidgin/gtkwebviewtoolbar.c              |   4 ++-
 9 files changed, 135 insertions(+), 2 deletions(-)

diffs (truncated from 322 to 300 lines):

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -7,6 +7,7 @@ syntax: regexp
 .*/perl/common/[^/]+\.c$
 .*/perl/common/blib.*
 .*/perl/common/pm_to_blib$
+.*/perl/common/MYMETA\.(json|yml)
 .*~$
 .*\.a$
 .*\.bak$
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -816,6 +816,18 @@ AC_SUBST(LIBXML_CFLAGS)
 AC_SUBST(LIBXML_LIBS)
 
 dnl #######################################################################
+dnl # Check for JSON-GLib (required, if compiled with Gadu-Gadu support)
+dnl #######################################################################
+
+PKG_CHECK_MODULES([JSON], [json-glib-1.0], [enable_json="yes"], [enable_json="no"])
+
+dnl #######################################################################
+dnl # Check for libcurl (required)
+dnl #######################################################################
+
+PKG_CHECK_MODULES([LIBCURL], [libcurl])
+
+dnl #######################################################################
 dnl # Check for zlib (required)
 dnl #######################################################################
 
@@ -1381,6 +1393,10 @@ AC_CHECK_FUNC(uname)
 
 AC_ARG_ENABLE(fortify, [AC_HELP_STRING([--disable-fortify], [compile without FORTIFY_SOURCE support])], , enable_fortify=yes)
 
+if test \( "x$static_gg" = "xyes" -o "x$dynamic_gg" = "xyes" \) -a "x$enable_json" != "xyes" ; then
+	AC_MSG_ERROR([json-glib-1.0 not found (required, when compiling with Gadu-Gadu support)])
+fi
+
 DEBUG_CFLAGS="$DEBUG_CFLAGS -DPURPLE_DISABLE_DEPRECATED -DPIDGIN_DISABLE_DEPRECATED -DFINCH_DISABLE_DEPRECATED -DGNT_DISABLE_DEPRECATED"
 if test "x$GCC" = "xyes"; then
 	dnl We enable -Wall later.
@@ -2770,6 +2786,7 @@ echo Use X Session Management...... : $e
 echo Use startup notification...... : $enable_startup_notification
 echo Build with GtkSpell support... : $enable_gtkspell
 echo Build with GCR widgets........ : $enable_gcr
+echo Build with JSON support....... : $enable_json
 echo
 echo Build with plugin support..... : $enable_plugins
 echo Build with Mono support....... : $enable_mono
diff --git a/libpurple/protocols/jabber/namespaces.h b/libpurple/protocols/jabber/namespaces.h
--- a/libpurple/protocols/jabber/namespaces.h
+++ b/libpurple/protocols/jabber/namespaces.h
@@ -109,4 +109,7 @@
 #define NS_GOOGLE_SESSION_PHONE "http://www.google.com/session/phone"
 #define NS_GOOGLE_SESSION_VIDEO "http://www.google.com/session/video"
 
+/* Apple extension(s) */
+#define NS_APPLE_IDLE "http://www.apple.com/xmpp/idle"
+
 #endif /* PURPLE_JABBER_NAMESPACES_H_ */
diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c
--- a/libpurple/protocols/jabber/presence.c
+++ b/libpurple/protocols/jabber/presence.c
@@ -1017,7 +1017,7 @@ void jabber_presence_parse(JabberStream 
 			pih(js, &presence, child);
 	}
 
-	if (presence.delayed && presence.idle) {
+	if (presence.delayed && presence.idle && presence.adjust_idle_for_delay) {
 		/* Delayed and idle, so update idle time */
 		presence.idle = presence.idle + (time(NULL) - presence.sent);
 	}
@@ -1172,11 +1172,33 @@ parse_delay(JabberStream *js, JabberPres
 }
 
 static void
+parse_apple_idle(JabberStream *js, JabberPresence *presence, xmlnode *x)
+{
+	xmlnode *since = xmlnode_get_child(x, "idle-since");
+	if (since) {
+		char *stamp = xmlnode_get_data_unescaped(since);
+		if (stamp) {
+			time_t tstamp = purple_str_to_time(stamp, TRUE, NULL, NULL, NULL);
+			if (tstamp != 0) {
+				presence->idle = time(NULL) - tstamp;
+				presence->adjust_idle_for_delay = FALSE;
+				if(presence->idle < 0) {
+					purple_debug_warning("jabber", "Received bogus idle timestamp %s\n", stamp);
+					presence->idle = 0;
+				}
+			}
+		}
+		g_free(stamp);
+	}
+}
+
+static void
 parse_idle(JabberStream *js, JabberPresence *presence, xmlnode *query)
 {
 	const gchar *seconds = xmlnode_get_attrib(query, "seconds");
 	if (seconds) {
 		presence->idle = atoi(seconds);
+		presence->adjust_idle_for_delay = TRUE;
 		if (presence->idle < 0) {
 			purple_debug_warning("jabber", "Received bogus idle time %s\n", seconds);
 			presence->idle = 0;
@@ -1276,6 +1298,9 @@ void jabber_presence_init(void)
 	jabber_presence_register_handler("x", NS_DELAYED_DELIVERY_LEGACY, parse_delay);
 	jabber_presence_register_handler("x", "http://jabber.org/protocol/muc#user", parse_muc_user);
 	jabber_presence_register_handler("x", "vcard-temp:x:update", parse_vcard_avatar);
+
+	/* Apple idle */
+	jabber_presence_register_handler("x", NS_APPLE_IDLE, parse_apple_idle);
 }
 
 void jabber_presence_uninit(void)
diff --git a/libpurple/protocols/jabber/presence.h b/libpurple/protocols/jabber/presence.h
--- a/libpurple/protocols/jabber/presence.h
+++ b/libpurple/protocols/jabber/presence.h
@@ -71,6 +71,7 @@ struct _JabberPresence {
 	gboolean delayed;
 	time_t sent;
 	int idle;
+	gboolean adjust_idle_for_delay;
 };
 
 typedef void (JabberPresenceHandler)(JabberStream *js, JabberPresence *presence,
diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am
--- a/pidgin/Makefile.am
+++ b/pidgin/Makefile.am
@@ -168,6 +168,7 @@ pidgin_LDADD = \
 	$(LIBXML_LIBS) \
 	$(WEBKIT_LIBS) \
 	$(GTK_LIBS) \
+	$(X11_LIBS) \
 	$(top_builddir)/libpurple/libpurple.la
 
 if USE_INTERNAL_LIBGADU
@@ -188,6 +189,7 @@ AM_CPPFLAGS = \
 	$(GSTREAMER_CFLAGS) \
 	$(DEBUG_CFLAGS) \
 	$(GTK_CFLAGS) \
+	$(X11_CFLAGS) \
 	$(DBUS_CFLAGS) \
 	$(GTKSPELL_CFLAGS) \
 	$(LIBXML_CFLAGS) \
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -8792,6 +8792,7 @@ pidgin_conversations_init(void)
 	default_conv_theme = purple_theme_manager_load_theme(theme_dir, "conversation");
 	g_free(theme_dir);
 
+#if !GTK_CHECK_VERSION(3,0,0)
 	{
 		/* Set default tab colors */
 		GString *str = g_string_new(NULL);
@@ -8827,6 +8828,7 @@ pidgin_conversations_init(void)
 		g_string_free(str, TRUE);
 		gtk_rc_reset_styles(settings);
 	}
+#endif
 }
 
 void
@@ -10187,6 +10189,49 @@ gtkconv_tab_set_tip(GtkWidget *widget, G
 	return FALSE;
 }
 
+#if GTK_CHECK_VERSION(3,0,0)
+static void set_default_tab_colors(GtkWidget *widget)
+{
+    GString *str;
+    GtkCssProvider *provider;
+    GError *error = NULL;
+    int iter;
+
+    struct {
+        const char *labelname;
+        const char *color;
+    } styles[] = {
+        {"tab-label-typing", "#4e9a06"},
+        {"tab-label-typed", "#c4a000"},
+        {"tab-label-attention", "#006aff"},
+        {"tab-label-unreadchat", "#cc0000"},
+        {"tab-label-event", "#888a85"},
+        {NULL, NULL}
+    };
+
+    str = g_string_new(NULL);
+
+    for (iter = 0; styles[iter].labelname; iter++) {
+        g_string_append_printf(str, "#%s {\n"
+                "    color: %s;\n"
+                "}\n",
+                styles[iter].labelname,
+                styles[iter].color);
+    }
+
+    provider = gtk_css_provider_new();
+
+    gtk_css_provider_load_from_data(provider, str->str, str->len, &error);
+
+    gtk_style_context_add_provider(gtk_widget_get_style_context(widget),
+            provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+    if (error)
+        g_error_free(error);
+    g_string_free(str, TRUE);
+}
+#endif
+
 void
 pidgin_conv_window_add_gtkconv(PidginWindow *win, PidginConversation *gtkconv)
 {
@@ -10225,6 +10270,9 @@ pidgin_conv_window_add_gtkconv(PidginWin
 
 	/* Tab label. */
 	gtkconv->tab_label = gtk_label_new(tmp_lab = purple_conversation_get_title(conv));
+#if GTK_CHECK_VERSION(3,0,0)
+    set_default_tab_colors(gtkconv->tab_label);
+#endif
 	gtk_widget_set_name(gtkconv->tab_label, "tab-label");
 
 	gtkconv->menu_tabby = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
diff --git a/pidgin/gtksmiley.c b/pidgin/gtksmiley.c
--- a/pidgin/gtksmiley.c
+++ b/pidgin/gtksmiley.c
@@ -417,21 +417,40 @@ pidgin_smiley_edit(GtkWidget *widget, Pu
 	g_signal_connect(window, "response", G_CALLBACK(do_add_select_cb), s);
 
 	/* The vbox */
+#if GTK_CHECK_VERSION(3,0,0)
+	vbox = gtk_grid_new();
+	gtk_grid_set_row_spacing(GTK_GRID(vbox), PIDGIN_HIG_BORDER);
+#else
 	vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
+#endif
 	gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(window))),
                     vbox);
 	gtk_widget_show(vbox);
 
 	/* The hbox */
+#if GTK_CHECK_VERSION(3,0,0)
+	hbox = gtk_grid_new();
+	gtk_grid_set_column_spacing(GTK_GRID(hbox), PIDGIN_HIG_BORDER);
+	gtk_grid_attach(GTK_GRID(vbox), hbox, 0, 0, 1, 1);
+#else
 	hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
 	gtk_container_add(GTK_CONTAINER(GTK_VBOX(vbox)), hbox);
+#endif
 
 	label = gtk_label_new_with_mnemonic(_("_Image:"));
+#if GTK_CHECK_VERSION(3,0,0)
+	gtk_grid_attach(GTK_GRID(hbox), label, 0, 0, 1, 1);
+#else
 	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+#endif
 	gtk_widget_show(label);
 
 	filech = gtk_button_new();
+#if GTK_CHECK_VERSION(3,0,0)
+	gtk_grid_attach_next_to(GTK_GRID(hbox), filech, NULL, GTK_POS_RIGHT, 1, 1);
+#else
 	gtk_box_pack_end(GTK_BOX(hbox), filech, FALSE, FALSE, 0);
+#endif
 	pidgin_set_accessible_label(filech, label);
 
 	s->smiley_image = gtk_image_new();
@@ -453,12 +472,23 @@ pidgin_smiley_edit(GtkWidget *widget, Pu
 	gtk_widget_show_all(hbox);
 
 	/* info */
+#if GTK_CHECK_VERSION(3,0,0)
+	hbox = gtk_grid_new();
+	gtk_grid_set_column_spacing(GTK_GRID(hbox), PIDGIN_HIG_BORDER);
+
+	gtk_grid_attach_next_to(GTK_GRID(vbox), hbox, NULL, GTK_POS_BOTTOM, 1, 1);
+#else
 	hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
 	gtk_container_add(GTK_CONTAINER(GTK_VBOX(vbox)),hbox);
+#endif
 
 	/* Shortcut text */
 	label = gtk_label_new_with_mnemonic(_("S_hortcut text:"));
+#if GTK_CHECK_VERSION(3,0,0)
+	gtk_grid_attach(GTK_GRID(hbox), label, 0, 0, 1, 1);
+#else
 	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+#endif
 	gtk_widget_show(label);
 
 	s->smile = gtk_entry_new();
@@ -476,7 +506,11 @@ pidgin_smiley_edit(GtkWidget *widget, Pu
 	g_signal_connect(G_OBJECT(s->smile), "insert-text", G_CALLBACK(smiley_name_insert_cb), s);
 	g_signal_connect(G_OBJECT(s->smile), "delete-text", G_CALLBACK(smiley_name_delete_cb), s);
 



More information about the Commits mailing list