# HG changeset patch # User Elliott Sales de Andrade # Date 1325644645 0 # Node ID dc44bb639e8e62b8c24f84412967399d6776204a # Parent 8436fb68930e1f73e73a573a415e9b5668fa8d7c# Parent a677e7b1497f220a103e5ca142005377b4177be5 propagate from branch 'im.pidgin.pidgin' (head 069350831810b6f4bd534a26fed03260a9b4adcd) to branch 'im.pidgin.cpw.qulogic.gtk3' (head cf49f6cfd58e227b28dc1822e5ab543bbabd80b7) diff -r a677e7b1497f -r dc44bb639e8e finch/finch.c --- a/finch/finch.c Thu Dec 29 07:33:57 2011 +0000 +++ b/finch/finch.c Wed Jan 04 02:37:25 2012 +0000 @@ -339,7 +339,17 @@ /* set a user-specified config directory */ if (opt_config_dir_arg != NULL) { - purple_util_set_user_dir(opt_config_dir_arg); + if (g_path_is_absolute(opt_config_dir_arg)) { + purple_util_set_user_dir(opt_config_dir_arg); + } else { + /* Make an absolute (if not canonical) path */ + char *cwd = g_get_current_dir(); + char *path = g_build_path(G_DIR_SEPARATOR_S, cwd, opt_config_dir_arg, NULL); + purple_util_set_user_dir(path); + g_free(path); + g_free(cwd); + } + g_free(opt_config_dir_arg); } diff -r a677e7b1497f -r dc44bb639e8e libpurple/account.h --- a/libpurple/account.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/account.h Wed Jan 04 02:37:25 2012 +0000 @@ -171,9 +171,7 @@ PurpleConnectionErrorInfo *current_error; /**< Errors */ }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Account API */ @@ -1191,8 +1189,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_ACCOUNT_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/accountopt.h --- a/libpurple/accountopt.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/accountopt.h Wed Jan 04 02:37:25 2012 +0000 @@ -37,10 +37,7 @@ /** @copydoc _PurpleAccountUserSplit */ typedef struct _PurpleAccountUserSplit PurpleAccountUserSplit; - -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Account Option API */ @@ -353,8 +350,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_ACCOUNTOPT_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/blist.h --- a/libpurple/blist.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/blist.h Wed Jan 04 02:37:25 2012 +0000 @@ -244,9 +244,7 @@ void (*_purple_reserved1)(void); }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Buddy List API */ @@ -1202,8 +1200,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_BLIST_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/buddyicon.h --- a/libpurple/buddyicon.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/buddyicon.h Wed Jan 04 02:37:25 2012 +0000 @@ -39,10 +39,7 @@ #include "prpl.h" #include "util.h" -#ifdef __cplusplus -extern "C" { -#endif - +G_BEGIN_DECLS /**************************************************************************/ /** @name Buddy Icon API */ @@ -397,8 +394,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_BUDDYICON_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/certificate.h --- a/libpurple/certificate.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/certificate.h Wed Jan 04 02:37:25 2012 +0000 @@ -34,11 +34,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - typedef enum { PURPLE_CERTIFICATE_INVALID = 0, @@ -357,6 +352,8 @@ gpointer cb_data; }; +G_BEGIN_DECLS + /*****************************************************************************/ /** @name Certificate Verification Functions */ /*****************************************************************************/ @@ -833,8 +830,6 @@ */ void purple_certificate_add_ca_search_path(const char *path); -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* _PURPLE_CERTIFICATE_H */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/circbuffer.h --- a/libpurple/circbuffer.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/circbuffer.h Wed Jan 04 02:37:25 2012 +0000 @@ -26,10 +26,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - typedef struct _PurpleCircBuffer { /** A pointer to the starting address of our chunk of memory. */ @@ -55,6 +51,8 @@ } PurpleCircBuffer; +G_BEGIN_DECLS + /** * Creates a new circular buffer. This will not allocate any memory for the * actual buffer until data is appended to it. @@ -111,8 +109,6 @@ */ gboolean purple_circ_buffer_mark_read(PurpleCircBuffer *buf, gsize len); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _CIRCBUFFER_H */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/cmds.h --- a/libpurple/cmds.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/cmds.h Wed Jan 04 02:37:25 2012 +0000 @@ -99,9 +99,7 @@ /*@}*/ -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Commands API */ @@ -240,8 +238,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_CMDS_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/connection.h --- a/libpurple/connection.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/connection.h Wed Jan 04 02:37:25 2012 +0000 @@ -258,9 +258,7 @@ prpl to avoid sending unneeded keepalives */ }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Connection API */ @@ -543,8 +541,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_CONNECTION_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/conversation.h --- a/libpurple/conversation.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/conversation.h Wed Jan 04 02:37:25 2012 +0000 @@ -249,9 +249,7 @@ void (*_purple_reserved4)(void); }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Conversation API */ @@ -1402,8 +1400,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_CONVERSATION_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/core.h --- a/libpurple/core.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/core.h Wed Jan 04 02:37:25 2012 +0000 @@ -76,9 +76,7 @@ void (*_purple_reserved3)(void); } PurpleCoreUiOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Initializes the core of purple. @@ -197,9 +195,7 @@ */ GHashTable* purple_core_get_ui_info(void); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_CORE_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/dbus-bindings.h --- a/libpurple/dbus-bindings.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/dbus-bindings.h Wed Jan 04 02:37:25 2012 +0000 @@ -32,9 +32,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS gint purple_dbus_pointer_to_id(gconstpointer node); gpointer purple_dbus_id_to_pointer(gint id, PurpleDBusType *type); @@ -103,8 +101,6 @@ DBusConnection *purple_dbus_get_connection(void); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif diff -r a677e7b1497f -r dc44bb639e8e libpurple/dbus-useful.h --- a/libpurple/dbus-useful.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/dbus-useful.h Wed Jan 04 02:37:25 2012 +0000 @@ -1,5 +1,7 @@ #include "conversation.h" +G_BEGIN_DECLS + PurpleAccount *purple_accounts_find_ext(const char *name, const char *protocol_id, gboolean (*account_test)(const PurpleAccount *account)); @@ -7,7 +9,5 @@ PurpleAccount *purple_accounts_find_connected(const char *name, const char *protocol); - +G_END_DECLS - - diff -r a677e7b1497f -r dc44bb639e8e libpurple/debug.h --- a/libpurple/debug.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/debug.h Wed Jan 04 02:37:25 2012 +0000 @@ -59,9 +59,7 @@ void (*_purple_reserved4)(void); } PurpleDebugUiOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Debug API */ @@ -228,8 +226,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_DEBUG_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/dnsquery.h --- a/libpurple/dnsquery.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/dnsquery.h Wed Jan 04 02:37:25 2012 +0000 @@ -76,9 +76,7 @@ void (*_purple_reserved4)(void); } PurpleDnsQueryUiOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name DNS query API */ @@ -154,8 +152,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_DNSQUERY_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/dnssrv.h --- a/libpurple/dnssrv.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/dnssrv.h Wed Jan 04 02:37:25 2012 +0000 @@ -24,10 +24,6 @@ #ifndef _PURPLE_DNSSRV_H #define _PURPLE_DNSSRV_H -#ifdef __cplusplus -extern "C" { -#endif - typedef struct _PurpleSrvTxtQueryData PurpleSrvTxtQueryData; typedef struct _PurpleSrvResponse PurpleSrvResponse; typedef struct _PurpleTxtResponse PurpleTxtResponse; @@ -96,6 +92,8 @@ */ typedef void (*PurpleTxtCallback)(GList *responses, gpointer data); +G_BEGIN_DECLS + /** * Queries an SRV record. * @@ -184,9 +182,7 @@ */ int purple_srv_txt_query_get_type(PurpleSrvTxtQueryData *query_data); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_DNSSRV_H */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/eventloop.h --- a/libpurple/eventloop.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/eventloop.h Wed Jan 04 02:37:25 2012 +0000 @@ -28,10 +28,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - /** * An input condition. */ @@ -154,6 +150,8 @@ void (*_purple_reserved4)(void); }; +G_BEGIN_DECLS + /**************************************************************************/ /** @name Event Loop API */ /**************************************************************************/ @@ -266,8 +264,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_EVENTLOOP_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/ft.h --- a/libpurple/ft.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/ft.h Wed Jan 04 02:37:25 2012 +0000 @@ -184,9 +184,7 @@ void *proto_data; /**< prpl-specific data. */ }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name File Transfer API */ @@ -843,9 +841,7 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_FT_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/idle.h --- a/libpurple/idle.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/idle.h Wed Jan 04 02:37:25 2012 +0000 @@ -41,9 +41,7 @@ void (*_purple_reserved4)(void); } PurpleIdleUiOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Idle API */ @@ -97,8 +95,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_IDLE_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/imgstore.h --- a/libpurple/imgstore.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/imgstore.h Wed Jan 04 02:37:25 2012 +0000 @@ -34,9 +34,7 @@ */ typedef struct _PurpleStoredImage PurpleStoredImage; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Add an image to the store. @@ -206,8 +204,6 @@ */ void purple_imgstore_uninit(void); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_IMGSTORE_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/log.h --- a/libpurple/log.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/log.h Wed Jan 04 02:37:25 2012 +0000 @@ -181,9 +181,7 @@ * IMPORTANT: Update that code if you add members here. */ }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /***************************************/ /** @name Log Functions */ @@ -574,8 +572,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_LOG_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/media-gst.h --- a/libpurple/media-gst.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/media-gst.h Wed Jan 04 02:37:25 2012 +0000 @@ -32,8 +32,6 @@ #include -G_BEGIN_DECLS - #define PURPLE_TYPE_MEDIA_ELEMENT_TYPE (purple_media_element_type_get_type()) #define PURPLE_TYPE_MEDIA_ELEMENT_INFO (purple_media_element_info_get_type()) #define PURPLE_MEDIA_ELEMENT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo)) @@ -73,9 +71,7 @@ PURPLE_MEDIA_ELEMENT_SINK = 1 << 10, /** can be set as an active sink */ } PurpleMediaElementType; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Gets the element type's GType. @@ -176,10 +172,6 @@ PurpleMediaElementInfo *info, PurpleMedia *media, const gchar *session_id, const gchar *participant); -#ifdef __cplusplus -} -#endif - G_END_DECLS #endif /* _PURPLE_MEDIA_GST_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/media.h --- a/libpurple/media.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/media.h Wed Jan 04 02:37:25 2012 +0000 @@ -27,15 +27,13 @@ #ifndef _PURPLE_MEDIA_H_ #define _PURPLE_MEDIA_H_ +#include +#include + #include "media/candidate.h" #include "media/codec.h" #include "media/enum-types.h" -#include -#include - -G_BEGIN_DECLS - #define PURPLE_TYPE_MEDIA (purple_media_get_type()) #define PURPLE_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA, PurpleMedia)) #define PURPLE_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA, PurpleMediaClass)) @@ -49,9 +47,7 @@ #include "signals.h" #include "util.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Gets the media class's GType @@ -379,10 +375,6 @@ */ void purple_media_remove_output_windows(PurpleMedia *media); -#ifdef __cplusplus -} -#endif - G_END_DECLS #endif /* _PURPLE_MEDIA_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/mediamanager.h --- a/libpurple/mediamanager.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/mediamanager.h Wed Jan 04 02:37:25 2012 +0000 @@ -38,8 +38,6 @@ #include "account.h" #include "media.h" -G_BEGIN_DECLS - #define PURPLE_TYPE_MEDIA_MANAGER (purple_media_manager_get_type()) #define PURPLE_MEDIA_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManager)) #define PURPLE_MEDIA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerClass)) @@ -47,9 +45,7 @@ #define PURPLE_IS_MEDIA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_MANAGER)) #define PURPLE_MEDIA_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerClass)) -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Media Manager API */ @@ -209,10 +205,6 @@ /*}@*/ -#ifdef __cplusplus -} -#endif - G_END_DECLS #endif /* _PURPLE_MEDIA_MANAGER_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/mime.h --- a/libpurple/mime.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/mime.h Wed Jan 04 02:37:25 2012 +0000 @@ -26,10 +26,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - /** * @file mime.h * @ingroup core @@ -48,6 +44,8 @@ */ typedef struct _PurpleMimePart PurpleMimePart; +G_BEGIN_DECLS + /** * Allocate an empty MIME document. */ @@ -211,8 +209,6 @@ void purple_mime_part_set_data(PurpleMimePart *part, const char *data); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif diff -r a677e7b1497f -r dc44bb639e8e libpurple/nat-pmp.h --- a/libpurple/nat-pmp.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/nat-pmp.h Wed Jan 04 02:37:25 2012 +0000 @@ -41,6 +41,8 @@ PURPLE_PMP_TYPE_TCP } PurplePmpType; +G_BEGIN_DECLS + /** * Initialize nat-pmp */ @@ -54,24 +56,28 @@ /** * Remove the NAT-PMP mapping for a specified type on a specified port * - * @param type The PurplePmpType + * @param type The PurplePmpType * @param privateport The private port on which we are listening locally - * @param publicport The public port on which we are expecting a response - * @param lifetime The lifetime of the mapping. It is recommended that this be PURPLE_PMP_LIFETIME. + * @param publicport The public port on which we are expecting a response + * @param lifetime The lifetime of the mapping. It is recommended that this + * be PURPLE_PMP_LIFETIME. * - * @returns TRUE if succesful; FALSE if unsuccessful + * @returns TRUE if successful; FALSE if unsuccessful */ -gboolean purple_pmp_create_map(PurplePmpType type, unsigned short privateport, unsigned short publicport, int lifetime); +gboolean purple_pmp_create_map(PurplePmpType type, unsigned short privateport, + unsigned short publicport, int lifetime); /** * Remove the NAT-PMP mapping for a specified type on a specified port * - * @param type The PurplePmpType + * @param type The PurplePmpType * @param privateport The private port on which the mapping was previously made * - * @returns TRUE if succesful; FALSE if unsuccessful + * @returns TRUE if successful; FALSE if unsuccessful */ gboolean purple_pmp_destroy_map(PurplePmpType type, unsigned short privateport); +G_END_DECLS + #endif diff -r a677e7b1497f -r dc44bb639e8e libpurple/network.h --- a/libpurple/network.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/network.h Wed Jan 04 02:37:25 2012 +0000 @@ -26,9 +26,9 @@ #ifndef _PURPLE_NETWORK_H_ #define _PURPLE_NETWORK_H_ -#ifdef __cplusplus -extern "C" { -#endif +#include + +G_BEGIN_DECLS /**************************************************************************/ /** @name Network API */ @@ -316,8 +316,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_NETWORK_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/notify.h --- a/libpurple/notify.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/notify.h Wed Jan 04 02:37:25 2012 +0000 @@ -175,9 +175,7 @@ } PurpleNotifyUiOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ @@ -734,8 +732,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_NOTIFY_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/ntlm.h --- a/libpurple/ntlm.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/ntlm.h Wed Jan 04 02:37:25 2012 +0000 @@ -27,9 +27,7 @@ #ifndef _PURPLE_NTLM_H #define _PURPLE_NTLM_H -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Generates the base64 encoded type 1 message needed for NTLM authentication @@ -66,8 +64,6 @@ */ gchar *purple_ntlm_gen_type3(const gchar *username, const gchar *passw, const gchar *hostname, const gchar *domain, const guint8 *nonce, guint32 *flags); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_NTLM_H */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/plugin.h --- a/libpurple/plugin.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/plugin.h Wed Jan 04 02:37:25 2012 +0000 @@ -239,9 +239,7 @@ #endif -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Plugin API */ @@ -663,8 +661,6 @@ */ void purple_plugin_action_free(PurplePluginAction *action); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_PLUGIN_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/pluginpref.h --- a/libpurple/pluginpref.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/pluginpref.h Wed Jan 04 02:37:25 2012 +0000 @@ -50,9 +50,7 @@ #include #include "prefs.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Plugin Preference API */ @@ -262,8 +260,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_PLUGINPREF_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/pounce.h --- a/libpurple/pounce.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/pounce.h Wed Jan 04 02:37:25 2012 +0000 @@ -59,9 +59,7 @@ /** A pounce callback. */ typedef void (*PurplePounceCb)(PurplePounce *, PurplePounceEvent, void *); -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Buddy Pounce API */ @@ -354,8 +352,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_POUNCE_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/prefs.h --- a/libpurple/prefs.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/prefs.h Wed Jan 04 02:37:25 2012 +0000 @@ -62,9 +62,7 @@ typedef void (*PurplePrefCallback) (const char *name, PurplePrefType type, gconstpointer val, gpointer data); -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Prefs API @@ -362,8 +360,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_PREFS_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/privacy.h --- a/libpurple/privacy.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/privacy.h Wed Jan 04 02:37:25 2012 +0000 @@ -40,10 +40,6 @@ #include "account.h" -#ifdef __cplusplus -extern "C" { -#endif - /** * Privacy core/UI operations. */ @@ -60,6 +56,8 @@ void (*_purple_reserved4)(void); } PurplePrivacyUiOps; +G_BEGIN_DECLS + /** * Adds a user to the account's permit list. * @@ -187,8 +185,6 @@ */ void purple_privacy_init(void); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_PRIVACY_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/protocols/jabber/auth_cyrus.c --- a/libpurple/protocols/jabber/auth_cyrus.c Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/protocols/jabber/auth_cyrus.c Wed Jan 04 02:37:25 2012 +0000 @@ -167,7 +167,6 @@ auth_no_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields) { PurpleAccount *account; - JabberStream *js; /* The password prompt dialog doesn't get disposed if the account disconnects */ if (!PURPLE_CONNECTION_IS_VALID(gc)) @@ -361,30 +360,30 @@ id = 0; js->sasl_cb[id].id = SASL_CB_GETREALM; - js->sasl_cb[id].proc = jabber_sasl_cb_realm; + js->sasl_cb[id].proc = (void *)jabber_sasl_cb_realm; js->sasl_cb[id].context = (void *)js; id++; js->sasl_cb[id].id = SASL_CB_AUTHNAME; - js->sasl_cb[id].proc = jabber_sasl_cb_simple; + js->sasl_cb[id].proc = (void *)jabber_sasl_cb_simple; js->sasl_cb[id].context = (void *)js; id++; js->sasl_cb[id].id = SASL_CB_USER; - js->sasl_cb[id].proc = jabber_sasl_cb_simple; + js->sasl_cb[id].proc = (void *)jabber_sasl_cb_simple; js->sasl_cb[id].context = (void *)js; id++; account = purple_connection_get_account(js->gc); if (purple_account_get_password(account) != NULL ) { js->sasl_cb[id].id = SASL_CB_PASS; - js->sasl_cb[id].proc = jabber_sasl_cb_secret; + js->sasl_cb[id].proc = (void *)jabber_sasl_cb_secret; js->sasl_cb[id].context = (void *)js; id++; } js->sasl_cb[id].id = SASL_CB_LOG; - js->sasl_cb[id].proc = jabber_sasl_cb_log; + js->sasl_cb[id].proc = (void *)jabber_sasl_cb_log; js->sasl_cb[id].context = (void*)js; id++; diff -r a677e7b1497f -r dc44bb639e8e libpurple/proxy.h --- a/libpurple/proxy.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/proxy.h Wed Jan 04 02:37:25 2012 +0000 @@ -56,9 +56,7 @@ #include "account.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Proxy structure API */ @@ -326,8 +324,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_PROXY_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/prpl.h --- a/libpurple/prpl.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/prpl.h Wed Jan 04 02:37:25 2012 +0000 @@ -621,9 +621,7 @@ #define PURPLE_PLUGIN_PROTOCOL_INFO(plugin) \ ((PurplePluginProtocolInfo *)(plugin)->info->extra_info) -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Attention Type API */ @@ -951,8 +949,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PRPL_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/request.h --- a/libpurple/request.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/request.h Wed Jan 04 02:37:25 2012 +0000 @@ -158,9 +158,7 @@ typedef void (*PurpleRequestFieldsCb)(void *, PurpleRequestFields *fields); typedef void (*PurpleRequestFileCb)(void *, const char *filename); -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Field List API */ @@ -1527,8 +1525,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_REQUEST_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/roomlist.h --- a/libpurple/roomlist.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/roomlist.h Wed Jan 04 02:37:25 2012 +0000 @@ -81,9 +81,7 @@ }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Room List API */ @@ -412,8 +410,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_ROOMLIST_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/savedstatuses.h --- a/libpurple/savedstatuses.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/savedstatuses.h Wed Jan 04 02:37:25 2012 +0000 @@ -60,9 +60,7 @@ #include "status.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Saved status subsystem */ @@ -418,8 +416,7 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_SAVEDSTATUSES_H_ */ + diff -r a677e7b1497f -r dc44bb639e8e libpurple/server.h --- a/libpurple/server.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/server.h Wed Jan 04 02:37:25 2012 +0000 @@ -30,9 +30,7 @@ #include "conversation.h" #include "prpl.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Send a typing message to a given user over a given connection. @@ -185,8 +183,7 @@ PurpleMessageFlags flags, const char *message, time_t mtime); void serv_send_file(PurpleConnection *gc, const char *who, const char *file); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_SERVER_H_ */ + diff -r a677e7b1497f -r dc44bb639e8e libpurple/signals.h --- a/libpurple/signals.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/signals.h Wed Jan 04 02:37:25 2012 +0000 @@ -35,9 +35,7 @@ typedef void (*PurpleSignalMarshalFunc)(PurpleCallback cb, va_list args, void *data, void **return_val); -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Signal API */ @@ -373,8 +371,7 @@ PurpleCallback cb, va_list args, void *data, void **return_val); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_SIGNALS_H_ */ + diff -r a677e7b1497f -r dc44bb639e8e libpurple/smiley.h --- a/libpurple/smiley.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/smiley.h Wed Jan 04 02:37:25 2012 +0000 @@ -50,9 +50,7 @@ #define PURPLE_IS_SMILEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_TYPE_SMILEY)) #define PURPLE_SMILEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_TYPE_SMILEY, PurpleSmileyClass)) -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Custom Smiley API */ @@ -253,9 +251,7 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_SMILEY_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/sound.h --- a/libpurple/sound.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/sound.h Wed Jan 04 02:37:25 2012 +0000 @@ -72,9 +72,7 @@ void (*_purple_reserved4)(void); } PurpleSoundUiOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Sound API */ @@ -136,8 +134,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_SOUND_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/sslconn.h --- a/libpurple/sslconn.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/sslconn.h Wed Jan 04 02:37:25 2012 +0000 @@ -140,9 +140,7 @@ void (*_purple_reserved4)(void); } PurpleSslOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name SSL API */ @@ -311,8 +309,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_SSLCONN_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/status.h --- a/libpurple/status.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/status.h Wed Jan 04 02:37:25 2012 +0000 @@ -148,9 +148,7 @@ #define PURPLE_MOOD_NAME "mood" #define PURPLE_MOOD_COMMENT "moodtext" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name PurpleStatusPrimitive API */ @@ -945,8 +943,7 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_STATUS_H_ */ + diff -r a677e7b1497f -r dc44bb639e8e libpurple/stringref.h --- a/libpurple/stringref.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/stringref.h Wed Jan 04 02:37:25 2012 +0000 @@ -29,11 +29,9 @@ #ifndef _PURPLE_STRINGREF_H_ #define _PURPLE_STRINGREF_H_ -#ifdef __cplusplus -extern "C" { -#endif +typedef struct _PurpleStringref PurpleStringref; -typedef struct _PurpleStringref PurpleStringref; +G_BEGIN_DECLS /** * Creates an immutable reference-counted string object. The newly @@ -131,8 +129,6 @@ */ size_t purple_stringref_len(const PurpleStringref *stringref); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_STRINGREF_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/stun.h --- a/libpurple/stun.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/stun.h Wed Jan 04 02:37:25 2012 +0000 @@ -26,10 +26,6 @@ #ifndef _PURPLE_STUN_H_ #define _PURPLE_STUN_H_ -#ifdef __cplusplus -extern "C" { -#endif - /**************************************************************************/ /** @name STUN API */ /**************************************************************************/ @@ -63,6 +59,8 @@ typedef void (*StunCallback) (PurpleStunNatDiscovery *); +G_BEGIN_DECLS + /** * Starts a NAT discovery. It returns a PurpleStunNatDiscovery if the discovery * is already done. Otherwise the callback is called when the discovery is over @@ -81,8 +79,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_STUN_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/upnp.h --- a/libpurple/upnp.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/upnp.h Wed Jan 04 02:37:25 2012 +0000 @@ -29,9 +29,7 @@ typedef struct _UPnPMappingAddRemove UPnPMappingAddRemove; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name UPnP API */ @@ -125,8 +123,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_UPNP_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/util.h --- a/libpurple/util.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/util.h Wed Jan 04 02:37:25 2012 +0000 @@ -58,10 +58,6 @@ #include "notify.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef char *(*PurpleInfoFieldFormatCallback)(const char *field, size_t len); struct _PurpleKeyValuePair @@ -71,6 +67,8 @@ }; +G_BEGIN_DECLS + /** * Creates a new PurpleMenuAction. * @@ -1459,8 +1457,6 @@ */ gchar *purple_uuid_random(void); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_UTIL_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/value.h --- a/libpurple/value.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/value.h Wed Jan 04 02:37:25 2012 +0000 @@ -88,9 +88,7 @@ */ typedef struct _PurpleValue PurpleValue; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Creates a new PurpleValue. @@ -464,8 +462,6 @@ */ void *purple_value_get_boxed(const PurpleValue *value); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_VALUE_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/whiteboard.h --- a/libpurple/whiteboard.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/whiteboard.h Wed Jan 04 02:37:25 2012 +0000 @@ -79,9 +79,7 @@ void (*_purple_reserved4)(void); }; -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +G_BEGIN_DECLS /******************************************************************************/ /** @name PurpleWhiteboard API */ @@ -330,8 +328,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* _PURPLE_WHITEBOARD_H_ */ diff -r a677e7b1497f -r dc44bb639e8e libpurple/xmlnode.h --- a/libpurple/xmlnode.h Thu Dec 29 07:33:57 2011 +0000 +++ b/libpurple/xmlnode.h Wed Jan 04 02:37:25 2012 +0000 @@ -28,10 +28,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - /** * The valid types for an xmlnode */ @@ -61,6 +57,8 @@ GHashTable *namespace_map; /**< The namespace map. */ }; +G_BEGIN_DECLS + /** * Creates a new xmlnode. * @@ -360,9 +358,7 @@ xmlnode *xmlnode_from_file(const char *dir, const char *filename, const char *description, const char *process); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_XMLNODE_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkaccount.h --- a/pidgin/gtkaccount.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkaccount.h Wed Jan 04 02:37:25 2012 +0000 @@ -37,6 +37,8 @@ } PidginAccountDialogType; +G_BEGIN_DECLS + /** * Shows the accounts window. */ @@ -80,4 +82,6 @@ */ void pidgin_account_uninit(void); +G_END_DECLS + #endif /* _PIDGINACCOUNT_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkblist-theme.h --- a/pidgin/gtkblist-theme.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkblist-theme.h Wed Jan 04 02:37:25 2012 +0000 @@ -79,6 +79,8 @@ } PidginBlistLayout; +G_BEGIN_DECLS + /**************************************************************************/ /** @name PidginThemeFont API */ /**************************************************************************/ @@ -146,7 +148,6 @@ /**************************************************************************/ /** @name Purple Buddy List Theme API */ /**************************************************************************/ -G_BEGIN_DECLS /** * GObject foo. @@ -182,7 +183,7 @@ * * @returns The buddy list layout. */ - PidginBlistLayout *pidgin_blist_theme_get_layout(PidginBlistTheme *theme); +PidginBlistLayout *pidgin_blist_theme_get_layout(PidginBlistTheme *theme); /** * Returns the background color to be used with expanded groups. @@ -191,7 +192,7 @@ * * @returns A gdk color. */ - GdkColor *pidgin_blist_theme_get_expanded_background_color(PidginBlistTheme *theme); +GdkColor *pidgin_blist_theme_get_expanded_background_color(PidginBlistTheme *theme); /** * Returns the text font and color to be used with expanded groups. @@ -200,7 +201,7 @@ * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme); /** * Returns the background color to be used with collapsed groups. @@ -209,7 +210,7 @@ * * @returns A gdk color. */ - GdkColor *pidgin_blist_theme_get_collapsed_background_color(PidginBlistTheme *theme); +GdkColor *pidgin_blist_theme_get_collapsed_background_color(PidginBlistTheme *theme); /** * Returns the text font and color to be used with collapsed groups. @@ -218,7 +219,7 @@ * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme); /** * Returns the colors to be used for contacts and chats. @@ -227,7 +228,7 @@ * * @returns A gdkcolor for contacts and chats. */ - GdkColor *pidgin_blist_theme_get_contact_color(PidginBlistTheme *theme); +GdkColor *pidgin_blist_theme_get_contact_color(PidginBlistTheme *theme); /** * Returns the text font and color to be used for expanded contacts. @@ -236,7 +237,7 @@ * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_contact_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_contact_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for online buddies. @@ -245,7 +246,7 @@ * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for away and idle buddies. @@ -254,7 +255,7 @@ * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for offline buddies. @@ -263,7 +264,7 @@ * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for idle buddies. @@ -272,7 +273,7 @@ * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_idle_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_idle_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for buddies with unread messages. @@ -281,7 +282,7 @@ * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for chats with unread messages @@ -291,7 +292,7 @@ * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_unread_message_nick_said_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_unread_message_nick_said_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for a buddy's status message. @@ -300,7 +301,7 @@ * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme); /* Set Methods */ @@ -434,4 +435,5 @@ void pidgin_blist_theme_set_status_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair); G_END_DECLS + #endif /* PIDGIN_BLIST_THEME_H */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkblist.h --- a/pidgin/gtkblist.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkblist.h Wed Jan 04 02:37:25 2012 +0000 @@ -127,6 +127,8 @@ #define PIDGIN_IS_PIDGIN_BLIST(list) \ (purple_blist_get_ui_ops() == pidgin_blist_get_ui_ops()) +G_BEGIN_DECLS + /************************************************************************** * @name GTK+ Buddy List API **************************************************************************/ @@ -397,5 +399,6 @@ */ void pidgin_blist_tooltip_destroy(void); +G_END_DECLS #endif /* _PIDGINBLIST_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkcellrendererexpander.h --- a/pidgin/gtkcellrendererexpander.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkcellrendererexpander.h Wed Jan 04 02:37:25 2012 +0000 @@ -23,11 +23,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - #define PIDGIN_TYPE_GTK_CELL_RENDERER_EXPANDER (pidgin_cell_renderer_expander_get_type()) #define PIDGIN_CELL_RENDERER_EXPANDER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PIDGIN_TYPE_GTK_CELL_RENDERER_EXPANDER, PidginCellRendererExpander)) #define PIDGIN_CELL_RENDERER_EXPANDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_TYPE_GTK_CELL_RENDERER_EXPANDER, PidginCellRendererExpanderClass)) @@ -48,12 +43,11 @@ GtkCellRendererClass parent_class; }; +G_BEGIN_DECLS + GType pidgin_cell_renderer_expander_get_type (void); GtkCellRenderer *pidgin_cell_renderer_expander_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* _PIDGINCELLRENDEREREXPANDER_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkcertmgr.h --- a/pidgin/gtkcertmgr.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkcertmgr.h Wed Jan 04 02:37:25 2012 +0000 @@ -43,6 +43,8 @@ gchar *label; }; +G_BEGIN_DECLS + /**************************************************************************/ /** @name Certificate Manager API */ /**************************************************************************/ @@ -59,4 +61,6 @@ /*@}*/ +G_END_DECLS + #endif /* _PIDGINCERTMGR_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkconn.h --- a/pidgin/gtkconn.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkconn.h Wed Jan 04 02:37:25 2012 +0000 @@ -25,6 +25,8 @@ #ifndef _PIDGINCONN_H_ #define _PIDGINCONN_H_ +G_BEGIN_DECLS + /**************************************************************************/ /** @name GTK+ Connection API */ /**************************************************************************/ @@ -56,4 +58,6 @@ */ void pidgin_connection_uninit(void); +G_END_DECLS + #endif /* _PIDGINCONN_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkconv-theme.c --- a/pidgin/gtkconv-theme.c Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkconv-theme.c Wed Jan 04 02:37:25 2012 +0000 @@ -28,6 +28,7 @@ #include "xmlnode.h" #include "pidgin.h" +#include "internal.h" #include "gtkconv.h" #include "gtkwebview.h" diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkconv.c --- a/pidgin/gtkconv.c Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkconv.c Wed Jan 04 02:37:25 2012 +0000 @@ -196,6 +196,7 @@ static void generate_send_to_items(PidginWindow *win); /* Prototypes. <-- because Paco-Paco hates this comment. */ +static void load_conv_theme(PidginConversation *gtkconv); static gboolean infopane_entry_activate(PidginConversation *gtkconv); static void got_typing_keypress(PidginConversation *gtkconv, gboolean first); static void gray_stuff_out(PidginConversation *gtkconv); @@ -448,12 +449,12 @@ static void clear_conversation_scrollback_cb(PurpleConversation *conv, void *data) { - PidginConversation *gtkconv = NULL; - - gtkconv = PIDGIN_CONVERSATION(conv); - - if (PIDGIN_CONVERSATION(conv)) - webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(gtkconv->webview), "", ""); + PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); + + if (PIDGIN_CONVERSATION(conv)) { + load_conv_theme(gtkconv); + gtkconv->last_flags = 0; + } } static PurpleCmdRet @@ -2195,19 +2196,13 @@ case GDK_Page_Up: case GDK_KP_Page_Up: -/* TODO WEBKIT: Write this. */ -#if 0 - gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); -#endif /* if 0 */ + gtk_webview_page_up(GTK_WEBVIEW(gtkconv->webview)); return TRUE; break; case GDK_Page_Down: case GDK_KP_Page_Down: -/* TODO WEBKIT: Write this. */ -#if 0 - gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); -#endif /* if 0 */ + gtk_webview_page_down(GTK_WEBVIEW(gtkconv->webview)); return TRUE; break; @@ -5086,6 +5081,8 @@ GString *str; const char *cur = text; const char *prev = cur; + time_t mtime; + struct tm *tm = NULL; if (text == NULL || *text == '\0') return NULL; @@ -5122,6 +5119,7 @@ } else if (g_str_has_prefix(cur, "%timeOpened")) { const char *tmp = cur + strlen("%timeOpened"); char *format = NULL; + if (*tmp == '{') { const char *end; tmp++; @@ -5131,11 +5129,22 @@ format = g_strndup(tmp, end - tmp); fin = end + 1; } - replace = purple_utf8_strftime(format ? format : "%X", NULL); + + if (!tm) { + mtime = time(NULL); + tm = localtime(&mtime); + } + + replace = purple_utf8_strftime(format ? format : "%X", tm); g_free(format); } else if (g_str_has_prefix(cur, "%dateOpened%")) { - replace = purple_date_format_short(NULL); + if (!tm) { + mtime = time(NULL); + tm = localtime(&mtime); + } + + replace = purple_date_format_short(tm); } else { cur++; @@ -5237,15 +5246,52 @@ conv_variant_changed_cb(GObject *gobject, GParamSpec *pspec, gpointer user_data) { PidginConversation *gtkconv = user_data; - const char *path; - char *js; + char *path, *js; path = pidgin_conversation_theme_get_css_path(PIDGIN_CONV_THEME(gobject)); js = g_strdup_printf("setStylesheet(\"mainStyle\", \"file://%s\");", path); + g_free(path); gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), js); g_free(js); } +static void +load_conv_theme(PidginConversation *gtkconv) +{ + char *header, *footer; + char *template; + char *basedir, *baseuri; + + header = replace_header_tokens(gtkconv->active_conv, + pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER)); + footer = replace_header_tokens(gtkconv->active_conv, + pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER)); + template = replace_template_tokens(gtkconv->theme, header, footer); + g_free(header); + g_free(footer); + + if (template == NULL) + return; + + set_theme_webkit_settings(WEBKIT_WEB_VIEW(gtkconv->webview), gtkconv->theme); + + basedir = pidgin_conversation_theme_get_template_path(gtkconv->theme); + baseuri = g_strdup_printf("file://%s", basedir); + webkit_web_view_load_string(WEBKIT_WEB_VIEW(gtkconv->webview), template, + "text/html", "UTF-8", baseuri); + + if (purple_conversation_get_type(gtkconv->active_conv) == PURPLE_CONV_TYPE_CHAT) + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), + "document.getElementById('Chat').className = 'groupchat'"); + + g_signal_connect(G_OBJECT(gtkconv->theme), "notify::variant", + G_CALLBACK(conv_variant_changed_cb), gtkconv); + + g_free(basedir); + g_free(baseuri); + g_free(template); +} + static GtkWidget * setup_common_pane(PidginConversation *gtkconv) { @@ -5256,8 +5302,6 @@ PurpleBuddy *buddy; gboolean chat = (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT); int buddyicon_size = 0; - char *header, *footer; - char *template; /* Setup the top part of the pane */ vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); @@ -5351,36 +5395,7 @@ frame = pidgin_create_webview(FALSE, >kconv->webview, NULL, &webview_sw); gtk_widget_set_size_request(gtkconv->webview, -1, 0); - header = replace_header_tokens(conv, - pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER)); - footer = replace_header_tokens(conv, - pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER)); - template = replace_template_tokens(gtkconv->theme, header, footer); - g_free(header); - g_free(footer); - - if (template != NULL) { - char *basedir; - char *baseuri; - - purple_debug_info("webkit", "template: %s\n", template); - - set_theme_webkit_settings(WEBKIT_WEB_VIEW(gtkconv->webview), gtkconv->theme); - - basedir = pidgin_conversation_theme_get_template_path(gtkconv->theme); - baseuri = g_strdup_printf("file://%s", basedir); - webkit_web_view_load_string(WEBKIT_WEB_VIEW(gtkconv->webview), template, "text/html", "UTF-8", baseuri); - - if (chat) - gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), "document.getElementById('Chat').className = 'groupchat'"); - - g_signal_connect(G_OBJECT(gtkconv->theme), "notify::variant", - G_CALLBACK(conv_variant_changed_cb), gtkconv); - - g_free(basedir); - g_free(baseuri); - g_free(template); - } + load_conv_theme(gtkconv); if (chat) { GtkWidget *hpaned; @@ -6142,14 +6157,16 @@ GString *str; const char *cur = text; const char *prev = cur; - - if (text == NULL) - return g_strdup(""); + struct tm *tm = NULL; + + if (text == NULL || *text == '\0') + return NULL; str = g_string_new(NULL); while ((cur = strchr(cur, '%'))) { const char *replace = NULL; const char *fin = NULL; + gpointer freeval = NULL; if (g_str_has_prefix(cur, "%message%")) { replace = message; @@ -6161,6 +6178,7 @@ } else if (g_str_has_prefix(cur, "%time")) { const char *tmp = cur + strlen("%time"); char *format = NULL; + if (*tmp == '{') { char *end; tmp++; @@ -6170,11 +6188,18 @@ format = g_strndup(tmp, end - tmp); fin = end + 1; } - replace = purple_utf8_strftime(format ? format : "%X", NULL); + + if (!tm) + tm = localtime(&mtime); + + replace = purple_utf8_strftime(format ? format : "%X", tm); g_free(format); } else if (g_str_has_prefix(cur, "%shortTime%")) { - replace = purple_utf8_strftime("%H:%M", NULL); + if (!tm) + tm = localtime(&mtime); + + replace = purple_utf8_strftime("%H:%M", tm); } else if (g_str_has_prefix(cur, "%userIconPath%")) { if (flags & PURPLE_MESSAGE_SEND) { @@ -6185,14 +6210,14 @@ replace = purple_imgstore_get_filename(img); } if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { - replace = g_build_filename("Outgoing", "buddy_icon.png", NULL); + replace = freeval = g_build_filename("Outgoing", "buddy_icon.png", NULL); } } else if (flags & PURPLE_MESSAGE_RECV) { PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); if (icon) replace = purple_buddy_icon_get_full_path(icon); if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { - replace = g_build_filename("Incoming", "buddy_icon.png", NULL); + replace = freeval = g_build_filename("Incoming", "buddy_icon.png", NULL); } } @@ -6217,6 +6242,8 @@ g_string_append_len(str, prev, cur - prev); if (replace) g_string_append(str, replace); + g_free(freeval); + replace = freeval = NULL; /* And update the pointers */ if (fin) { @@ -6324,23 +6351,40 @@ old_flags = gtkconv->last_flags; if ((flags & PURPLE_MESSAGE_SEND) && (old_flags & PURPLE_MESSAGE_SEND)) { - message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT); + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, + PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT); func = "appendNextMessage"; + } else if (flags & PURPLE_MESSAGE_SEND) { - message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT); + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, + PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT); + } else if ((flags & PURPLE_MESSAGE_RECV) && (old_flags & PURPLE_MESSAGE_RECV)) { - message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT); - func = "appendNextMessage"; + GList *history = purple_conversation_get_message_history(conv); + PurpleConvMessage *last_msg = (PurpleConvMessage *)history->data; + + /* If the senders are the same, use appendNextMessage */ + if (purple_strequal(purple_conversation_message_get_sender(last_msg), name)) { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, + PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT); + func = "appendNextMessage"; + } else { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, + PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT); + } } else if (flags & PURPLE_MESSAGE_RECV) { - message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT); + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, + PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT); + } else { - message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS); + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, + PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS); } gtkconv->last_flags = flags; smileyed = smiley_parse_markup(message, purple_account_get_protocol_id(account)); msg = replace_message_tokens(message_html, conv, name, alias, smileyed, flags, mtime); - escape = gtk_webview_quote_js_string(msg); + escape = gtk_webview_quote_js_string(msg ? msg : ""); script = g_strdup_printf("%s(%s)", func, escape); purple_debug_info("webkit", "JS: %s\n", script); diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkconv.h --- a/pidgin/gtkconv.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkconv.h Wed Jan 04 02:37:25 2012 +0000 @@ -157,6 +157,8 @@ /*@}*/ +G_BEGIN_DECLS + /************************************************************************** * @name GTK+ Conversation API **************************************************************************/ @@ -269,4 +271,6 @@ /*@}*/ +G_END_DECLS + #endif /* _PIDGIN_CONVERSATION_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkconvwin.h --- a/pidgin/gtkconvwin.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkconvwin.h Wed Jan 04 02:37:25 2012 +0000 @@ -107,6 +107,8 @@ /*@}*/ +G_BEGIN_DECLS + /************************************************************************** * @name GTK+ Conversation Window API **************************************************************************/ @@ -153,4 +155,6 @@ /*@}*/ +G_END_DECLS + #endif /* _PIDGIN_CONVERSATION_WINDOW_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkdebug.h --- a/pidgin/gtkdebug.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkdebug.h Wed Jan 04 02:37:25 2012 +0000 @@ -28,6 +28,8 @@ #include "debug.h" +G_BEGIN_DECLS + /** * Initializes the GTK+ debug system. */ @@ -62,4 +64,6 @@ */ PurpleDebugUiOps *pidgin_debug_get_ui_ops(void); +G_END_DECLS + #endif /* _PIDGINDEBUG_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkdialogs.h --- a/pidgin/gtkdialogs.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkdialogs.h Wed Jan 04 02:37:25 2012 +0000 @@ -30,6 +30,8 @@ #include "account.h" #include "conversation.h" +G_BEGIN_DECLS + /* Functions in gtkdialogs.c (these should actually stay in this file) */ void pidgin_dialogs_destroy_all(void); void pidgin_dialogs_about(void); @@ -53,4 +55,6 @@ /* This macro should probably be moved elsewhere */ #define PIDGIN_WINDOW_ICONIFIED(x) (gdk_window_get_state(GTK_WIDGET(x)->window) & GDK_WINDOW_STATE_ICONIFIED) +G_END_DECLS + #endif /* _PIDGINDIALOGS_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkdnd-hints.h --- a/pidgin/gtkdnd-hints.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkdnd-hints.h Wed Jan 04 02:37:25 2012 +0000 @@ -52,6 +52,8 @@ } DndHintPosition; +G_BEGIN_DECLS + /** * Shows a drag-and-drop hint at the specified location. * @@ -84,4 +86,6 @@ void dnd_hints_show_relative(DndHintWindowId id, GtkWidget *widget, DndHintPosition horiz, DndHintPosition vert); +G_END_DECLS + #endif /* _PIDGIN_DND_HINTS_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkdocklet.h --- a/pidgin/gtkdocklet.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkdocklet.h Wed Jan 04 02:37:25 2012 +0000 @@ -25,9 +25,13 @@ #ifndef _GTKDOCKLET_H_ #define _GTKDOCKLET_H_ +G_BEGIN_DECLS + void pidgin_docklet_init(void); void pidgin_docklet_uninit(void); void*pidgin_docklet_get_handle(void); +G_END_DECLS + #endif /* _GTKDOCKLET_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkeventloop.h --- a/pidgin/gtkeventloop.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkeventloop.h Wed Jan 04 02:37:25 2012 +0000 @@ -28,6 +28,8 @@ #include "eventloop.h" +G_BEGIN_DECLS + /** * Returns the GTK+ event loop UI operations structure. * @@ -35,4 +37,6 @@ */ PurpleEventLoopUiOps *pidgin_eventloop_get_ui_ops(void); +G_END_DECLS + #endif /* _PIDGINEVENTLOOP_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkft.h --- a/pidgin/gtkft.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkft.h Wed Jan 04 02:37:25 2012 +0000 @@ -36,6 +36,8 @@ */ typedef struct _PidginXferDialog PidginXferDialog; +G_BEGIN_DECLS + /**************************************************************************/ /** @name GTK+ File Transfer Dialog API */ /**************************************************************************/ @@ -145,4 +147,6 @@ /*@}*/ +G_END_DECLS + #endif /* _PIDGINFT_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkidle.h --- a/pidgin/gtkidle.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkidle.h Wed Jan 04 02:37:25 2012 +0000 @@ -28,6 +28,8 @@ #include "idle.h" +G_BEGIN_DECLS + /**************************************************************************/ /** @name GTK+ Idle API */ /**************************************************************************/ @@ -42,4 +44,6 @@ /*@}*/ +G_END_DECLS + #endif /* _PIDGIN_IDLE_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkimhtml.h --- a/pidgin/gtkimhtml.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkimhtml.h Wed Jan 04 02:37:25 2012 +0000 @@ -31,9 +31,7 @@ #include "connection.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /************************************************************************** * @name Structures @@ -828,8 +826,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PIDGINIMHTML_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkimhtmltoolbar.h --- a/pidgin/gtkimhtmltoolbar.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkimhtmltoolbar.h Wed Jan 04 02:37:25 2012 +0000 @@ -26,9 +26,7 @@ #include #include "gtkimhtml.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS #define DEFAULT_FONT_FACE "Helvetica 12" @@ -98,8 +96,6 @@ void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, PurpleConversation *conv); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PIDGINIMHTMLTOOLBAR_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtklog.h --- a/pidgin/gtklog.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtklog.h Wed Jan 04 02:37:25 2012 +0000 @@ -52,6 +52,7 @@ }; +G_BEGIN_DECLS void pidgin_log_show(PurpleLogType type, const char *buddyname, PurpleAccount *account); void pidgin_log_show_contact(PurpleContact *contact); @@ -82,4 +83,6 @@ /*@}*/ +G_END_DECLS + #endif diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkmain.c --- a/pidgin/gtkmain.c Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkmain.c Wed Jan 04 02:37:25 2012 +0000 @@ -719,7 +719,16 @@ /* set a user-specified config directory */ if (opt_config_dir_arg != NULL) { - purple_util_set_user_dir(opt_config_dir_arg); + if (g_path_is_absolute(opt_config_dir_arg)) { + purple_util_set_user_dir(opt_config_dir_arg); + } else { + /* Make an absolute (if not canonical) path */ + char *cwd = g_get_current_dir(); + char *path = g_build_path(G_DIR_SEPARATOR_S, cwd, opt_config_dir_arg, NULL); + purple_util_set_user_dir(path); + g_free(path); + g_free(cwd); + } } /* diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkmedia.c diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtknotify.h --- a/pidgin/gtknotify.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtknotify.h Wed Jan 04 02:37:25 2012 +0000 @@ -29,6 +29,8 @@ #include "notify.h" #include "pounce.h" +G_BEGIN_DECLS + /** * Adds a buddy pounce to the buddy pounce dialog * @@ -59,4 +61,6 @@ */ void pidgin_notify_uninit(void); +G_END_DECLS + #endif /* _PIDGINNOTIFY_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkplugin.h --- a/pidgin/gtkplugin.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkplugin.h Wed Jan 04 02:37:25 2012 +0000 @@ -56,6 +56,8 @@ #define PIDGIN_PLUGIN_UI_INFO(plugin) \ ((PidginPluginUiInfo *)(plugin)->info->ui_info) +G_BEGIN_DECLS + /** * Returns the configuration frame widget for a GTK+ plugin, if one * exists. @@ -77,4 +79,6 @@ */ void pidgin_plugin_dialog_show(void); +G_END_DECLS + #endif /* _PIDGINPLUGIN_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkpluginpref.h --- a/pidgin/gtkpluginpref.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkpluginpref.h Wed Jan 04 02:37:25 2012 +0000 @@ -31,9 +31,7 @@ #include "pidgin.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Creates a Gtk Preference frame for a PurplePluginPrefFrame @@ -43,8 +41,6 @@ */ GtkWidget *pidgin_plugin_pref_create_frame(PurplePluginPrefFrame *frame); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PIDGINPLUGINPREF_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkpounce.h --- a/pidgin/gtkpounce.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkpounce.h Wed Jan 04 02:37:25 2012 +0000 @@ -28,6 +28,8 @@ #include "pounce.h" +G_BEGIN_DECLS + /** * Displays a New Buddy Pounce or Edit Buddy Pounce dialog. * @@ -60,4 +62,6 @@ */ void pidgin_pounces_init(void); +G_END_DECLS + #endif /* _PIDGINPOUNCE_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkprefs.h --- a/pidgin/gtkprefs.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkprefs.h Wed Jan 04 02:37:25 2012 +0000 @@ -29,6 +29,8 @@ #include "prefs.h" +G_BEGIN_DECLS + /** * Initializes all UI-specific preferences. */ @@ -128,4 +130,6 @@ */ void pidgin_prefs_update_old(void); +G_END_DECLS + #endif /* _PIDGINPREFS_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkprivacy.h --- a/pidgin/gtkprivacy.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkprivacy.h Wed Jan 04 02:37:25 2012 +0000 @@ -28,6 +28,8 @@ #include "privacy.h" +G_BEGIN_DECLS + /** * Initializes the GTK+ privacy subsystem. */ @@ -72,4 +74,6 @@ */ PurplePrivacyUiOps *pidgin_privacy_get_ui_ops(void); +G_END_DECLS + #endif /* _PIDGINPRIVACY_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkrequest.h --- a/pidgin/gtkrequest.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkrequest.h Wed Jan 04 02:37:25 2012 +0000 @@ -28,6 +28,8 @@ #include "request.h" +G_BEGIN_DECLS + /** * Returns the UI operations structure for GTK+ request functions. * @@ -35,4 +37,6 @@ */ PurpleRequestUiOps *pidgin_request_get_ui_ops(void); +G_END_DECLS + #endif /* _PIDGINREQUEST_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkroomlist.h --- a/pidgin/gtkroomlist.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkroomlist.h Wed Jan 04 02:37:25 2012 +0000 @@ -28,6 +28,8 @@ #include "roomlist.h" +G_BEGIN_DECLS + /** * Initializes the room list subsystem. */ @@ -53,4 +55,6 @@ */ void pidgin_roomlist_dialog_show_with_account(PurpleAccount *account); +G_END_DECLS + #endif /* _PIDGINROOMLIST_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtksavedstatuses.h --- a/pidgin/gtksavedstatuses.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtksavedstatuses.h Wed Jan 04 02:37:25 2012 +0000 @@ -29,6 +29,8 @@ #include "savedstatuses.h" #include "status.h" +G_BEGIN_DECLS + /** * Shows the status window. */ @@ -85,4 +87,6 @@ */ void pidgin_status_uninit(void); +G_END_DECLS + #endif /* _PIDGINSAVEDSTATUSES_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtksession.h --- a/pidgin/gtksession.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtksession.h Wed Jan 04 02:37:25 2012 +0000 @@ -26,6 +26,8 @@ #ifndef _PIDGINSESSION_H_ #define _PIDGINSESSION_H_ +G_BEGIN_DECLS + /**************************************************************************/ /** @name X Windows session subsystem */ /**************************************************************************/ @@ -51,4 +53,6 @@ /*@}*/ +G_END_DECLS + #endif /* _PIDGINSESSION_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtksmiley.h --- a/pidgin/gtksmiley.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtksmiley.h Wed Jan 04 02:37:25 2012 +0000 @@ -31,6 +31,8 @@ typedef struct _PidginSmiley PidginSmiley; +G_BEGIN_DECLS + /** * Add a PurpleSmiley to the GtkIMHtmlSmiley's list to be able to use it * in pidgin @@ -108,4 +110,6 @@ */ void pidgin_smiley_editor_set_data(PidginSmiley *editor, gpointer data, gsize datasize); +G_END_DECLS + #endif /* PIDGIN_GTKSMILEY_H */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtksound.h --- a/pidgin/gtksound.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtksound.h Wed Jan 04 02:37:25 2012 +0000 @@ -28,6 +28,8 @@ #include "sound.h" +G_BEGIN_DECLS + /**************************************************************************/ /** @name GTK+ Sound API */ /**************************************************************************/ @@ -72,4 +74,6 @@ /*@}*/ +G_END_DECLS + #endif /* _PIDGINSOUND_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtksourceundomanager.h --- a/pidgin/gtksourceundomanager.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtksourceundomanager.h Wed Jan 04 02:37:25 2012 +0000 @@ -57,6 +57,8 @@ void (*can_redo) (GtkSourceUndoManager *um, gboolean can_redo); }; +G_BEGIN_DECLS + GType gtk_source_undo_manager_get_type (void) G_GNUC_CONST; GtkSourceUndoManager* gtk_source_undo_manager_new (GtkTextBuffer *buffer); @@ -78,6 +80,8 @@ (GtkSourceUndoManager *um, gint undo_levels); +G_END_DECLS + #endif /* __GTK_SOURCE_UNDO_MANAGER_H__ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkthemes.h --- a/pidgin/gtkthemes.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkthemes.h Wed Jan 04 02:37:25 2012 +0000 @@ -46,6 +46,8 @@ extern struct smiley_theme *current_smiley_theme; extern GSList *smiley_themes; +G_BEGIN_DECLS + void pidgin_themes_init(void); gboolean pidgin_themes_smileys_disabled(void); @@ -62,4 +64,6 @@ GSList *pidgin_themes_get_proto_smileys(const char *id); +G_END_DECLS + #endif /* _PIDGINTHEMES_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkutils.h --- a/pidgin/gtkutils.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkutils.h Wed Jan 04 02:37:25 2012 +0000 @@ -31,10 +31,6 @@ #include "prpl.h" #include "util.h" - - - - typedef enum { PIDGIN_BUTTON_HORIZONTAL, @@ -80,6 +76,8 @@ typedef gboolean (*PidginFilterBuddyCompletionEntryFunc) (const PidginBuddyCompletionEntry *completion_entry, gpointer user_data); +G_BEGIN_DECLS + /** * Sets up a gtkimhtml widget, loads it with smileys, and sets the * default signal handlers. @@ -903,5 +901,7 @@ */ void pidgin_utils_uninit(void); +G_END_DECLS + #endif /* _PIDGINUTILS_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkwebview.c --- a/pidgin/gtkwebview.c Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkwebview.c Wed Jan 04 02:37:25 2012 +0000 @@ -25,79 +25,78 @@ * */ -#ifdef HAVE_CONFIG_H -#include -#endif +#include "internal.h" +#include "pidgin.h" -#include -#include -#include -#include -#include +#include "gtkwebview.h" + +#define MAX_SCROLL_TIME 0.4 /* seconds */ +#define SCROLL_DELAY 33 /* milliseconds */ -#include "util.h" -#include "gtkwebview.h" -#include "imgstore.h" +#define GTK_WEBVIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GTK_TYPE_WEBVIEW, GtkWebViewPriv)) -static WebKitWebViewClass *parent_class = NULL; +/****************************************************************************** + * Structs + *****************************************************************************/ -struct GtkWebViewPriv { +typedef struct _GtkWebViewPriv { GHashTable *images; /**< a map from id to temporary file for the image */ - gboolean empty; /**< whether anything has been appended **/ + gboolean empty; /**< whether anything has been appended **/ /* JS execute queue */ GQueue *js_queue; gboolean is_loading; + + /* Scroll adjustments */ GtkAdjustment *vadj; guint scroll_src; GTimer *scroll_time; -}; +} GtkWebViewPriv; + +/****************************************************************************** + * Globals + *****************************************************************************/ -GtkWidget * -gtk_webview_new(void) -{ - GtkWebView* ret = GTK_WEBVIEW(g_object_new(gtk_webview_get_type(), NULL)); - return GTK_WIDGET(ret); -} +static WebKitWebViewClass *parent_class = NULL; -static char * -get_image_filename_from_id(GtkWebView* view, int id) +/****************************************************************************** + * Helpers + *****************************************************************************/ + +static const char * +get_image_src_from_id(GtkWebViewPriv *priv, int id) { - char *filename = NULL; - FILE *file; - PurpleStoredImage* img; - - if (!view->priv->images) - view->priv->images = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); + char *src; + PurpleStoredImage *img; - filename = (char *)g_hash_table_lookup(view->priv->images, GINT_TO_POINTER(id)); - if (filename) - return filename; + if (priv->images) { + /* Check for already loaded image */ + src = (char *)g_hash_table_lookup(priv->images, GINT_TO_POINTER(id)); + if (src) + return src; + } else { + priv->images = g_hash_table_new_full(g_direct_hash, g_direct_equal, + NULL, g_free); + } - /* else get from img store */ - file = purple_mkstemp(&filename, TRUE); - + /* Find image in store */ img = purple_imgstore_find_by_id(id); - fwrite(purple_imgstore_get_data(img), purple_imgstore_get_size(img), 1, file); - g_hash_table_insert(view->priv->images, GINT_TO_POINTER(id), filename); - fclose(file); - return filename; -} + src = (char *)purple_imgstore_get_filename(img); + if (src) { + src = g_strdup_printf("file://%s", src); + } else { + char *tmp; + tmp = purple_base64_encode(purple_imgstore_get_data(img), + purple_imgstore_get_size(img)); + src = g_strdup_printf("data:base64,%s", tmp); + g_free(tmp); + } -static void -clear_single_image(gpointer key, gpointer value, gpointer userdata) -{ - g_unlink((char *)value); -} + g_hash_table_insert(priv->images, GINT_TO_POINTER(id), src); -static void -clear_images(GtkWebView *view) -{ - if (!view->priv->images) - return; - g_hash_table_foreach(view->priv->images, clear_single_image, NULL); - g_hash_table_unref(view->priv->images); + return src; } /* @@ -106,10 +105,10 @@ * purple changes the way it works. */ static char * -replace_img_id_with_src(GtkWebView *view, const char *html) +replace_img_id_with_src(GtkWebViewPriv *priv, const char *html) { - GString *buffer = g_string_sized_new(strlen(html)); - const char* cur = html; + GString *buffer = g_string_new(NULL); + const char *cur = html; char *id; int nid; @@ -152,39 +151,57 @@ /* let's dump this, tag and then dump the src information */ g_string_append_len(buffer, img, cur - img); - g_string_append_printf(buffer, " src='file://%s' ", get_image_filename_from_id(view, nid)); + g_string_append_printf(buffer, " src='%s' ", get_image_src_from_id(priv, nid)); } return g_string_free(buffer, FALSE); } -static void -gtk_webview_finalize(GObject *view) +static gboolean +process_js_script_queue(GtkWebView *webview) { - gpointer temp; + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + char *script; - while ((temp = g_queue_pop_head(GTK_WEBVIEW(view)->priv->js_queue))) - g_free(temp); - g_queue_free(GTK_WEBVIEW(view)->priv->js_queue); + if (priv->is_loading) + return FALSE; /* we will be called when loaded */ + if (!priv->js_queue || g_queue_is_empty(priv->js_queue)) + return FALSE; /* nothing to do! */ - clear_images(GTK_WEBVIEW(view)); - g_free(GTK_WEBVIEW(view)->priv); - G_OBJECT_CLASS(parent_class)->finalize(G_OBJECT(view)); + script = g_queue_pop_head(priv->js_queue); + webkit_web_view_execute_script(WEBKIT_WEB_VIEW(webview), script); + g_free(script); + + return TRUE; /* there may be more for now */ } static void -gtk_webview_class_init(GtkWebViewClass *klass, gpointer userdata) +webview_load_started(WebKitWebView *webview, WebKitWebFrame *frame, + gpointer userdata) { - parent_class = g_type_class_ref(webkit_web_view_get_type()); - G_OBJECT_CLASS(klass)->finalize = gtk_webview_finalize; + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + + /* is there a better way to test for is_loading? */ + priv->is_loading = TRUE; +} + +static void +webview_load_finished(WebKitWebView *webview, WebKitWebFrame *frame, + gpointer userdata) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + + priv->is_loading = FALSE; + g_idle_add((GSourceFunc)process_js_script_queue, webview); } static gboolean -webview_link_clicked(WebKitWebView *view, - WebKitWebFrame *frame, - WebKitNetworkRequest *request, - WebKitWebNavigationAction *navigation_action, - WebKitWebPolicyDecision *policy_decision) +webview_link_clicked(WebKitWebView *webview, + WebKitWebFrame *frame, + WebKitNetworkRequest *request, + WebKitWebNavigationAction *navigation_action, + WebKitWebPolicyDecision *policy_decision, + gpointer userdata) { const gchar *uri; WebKitWebNavigationReason reason; @@ -202,77 +219,155 @@ return TRUE; } +/* + * Smoothly scroll a WebView. + * + * @return TRUE if the window needs to be scrolled further, FALSE if we're at the bottom. + */ static gboolean -process_js_script_queue(GtkWebView *view) +smooth_scroll_cb(gpointer data) { - char *script; - if (view->priv->is_loading) - return FALSE; /* we will be called when loaded */ - if (!view->priv->js_queue || g_queue_is_empty(view->priv->js_queue)) - return FALSE; /* nothing to do! */ + GtkWebViewPriv *priv = data; + GtkAdjustment *adj; + gdouble max_val; + gdouble scroll_val; + + g_return_val_if_fail(priv->scroll_time != NULL, FALSE); - script = g_queue_pop_head(view->priv->js_queue); - webkit_web_view_execute_script(WEBKIT_WEB_VIEW(view), script); - g_free(script); + adj = priv->vadj; +#if GTK_CHECK_VERSION(2,14,0) + max_val = gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj); +#else + max_val = adj->upper - adj->page_size; +#endif + scroll_val = gtk_adjustment_get_value(adj) + + ((max_val - gtk_adjustment_get_value(adj)) / 3); - return TRUE; /* there may be more for now */ + if (g_timer_elapsed(priv->scroll_time, NULL) > MAX_SCROLL_TIME + || scroll_val >= max_val) { + /* time's up. jump to the end and kill the timer */ + gtk_adjustment_set_value(adj, max_val); + g_timer_destroy(priv->scroll_time); + priv->scroll_time = NULL; + g_source_remove(priv->scroll_src); + priv->scroll_src = 0; + return FALSE; + } + + /* scroll by 1/3rd the remaining distance */ + gtk_adjustment_set_value(adj, scroll_val); + return TRUE; } -static void -webview_load_started(WebKitWebView *view, - WebKitWebFrame *frame, - gpointer userdata) +static gboolean +scroll_idle_cb(gpointer data) { - /* is there a better way to test for is_loading? */ - GTK_WEBVIEW(view)->priv->is_loading = TRUE; + GtkWebViewPriv *priv = data; + GtkAdjustment *adj = priv->vadj; + gdouble max_val; + + if (adj) { +#if GTK_CHECK_VERSION(2,14,0) + max_val = gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj); +#else + max_val = adj->upper - adj->page_size; +#endif + gtk_adjustment_set_value(adj, max_val); + } + + priv->scroll_src = 0; + return FALSE; +} + +/****************************************************************************** + * GObject Stuff + *****************************************************************************/ + +GtkWidget * +gtk_webview_new(void) +{ + return GTK_WIDGET(g_object_new(gtk_webview_get_type(), NULL)); } static void -webview_load_finished(WebKitWebView *view, - WebKitWebFrame *frame, - gpointer userdata) +gtk_webview_finalize(GObject *webview) { - GTK_WEBVIEW(view)->priv->is_loading = FALSE; - g_idle_add((GSourceFunc)process_js_script_queue, view); + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + gpointer temp; + + while ((temp = g_queue_pop_head(priv->js_queue))) + g_free(temp); + g_queue_free(priv->js_queue); + + if (priv->images) + g_hash_table_unref(priv->images); + + G_OBJECT_CLASS(parent_class)->finalize(G_OBJECT(webview)); } -void -gtk_webview_safe_execute_script(GtkWebView *view, const char *script) +static void +gtk_webview_class_init(GtkWebViewClass *klass, gpointer userdata) { - g_queue_push_tail(view->priv->js_queue, g_strdup(script)); - g_idle_add((GSourceFunc)process_js_script_queue, view); + parent_class = g_type_class_ref(webkit_web_view_get_type()); + + g_type_class_add_private(klass, sizeof(GtkWebViewPriv)); + + G_OBJECT_CLASS(klass)->finalize = gtk_webview_finalize; } static void -gtk_webview_init(GtkWebView *view, gpointer userdata) +gtk_webview_init(GtkWebView *webview, gpointer userdata) { - view->priv = g_new0(struct GtkWebViewPriv, 1); - g_signal_connect(view, "navigation-policy-decision-requested", + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + + priv->empty = TRUE; + priv->js_queue = g_queue_new(); + + g_signal_connect(webview, "navigation-policy-decision-requested", G_CALLBACK(webview_link_clicked), - view); + webview); - g_signal_connect(view, "load-started", + g_signal_connect(webview, "load-started", G_CALLBACK(webview_load_started), - view); + webview); - g_signal_connect(view, "load-finished", + g_signal_connect(webview, "load-finished", G_CALLBACK(webview_load_finished), - view); - - view->priv->empty = TRUE; - view->priv->js_queue = g_queue_new(); + webview); } - -void -gtk_webview_load_html_string_with_imgstore(GtkWebView *view, const char *html) +GType +gtk_webview_get_type(void) { - char *html_imged; + static GType mview_type = 0; + if (G_UNLIKELY(mview_type == 0)) { + static const GTypeInfo mview_info = { + sizeof(GtkWebViewClass), + NULL, + NULL, + (GClassInitFunc)gtk_webview_class_init, + NULL, + NULL, + sizeof(GtkWebView), + 0, + (GInstanceInitFunc)gtk_webview_init, + NULL + }; + mview_type = g_type_register_static(webkit_web_view_get_type(), + "GtkWebView", &mview_info, 0); + } + return mview_type; +} - clear_images(view); - html_imged = replace_img_id_with_src(view, html); - webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(view), html_imged, "file:///"); - g_free(html_imged); +/***************************************************************************** + * Public API functions + *****************************************************************************/ + +gboolean +gtk_webview_is_empty(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + return priv->empty; } char * @@ -299,14 +394,34 @@ } cur++; } + g_string_append_c(str, '"'); + return g_string_free(str, FALSE); } +void +gtk_webview_safe_execute_script(GtkWebView *webview, const char *script) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + g_queue_push_tail(priv->js_queue, g_strdup(script)); + g_idle_add((GSourceFunc)process_js_script_queue, webview); +} void -gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj) +gtk_webview_load_html_string_with_imgstore(GtkWebView *webview, const char *html) { - webview->priv->vadj = vadj; + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + char *html_imged; + + if (priv->images) { + g_hash_table_unref(priv->images); + priv->images = NULL; + } + + html_imged = replace_img_id_with_src(priv, html); + webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), html_imged, NULL, + NULL, "file:///"); + g_free(html_imged); } /* this is a "hack", my plan is to eventually handle this @@ -315,77 +430,34 @@ * wrong to hardcode that here. */ void -gtk_webview_append_html(GtkWebView *view, const char *html) +gtk_webview_append_html(GtkWebView *webview, const char *html) { + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); char *escaped = gtk_webview_quote_js_string(html); char *script = g_strdup_printf("document.write(%s)", escaped); - webkit_web_view_execute_script(WEBKIT_WEB_VIEW(view), script); - view->priv->empty = FALSE; - gtk_webview_scroll_to_end(view, TRUE); + webkit_web_view_execute_script(WEBKIT_WEB_VIEW(webview), script); + priv->empty = FALSE; + gtk_webview_scroll_to_end(webview, TRUE); g_free(script); g_free(escaped); } -gboolean -gtk_webview_is_empty(GtkWebView *view) -{ - return view->priv->empty; -} - -#define MAX_SCROLL_TIME 0.4 /* seconds */ -#define SCROLL_DELAY 33 /* milliseconds */ - -/* - * Smoothly scroll a WebView. - * - * @return TRUE if the window needs to be scrolled further, FALSE if we're at the bottom. - */ -static gboolean -smooth_scroll_cb(gpointer data) +void +gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj) { - struct GtkWebViewPriv *priv = data; - GtkAdjustment *adj = priv->vadj; - gdouble max_val = adj->upper - adj->page_size; - gdouble scroll_val = gtk_adjustment_get_value(adj) + ((max_val - gtk_adjustment_get_value(adj)) / 3); - - g_return_val_if_fail(priv->scroll_time != NULL, FALSE); - - if (g_timer_elapsed(priv->scroll_time, NULL) > MAX_SCROLL_TIME || scroll_val >= max_val) { - /* time's up. jump to the end and kill the timer */ - gtk_adjustment_set_value(adj, max_val); - g_timer_destroy(priv->scroll_time); - priv->scroll_time = NULL; - g_source_remove(priv->scroll_src); - priv->scroll_src = 0; - return FALSE; - } - - /* scroll by 1/3rd the remaining distance */ - gtk_adjustment_set_value(adj, scroll_val); - return TRUE; -} - -static gboolean -scroll_idle_cb(gpointer data) -{ - struct GtkWebViewPriv *priv = data; - GtkAdjustment *adj = priv->vadj; - if (adj) { - gtk_adjustment_set_value(adj, adj->upper - adj->page_size); - } - priv->scroll_src = 0; - return FALSE; + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + priv->vadj = vadj; } void gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth) { - struct GtkWebViewPriv *priv = webview->priv; + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); if (priv->scroll_time) g_timer_destroy(priv->scroll_time); if (priv->scroll_src) g_source_remove(priv->scroll_src); - if(smooth) { + if (smooth) { priv->scroll_time = g_timer_new(); priv->scroll_src = g_timeout_add_full(G_PRIORITY_LOW, SCROLL_DELAY, smooth_scroll_cb, priv, NULL); } else { @@ -394,26 +466,40 @@ } } -GType -gtk_webview_get_type(void) +void gtk_webview_page_up(GtkWebView *webview) { - static GType mview_type = 0; - if (G_UNLIKELY(mview_type == 0)) { - static const GTypeInfo mview_info = { - sizeof(GtkWebViewClass), - NULL, - NULL, - (GClassInitFunc) gtk_webview_class_init, - NULL, - NULL, - sizeof(GtkWebView), - 0, - (GInstanceInitFunc) gtk_webview_init, - NULL - }; - mview_type = g_type_register_static(webkit_web_view_get_type(), - "GtkWebView", &mview_info, 0); - } - return mview_type; + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkAdjustment *vadj = priv->vadj; + gdouble scroll_val; + +#if GTK_CHECK_VERSION(2,14,0) + scroll_val = gtk_adjustment_get_value(vadj) - gtk_adjustment_get_page_size(vadj); + scroll_val = MAX(scroll_val, gtk_adjustment_get_lower(vadj)); +#else + scroll_val = gtk_adjustment_get_value(vadj) - vadj->page_size; + scroll_val = MAX(scroll_val, vadj->lower); +#endif + + gtk_adjustment_set_value(vadj, scroll_val); } +void gtk_webview_page_down(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkAdjustment *vadj = priv->vadj; + gdouble scroll_val; + gdouble page_size; + +#if GTK_CHECK_VERSION(2,14,0) + page_size = gtk_adjustment_get_page_size(vadj); + scroll_val = gtk_adjustment_get_value(vadj) + page_size; + scroll_val = MIN(scroll_val, gtk_adjustment_get_upper(vadj) - page_size); +#else + page_size = vadj->page_size; + scroll_val = gtk_adjustment_get_value(vadj) + page_size; + scroll_val = MIN(scroll_val, vadj->upper - page_size); +#endif + + gtk_adjustment_set_value(vadj, scroll_val); +} + diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkwebview.h --- a/pidgin/gtkwebview.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkwebview.h Wed Jan 04 02:37:25 2012 +0000 @@ -32,34 +32,27 @@ #include #include -#include "notify.h" - #define GTK_TYPE_WEBVIEW (gtk_webview_get_type()) #define GTK_WEBVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_WEBVIEW, GtkWebView)) #define GTK_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_WEBVIEW, GtkWebViewClass)) #define GTK_IS_WEBVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_WEBVIEW)) -#define GTK_IS_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_WEBVIEW)) +#define GTK_IS_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_WEBVIEW)) +#define GTK_WEBVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_WEBVIEW, GtkWebViewClass)) - -struct GtkWebViewPriv; +typedef struct _GtkWebView GtkWebView; +typedef struct _GtkWebViewClass GtkWebViewClass; struct _GtkWebView { - WebKitWebView webkit_web_view; - - /*< private >*/ - struct GtkWebViewPriv *priv; + WebKitWebView parent; }; -typedef struct _GtkWebView GtkWebView; - struct _GtkWebViewClass { WebKitWebViewClass parent; }; -typedef struct _GtkWebViewClass GtkWebViewClass; - +G_BEGIN_DECLS /** * Returns the GType for a GtkWebView widget @@ -76,12 +69,15 @@ GtkWidget *gtk_webview_new(void); /** - * Set the vertical adjustment for the GtkWebView. + * TODO WEBKIT: Right now this just tests whether an append has been called + * since the last clear or since the Widget was created. So it does not + * test for load_string's called in between. * - * @param webview The GtkWebView object - * @param vadj The GtkAdjustment that control the webview + * @param webview The GtkWebView object + * + * @return gboolean indicating whether the webview is empty */ -void gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj); +gboolean gtk_webview_is_empty(GtkWebView *webview); /** * A very basic routine to append html, which can be considered @@ -103,17 +99,6 @@ void gtk_webview_load_html_string_with_imgstore(GtkWebView *webview, const char *html); /** - * TODO WEBKIT: Right now this just tests whether an append has been called - * since the last clear or since the Widget was created. So it does not - * test for load_string's called in between. - * - * @param webview The GtkWebView object - * - * @return gboolean indicating whether the webview is empty - */ -gboolean gtk_webview_is_empty(GtkWebView *webview); - -/** * Execute the JavaScript only after the webkit_webview_load_string * loads completely. We also guarantee that the scripts are executed * in the order they are called here. This is useful to avoid race @@ -136,6 +121,14 @@ char *gtk_webview_quote_js_string(const char *str); /** + * Set the vertical adjustment for the GtkWebView. + * + * @param webview The GtkWebView object + * @param vadj The GtkAdjustment that control the webview + */ +void gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj); + +/** * Scrolls the Webview to the end of its contents. * * @param webview The GtkWebView object @@ -143,5 +136,21 @@ */ void gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth); +/** + * Scrolls a GtkWebView up by one page. + * + * @param webview The GtkWebView. + */ +void gtk_webview_page_up(GtkWebView *webview); + +/** + * Scrolls a GtkWebView down by one page. + * + * @param webview The GtkWebView. + */ +void gtk_webview_page_down(GtkWebView *webview); + +G_END_DECLS + #endif /* _PIDGIN_WEBVIEW_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/gtkwhiteboard.h --- a/pidgin/gtkwhiteboard.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/gtkwhiteboard.h Wed Jan 04 02:37:25 2012 +0000 @@ -59,9 +59,7 @@ int brush_size; /**< Brush size */ } PidginWhiteboard; -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +G_BEGIN_DECLS /*****************************************************************************/ /** @name PidginWhiteboard API */ @@ -77,8 +75,6 @@ /*@}*/ -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* _PIDGINWHITEBOARD_H_ */ diff -r a677e7b1497f -r dc44bb639e8e pidgin/pidgintooltip.h --- a/pidgin/pidgintooltip.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/pidgintooltip.h Wed Jan 04 02:37:25 2012 +0000 @@ -59,6 +59,8 @@ */ typedef gboolean (*PidginTooltipPaint)(GtkWidget *tipwindow, gpointer userdata); +G_BEGIN_DECLS + /** * Setup tooltip drawing functions for a treeview. * @@ -101,4 +103,6 @@ void pidgin_tooltip_show(GtkWidget *widget, gpointer userdata, PidginTooltipCreate create_cb, PidginTooltipPaint paint_cb); +G_END_DECLS + #endif diff -r a677e7b1497f -r dc44bb639e8e pidgin/plugins/Makefile.am --- a/pidgin/plugins/Makefile.am Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/plugins/Makefile.am Wed Jan 04 02:37:25 2012 +0000 @@ -38,6 +38,7 @@ gtkbuddynote_la_LDFLAGS = -module -avoid-version history_la_LDFLAGS = -module -avoid-version iconaway_la_LDFLAGS = -module -avoid-version +markerline_la_LDFLAGS = -module -avoid-version notify_la_LDFLAGS = -module -avoid-version pidginrc_la_LDFLAGS = -module -avoid-version relnot_la_LDFLAGS = -module -avoid-version @@ -56,6 +57,7 @@ gtkbuddynote.la \ history.la \ iconaway.la \ + markerline.la \ notify.la \ pidginrc.la \ relnot.la \ @@ -80,6 +82,7 @@ gtkbuddynote_la_SOURCES = gtkbuddynote.c history_la_SOURCES = history.c iconaway_la_SOURCES = iconaway.c +markerline_la_SOURCES = markerline.c notify_la_SOURCES = notify.c pidginrc_la_SOURCES = pidginrc.c relnot_la_SOURCES = relnot.c @@ -96,6 +99,7 @@ gtkbuddynote_la_LIBADD = $(GTK_LIBS) history_la_LIBADD = $(GTK_LIBS) iconaway_la_LIBADD = $(GTK_LIBS) +markerline_la_LIBADD = $(GTK_LIBS) $(WEBKIT_LIBS) notify_la_LIBADD = $(GTK_LIBS) pidginrc_la_LIBADD = $(GTK_LIBS) relnot_la_LIBADD = $(GLIB_LIBS) diff -r a677e7b1497f -r dc44bb639e8e pidgin/plugins/markerline.c --- a/pidgin/plugins/markerline.c Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/plugins/markerline.c Wed Jan 04 02:37:25 2012 +0000 @@ -33,81 +33,38 @@ /* Purple headers */ #include -#include #include +#include #include #define PREF_PREFIX "/plugins/gtk/" PLUGIN_ID #define PREF_IMS PREF_PREFIX "/ims" #define PREF_CHATS PREF_PREFIX "/chats" -static int -imhtml_expose_cb(GtkWidget *widget, GdkEventExpose *event, PidginConversation *gtkconv) -{ - int y, last_y, offset; - GdkRectangle visible_rect; - GtkTextIter iter; - GdkRectangle buf; - int pad; - PurpleConversation *conv = gtkconv->active_conv; - PurpleConversationType type = purple_conversation_get_type(conv); - - if ((type == PURPLE_CONV_TYPE_CHAT && !purple_prefs_get_bool(PREF_CHATS)) || - (type == PURPLE_CONV_TYPE_IM && !purple_prefs_get_bool(PREF_IMS))) - return FALSE; - - gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &visible_rect); - - offset = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "markerline")); - if (offset) - { - gtk_text_buffer_get_iter_at_offset(gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget)), - &iter, offset); - - gtk_text_view_get_iter_location(GTK_TEXT_VIEW(widget), &iter, &buf); - last_y = buf.y + buf.height; - pad = (gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(widget)) + - gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(widget))) / 2; - last_y += pad; - } - else - last_y = 0; - - gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT, - 0, last_y, 0, &y); - - if (y >= event->area.y) - { - GdkColor red = {0, 0xffff, 0, 0}; - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(event->window)); - - gdk_cairo_set_source_color(cr, &red); - cairo_move_to(cr, 0.0, y + 0.5); - cairo_rel_line_to(cr, visible_rect.width, 0.0); - cairo_set_line_width(cr, 1.0); - cairo_stroke(cr); - cairo_destroy(cr); - } - return FALSE; -} - static void update_marker_for_gtkconv(PidginConversation *gtkconv) { - GtkTextIter iter; - GtkTextBuffer *buffer; + PurpleConversation *conv; + PurpleConversationType type; + g_return_if_fail(gtkconv != NULL); - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)); + conv = gtkconv->active_conv; + type = purple_conversation_get_type(conv); - if (!gtk_text_buffer_get_char_count(buffer)) + if ((type == PURPLE_CONV_TYPE_CHAT && !purple_prefs_get_bool(PREF_CHATS)) || + (type == PURPLE_CONV_TYPE_IM && !purple_prefs_get_bool(PREF_IMS))) return; - gtk_text_buffer_get_end_iter(buffer, &iter); - - g_object_set_data(G_OBJECT(gtkconv->imhtml), "markerline", - GINT_TO_POINTER(gtk_text_iter_get_offset(&iter))); - gtk_widget_queue_draw(gtkconv->imhtml); + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), + "var mhr = document.getElementById(\"markerhr\");" + "if (!mhr) {" + "mhr = document.createElement(\"hr\");" + "mhr.setAttribute(\"id\", \"markerhr\");" + "mhr.setAttribute(\"color\", \"#ff0000\");" + "mhr.setAttribute(\"size\", \"1\");" + "}" + "document.getElementById(\"Chat\").appendChild(mhr);"); } static gboolean @@ -125,28 +82,6 @@ return FALSE; } -#if 0 -static gboolean -window_resized(GtkWidget *w, GdkEventConfigure *event, PidginWindow *win) -{ - GList *list; - - list = pidgin_conv_window_get_gtkconvs(win); - - for (; list; list = list->next) - update_marker_for_gtkconv(list->data); - - return FALSE; -} - -static gboolean -imhtml_resize_cb(GtkWidget *w, GtkAllocation *allocation, PidginConversation *gtkconv) -{ - gtk_widget_queue_draw(w); - return FALSE; -} -#endif - static void page_switched(GtkWidget *widget, GtkWidget *page, gint num, PidginWindow *win) { @@ -156,7 +91,9 @@ static void detach_from_gtkconv(PidginConversation *gtkconv, gpointer null) { - g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->imhtml), imhtml_expose_cb, gtkconv); + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), + "var mhr = document.getElementById(\"markerhr\");" + "if (mhr) mhr.parentNode.removeChild(mhr);"); } static void @@ -165,16 +102,13 @@ g_list_foreach(pidgin_conv_window_get_gtkconvs(win), (GFunc)detach_from_gtkconv, NULL); g_signal_handlers_disconnect_by_func(G_OBJECT(win->notebook), page_switched, win); g_signal_handlers_disconnect_by_func(G_OBJECT(win->window), focus_removed, win); - - gtk_widget_queue_draw(win->window); } static void attach_to_gtkconv(PidginConversation *gtkconv, gpointer null) { detach_from_gtkconv(gtkconv, NULL); - g_signal_connect(G_OBJECT(gtkconv->imhtml), "expose_event", - G_CALLBACK(imhtml_expose_cb), gtkconv); + update_marker_for_gtkconv(gtkconv); } static void @@ -187,8 +121,6 @@ g_signal_connect(G_OBJECT(win->notebook), "switch_page", G_CALLBACK(page_switched), win); - - gtk_widget_queue_draw(win->window); } static void @@ -220,15 +152,15 @@ jump_to_markerline(PurpleConversation *conv, gpointer null) { PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); - int offset; - GtkTextIter iter; if (!gtkconv) return; - offset = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkconv->imhtml), "markerline")); - gtk_text_buffer_get_iter_at_offset(GTK_IMHTML(gtkconv->imhtml)->text_buffer, &iter, offset); - gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(gtkconv->imhtml), &iter, 0, TRUE, 0, 0); + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), + "var mhr = document.getElementById(\"markerhr\");" + "if (mhr) {" + "window.scroll(0, mhr.offsetTop);" + "}"); } static void diff -r a677e7b1497f -r dc44bb639e8e pidgin/smileyparser.h --- a/pidgin/smileyparser.h Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/smileyparser.h Wed Jan 04 02:37:25 2012 +0000 @@ -20,6 +20,10 @@ * */ +G_BEGIN_DECLS + char * smiley_parse_markup(const char *markup, const char *sml); +G_END_DECLS + diff -r a677e7b1497f -r dc44bb639e8e pidgin/themes/Template.html --- a/pidgin/themes/Template.html Thu Dec 29 07:33:57 2011 +0000 +++ b/pidgin/themes/Template.html Wed Jan 04 02:37:25 2012 +0000 @@ -3,66 +3,215 @@ - - + - + - - + - - + %@