diff options
author | Gary Kramlich <grim@reaperworld.com> | 2015-12-21 22:14:59 -0600 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2015-12-21 22:14:59 -0600 |
commit | 7daac9b9e8d061df4e49f4e3127b85438b59875f (patch) | |
tree | ebff74e7ee47514d3c8c70a531622caef5b44e01 | |
parent | 24bc21a4b6b12b8f4b09cd152206b8cc16845ff1 (diff) | |
parent | 7091ea47bedf76e4959e79ce054f39f6b799db32 (diff) | |
download | pidgin-7daac9b9e8d061df4e49f4e3127b85438b59875f.tar.gz |
Merge default back in
111 files changed, 626 insertions, 2012 deletions
diff --git a/configure.ac b/configure.ac index 0e12781736..0ff15a1c04 100644 --- a/configure.ac +++ b/configure.ac @@ -517,15 +517,9 @@ AC_ARG_WITH(x, [], AC_ARG_ENABLE(gtkui, [AS_HELP_STRING([--disable-gtkui], [compile without GTK+ user interface])], enable_gtkui="$enableval", enable_gtkui="yes") -AC_ARG_WITH(gtk, [AS_HELP_STRING([--with-gtk=<version>], - [compile with GTK+ 2 or 3 user interface (default: auto)])], - with_gtk="$withval", with_gtk="auto") AC_ARG_ENABLE(consoleui, [AS_HELP_STRING([--disable-consoleui], [compile without console user interface])], [enable_consoleui=$enableval force_finch=$enableval], [enable_consoleui=yes force_finch=no]) -AC_ARG_ENABLE(gstreamer, - [AS_HELP_STRING([--disable-gstreamer], [compile without GStreamer audio support])], - enable_gst="$enableval", enable_gst="yes") dnl ####################################################################### dnl # Check for GTK+ 2.18 and other things used by the GTK UI @@ -578,45 +572,22 @@ else x_incpath_add="-I$x_includes" fi +dnl ####################################################################### +dnl Check Pidgin dependencies +dnl ####################################################################### if test "x$enable_gtkui" = "xyes" ; then - if test "x$with_gtk" = "x3"; then - PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.0.0], , [ - AC_MSG_RESULT(no) - AC_MSG_ERROR([ + PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.0.0], , [ + AC_MSG_RESULT(no) + AC_MSG_ERROR([ You must have GTK+ 3.0.0 or newer development headers installed to compile Pidgin. If you want to build only Finch then specify --disable-gtkui when running configure. ])]) - elif test "x$with_gtk" = "x2"; then - PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.18.0], , [ - AC_MSG_RESULT(no) - AC_MSG_ERROR([ -You must have GTK+ 2.18.0 or newer development headers installed to compile -Pidgin. If you want to build only Finch then specify --disable-gtkui when -running configure. -])]) - elif test "x$with_gtk" = "xauto"; then - if test "x$enable_gst" != "xno"; then - gst10_pkg="gstreamer-1.0" - gst010_pkg="gstreamer-0.10" - fi - PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.0.0 $gst10_pkg], [with_gtk=3], [ - AC_MSG_RESULT(no) - PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.18.0 $gst010_pkg], [with_gtk=2], [ - AC_MSG_RESULT(no) - AC_MSG_ERROR([ -You must have GTK+ 2.18.0 or newer and GStreamer development headers installed to compile -Pidgin. If you want to build only Finch then specify --disable-gtkui when -running configure. Use --disable-gstreamer if you do not need GStreamer (sound) support. -])])]) - else - AC_MSG_ERROR([--with-gtk must specify one of 2, 3 or auto.]) - fi AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) - GTK_PC_MODULE="gtk+-${with_gtk}.0" - GTK_VERSION=${with_gtk} + GTK_PC_MODULE="gtk+-3.0" + GTK_VERSION="3" AC_SUBST(GTK_PC_MODULE) AC_SUBST(GTK_VERSION) @@ -625,25 +596,14 @@ running configure. Use --disable-gstreamer if you do not need GStreamer (sound) AC_DEFINE(HAVE_PANGO14, 1, [Define if we have Pango 1.4 or newer.]),:) WEBKIT_VERSION=1.3.7 - if test "x$with_gtk" = "x3"; then - WEBKIT_PC_MODULE="webkitgtk-3.0" - PKG_CHECK_MODULES(WEBKIT, [$WEBKIT_PC_MODULE >= $WEBKIT_VERSION], , [ - AC_MSG_RESULT(no) - AC_MSG_ERROR([ + WEBKIT_PC_MODULE="webkitgtk-3.0" + PKG_CHECK_MODULES(WEBKIT, [$WEBKIT_PC_MODULE >= $WEBKIT_VERSION], , [ + AC_MSG_RESULT(no) + AC_MSG_ERROR([ You must have WebKit for GTK+3 $WEBKIT_VERSION or newer development headers installed to compile Pidgin. If you want to build only Finch then specify --disable-gtkui when running configure. ])]) - else - WEBKIT_PC_MODULE="webkit-1.0" - PKG_CHECK_MODULES(WEBKIT, [$WEBKIT_PC_MODULE >= $WEBKIT_VERSION], , [ - AC_MSG_RESULT(no) - AC_MSG_ERROR([ -You must have WebKit for GTK+2 $WEBKIT_VERSION or newer development headers -installed to compile Pidgin. If you want to build only Finch then specify ---disable-gtkui when running configure. -])]) - fi AC_SUBST(WEBKIT_CFLAGS) AC_SUBST(WEBKIT_LIBS) AC_SUBST(WEBKIT_PC_MODULE) @@ -822,29 +782,16 @@ Use --disable-cap if you do not need the Contact Availability Prediction plugin. dnl # Check for GCR for its certificate widgets dnl ####################################################################### if test "x$enable_gcr" = "xyes"; then - if test "x$with_gtk" = "x3"; then - PKG_CHECK_MODULES(GCR, gcr-3, [ - AC_DEFINE(ENABLE_GCR, 1, [Define to 1 if GCR is found.])], [ - AC_MSG_RESULT(no) - enable_gcr="no" - if test "x$force_deps" = "xyes" ; then - AC_MSG_ERROR([ + PKG_CHECK_MODULES(GCR, gcr-3, [ + AC_DEFINE(ENABLE_GCR, 1, [Define to 1 if GCR is found.])], [ + AC_MSG_RESULT(no) + enable_gcr="no" + if test "x$force_deps" = "xyes" ; then + AC_MSG_ERROR([ GCR for GTK+3 development headers not found. Use --disable-gcr if you do not need GCR certificate widgets. ]) - fi]) - else - PKG_CHECK_MODULES(GCR, gcr-0, [ - AC_DEFINE(ENABLE_GCR, 1, [Define to 1 if GCR is found.])], [ - AC_MSG_RESULT(no) - enable_gcr="no" - if test "x$force_deps" = "xyes" ; then - AC_MSG_ERROR([ -GCR for GTK+2 development headers not found. -Use --disable-gcr if you do not need GCR certificate widgets. -]) - fi]) - fi + fi]) fi @@ -1011,93 +958,32 @@ AM_GCONF_SOURCE_2 dnl ####################################################################### dnl # Check for GStreamer dnl ####################################################################### +AC_ARG_ENABLE(gstreamer, + [AS_HELP_STRING([--disable-gstreamer], [compile without GStreamer audio support])], + enable_gst="$enableval", enable_gst="yes") -dnl AC_ARG_ENABLE is declared near GTK2/3 configuration -AC_ARG_WITH(gstreamer, [AS_HELP_STRING([--with-gstreamer=<version>], - [compile with GStreamer 0.10 or 1.0 interface (default: auto)])], - with_gstreamer="$withval", with_gstreamer="auto") -if test "x$enable_gst" != "xno"; then - if test "x$with_gstreamer" == "xauto" -a "x$with_gtk" = "x3"; then - with_gstreamer="1.0" - elif test "x$with_gstreamer" == "xauto" -a "x$with_gtk" = "x2"; then - with_gstreamer="0.10" - fi - if test "x$with_gstreamer" == "xauto"; then - PKG_CHECK_MODULES(GSTREAMER, [gstreamer-1.0], [ - AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds]) - with_gstreamer="1.0" - AC_SUBST(GSTREAMER_CFLAGS) - AC_SUBST(GSTREAMER_LIBS) - dnl Check whether forking stuff is required for this version. - ], [ - PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10], [ - AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds]) - with_gstreamer="0.10" - AC_SUBST(GSTREAMER_CFLAGS) - AC_SUBST(GSTREAMER_LIBS) - ], [ - AC_MSG_RESULT(no) - enable_gst="no" - if test "x$force_deps" = "xyes" ; then - AC_MSG_ERROR([ -GStreamer development headers not found. -Use --disable-gstreamer if you do not need GStreamer (sound) support. -]) - fi - ]) - ]) - elif test "x$with_gstreamer" == "x1.0"; then - PKG_CHECK_MODULES(GSTREAMER, [gstreamer-1.0], [ - AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer 1.0 for playing sounds]) - AC_SUBST(GSTREAMER_CFLAGS) - AC_SUBST(GSTREAMER_LIBS) - ], [ - AC_MSG_RESULT(no) - enable_gst="no" - if test "x$force_deps" = "xyes" ; then - AC_MSG_ERROR([ -GStreamer development headers not found. -Use --disable-gstreamer if you do not need GStreamer (sound) support. -]) - fi - ]) - elif test "x$with_gstreamer" == "x0.10"; then - PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10], [ - AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer 0.10 for playing sounds]) - AC_SUBST(GSTREAMER_CFLAGS) - AC_SUBST(GSTREAMER_LIBS) - ], [ - AC_MSG_RESULT(no) - enable_gst="no" - if test "x$force_deps" = "xyes" ; then - AC_MSG_ERROR([ -GStreamer development headers not found. -Use --disable-gstreamer if you do not need GStreamer (sound) support. -]) - fi - ]) - else - AC_MSG_ERROR([--with-gstreamer must specify one of 0.10, 1.0 or auto.]) - fi -fi - -if test "x$with_gtk" == "x3" -a "x$with_gstreamer" == "x0.10"; then - AC_MSG_ERROR([WebKitGTK+ 3.0 cannot be mixed with GStreamer 0.10. -Please switch to WebKitGTK+ 2.0 or GStreamer 1.0.]) -elif test "x$with_gtk" == "x2" -a "x$with_gstreamer" == "x1.0"; then - AC_MSG_ERROR([WebKitGTK+ 2.0 cannot be mixed with GStreamer 1.0. -Please switch to WebKitGTK+ 3.0 or GStreamer 0.10.]) -fi -if test "x$with_gstreamer" == "x0.10" -o "x$with_gstreamer" == "x1.0"; then - AC_SUBST(GSTREAMER_VER, [$with_gstreamer]) -else - AC_SUBST(GSTREAMER_VER, "") +if test x"$enable_gst" != "xno"; then + PKG_CHECK_MODULES(GSTREAMER, [gstreamer-1.0], [ + AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds]) + with_gstreamer="1.0" + AC_SUBST(GSTREAMER_CFLAGS) + AC_SUBST(GSTREAMER_LIBS) + ], [ + AC_MSG_RESULT(no) + enable_gst="no" + if test "x$force_deps" = "xyes" ; then + AC_MSG_ERROR([ + GStreamer development headers not found. + Use --disable-gstreamer if you do not need GStreamer (sound) support. + ]) + fi + ]) fi dnl ####################################################################### dnl # Check for GStreamer Video dnl ####################################################################### -if test "x$enable_gst" != "xno" -a "x$with_gstreamer" == "x1.0"; then +if test "x$enable_gst" != "xno"; then AC_ARG_ENABLE(gstreamer-video, [AS_HELP_STRING([--disable-gstreamer-video], [compile without GStreamer 1.0 Video Overlay support])], enable_gstvideo="$enableval", enable_gstvideo="yes") @@ -1115,47 +1001,18 @@ else fi dnl ####################################################################### -dnl # Check for GStreamer Interfaces -dnl ####################################################################### -if test "x$enable_gst" != "xno" -a "x$with_gstreamer" == "x0.10"; then - AC_ARG_ENABLE(gstreamer-interfaces, - [AS_HELP_STRING([--disable-gstreamer-interfaces], [compile without GStreamer 0.10 interface support])], - enable_gstinterfaces="$enableval", enable_gstinterfaces="yes") - if test "x$enable_gstinterfaces" != "xno"; then - PKG_CHECK_MODULES(GSTINTERFACES, [gstreamer-interfaces-0.10], [ - AC_DEFINE(USE_GSTINTERFACES, 1, [Use GStreamer 0.10 interfaces for X overlay support]) - AC_SUBST(GSTINTERFACES_CFLAGS) - AC_SUBST(GSTINTERFACES_LIBS) - ], [ - enable_gstinterfaces="no" - ]) - fi -else - enable_gstinterfaces="no" -fi - -dnl ####################################################################### dnl # Check for Farstream dnl ####################################################################### AC_ARG_ENABLE(farstream, [AS_HELP_STRING([--disable-farstream], [compile without farstream support])], enable_farstream="$enableval", enable_farstream="yes") if test "x$enable_farstream" != "xno"; then - if test "x$with_gstreamer" == "x1.0"; then - PKG_CHECK_MODULES(FARSTREAM, [farstream-0.2 >= 0.2.7], [ - AC_SUBST(FARSTREAM_CFLAGS) - AC_SUBST(FARSTREAM_LIBS) - ], [ - enable_farstream="no" - ]) - else - PKG_CHECK_MODULES(FARSTREAM, [farstream-0.1], [ - AC_SUBST(FARSTREAM_CFLAGS) - AC_SUBST(FARSTREAM_LIBS) - ], [ - enable_farstream="no" - ]) - fi + PKG_CHECK_MODULES(FARSTREAM, [farstream-0.2 >= 0.2.7], [ + AC_SUBST(FARSTREAM_CFLAGS) + AC_SUBST(FARSTREAM_LIBS) + ], [ + enable_farstream="no" + ]) fi dnl ####################################################################### @@ -1165,9 +1022,7 @@ AC_ARG_ENABLE(vv, [AS_HELP_STRING([--disable-vv], [compile without voice and video support])], enable_vv="$enableval", enable_vv="yes") if test "x$enable_vv" != "xno"; then - if test "x$enable_gst" != "xno" -a "x$with_gstreamer" == "x1.0" -a "x$enable_gstvideo" != "xno" -a "x$enable_farstream" != "xno"; then - AC_DEFINE(USE_VV, 1, [Use voice and video]) - elif test "x$enable_gst" != "xno" -a "x$with_gstreamer" == "x0.10" -a "x$enable_gstinterfaces" != "xno" -a "x$enable_farstream" != "xno"; then + if test "x$enable_gst" != "xno" -a "x$enable_gstvideo" != "xno" -a "x$enable_farstream" != "xno"; then AC_DEFINE(USE_VV, 1, [Use voice and video]) else enable_vv="no" @@ -1185,7 +1040,7 @@ AM_CONDITIONAL(USE_VV, test "x$enable_vv" != "xno") dnl ####################################################################### dnl # Check for Raw data streams support in Farstream dnl ####################################################################### -if test "x$enable_vv" != "xno" -a "x$with_gstreamer" == "x1.0"; then +if test "x$enable_vv" != "xno"; then PKG_CHECK_MODULES(GSTAPP, [gstreamer-app-1.0], [ AC_DEFINE(USE_GSTAPP, 1, [Use GStreamer Video Overlay support]) AC_SUBST(GSTAPP_CFLAGS) @@ -1891,7 +1746,7 @@ dnl ####################################################################### if test "x$enable_plugins" = "xyes" ; then PKG_CHECK_MODULES(GPLUGIN, [gplugin >= 0.0.17 gmodule-2.0], [ dnl # GPLUGIN_REQ sets pkg-config requirements in the .pc file - if test "x$with_gtk" != "xno" ; then + if test "x$enable_gtkui" != "xno" ; then GPLUGIN_REQ=[", gplugin, gplugin-gtk"] else GPLUGIN_REQ=[", gplugin"] @@ -2102,10 +1957,7 @@ if test "x$enable_gnutls" != "xno"; then fi if test "x$have_gnutls" = "xyes"; then - AC_DEFINE(HAVE_GNUTLS, 1, [Define if you have GnuTLS]) - AC_DEFINE(HAVE_SSL, 1, [Define if you have SSL]) - msg_gnutls="GnuTLS" fi fi @@ -2139,11 +1991,10 @@ if test "x$enable_nss" != "xno"; then fi if test "x$have_nss" = "xyes"; then - AC_DEFINE(HAVE_NSS, 1, [Define if you have Mozilla NSS]) - AC_DEFINE(HAVE_SSL, 1, [Define if you have SSL]) - msg_nss="Mozilla NSS" + else + AC_MSG_ERROR([No SSL/TLS library available]) fi fi @@ -2470,9 +2321,6 @@ echo $PACKAGE $VERSION echo echo Build GTK+ UI................. : $enable_gtkui -if test "x$enable_gtkui" = "xyes"; then - echo Build for GTK+ version........ : $with_gtk -fi echo Build console UI.............. : $enable_consoleui echo Build for X11................. : $with_x echo diff --git a/finch/gntaccount.c b/finch/gntaccount.c index 95815e8d1a..0c99d251fc 100644 --- a/finch/gntaccount.c +++ b/finch/gntaccount.c @@ -979,8 +979,7 @@ free_add_user_data(AddUserData *data) { g_free(data->username); - if (data->alias != NULL) - g_free(data->alias); + g_free(data->alias); g_free(data); } diff --git a/finch/gntsound.c b/finch/gntsound.c index 1a89d60408..59866b2016 100644 --- a/finch/gntsound.c +++ b/finch/gntsound.c @@ -544,11 +544,7 @@ finch_sound_play_file(const char *filename) return; } -#if GST_CHECK_VERSION(1,0,0) play = gst_element_factory_make("playbin", "play"); -#else - play = gst_element_factory_make("playbin2", "play"); -#endif if (play == NULL) { return; diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am index bbbb0e4c45..6d0b5a3279 100644 --- a/libpurple/Makefile.am +++ b/libpurple/Makefile.am @@ -263,7 +263,9 @@ purple_enumheaders = \ $(srcdir)/roomlist.h \ $(srcdir)/status.h \ ${srcdir}/sound.h \ - $(srcdir)/xfer.h + $(srcdir)/xfer.h \ + $(srcdir)/xmlnode.h + marshallers.h: marshallers.list $(AM_V_GEN)$(GLIB_GENMARSHAL) --prefix=purple_smarshal $(srcdir)/marshallers.list --header > marshallers.h diff --git a/libpurple/ciphers/hmaccipher.c b/libpurple/ciphers/hmaccipher.c index 19c9f2ed91..0d1bbf3e15 100644 --- a/libpurple/ciphers/hmaccipher.c +++ b/libpurple/ciphers/hmaccipher.c @@ -77,14 +77,10 @@ purple_hmac_cipher_reset(PurpleCipher *cipher) { if(PURPLE_IS_HASH(priv->hash)) purple_hash_reset(priv->hash); - if(priv->ipad) { - g_free(priv->ipad); - priv->ipad = NULL; - } - if(priv->opad) { - g_free(priv->opad); - priv->opad = NULL; - } + g_free(priv->ipad); + priv->ipad = NULL; + g_free(priv->opad); + priv->opad = NULL; } static void diff --git a/libpurple/example/Makefile.am b/libpurple/example/Makefile.am index dfb6188d6a..9125ea2ea1 100644 --- a/libpurple/example/Makefile.am +++ b/libpurple/example/Makefile.am @@ -4,13 +4,13 @@ nullclient_SOURCES = defines.h nullclient.c nullclient_DEPENDENCIES = nullclient_LDFLAGS = -export-dynamic nullclient_LDADD = \ + $(top_builddir)/libpurple/libpurple.la \ $(DBUS_LIBS) \ $(INTLLIBS) \ $(GLIB_LIBS) \ $(GPLUGIN_LIBS) \ $(LIBXML_LIBS) \ - $(GSTVIDEO_LIBS) \ - $(top_builddir)/libpurple/libpurple.la + $(GSTVIDEO_LIBS) AM_CPPFLAGS = \ -DSTANDALONE \ diff --git a/libpurple/http.c b/libpurple/http.c index 6078afc5cb..3df6318f8b 100644 --- a/libpurple/http.c +++ b/libpurple/http.c @@ -751,8 +751,7 @@ static void _purple_http_gen_headers(PurpleHttpConnection *hc) request_url, req->http11 ? "1.1" : "1.0"); - if (tmp_url) - g_free(tmp_url); + g_free(tmp_url); if (!purple_http_headers_get(hdrs, "host")) g_string_append_printf(h, "Host: %s\r\n", url->host); @@ -1474,13 +1473,6 @@ static gboolean _purple_http_reconnect(PurpleHttpConnection *hc) return FALSE; } - if (is_ssl && !purple_ssl_is_supported()) { - _purple_http_error(hc, _("Unable to connect to %s: %s"), - url->host, _("Server requires TLS/SSL, " - "but no TLS/SSL support was found.")); - return FALSE; - } - if (hc->request->keepalive_pool != NULL) { hc->socket_request = purple_http_keepalive_pool_request( hc->request->keepalive_pool, hc->gc, url->host, @@ -1756,13 +1748,6 @@ void purple_http_conn_cancel_all(PurpleConnection *gc) "related to gc=%p (it shouldn't happen)\n", gc); } -gboolean purple_http_conn_is_cancelling(PurpleHttpConnection *http_conn) -{ - if (http_conn == NULL) - return FALSE; - return http_conn->is_cancelling; -} - gboolean purple_http_conn_is_running(PurpleHttpConnection *http_conn) { if (http_conn == NULL) diff --git a/libpurple/http.h b/libpurple/http.h index 43c5001c1c..a05bc38a54 100644 --- a/libpurple/http.h +++ b/libpurple/http.h @@ -222,16 +222,6 @@ void purple_http_conn_cancel(PurpleHttpConnection *http_conn); void purple_http_conn_cancel_all(PurpleConnection *gc); /** - * purple_http_conn_is_cancelling: - * @http_conn: The HTTP connection (may be invalid pointer). - * - * Checks, if provided HTTP request is cancelling. - * - * Returns: TRUE, if provided connection is currently cancelling. - */ -gboolean purple_http_conn_is_cancelling(PurpleHttpConnection *http_conn); - -/** * purple_http_conn_is_running: * @http_conn: The HTTP connection (may be invalid pointer). * diff --git a/libpurple/media/backend-fs2.c b/libpurple/media/backend-fs2.c index ad4b203bc9..d41448d987 100644 --- a/libpurple/media/backend-fs2.c +++ b/libpurple/media/backend-fs2.c @@ -76,7 +76,6 @@ static GList *purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self, static GList *purple_media_backend_fs2_get_local_candidates( PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant); -#if GST_CHECK_VERSION(1,0,0) static gboolean purple_media_backend_fs2_set_encryption_parameters ( PurpleMediaBackend *self, const gchar *sess_id, const gchar *cipher, const gchar *auth, const gchar *key, gsize key_len); @@ -84,7 +83,6 @@ static gboolean purple_media_backend_fs2_set_decryption_parameters( PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, const gchar *cipher, const gchar *auth, const gchar *key, gsize key_len); -#endif static gboolean purple_media_backend_fs2_set_remote_codecs( PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, @@ -230,14 +228,12 @@ purple_media_network_protocol_to_fs(PurpleMediaNetworkProtocol protocol) switch (protocol) { case PURPLE_MEDIA_NETWORK_PROTOCOL_UDP: return FS_NETWORK_PROTOCOL_UDP; -#if GST_CHECK_VERSION(1,0,0) case PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE: return FS_NETWORK_PROTOCOL_TCP_PASSIVE; case PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_ACTIVE: return FS_NETWORK_PROTOCOL_TCP_ACTIVE; case PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_SO: return FS_NETWORK_PROTOCOL_TCP_SO; -#endif default: g_return_val_if_reached(FS_NETWORK_PROTOCOL_TCP); } @@ -249,30 +245,21 @@ purple_media_network_protocol_from_fs(FsNetworkProtocol protocol) switch (protocol) { case FS_NETWORK_PROTOCOL_UDP: return PURPLE_MEDIA_NETWORK_PROTOCOL_UDP; -#if GST_CHECK_VERSION(1,0,0) case FS_NETWORK_PROTOCOL_TCP_PASSIVE: return PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE; case FS_NETWORK_PROTOCOL_TCP_ACTIVE: return PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_ACTIVE; case FS_NETWORK_PROTOCOL_TCP_SO: return PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_SO; -#endif default: g_return_val_if_reached(PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE); } } -#if GST_CHECK_VERSION(1,0,0) static GstPadProbeReturn event_probe_cb(GstPad *srcpad, GstPadProbeInfo *info, gpointer unused) -#else -static gboolean -event_probe_cb(GstPad *srcpad, GstEvent *event, gboolean release_pad) -#endif { -#if GST_CHECK_VERSION(1,0,0) GstEvent *event = GST_PAD_PROBE_INFO_EVENT(info); -#endif if (GST_EVENT_TYPE(event) == GST_EVENT_CUSTOM_DOWNSTREAM && gst_event_has_name(event, "purple-unlink-tee")) { @@ -280,40 +267,23 @@ event_probe_cb(GstPad *srcpad, GstEvent *event, gboolean release_pad) gst_pad_unlink(srcpad, gst_pad_get_peer(srcpad)); -#if GST_CHECK_VERSION(1,0,0) gst_pad_remove_probe(srcpad, g_value_get_ulong(gst_structure_get_value(s, "handler-id"))); -#else - gst_pad_remove_event_probe(srcpad, - g_value_get_uint(gst_structure_get_value(s, "handler-id"))); -#endif if (g_value_get_boolean(gst_structure_get_value(s, "release-pad"))) gst_element_release_request_pad(GST_ELEMENT_PARENT(srcpad), srcpad); -#if GST_CHECK_VERSION(1,0,0) return GST_PAD_PROBE_DROP; -#else - return FALSE; -#endif } -#if GST_CHECK_VERSION(1,0,0) return GST_PAD_PROBE_OK; -#else - return TRUE; -#endif } static void unlink_teepad_dynamic(GstPad *srcpad, gboolean release_pad) { -#if GST_CHECK_VERSION(1,0,0) gulong id = gst_pad_add_probe(srcpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, event_probe_cb, NULL, NULL); -#else - guint id = gst_pad_add_event_probe(srcpad, G_CALLBACK(event_probe_cb), NULL); -#endif if (GST_IS_GHOST_PAD(srcpad)) srcpad = gst_ghost_pad_get_target(GST_GHOST_PAD(srcpad)); @@ -322,11 +292,7 @@ unlink_teepad_dynamic(GstPad *srcpad, gboolean release_pad) gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM, gst_structure_new("purple-unlink-tee", "release-pad", G_TYPE_BOOLEAN, release_pad, -#if GST_CHECK_VERSION(1,0,0) "handler-id", G_TYPE_ULONG, id, -#else - "handler-id", G_TYPE_UINT, id, -#endif NULL))); } @@ -548,12 +514,10 @@ purple_media_backend_iface_init(PurpleMediaBackendIface *iface) purple_media_backend_fs2_get_local_candidates; iface->set_remote_codecs = purple_media_backend_fs2_set_remote_codecs; iface->set_send_codec = purple_media_backend_fs2_set_send_codec; -#if GST_CHECK_VERSION(1,0,0) iface->set_encryption_parameters = purple_media_backend_fs2_set_encryption_parameters; iface->set_decryption_parameters = purple_media_backend_fs2_set_decryption_parameters; -#endif iface->set_params = purple_media_backend_fs2_set_params; iface->get_available_params = purple_media_backend_fs2_get_available_params; iface->send_dtmf = purple_media_backend_fs2_send_dtmf; @@ -934,13 +898,9 @@ gst_msg_db_to_percent(GstMessage *msg, gchar *value_name) gdouble percent; list = gst_structure_get_value(gst_message_get_structure(msg), value_name); -#if GST_CHECK_VERSION(1,0,0) G_GNUC_BEGIN_IGNORE_DEPRECATIONS value = g_value_array_get_nth(g_value_get_boxed(list), 0); G_GNUC_END_IGNORE_DEPRECATIONS -#else - value = gst_value_list_get_value(list, 0); -#endif value_db = g_value_get_double(value); percent = pow(10, value_db / 20); return (percent > 1.0) ? 1.0 : percent; @@ -1670,11 +1630,7 @@ create_src(PurpleMediaBackendFs2 *self, const gchar *sess_id, srcpad = gst_element_get_static_pad(session->srcvalve, "src"); g_object_set(volume, "volume", input_volume, NULL); } else { -#if GST_CHECK_VERSION(1,0,0) srcpad = gst_element_get_request_pad(session->tee, "src_%u"); -#else - srcpad = gst_element_get_request_pad(session->tee, "src%d"); -#endif } purple_debug_info("backend-fs2", "connecting pad: %s\n", @@ -1926,11 +1882,7 @@ src_pad_added_cb(FsStream *fsstream, GstPad *srcpad, gst_element_link(stream->queue, stream->volume); sink = stream->queue; } else if (codec->media_type == FS_MEDIA_TYPE_VIDEO) { -#if GST_CHECK_VERSION(1,0,0) stream->src = gst_element_factory_make("funnel", NULL); -#else - stream->src = gst_element_factory_make("fsfunnel", NULL); -#endif sink = gst_element_factory_make("fakesink", NULL); g_object_set(G_OBJECT(sink), "async", FALSE, NULL); gst_bin_add(GST_BIN(priv->confbin), sink); @@ -1938,11 +1890,7 @@ src_pad_added_cb(FsStream *fsstream, GstPad *srcpad, stream->fakesink = sink; #ifdef HAVE_MEDIA_APPLICATION } else if (codec->media_type == FS_MEDIA_TYPE_APPLICATION) { -#if GST_CHECK_VERSION(1,0,0) stream->src = gst_element_factory_make("funnel", NULL); -#else - stream->src = gst_element_factory_make("fsfunnel", NULL); -#endif sink = purple_media_manager_get_element( purple_media_get_manager(priv->media), PURPLE_MEDIA_RECV_APPLICATION, priv->media, @@ -1960,11 +1908,7 @@ src_pad_added_cb(FsStream *fsstream, GstPad *srcpad, gst_element_link_many(stream->src, stream->tee, sink, NULL); } -#if GST_CHECK_VERSION(1,0,0) sinkpad = gst_element_get_request_pad(stream->src, "sink_%u"); -#else - sinkpad = gst_element_get_request_pad(stream->src, "sink%d"); -#endif gst_pad_link(srcpad, sinkpad); gst_object_unref(sinkpad); @@ -2405,7 +2349,6 @@ purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self, return TRUE; } -#if GST_CHECK_VERSION(1,0,0) static GstStructure * create_fs2_srtp_structure(const gchar *cipher, const gchar *auth, const gchar *key, gsize key_len) @@ -2494,7 +2437,6 @@ purple_media_backend_fs2_set_decryption_parameters (PurpleMediaBackend *self, gst_structure_free(srtp); return result; } -#endif /* GST 1.0+ */ static gboolean purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self, diff --git a/libpurple/mediamanager.c b/libpurple/mediamanager.c index dfb8731f37..f8e19749d7 100644 --- a/libpurple/mediamanager.c +++ b/libpurple/mediamanager.c @@ -35,11 +35,7 @@ #include <media/backend-fs2.h> #include <farstream/fs-element-added-notifier.h> -#if GST_CHECK_VERSION(1,0,0) #include <gst/video/videooverlay.h> -#else -#include <gst/interfaces/xoverlay.h> -#endif #ifdef HAVE_MEDIA_APPLICATION #include <gst/app/app.h> #endif @@ -312,11 +308,7 @@ purple_media_manager_get_pipeline(PurpleMediaManager *manager) gst_bus_add_signal_watch(GST_BUS(bus)); g_signal_connect(G_OBJECT(bus), "message", G_CALLBACK(pipeline_bus_call), manager); -#if GST_CHECK_VERSION(1,0,0) gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, NULL, NULL); -#else - gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, NULL); -#endif gst_object_unref(bus); filename = g_build_filename(purple_user_dir(), @@ -626,9 +618,7 @@ request_pad_unlinked_cb(GstPad *pad, GstPad *peer, gpointer user_data) { GstElement *parent = GST_ELEMENT_PARENT(pad); GstIterator *iter; -#if GST_CHECK_VERSION(1,0,0) GValue tmp = G_VALUE_INIT; -#endif GstPad *remaining_pad; GstIteratorResult result; @@ -636,21 +626,15 @@ request_pad_unlinked_cb(GstPad *pad, GstPad *peer, gpointer user_data) iter = gst_element_iterate_src_pads(parent); -#if GST_CHECK_VERSION(1,0,0) result = gst_iterator_next(iter, &tmp); -#else - result = gst_iterator_next(iter, (gpointer)&remaining_pad); -#endif if (result == GST_ITERATOR_DONE) { gst_element_set_locked_state(parent, TRUE); gst_element_set_state(parent, GST_STATE_NULL); gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(parent)), parent); } else if (result == GST_ITERATOR_OK) { -#if GST_CHECK_VERSION(1,0,0) remaining_pad = g_value_get_object(&tmp); g_value_reset(&tmp); -#endif gst_object_unref(remaining_pad); } @@ -702,11 +686,7 @@ purple_media_manager_get_video_caps(PurpleMediaManager *manager) { #ifdef USE_VV if (manager->priv->video_caps == NULL) -#if GST_CHECK_VERSION(1,0,0) manager->priv->video_caps = gst_caps_from_string("video/x-raw," -#else - manager->priv->video_caps = gst_caps_from_string("video/x-raw-yuv," -#endif "width=[250,352], height=[200,288], framerate=[1/1,20/1]"); return manager->priv->video_caps; #else @@ -1159,11 +1139,7 @@ purple_media_manager_get_element(PurpleMediaManager *manager, g_free(id); tee = gst_bin_get_by_name(GST_BIN(ret), "tee"); -#if GST_CHECK_VERSION(1,0,0) pad = gst_element_get_request_pad(tee, "src_%u"); -#else - pad = gst_element_get_request_pad(tee, "src%d"); -#endif gst_object_unref(tee); ghost = gst_ghost_pad_new(NULL, pad); gst_object_unref(pad); @@ -1369,11 +1345,7 @@ window_id_cb(GstBus *bus, GstMessage *msg, PurpleMediaOutputWindow *ow) GstElement *sink; if (GST_MESSAGE_TYPE(msg) != GST_MESSAGE_ELEMENT -#if GST_CHECK_VERSION(1,0,0) || !gst_is_video_overlay_prepare_window_handle_message(msg)) -#else - || !gst_structure_has_name(msg->structure, "prepare-xwindow-id")) -#endif return; sink = GST_ELEMENT(GST_MESSAGE_SRC(msg)); @@ -1387,16 +1359,8 @@ window_id_cb(GstBus *bus, GstMessage *msg, PurpleMediaOutputWindow *ow) | G_SIGNAL_MATCH_DATA, 0, 0, NULL, window_id_cb, ow); -#if GST_CHECK_VERSION(1,0,0) gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(GST_MESSAGE_SRC(msg)), ow->window_id); -#elif GST_CHECK_VERSION(0,10,31) - gst_x_overlay_set_window_handle(GST_X_OVERLAY(GST_MESSAGE_SRC(msg)), - ow->window_id); -#else - gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GST_MESSAGE_SRC(msg)), - ow->window_id); -#endif } #endif @@ -1429,11 +1393,7 @@ purple_media_manager_create_output_window(PurpleMediaManager *manager, continue; queue = gst_element_factory_make("queue", NULL); -#if GST_CHECK_VERSION(1,0,0) convert = gst_element_factory_make("videoconvert", NULL); -#else - convert = gst_element_factory_make("ffmpegcolorspace", NULL); -#endif ow->sink = purple_media_manager_get_element( manager, PURPLE_MEDIA_RECV_VIDEO, ow->media, ow->session_id, diff --git a/libpurple/network.c b/libpurple/network.c index 6255c31045..8588c48c56 100644 --- a/libpurple/network.c +++ b/libpurple/network.c @@ -1014,7 +1014,7 @@ purple_network_set_stun_server(const gchar *stun_server) purple_debug_info("network", "network is unavailable, don't try to update STUN IP"); } - } else if (stun_ip) { + } else { g_free(stun_ip); stun_ip = NULL; } @@ -1034,7 +1034,7 @@ purple_network_set_turn_server(const gchar *turn_server) purple_debug_info("network", "network is unavailable, don't try to update TURN IP"); } - } else if (turn_ip) { + } else { g_free(turn_ip); turn_ip = NULL; } @@ -1304,8 +1304,7 @@ purple_network_uninit(void) purple_signal_unregister(purple_network_get_handle(), "network-configuration-changed"); - if (stun_ip) - g_free(stun_ip); + g_free(stun_ip); g_hash_table_destroy(upnp_port_mappings); g_hash_table_destroy(nat_pmp_port_mappings); diff --git a/libpurple/plugins/perl/common/SSLConn.xs b/libpurple/plugins/perl/common/SSLConn.xs index 3730e80683..f800c021a6 100644 --- a/libpurple/plugins/perl/common/SSLConn.xs +++ b/libpurple/plugins/perl/common/SSLConn.xs @@ -28,9 +28,6 @@ purple_ssl_close(gsc) Purple::Ssl::Ops purple_ssl_get_ops() -gboolean -purple_ssl_is_supported() - size_t purple_ssl_read(gsc, buffer, len) Purple::Ssl::Connection gsc diff --git a/libpurple/plugins/ssl/ssl-nss.c b/libpurple/plugins/ssl/ssl-nss.c index d068c8c401..fe407f8599 100644 --- a/libpurple/plugins/ssl/ssl-nss.c +++ b/libpurple/plugins/ssl/ssl-nss.c @@ -682,8 +682,7 @@ x509_import_from_file(const gchar *filename) if (len == 0) { purple_debug_error("nss/x509", "Certificate file has no contents!\n"); - if (rawcert) - g_free(rawcert); + g_free(rawcert); return NULL; } @@ -731,8 +730,7 @@ x509_importcerts_from_file(const gchar *filename) if (len == 0) { purple_debug_error("nss/x509", "Certificate file has no contents!\n"); - if (rawcert) - g_free(rawcert); + g_free(rawcert); return NULL; } diff --git a/libpurple/protocols/bonjour/bonjour.h b/libpurple/protocols/bonjour/bonjour.h index a16fa6811a..42b89fc50b 100644 --- a/libpurple/protocols/bonjour/bonjour.h +++ b/libpurple/protocols/bonjour/bonjour.h @@ -26,6 +26,8 @@ #ifndef _BONJOUR_H_ #define _BONJOUR_H_ +#include <gmodule.h> + #include "internal.h" #include "protocol.h" diff --git a/libpurple/protocols/facebook/Makefile.mingw b/libpurple/protocols/facebook/Makefile.mingw index f34fed9c95..3fe4e70a9a 100644 --- a/libpurple/protocols/facebook/Makefile.mingw +++ b/libpurple/protocols/facebook/Makefile.mingw @@ -59,6 +59,7 @@ OBJECTS = $(C_SRC:%.c=%.o) ## LIBS = \ -lglib-2.0 \ + -lgio-2.0 \ -lgobject-2.0 \ -lws2_32 \ -lintl \ diff --git a/libpurple/protocols/facebook/api.c b/libpurple/protocols/facebook/api.c index 9c014bb940..118af2daea 100644 --- a/libpurple/protocols/facebook/api.c +++ b/libpurple/protocols/facebook/api.c @@ -50,8 +50,9 @@ enum struct _FbApiPrivate { - PurpleConnection *gc; FbMqtt *mqtt; + FbHttpConns *cons; + PurpleConnection *gc; GHashTable *data; FbId uid; @@ -160,6 +161,7 @@ fb_api_dispose(GObject *obj) FbApiPrivate *priv = FB_API(obj)->priv; GHashTableIter iter; + fb_http_conns_cancel_all(priv->cons); g_hash_table_iter_init(&iter, priv->data); while (g_hash_table_iter_next(&iter, NULL, (gpointer) &fata)) { @@ -167,14 +169,11 @@ fb_api_dispose(GObject *obj) g_free(fata); } - if (G_LIKELY(priv->gc != NULL)) { - purple_http_conn_cancel_all(priv->gc); - } - if (G_UNLIKELY(priv->mqtt != NULL)) { g_object_unref(priv->mqtt); } + fb_http_conns_free(priv->cons); g_hash_table_destroy(priv->data); g_hash_table_destroy(priv->mids); @@ -485,6 +484,7 @@ fb_api_init(FbApi *api) priv = G_TYPE_INSTANCE_GET_PRIVATE(api, FB_TYPE_API, FbApiPrivate); api->priv = priv; + priv->cons = fb_http_conns_new(); priv->data = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL); priv->mids = g_hash_table_new_full(g_int64_hash, g_int64_equal, @@ -646,19 +646,20 @@ fb_api_http_chk(FbApi *api, PurpleHttpConnection *con, PurpleHttpResponse *res, { const gchar *data; const gchar *msg; + FbApiPrivate *priv = api->priv; gchar *emsg; GError *err = NULL; gint code; gsize size; - if (G_UNLIKELY(purple_http_conn_is_cancelling(con))) { - /* Ignore canceling HTTP requests */ + if (fb_http_conns_is_canceled(priv->cons)) { return FALSE; } msg = purple_http_response_get_error(res); code = purple_http_response_get_code(res); data = purple_http_response_get_data(res, &size); + fb_http_conns_remove(priv->cons, con); if (msg != NULL) { emsg = g_strdup_printf("%s (%d)", msg, code); @@ -717,7 +718,7 @@ fb_api_http_req(FbApi *api, const gchar *url, const gchar *name, fb_http_params_set_str(params, "format", "json"); fb_http_params_set_str(params, "method", method); - val = fb_util_locale_str(); + val = fb_util_get_locale(); fb_http_params_set_str(params, "locale", val); g_free(val); @@ -755,6 +756,7 @@ fb_api_http_req(FbApi *api, const gchar *url, const gchar *name, data = fb_http_params_close(params, NULL); purple_http_request_set_contents(req, data, -1); ret = purple_http_request(priv->gc, req, callback, api); + fb_http_conns_add(priv->cons, ret); purple_http_request_unref(req); fb_util_debug(FB_UTIL_DEBUG_INFO, "HTTP Request (%p):", ret); @@ -919,7 +921,7 @@ fb_api_cb_mqtt_open(FbMqtt *mqtt, gpointer data) fb_thrift_write_stop(thft); bytes = fb_thrift_get_bytes(thft); - cytes = fb_util_zcompress(bytes, &err); + cytes = fb_util_zlib_deflate(bytes, &err); FB_API_ERROR_EMIT(api, err, g_object_unref(thft); @@ -1619,10 +1621,10 @@ fb_api_cb_mqtt_publish(FbMqtt *mqtt, const gchar *topic, GByteArray *pload, {"/t_p", fb_api_cb_publish_p} }; - comp = fb_util_zcompressed(pload); + comp = fb_util_zlib_test(pload); if (G_LIKELY(comp)) { - bytes = fb_util_zuncompress(pload, &err); + bytes = fb_util_zlib_inflate(pload, &err); FB_API_ERROR_EMIT(api, err, return); } else { bytes = (GByteArray*) pload; @@ -1685,7 +1687,7 @@ fb_api_rehash(FbApi *api) priv = api->priv; if (priv->cid == NULL) { - priv->cid = fb_util_randstr(32); + priv->cid = fb_util_rand_alnum(32); } if (priv->did == NULL) { @@ -1954,6 +1956,8 @@ fb_api_cb_contacts(PurpleHttpConnection *con, PurpleHttpResponse *res, fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE, "$.graph_api_write_id"); fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE, + "$.represented_profile.friendship_status"); + fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE, "$.represented_profile.id"); fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE, "$.structured_name.text"); @@ -1965,6 +1969,12 @@ fb_api_cb_contacts(PurpleHttpConnection *con, PurpleHttpResponse *res, while (fb_json_values_update(values, &err)) { g_free(writeid); writeid = fb_json_values_next_str_dup(values, NULL); + str = fb_json_values_next_str(values, NULL); + + if (!purple_strequal(str, "ARE_FRIENDS")) { + continue; + } + user = fb_api_user_dup(NULL, FALSE); str = fb_json_values_next_str(values, "0"); @@ -2127,7 +2137,7 @@ fb_api_publish(FbApi *api, const gchar *topic, const gchar *format, ...) va_end(ap); bytes = g_byte_array_new_take((guint8*) msg, strlen(msg)); - cytes = fb_util_zcompress(bytes, &err); + cytes = fb_util_zlib_deflate(bytes, &err); FB_API_ERROR_EMIT(api, err, g_byte_array_free(bytes, TRUE); diff --git a/libpurple/protocols/facebook/data.c b/libpurple/protocols/facebook/data.c index c9d2e97dae..d855886036 100644 --- a/libpurple/protocols/facebook/data.c +++ b/libpurple/protocols/facebook/data.c @@ -30,6 +30,7 @@ struct _FbDataPrivate { FbApi *api; + FbHttpConns *cons; PurpleConnection *gc; PurpleRoomlist *roomlist; GQueue *msgs; @@ -67,6 +68,7 @@ fb_data_dispose(GObject *obj) GHashTableIter iter; gpointer ptr; + fb_http_conns_cancel_all(priv->cons); g_hash_table_iter_init(&iter, priv->evs); while (g_hash_table_iter_next(&iter, NULL, &ptr)) { @@ -77,6 +79,7 @@ fb_data_dispose(GObject *obj) g_object_unref(priv->api); } + fb_http_conns_free(priv->cons); g_queue_free_full(priv->msgs, (GDestroyNotify) fb_api_message_free); g_hash_table_destroy(priv->imgs); @@ -101,7 +104,9 @@ fb_data_init(FbData *fata) priv = G_TYPE_INSTANCE_GET_PRIVATE(fata, FB_TYPE_DATA, FbDataPrivate); fata->priv = priv; + priv->cons = fb_http_conns_new(); priv->msgs = g_queue_new(); + priv->imgs = g_hash_table_new_full(g_direct_hash, g_direct_equal, g_object_unref, NULL); priv->unread = g_hash_table_new_full(fb_id_hash, fb_id_equal, @@ -528,22 +533,25 @@ fb_data_image_cb(PurpleHttpConnection *con, PurpleHttpResponse *res, { FbDataImage *img = data; FbDataImagePrivate *priv = img->priv; + FbDataPrivate *driv = priv->fata->priv; GError *err = NULL; - if (G_UNLIKELY(purple_http_conn_is_cancelling(con))) { - /* Ignore canceling HTTP requests */ + if (fb_http_conns_is_canceled(driv->cons)) { return; } + fb_http_conns_remove(driv->cons, con); fb_http_error_chk(res, &err); + priv->image = (guint8*) purple_http_response_get_data(res, &priv->size); priv->func(img, err); - if (G_UNLIKELY(err != NULL)) { + if (G_LIKELY(err == NULL)) { + fb_data_image_queue(priv->fata); + } else { g_error_free(err); } - fb_data_image_queue(priv->fata); g_object_unref(img); } @@ -555,6 +563,7 @@ fb_data_image_queue(FbData *fata) FbDataPrivate *priv; GHashTableIter iter; guint active = 0; + PurpleHttpConnection *con; g_return_if_fail(FB_IS_DATA(fata)); priv = fata->priv; @@ -579,7 +588,8 @@ fb_data_image_queue(FbData *fata) img->priv->active = TRUE; url = fb_data_image_get_url(img); - purple_http_get(priv->gc, fb_data_image_cb, img, url); + con = purple_http_get(priv->gc, fb_data_image_cb, img, url); + fb_http_conns_add(priv->cons, con); if (++active >= FB_DATA_ICON_MAX) { break; diff --git a/libpurple/protocols/facebook/facebook.c b/libpurple/protocols/facebook/facebook.c index 9c9d855b53..a9d92716b5 100644 --- a/libpurple/protocols/facebook/facebook.c +++ b/libpurple/protocols/facebook/facebook.c @@ -854,13 +854,6 @@ fb_login(PurpleAccount *acct) gc = purple_account_get_connection(acct); - if (!purple_ssl_is_supported()) { - purple_connection_error(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support unavailable")); - return; - } - fata = fb_data_new(gc); api = fb_data_get_api(fata); convh = purple_conversations_get_handle(); diff --git a/libpurple/protocols/facebook/facebook.h b/libpurple/protocols/facebook/facebook.h index 43450e822f..edc8b26277 100644 --- a/libpurple/protocols/facebook/facebook.h +++ b/libpurple/protocols/facebook/facebook.h @@ -32,6 +32,7 @@ */ #include <glib.h> +#include <gmodule.h> #define FACEBOOK_TYPE_PROTOCOL (facebook_protocol_get_type()) #define FACEBOOK_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), FACEBOOK_TYPE_PROTOCOL, FacebookProtocol)) diff --git a/libpurple/protocols/facebook/http.c b/libpurple/protocols/facebook/http.c index 9f54581192..caeeadccb2 100644 --- a/libpurple/protocols/facebook/http.c +++ b/libpurple/protocols/facebook/http.c @@ -25,6 +25,12 @@ #include "http.h" +struct _FbHttpConns +{ + GHashTable *cons; + gboolean canceled; +}; + GQuark fb_http_error_quark(void) { @@ -37,6 +43,74 @@ fb_http_error_quark(void) return q; } +FbHttpConns * +fb_http_conns_new(void) +{ + FbHttpConns *cons; + + cons = g_new0(FbHttpConns, 1); + cons->cons = g_hash_table_new(g_direct_hash, g_direct_equal); + return cons; +} + +void +fb_http_conns_free(FbHttpConns *cons) +{ + g_return_if_fail(cons != NULL); + + g_hash_table_destroy(cons->cons); + g_free(cons); +} + +void +fb_http_conns_cancel_all(FbHttpConns *cons) +{ + GHashTableIter iter; + gpointer con; + + g_return_if_fail(cons != NULL); + g_return_if_fail(!cons->canceled); + + cons->canceled = TRUE; + g_hash_table_iter_init(&iter, cons->cons); + + while (g_hash_table_iter_next(&iter, &con, NULL)) { + g_hash_table_iter_remove(&iter); + purple_http_conn_cancel(con); + } +} + +gboolean +fb_http_conns_is_canceled(FbHttpConns *cons) +{ + g_return_val_if_fail(cons != NULL, TRUE); + return cons->canceled; +} + +void +fb_http_conns_add(FbHttpConns *cons, PurpleHttpConnection *con) +{ + g_return_if_fail(cons != NULL); + g_return_if_fail(!cons->canceled); + g_hash_table_replace(cons->cons, con, con); +} + +void +fb_http_conns_remove(FbHttpConns *cons, PurpleHttpConnection *con) +{ + g_return_if_fail(cons != NULL); + g_return_if_fail(!cons->canceled); + g_hash_table_remove(cons->cons, con); +} + +void +fb_http_conns_reset(FbHttpConns *cons) +{ + g_return_if_fail(cons != NULL); + cons->canceled = FALSE; + g_hash_table_remove_all(cons->cons); +} + gboolean fb_http_error_chk(PurpleHttpResponse *res, GError **error) { diff --git a/libpurple/protocols/facebook/http.h b/libpurple/protocols/facebook/http.h index e509b097a1..17bbf8d26d 100644 --- a/libpurple/protocols/facebook/http.h +++ b/libpurple/protocols/facebook/http.h @@ -43,6 +43,13 @@ #define FB_HTTP_ERROR fb_http_error_quark() /** + * FbHttpConns: + * + * Represents a set of #PurpleHttpConnection. + */ +typedef struct _FbHttpConns FbHttpConns; + +/** * FbHttpParams: * * Represents a set of key/value HTTP parameters. @@ -73,9 +80,81 @@ GQuark fb_http_error_quark(void); /** + * fb_http_conns_new: + * + * Creates a new #FbHttpConns. The returned #FbHttpConns should be + * freed with #fb_http_conns_free() when no longer needed. + * + * Returns: The new #FbHttpConns. + */ +FbHttpConns * +fb_http_conns_new(void); + +/** + * fb_http_conns_free: + * @cons: The #FbHttpConns. + * + * Frees all memory used by the #FbHttpConns. This will *not* cancel + * the any of the added #PurpleHttpConnection. + */ +void +fb_http_conns_free(FbHttpConns *cons); + +/** + * fb_http_conns_cancel_all: + * @cons: The #FbHttpConns. + * + * Cancels each #PurpleHttpConnection in the #FbHttpConns. + */ +void +fb_http_conns_cancel_all(FbHttpConns *cons); + +/** + * fb_http_conns_is_canceled: + * @cons: The #FbHttpConns. + * + * Determines if the #FbHttpConns has been canceled. + * + * Returns: #TRUE if it has been canceled, otherwise #FALSE. + */ +gboolean +fb_http_conns_is_canceled(FbHttpConns *cons); + +/** + * fb_http_conns_add: + * @cons: The #FbHttpConns. + * @con: The #PurpleHttpConnection. + * + * Adds a #PurpleHttpConnection to the #FbHttpConns. + */ +void +fb_http_conns_add(FbHttpConns *cons, PurpleHttpConnection *con); + +/** + * fb_http_conns_remove: + * @cons: The #FbHttpConns. + * @con: The #PurpleHttpConnection. + * + * Removes a #PurpleHttpConnection from the #FbHttpConns. + */ +void +fb_http_conns_remove(FbHttpConns *cons, PurpleHttpConnection *con); + +/** + * fb_http_conns_reset: + * @cons: The #FbHttpConns. + * + * Resets the #FbHttpConns. This removes each #PurpleHttpConnection + * from the #FbHttpConns *without* canceling it. This allows the the + * #FbHttpConns to be reused. + */ +void +fb_http_conns_reset(FbHttpConns *cons); + +/** * fb_http_error_chk: * @res: The #PurpleHttpResponse. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Checks a #PurpleHttpResponse for success. This optionally assigns an * appropriate #GError upon failure. @@ -142,7 +221,7 @@ fb_http_params_close(FbHttpParams *params, const gchar *url); * fb_http_params_get_bool: * @params: The #FbHttpParams. * @name: The parameter name. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Gets a boolean value from the #FbHttpParams. This optionally assigns * an appropriate #GError upon failure. @@ -157,7 +236,7 @@ fb_http_params_get_bool(FbHttpParams *params, const gchar *name, * fb_http_params_get_dbl: * @params: The #FbHttpParams. * @name: The parameter name. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Gets a floating point value from the #FbHttpParams. This optionally * assigns an appropriate #GError upon failure. @@ -172,7 +251,7 @@ fb_http_params_get_dbl(FbHttpParams *params, const gchar *name, * fb_http_params_get_int: * @params: The #FbHttpParams. * @name: The parameter name. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Gets an integer value from the #FbHttpParams. This optionally * assigns an appropriate #GError upon failure. @@ -187,7 +266,7 @@ fb_http_params_get_int(FbHttpParams *params, const gchar *name, * fb_http_params_get_str: * @params: The #FbHttpParams. * @name: The parameter name. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Gets a string value from the #FbHttpParams. This optionally assigns * an appropriate #GError upon failure. @@ -202,7 +281,7 @@ fb_http_params_get_str(FbHttpParams *params, const gchar *name, * fb_http_params_dup_str: * @params: The #FbHttpParams. * @name: The parameter name. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Gets a duplicated string value from the #FbHttpParams. This * optionally assigns an appropriate #GError upon failure. The returned diff --git a/libpurple/protocols/facebook/id.h b/libpurple/protocols/facebook/id.h index a2adcc73a5..37a31a6e45 100644 --- a/libpurple/protocols/facebook/id.h +++ b/libpurple/protocols/facebook/id.h @@ -93,7 +93,7 @@ * * Return: #TRUE if the string is an #FbId, otherwise #FALSE. */ -#define FB_ID_IS_STR(s) fb_util_str_is(s, G_ASCII_DIGIT) +#define FB_ID_IS_STR(s) fb_util_strtest(s, G_ASCII_DIGIT) /** * FB_ID_TO_STR: diff --git a/libpurple/protocols/facebook/json.c b/libpurple/protocols/facebook/json.c index f931ecd61a..f36839c534 100644 --- a/libpurple/protocols/facebook/json.c +++ b/libpurple/protocols/facebook/json.c @@ -258,13 +258,23 @@ fb_json_bldr_add_strf(JsonBuilder *bldr, const gchar *name, JsonNode * fb_json_node_new(const gchar *data, gssize size, GError **error) { + gchar *slice; JsonNode *root; JsonParser *prsr; + g_return_val_if_fail(data != NULL, NULL); + + if (size < 0) { + size = strlen(data); + } + + /* Ensure data is null terminated for json-glib < 1.0.2 */ + slice = g_strndup(data, size); prsr = json_parser_new(); - if (!json_parser_load_from_data(prsr, data, size, error)) { + if (!json_parser_load_from_data(prsr, slice, size, error)) { g_object_unref(prsr); + g_free(slice); return NULL; } @@ -272,6 +282,7 @@ fb_json_node_new(const gchar *data, gssize size, GError **error) root = json_node_copy(root); g_object_unref(prsr); + g_free(slice); return root; } @@ -284,6 +295,11 @@ fb_json_node_get(JsonNode *root, const gchar *expr, GError **error) JsonNode *node; JsonNode *ret; + /* Special case for json-glib < 0.99.2 */ + if (purple_strequal(expr, "$")) { + return json_node_copy(root); + } + node = json_path_query(expr, root, &err); if (err != NULL) { diff --git a/libpurple/protocols/facebook/json.h b/libpurple/protocols/facebook/json.h index 7b83686da5..342ff9c5b8 100644 --- a/libpurple/protocols/facebook/json.h +++ b/libpurple/protocols/facebook/json.h @@ -167,7 +167,7 @@ fb_json_bldr_close(JsonBuilder *bldr, JsonNodeType type, gsize *size); /** * fb_json_bldr_arr_begin: * @bldr: The #JsonBuilder. - * @name: The member name, or #NULL. + * @name: The member name or #NULL. * * Begins an array member in the #JsonBuilder. */ @@ -186,7 +186,7 @@ fb_json_bldr_arr_end(JsonBuilder *bldr); /** * fb_json_bldr_obj_begin: * @bldr: The #JsonBuilder. - * @name: The member name, or #NULL. + * @name: The member name or #NULL. * * Begins an object member in the #JsonBuilder. */ @@ -205,7 +205,7 @@ fb_json_bldr_obj_end(JsonBuilder *bldr); /** * fb_json_bldr_add_bool: * @bldr: The #JsonBuilder. - * @name: The member name, or #NULL. + * @name: The member name or #NULL. * @value: The value. * * Adds a boolean memeber to the #JsonBuilder. @@ -216,7 +216,7 @@ fb_json_bldr_add_bool(JsonBuilder *bldr, const gchar *name, gboolean value); /** * fb_json_bldr_add_dbl: * @bldr: The #JsonBuilder. - * @name: The member name, or #NULL. + * @name: The member name or #NULL. * @value: The value. * * Adds a floating point memeber to the #JsonBuilder. @@ -227,7 +227,7 @@ fb_json_bldr_add_dbl(JsonBuilder *bldr, const gchar *name, gdouble value); /** * fb_json_bldr_add_int: * @bldr: The #JsonBuilder. - * @name: The member name, or #NULL. + * @name: The member name or #NULL. * @value: The value. * * Adds a integer memeber to the #JsonBuilder. @@ -238,7 +238,7 @@ fb_json_bldr_add_int(JsonBuilder *bldr, const gchar *name, gint64 value); /** * fb_json_bldr_add_str: * @bldr: The #JsonBuilder. - * @name: The member name, or #NULL. + * @name: The member name or #NULL. * @value: The value. * * Adds a string memeber to the #JsonBuilder. @@ -249,7 +249,7 @@ fb_json_bldr_add_str(JsonBuilder *bldr, const gchar *name, const gchar *value); /** * fb_json_bldr_add_strf: * @bldr: The #JsonBuilder. - * @name: The member name, or #NULL. + * @name: The member name or #NULL. * @format: The format string literal. * @...: The arguments for @format. * @@ -263,8 +263,8 @@ fb_json_bldr_add_strf(JsonBuilder *bldr, const gchar *name, /** * fb_json_node_new: * @data: The string JSON. - * @size: The size of @json, or -1 if null-terminated. - * @error: The return location for the #GError, or #NULL. + * @size: The size of @json or -1 if null-terminated. + * @error: The return location for the #GError or #NULL. * * Creates a new #JsonNode. The returned #JsonBuilder should be freed * wuth #json_node_free() when no longer needed. @@ -278,7 +278,7 @@ fb_json_node_new(const gchar *data, gssize size, GError **error); * fb_json_node_get: * @root: The root #JsonNode. * @expr: The #JsonPath expression. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Gets a new #JsonNode value from a parent #JsonNode with a #JsonPath * expression. The returned #JsonNode should be freed with @@ -306,7 +306,7 @@ fb_json_node_get_nth(JsonNode *root, guint n); * fb_json_node_get_arr: * @root: The root #JsonNode. * @expr: The #JsonPath expression. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Gets a new #JsonArray value from a parent #JsonNode with a #JsonPath * expression. The returned #JsonArray should be freed with @@ -321,7 +321,7 @@ fb_json_node_get_arr(JsonNode *root, const gchar *expr, GError **error); * fb_json_node_get_bool: * @root: The root #JsonNode. * @expr: The #JsonPath expression. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Gets a boolean value from a parent #JsonNode with a #JsonPath * expression. @@ -335,7 +335,7 @@ fb_json_node_get_bool(JsonNode *root, const gchar *expr, GError **error); * fb_json_node_get_dbl: * @root: The root #JsonNode. * @expr: The #JsonPath expression. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Gets a floating point value from a parent #JsonNode with a #JsonPath * expression. @@ -349,7 +349,7 @@ fb_json_node_get_dbl(JsonNode *root, const gchar *expr, GError **error); * fb_json_node_get_int: * @root: The root #JsonNode. * @expr: The #JsonPath expression. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Gets an integer value from a parent #JsonNode with a #JsonPath * expression. @@ -363,7 +363,7 @@ fb_json_node_get_int(JsonNode *root, const gchar *expr, GError **error); * fb_json_node_get_str: * @root: The root #JsonNode. * @expr: The #JsonPath expression. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Gets an string value from a parent #JsonNode with a #JsonPath * expression. The returned string should be freed with #g_free() @@ -404,8 +404,8 @@ fb_json_values_add(FbJsonValues *values, FbJsonType type, gboolean required, * @values: The #FbJsonValues. * * Gets the current working root #JsonNode. This is either the current - * array #JsonNode, or the root #JsonNode. The returned #JsonNode - * should not be freed. + * array #JsonNode or the root #JsonNode. The returned #JsonNode should + * not be freed. */ JsonNode * fb_json_values_get_root(FbJsonValues *values); @@ -425,7 +425,7 @@ fb_json_values_set_array(FbJsonValues *values, gboolean required, /** * fb_json_values_update: * @values: The #FbJsonValues. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Updates the current working root. This should be called after all of * the #FbJsonValue's have been added with #fb_json_values_add(). If an diff --git a/libpurple/protocols/facebook/mqtt.h b/libpurple/protocols/facebook/mqtt.h index 60922ae306..f9fb4818ad 100644 --- a/libpurple/protocols/facebook/mqtt.h +++ b/libpurple/protocols/facebook/mqtt.h @@ -521,7 +521,7 @@ fb_mqtt_message_read_r(FbMqttMessage *msg, GByteArray *bytes); /** * fb_mqtt_message_read_byte: * @msg: The #FbMqttMessage. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads an 8-bit integer value from the #FbMqttMessage. If @value is * #NULL, this will simply advance the cursor position. @@ -534,7 +534,7 @@ fb_mqtt_message_read_byte(FbMqttMessage *msg, guint8 *value); /** * fb_mqtt_message_read_mid: * @msg: The #FbMqttMessage. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads a message identifier from the #FbMqttMessage. If @value is * #NULL, this will simply advance the cursor position. @@ -547,7 +547,7 @@ fb_mqtt_message_read_mid(FbMqttMessage *msg, guint16 *value); /** * fb_mqtt_message_read_u16: * @msg: The #FbMqttMessage. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads a 16-bit integer value from the #FbMqttMessage. If @value is * #NULL, this will simply advance the cursor position. @@ -560,7 +560,7 @@ fb_mqtt_message_read_u16(FbMqttMessage *msg, guint16 *value); /** * fb_mqtt_message_read_str: * @msg: The #FbMqttMessage. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads a string value from the #FbMqttMessage. The value returned to * @value should be freed with #g_free() when no longer needed. If diff --git a/libpurple/protocols/facebook/thrift.h b/libpurple/protocols/facebook/thrift.h index 708a863e0b..620383fc86 100644 --- a/libpurple/protocols/facebook/thrift.h +++ b/libpurple/protocols/facebook/thrift.h @@ -193,7 +193,7 @@ fb_thrift_read(FbThrift *thft, gpointer data, guint size); /** * fb_thrift_read_bool: * @thft: The #FbThrift. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads a boolean value from the #FbThrift. If @value is #NULL, this * will simply advance the cursor position. @@ -206,7 +206,7 @@ fb_thrift_read_bool(FbThrift *thft, gboolean *value); /** * fb_thrift_read_byte: * @thft: The #FbThrift. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads an 8-bit integer value from the #FbThrift. If @value is #NULL, * this will simply advance the cursor position. @@ -219,7 +219,7 @@ fb_thrift_read_byte(FbThrift *thft, guint8 *value); /** * fb_thrift_read_dbl: * @thft: The #FbThrift. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads a 64-bit floating point value from the #FbThrift. If @value * is #NULL, this will simply advance the cursor position. @@ -232,7 +232,7 @@ fb_thrift_read_dbl(FbThrift *thft, gdouble *value); /** * fb_thrift_read_i16: * @thft: The #FbThrift. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads a signed 16-bit integer value from the #FbThrift. This will * convert the integer from the zig-zag format. If @value is #NULL, @@ -246,7 +246,7 @@ fb_thrift_read_i16(FbThrift *thft, gint16 *value); /** * fb_thrift_read_vi16: * @thft: The #FbThrift. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads a 16-bit integer value from the #FbThrift. This reads the raw * integer value without converting it from the zig-zag format. If @@ -260,7 +260,7 @@ fb_thrift_read_vi16(FbThrift *thft, guint16 *value); /** * fb_thrift_read_i32: * @thft: The #FbThrift. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads a signed 32-bit integer value from the #FbThrift. This will * convert the integer from the zig-zag format. If @value is #NULL, @@ -274,7 +274,7 @@ fb_thrift_read_i32(FbThrift *thft, gint32 *value); /** * fb_thrift_read_vi32: * @thft: The #FbThrift. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads a 32-bit integer value from the #FbThrift. This reads the raw * integer value without converting it from the zig-zag format. If @@ -288,7 +288,7 @@ fb_thrift_read_vi32(FbThrift *thft, guint32 *value); /** * fb_thrift_read_i64: * @thft: The #FbThrift. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads a signed 64-bit integer value from the #FbThrift. This will * convert the integer from the zig-zag format. If @value is #NULL, @@ -302,7 +302,7 @@ fb_thrift_read_i64(FbThrift *thft, gint64 *value); /** * fb_thrift_read_vi64: * @thft: The #FbThrift. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads a 64-bit integer value from the #FbThrift. This reads the raw * integer value without converting it from the zig-zag format. If @@ -316,7 +316,7 @@ fb_thrift_read_vi64(FbThrift *thft, guint64 *value); /** * fb_thrift_read_str: * @thft: The #FbThrift. - * @value: The return location for the value, or #NULL. + * @value: The return location for the value or #NULL. * * Reads a string value from the #FbThrift. The value returned to * @value should be freed with #g_free() when no longer needed. If @@ -331,7 +331,7 @@ fb_thrift_read_str(FbThrift *thft, gchar **value); * fb_thrift_read_field: * @thft: The #FbThrift. * @type: The return location for the #FbThriftType. - * @id: The return location for the identifier, or #NULL. + * @id: The return location for the identifier or #NULL. * * Reads a field header from the #FbThrift. * diff --git a/libpurple/protocols/facebook/util.c b/libpurple/protocols/facebook/util.c index 4ff0b41d56..0189bf1251 100644 --- a/libpurple/protocols/facebook/util.c +++ b/libpurple/protocols/facebook/util.c @@ -244,7 +244,7 @@ fb_util_debug_hexdump(PurpleDebugLevel level, const GByteArray *bytes, } gchar * -fb_util_locale_str(void) +fb_util_get_locale(void) { const gchar * const *langs; const gchar *lang; @@ -272,7 +272,7 @@ fb_util_locale_str(void) } gchar * -fb_util_randstr(gsize size) +fb_util_rand_alnum(guint len) { gchar *ret; GRand *rand; @@ -285,19 +285,16 @@ fb_util_randstr(gsize size) "0123456789"; static const gsize charc = G_N_ELEMENTS(chars) - 1; - if (G_UNLIKELY(size < 1)) { - return NULL; - } - + g_return_val_if_fail(len > 0, NULL); rand = g_rand_new(); - ret = g_new(gchar, size + 1); + ret = g_new(gchar, len + 1); - for (i = 0; i < size; i++) { + for (i = 0; i < len; i++) { j = g_rand_int_range(rand, 0, charc); ret[i] = chars[j]; } - ret[size] = 0; + ret[len] = 0; g_rand_free(rand); return ret; } @@ -463,7 +460,7 @@ fb_util_serv_got_chat_in(PurpleConnection *gc, gint id, const gchar *who, } gboolean -fb_util_str_is(const gchar *str, GAsciiType type) +fb_util_strtest(const gchar *str, GAsciiType type) { gsize i; gsize size; @@ -484,7 +481,7 @@ fb_util_str_is(const gchar *str, GAsciiType type) } gboolean -fb_util_zcompressed(const GByteArray *bytes) +fb_util_zlib_test(const GByteArray *bytes) { guint8 b0; guint8 b1; @@ -503,7 +500,7 @@ fb_util_zcompressed(const GByteArray *bytes) } static GByteArray * -fb_util_zconv(GConverter *conv, const GByteArray *bytes, GError **error) +fb_util_zlib_conv(GConverter *conv, const GByteArray *bytes, GError **error) { GByteArray *ret; GConverterResult res; @@ -546,25 +543,25 @@ fb_util_zconv(GConverter *conv, const GByteArray *bytes, GError **error) } GByteArray * -fb_util_zcompress(const GByteArray *bytes, GError **error) +fb_util_zlib_deflate(const GByteArray *bytes, GError **error) { GByteArray *ret; GZlibCompressor *conv; conv = g_zlib_compressor_new(G_ZLIB_COMPRESSOR_FORMAT_ZLIB, -1); - ret = fb_util_zconv(G_CONVERTER(conv), bytes, error); + ret = fb_util_zlib_conv(G_CONVERTER(conv), bytes, error); g_object_unref(conv); return ret; } GByteArray * -fb_util_zuncompress(const GByteArray *bytes, GError **error) +fb_util_zlib_inflate(const GByteArray *bytes, GError **error) { GByteArray *ret; GZlibDecompressor *conv; conv = g_zlib_decompressor_new(G_ZLIB_COMPRESSOR_FORMAT_ZLIB); - ret = fb_util_zconv(G_CONVERTER(conv), bytes, error); + ret = fb_util_zlib_conv(G_CONVERTER(conv), bytes, error); g_object_unref(conv); return ret; } diff --git a/libpurple/protocols/facebook/util.h b/libpurple/protocols/facebook/util.h index 6dcd500cdb..e4c3de4123 100644 --- a/libpurple/protocols/facebook/util.h +++ b/libpurple/protocols/facebook/util.h @@ -110,7 +110,7 @@ fb_util_error_quark(void); * @acct: The #PurpleAccount. * @chat: The #PurpleChatConversation. * @name: The name of the buddy. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * * Finds a buddy by their name or alias. * @@ -216,7 +216,7 @@ fb_util_debug_hexdump(PurpleDebugLevel level, const GByteArray *bytes, G_GNUC_PRINTF(3, 4); /** - * fb_util_locale_str: + * fb_util_get_locale: * * Gets the locale string (ex: en_US) from the system. The returned * string should be freed with #g_free() when no longer needed. @@ -224,19 +224,20 @@ fb_util_debug_hexdump(PurpleDebugLevel level, const GByteArray *bytes, * Returns: The locale string. */ gchar * -fb_util_locale_str(void); +fb_util_get_locale(void); /** - * fb_util_randstr: - * @size: The size of the string. + * fb_util_rand_alnum: + * @len: The length of the string. * - * Gets a random alphanumeric string. The returned string should be - * freed with #g_free() when no longer needed. + * Gets a random alphanumeric (A-Za-z0-9) string. This function should + * *not* be relied on for cryptographic operations. The returned string + * should be freed with #g_free() when no longer needed. * - * Returns: The random string. + * Returns: The alphanumeric string. */ gchar * -fb_util_randstr(gsize size); +fb_util_rand_alnum(guint len); /** * fb_util_request_buddy: @@ -244,7 +245,7 @@ fb_util_randstr(gsize size); * @title: The title of the message or #NULL. * @primary: The main point of the message or #NULL. * @secondary: The secondary information or #NULL. - * @select: A #GSList of selected buddies, or #NULL. + * @select: A #GSList of selected buddies or #NULL. * @multi: #TRUE to for multiple buddy selections, otherwise #FALSE. * @ok_cb: The callback for the `OK` button or #NULL. * @cancel_cb: The callback for the `Cancel` button or #NULL. @@ -295,52 +296,55 @@ fb_util_serv_got_chat_in(PurpleConnection *gc, gint id, const gchar *who, guint64 timestamp); /** - * fb_util_str_is: + * fb_util_strtest: * @str: The string. * @type: The #GAsciiType. * - * Determines if @str abides to the #GAsciiType. + * Tests if the string only contains characters allowed by the + * #GAsciiType. More than one type can be specified by ORing the types + * together. * - * Returns: #TRUE if the string abides to @type, otherwise #FALSE. + * Returns: #TRUE if the string only contains characters allowed by the + * #GAsciiType, otherwise #FALSE. */ gboolean -fb_util_str_is(const gchar *str, GAsciiType type); +fb_util_strtest(const gchar *str, GAsciiType type); /** - * fb_util_zcompressed: + * fb_util_zlib_test: * @bytes: The #GByteArray. * - * Determines if the #GByteArray is zlib compressed. + * Tests if the #GByteArray is zlib compressed. * * Returns: #TRUE if the #GByteArray is compressed, otherwise #FALSE. */ gboolean -fb_util_zcompressed(const GByteArray *bytes); +fb_util_zlib_test(const GByteArray *bytes); /** - * fb_util_zcompress: + * fb_util_zlib_deflate: * @bytes: The #GByteArray. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * - * Compresses a #GByteArray with zlib. The returned #GByteArray should - * be freed with #g_byte_array_free() when no longer needed. + * Deflates a #GByteArray with zlib. The returned #GByteArray should be + * freed with #g_byte_array_free() when no longer needed. * - * Returns: The compressed #GByteArray. + * Returns: The deflated #GByteArray or #NULL on error. */ GByteArray * -fb_util_zcompress(const GByteArray *bytes, GError **error); +fb_util_zlib_deflate(const GByteArray *bytes, GError **error); /** - * fb_util_zuncompress: + * fb_util_zlib_inflate: * @bytes: The #GByteArray. - * @error: The return location for the #GError, or #NULL. + * @error: The return location for the #GError or #NULL. * - * Uncompresses a #GByteArray with zlib. The returned #GByteArray - * should be freed with #g_byte_array_free() when no longer needed. + * Inflates a #GByteArray with zlib. The returned #GByteArray should be + * freed with #g_byte_array_free() when no longer needed. * - * Returns: The uncompressed #GByteArray, or #NULL on error. + * Returns: The inflated #GByteArray or #NULL on error. */ GByteArray * -fb_util_zuncompress(const GByteArray *bytes, GError **error); +fb_util_zlib_inflate(const GByteArray *bytes, GError **error); #endif /* _FACEBOOK_UTIL_H_ */ diff --git a/libpurple/protocols/gg/gg.h b/libpurple/protocols/gg/gg.h index 5ef33eeb11..5d8e110a22 100644 --- a/libpurple/protocols/gg/gg.h +++ b/libpurple/protocols/gg/gg.h @@ -26,6 +26,7 @@ #define GGP_UIN_LEN_MAX 10 +#include <gmodule.h> #include <libgadu.h> #include "internal.h" diff --git a/libpurple/protocols/gg/lib/http.c b/libpurple/protocols/gg/lib/http.c index 719aee6ab3..3375df7c85 100644 --- a/libpurple/protocols/gg/lib/http.c +++ b/libpurple/protocols/gg/lib/http.c @@ -312,10 +312,8 @@ int gg_http_watch_fd(struct gg_http *h) if (res == -1 && errno != EINTR && errno != EAGAIN) { gg_debug(GG_DEBUG_MISC, "=> http, reading header failed (errno=%d)\n", errno); - if (h->header) { - free(h->header); - h->header = NULL; - } + free(h->header); + h->header = NULL; gg_http_error(GG_ERROR_READING); } @@ -328,10 +326,8 @@ int gg_http_watch_fd(struct gg_http *h) if (res == 0) { gg_debug(GG_DEBUG_MISC, "=> http, connection reset by peer\n"); - if (h->header) { - free(h->header); - h->header = NULL; - } + free(h->header); + h->header = NULL; gg_http_error(GG_ERROR_READING); } @@ -447,10 +443,8 @@ int gg_http_watch_fd(struct gg_http *h) if (res == -1 && errno != EINTR && errno != EAGAIN) { gg_debug(GG_DEBUG_MISC, "=> http, reading body failed (errno=%d)\n", errno); - if (h->body) { - free(h->body); - h->body = NULL; - } + free(h->body); + h->body = NULL; gg_http_error(GG_ERROR_READING); } @@ -472,10 +466,8 @@ int gg_http_watch_fd(struct gg_http *h) "connection closed while reading " "(have %d, need %d)\n", h->body_done, h->body_size); - if (h->body) { - free(h->body); - h->body = NULL; - } + free(h->body); + h->body = NULL; gg_http_error(GG_ERROR_READING); } diff --git a/libpurple/protocols/gg/roster.c b/libpurple/protocols/gg/roster.c index e22931c40d..5316392503 100644 --- a/libpurple/protocols/gg/roster.c +++ b/libpurple/protocols/gg/roster.c @@ -159,8 +159,7 @@ static void ggp_roster_content_free(ggp_roster_content *content) g_hash_table_destroy(content->group_ids); if (content->group_names) g_hash_table_destroy(content->group_names); - if (content->bots_group_id) - g_free(content->bots_group_id); + g_free(content->bots_group_id); g_free(content); } diff --git a/libpurple/protocols/gg/tcpsocket.c b/libpurple/protocols/gg/tcpsocket.c index 33ab3769ba..1d2c4dee76 100644 --- a/libpurple/protocols/gg/tcpsocket.c +++ b/libpurple/protocols/gg/tcpsocket.c @@ -113,8 +113,7 @@ ggp_tcpsocket_write(void *_gc, void *_ps, const unsigned char *data, size_t len) void ggp_tcpsocket_setup(PurpleConnection *gc, struct gg_login_params *glp) { - glp->socket_manager_type = purple_ssl_is_supported() ? - GG_SOCKET_MANAGER_TYPE_TLS : GG_SOCKET_MANAGER_TYPE_TCP; + glp->socket_manager_type = GG_SOCKET_MANAGER_TYPE_TLS; glp->socket_manager.cb_data = gc; glp->socket_manager.connect_cb = ggp_tcpsocket_connect; glp->socket_manager.close_cb = ggp_tcpsocket_close; diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index b9ff167cf9..d4ecabfdce 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -370,16 +370,9 @@ static void irc_login(PurpleAccount *account) purple_connection_update_progress(gc, _("Connecting"), 1, 2); if (purple_account_get_bool(account, "ssl", FALSE)) { - if (purple_ssl_is_supported()) { - irc->gsc = purple_ssl_connect(account, irc->server, - purple_account_get_int(account, "port", IRC_DEFAULT_SSL_PORT), - irc_login_cb_ssl, irc_ssl_connect_failure, gc); - } else { - purple_connection_error (gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support unavailable")); - return; - } + irc->gsc = purple_ssl_connect(account, irc->server, + purple_account_get_int(account, "port", IRC_DEFAULT_SSL_PORT), + irc_login_cb_ssl, irc_ssl_connect_failure, gc); } if (!irc->gsc) { diff --git a/libpurple/protocols/irc/irc.h b/libpurple/protocols/irc/irc.h index a65559f1ae..b6a70843e6 100644 --- a/libpurple/protocols/irc/irc.h +++ b/libpurple/protocols/irc/irc.h @@ -24,6 +24,7 @@ #define _PURPLE_IRC_H #include <glib.h> +#include <gmodule.h> #ifdef HAVE_CYRUS_SASL #include <sasl/sasl.h> diff --git a/libpurple/protocols/jabber/chat.c b/libpurple/protocols/jabber/chat.c index 4fd5bf564e..a8636542a6 100644 --- a/libpurple/protocols/jabber/chat.c +++ b/libpurple/protocols/jabber/chat.c @@ -540,8 +540,7 @@ static void jabber_chat_room_configure_cb(JabberStream *js, const char *from, _("Configuration error"), msg, purple_request_cpar_from_connection(js->gc)); - if(msg) - g_free(msg); + g_free(msg); return; } @@ -621,8 +620,7 @@ jabber_chat_register_x_data_result_cb(JabberStream *js, const char *from, _("Registration error"), msg, purple_request_cpar_from_connection(js->gc)); - if(msg) - g_free(msg); + g_free(msg); return; } } @@ -692,8 +690,7 @@ static void jabber_chat_register_cb(JabberStream *js, const char *from, _("Registration error"), msg, purple_request_cpar_from_connection(js->gc)); - if(msg) - g_free(msg); + g_free(msg); return; } diff --git a/libpurple/protocols/jabber/ibb.c b/libpurple/protocols/jabber/ibb.c index 8131b296ef..a1877a8c5d 100644 --- a/libpurple/protocols/jabber/ibb.c +++ b/libpurple/protocols/jabber/ibb.c @@ -294,10 +294,8 @@ jabber_ibb_session_send_acknowledge_cb(JabberStream *js, const char *from, if (sess) { /* reset callback */ - if (sess->last_iq_id) { - g_free(sess->last_iq_id); - sess->last_iq_id = NULL; - } + g_free(sess->last_iq_id); + sess->last_iq_id = NULL; if (type == JABBER_IQ_ERROR) { jabber_ibb_session_close(sess); diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 896c11d241..58d035a3d5 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -99,10 +99,8 @@ static void jabber_stream_init(JabberStream *js) { char *open_stream; - if (js->stream_id) { - g_free(js->stream_id); - js->stream_id = NULL; - } + g_free(js->stream_id); + js->stream_id = NULL; open_stream = g_strdup_printf("<stream:stream to='%s' " "xmlns='" NS_XMPP_CLIENT "' " @@ -235,21 +233,16 @@ jabber_process_starttls(JabberStream *js, PurpleXmlNode *packet) */ { const gchar *connection_security = purple_account_get_string(account, "connection_security", JABBER_DEFAULT_REQUIRE_TLS); - if (!g_str_equal(connection_security, "none") && - purple_ssl_is_supported()) { + if (!g_str_equal(connection_security, "none")) { jabber_send_raw(js, "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1); return TRUE; } } #else - if(purple_ssl_is_supported()) { - jabber_send_raw(js, - "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1); - return TRUE; - } else { - purple_debug_warning("jabber", "No libpurple TLS/SSL support found."); - } + jabber_send_raw(js, + "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1); + return TRUE; #endif starttls = purple_xmlnode_get_child(packet, "starttls"); @@ -1078,19 +1071,13 @@ jabber_stream_connect(JabberStream *js) /* if they've got old-ssl mode going, we probably want to ignore SRV lookups */ if (g_str_equal("old_ssl", purple_account_get_string(account, "connection_security", JABBER_DEFAULT_REQUIRE_TLS))) { - if(purple_ssl_is_supported()) { - js->gsc = purple_ssl_connect(account, js->certificate_CN, - purple_account_get_int(account, "port", 5223), - jabber_login_callback_ssl, jabber_ssl_connect_failure, gc); - if (!js->gsc) { - purple_connection_error(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("Unable to establish SSL connection")); - } - } else { + js->gsc = purple_ssl_connect(account, js->certificate_CN, + purple_account_get_int(account, "port", 5223), + jabber_login_callback_ssl, jabber_ssl_connect_failure, gc); + if (!js->gsc) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support unavailable")); + _("Unable to establish SSL connection")); } return; @@ -2671,10 +2658,8 @@ void jabber_convo_closed(PurpleConnection *gc, const char *who) if((jb = jabber_buddy_find(js, who, TRUE)) && (jbr = jabber_buddy_find_resource(jb, jid->resource))) { - if(jbr->thread_id) { - g_free(jbr->thread_id); - jbr->thread_id = NULL; - } + g_free(jbr->thread_id); + jbr->thread_id = NULL; } jabber_id_free(jid); diff --git a/libpurple/protocols/jabber/jabber.h b/libpurple/protocols/jabber/jabber.h index aeaba62c62..f5b027fd3c 100644 --- a/libpurple/protocols/jabber/jabber.h +++ b/libpurple/protocols/jabber/jabber.h @@ -56,6 +56,7 @@ typedef struct _JabberStream JabberStream; #include <libxml/parser.h> #include <glib.h> +#include <gmodule.h> #include <gio/gio.h> #include "circularbuffer.h" diff --git a/libpurple/protocols/jabber/message.c b/libpurple/protocols/jabber/message.c index 5df8d1eb13..ef38fa9337 100644 --- a/libpurple/protocols/jabber/message.c +++ b/libpurple/protocols/jabber/message.c @@ -147,8 +147,7 @@ static void handle_chat(JabberMessage *jm) jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; } - if(jbr->thread_id) - g_free(jbr->thread_id); + g_free(jbr->thread_id); jbr->thread_id = g_strdup(jbr->thread_id); } diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c index 9c3aa5b7af..af618d22eb 100644 --- a/libpurple/protocols/jabber/presence.c +++ b/libpurple/protocols/jabber/presence.c @@ -245,10 +245,8 @@ void jabber_presence_send(JabberStream *js, gboolean force) /* update old values */ - if(js->old_msg) - g_free(js->old_msg); - if(js->old_avatarhash) - g_free(js->old_avatarhash); + g_free(js->old_msg); + g_free(js->old_avatarhash); js->old_msg = g_strdup(stripped); js->old_avatarhash = g_strdup(js->avatar_hash); js->old_state = state; @@ -440,7 +438,7 @@ jabber_vcard_parse_avatar(JabberStream *js, const char *from, if (tmp && strstr(bare_jid, tmp) == NULL) { g_free(nickname); nickname = tmp; - } else if (tmp) + } else g_free(tmp); g_free(bare_jid); @@ -945,10 +943,8 @@ void jabber_presence_parse(JabberStream *js, PurpleXmlNode *packet) if (presence.jid_from->node) presence.chat = jabber_chat_find(js, presence.jid_from->node, presence.jid_from->domain); - if(presence.jb->error_msg) { - g_free(presence.jb->error_msg); - presence.jb->error_msg = NULL; - } + g_free(presence.jb->error_msg); + presence.jb->error_msg = NULL; if (presence.type == JABBER_PRESENCE_AVAILABLE) { presence.state = JABBER_BUDDY_STATE_ONLINE; diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c index 0e6505ea25..8ae46e8958 100644 --- a/libpurple/protocols/jabber/si.c +++ b/libpurple/protocols/jabber/si.c @@ -351,8 +351,7 @@ void jabber_bytestreams_parse(JabberStream *js, const char *from, if(!jsx->accepted) return; - if(jsx->iq_id) - g_free(jsx->iq_id); + g_free(jsx->iq_id); jsx->iq_id = g_strdup(id); for(streamhost = purple_xmlnode_get_child(query, "streamhost"); streamhost; diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index a80b768ec2..6cfa78747b 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -1341,15 +1341,6 @@ msn_login(PurpleAccount *account) gc = purple_account_get_connection(account); - if (!purple_ssl_is_supported()) - { - purple_connection_error(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support is needed for MSN. Please install a supported " - "SSL library.")); - return; - } - http_method = purple_account_get_bool(account, "http_method", FALSE); if (http_method) diff --git a/libpurple/protocols/msn/msn.h b/libpurple/protocols/msn/msn.h index 5dd43ef1b4..747a1ecf96 100644 --- a/libpurple/protocols/msn/msn.h +++ b/libpurple/protocols/msn/msn.h @@ -110,6 +110,8 @@ typedef enum MSN_CLIENT_VER_15_0 = 0xB0 /* MSNC11 */ } MsnClientVerId; +#include <gmodule.h> + #include "internal.h" #include "session.h" diff --git a/libpurple/protocols/msn/object.c b/libpurple/protocols/msn/object.c index 14a479af15..63a3485e80 100644 --- a/libpurple/protocols/msn/object.c +++ b/libpurple/protocols/msn/object.c @@ -37,8 +37,7 @@ c = strchr(tag, '"'); \ if (c != NULL) \ { \ - if (obj->field != NULL) \ - g_free(obj->field); \ + g_free(obj->field); \ obj->field = g_strndup(tag, c - tag); \ } \ } diff --git a/libpurple/protocols/mxit/client.c b/libpurple/protocols/mxit/client.c index cdd4a4f4b7..a36653a853 100644 --- a/libpurple/protocols/mxit/client.c +++ b/libpurple/protocols/mxit/client.c @@ -1906,20 +1906,17 @@ static void mxit_parse_cmd_extprofile( struct MXitSession* session, struct recor /* this is an invite, so update its profile info */ if ( ( statusMsg ) && ( *statusMsg ) ) { /* update the status message */ - if ( contact->statusMsg ) - g_free( contact->statusMsg ); + g_free(contact->statusMsg); contact->statusMsg = strdup( statusMsg ); } else contact->statusMsg = NULL; - if ( contact->profile ) - g_free( contact->profile ); + g_free(contact->profile); contact->profile = profile; if ( ( avatarId ) && ( *avatarId ) ) { /* avatar must be requested for this invite before we can display it */ mxit_get_avatar( session, mxitId, avatarId ); - if ( contact->avatarId ) - g_free( contact->avatarId ); + g_free(contact->avatarId); contact->avatarId = strdup( avatarId ); } else { @@ -1941,8 +1938,7 @@ static void mxit_parse_cmd_extprofile( struct MXitSession* session, struct recor if ( buddy ) { contact = purple_buddy_get_protocol_data( buddy ); if ( contact ) { - if ( contact->statusMsg ) - g_free( contact->statusMsg ); + g_free(contact->statusMsg); contact->statusMsg = strdup( statusMsg ); } } @@ -2926,12 +2922,9 @@ void mxit_close_connection( struct MXitSession* session ) session->invites = g_list_remove( session->invites, contact ); - if ( contact->msg ) - g_free( contact->msg ); - if ( contact->statusMsg ) - g_free( contact->statusMsg ); - if ( contact->profile ) - g_free( contact->profile ); + g_free(contact->msg); + g_free(contact->statusMsg); + g_free(contact->profile); if (contact->image) g_object_unref(contact->image); g_free( contact ); diff --git a/libpurple/protocols/mxit/formcmds.c b/libpurple/protocols/mxit/formcmds.c index c56cf67449..62f1af0746 100644 --- a/libpurple/protocols/mxit/formcmds.c +++ b/libpurple/protocols/mxit/formcmds.c @@ -303,8 +303,7 @@ static void command_platformreq(GHashTable* hash, GString* msg) g_string_append_printf(msg, "<a href=\"%s\">%s</a>", purple_url_decode(dest), (text) ? text : _( "Download" )); /* add link to display message */ } - if (text) - g_free(text); + g_free(text); } diff --git a/libpurple/protocols/mxit/markup.c b/libpurple/protocols/mxit/markup.c index 287607fc37..174c769efa 100644 --- a/libpurple/protocols/mxit/markup.c +++ b/libpurple/protocols/mxit/markup.c @@ -258,8 +258,7 @@ static void free_markupdata( struct RXMsgData* mx ) if ( mx ) { if ( mx->msg ) g_string_free( mx->msg, TRUE ); - if ( mx->from ) - g_free( mx->from ); + g_free(mx->from); g_free( mx ); } } diff --git a/libpurple/protocols/mxit/multimx.c b/libpurple/protocols/mxit/multimx.c index 77fa9c8af4..b42bd44f86 100644 --- a/libpurple/protocols/mxit/multimx.c +++ b/libpurple/protocols/mxit/multimx.c @@ -164,8 +164,7 @@ static void room_remove(struct MXitSession* session, struct multimx* multimx) session->rooms = g_list_remove(session->rooms, multimx); /* free nickname */ - if (multimx->nickname) - g_free(multimx->nickname); + g_free(multimx->nickname); /* Deallocate it */ g_free (multimx); diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index 30342f875a..86a64efef8 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -112,8 +112,7 @@ static void* mxit_link_click( const char* link64 ) skip: /* this is not an internal mxit link */ - if ( link ) - g_free( link ); + g_free(link); link = NULL; if ( parts ) @@ -491,12 +490,9 @@ static void mxit_free_buddy( PurpleBuddy* buddy ) contact = purple_buddy_get_protocol_data( buddy ); if ( contact ) { - if ( contact->statusMsg ) - g_free( contact->statusMsg ); - if ( contact->avatarId ) - g_free( contact->avatarId ); - if ( contact->msg ) - g_free( contact->msg ); + g_free(contact->statusMsg); + g_free(contact->avatarId); + g_free(contact->msg); if (contact->image) g_object_unref(contact->image); g_free( contact ); diff --git a/libpurple/protocols/mxit/mxit.h b/libpurple/protocols/mxit/mxit.h index 713366859a..62bfe37bef 100644 --- a/libpurple/protocols/mxit/mxit.h +++ b/libpurple/protocols/mxit/mxit.h @@ -26,6 +26,7 @@ #ifndef _MXIT_H_ #define _MXIT_H_ +#include <gmodule.h> #include "internal.h" #include "http.h" diff --git a/libpurple/protocols/mxit/roster.c b/libpurple/protocols/mxit/roster.c index af75237810..83deee7ac9 100644 --- a/libpurple/protocols/mxit/roster.c +++ b/libpurple/protocols/mxit/roster.c @@ -481,10 +481,8 @@ void mxit_update_buddy_presence( struct MXitSession* session, const char* userna // TODO: Download custom mood frame. /* update status message */ - if ( contact->statusMsg ) { - g_free( contact->statusMsg ); - contact->statusMsg = NULL; - } + g_free(contact->statusMsg); + contact->statusMsg = NULL; if ( ( statusMsg ) && ( statusMsg[0] != '\0' ) ) contact->statusMsg = g_markup_escape_text( statusMsg, -1 ); @@ -532,8 +530,7 @@ void mxit_update_buddy_avatar( struct MXitSession* session, const char* username /* avatar has not changed - do nothing */ } else if ( avatarId[0] != '\0' ) { /* avatar has changed */ - if ( contact->avatarId ) - g_free( contact->avatarId ); + g_free(contact->avatarId); contact->avatarId = g_strdup( avatarId ); /* Send request to download new avatar image */ @@ -596,12 +593,9 @@ static void mxit_cb_buddy_auth( const char *message, gpointer user_data ) invite->session->invites = g_list_remove( invite->session->invites, invite->contact ); /* freeup invite object */ - if ( invite->contact->msg ) - g_free( invite->contact->msg ); - if ( invite->contact->statusMsg ) - g_free( invite->contact->statusMsg ); - if ( invite->contact->profile ) - g_free( invite->contact->profile ); + g_free(invite->contact->msg); + g_free(invite->contact->statusMsg); + g_free(invite->contact->profile); if (invite->contact->image) g_object_unref(invite->contact->image); g_free( invite->contact ); @@ -627,12 +621,9 @@ static void mxit_cb_buddy_deny( const char *message, gpointer user_data ) invite->session->invites = g_list_remove( invite->session->invites, invite->contact ); /* freeup invite object */ - if ( invite->contact->msg ) - g_free( invite->contact->msg ); - if ( invite->contact->statusMsg ) - g_free( invite->contact->statusMsg ); - if ( invite->contact->profile ) - g_free( invite->contact->profile ); + g_free(invite->contact->msg); + g_free(invite->contact->statusMsg); + g_free(invite->contact->profile); if (invite->contact->image) g_object_unref(invite->contact->image); g_free( invite->contact ); diff --git a/libpurple/protocols/novell/nmconference.c b/libpurple/protocols/novell/nmconference.c index 46c22d46e7..7fc024b7c0 100644 --- a/libpurple/protocols/novell/nmconference.c +++ b/libpurple/protocols/novell/nmconference.c @@ -83,8 +83,7 @@ nm_release_conference(NMConference * conference) "Releasing conference %p, total=%d\n", conference, --conf_count); - if (conference->guid) - g_free(conference->guid); + g_free(conference->guid); if (conference->participants) { for (node = conference->participants; node; node = node->next) { diff --git a/libpurple/protocols/novell/nmconn.c b/libpurple/protocols/novell/nmconn.c index 1d67a54807..4c5aacad05 100644 --- a/libpurple/protocols/novell/nmconn.c +++ b/libpurple/protocols/novell/nmconn.c @@ -187,10 +187,8 @@ void nm_release_conn(NMConn *conn) } g_slist_free(conn->requests); conn->requests = NULL; - if (conn->ssl_conn) { - g_free(conn->ssl_conn); - conn->ssl_conn = NULL; - } + g_free(conn->ssl_conn); + conn->ssl_conn = NULL; g_free(conn->addr); conn->addr = NULL; g_free(conn); diff --git a/libpurple/protocols/novell/nmcontact.c b/libpurple/protocols/novell/nmcontact.c index a109d72d32..cc073d3293 100644 --- a/libpurple/protocols/novell/nmcontact.c +++ b/libpurple/protocols/novell/nmcontact.c @@ -164,8 +164,7 @@ nm_contact_update_list_properties(NMContact * contact, NMField * fields) nm_locate_field(NM_A_SZ_DISPLAY_NAME, (NMField *) fields->ptr_value))) { if (field->ptr_value) { - if (contact->display_name) - g_free(contact->display_name); + g_free(contact->display_name); contact->display_name = g_strdup((char *) field->ptr_value); } @@ -175,8 +174,7 @@ nm_contact_update_list_properties(NMContact * contact, NMField * fields) if ((field = nm_locate_field(NM_A_SZ_DN, (NMField *) fields->ptr_value))) { if (field->ptr_value) { - if (contact->dn) - g_free(contact->dn); + g_free(contact->dn); contact->dn = g_strdup((char *) field->ptr_value); } @@ -303,10 +301,8 @@ nm_contact_set_display_name(NMContact * contact, const char *display_name) if (contact == NULL) return; - if (contact->display_name) { - g_free(contact->display_name); - contact->display_name = NULL; - } + g_free(contact->display_name); + contact->display_name = NULL; if (display_name) contact->display_name = g_strdup(display_name); @@ -318,10 +314,8 @@ nm_contact_set_dn(NMContact * contact, const char *dn) if (contact == NULL) return; - if (contact->dn) { - g_free(contact->dn); - contact->dn = NULL; - } + g_free(contact->dn); + contact->dn = NULL; if (dn) contact->dn = g_strdup(dn); @@ -538,8 +532,7 @@ nm_folder_update_list_properties(NMFolder * folder, NMField * fields) nm_locate_field(NM_A_SZ_DISPLAY_NAME, (NMField *) fields->ptr_value))) { if (field->ptr_value) { - if (folder->name) - g_free(folder->name); + g_free(folder->name); folder->name = g_strdup((char *) field->ptr_value); } @@ -640,8 +633,7 @@ nm_folder_set_name(NMFolder * folder, const char *name) if (folder == NULL || name == NULL) return; - if (folder->name) - g_free(folder->name); + g_free(folder->name); folder->name = g_strdup(name); } diff --git a/libpurple/protocols/novell/nmevent.c b/libpurple/protocols/novell/nmevent.c index 5268b96813..f709e66bc2 100644 --- a/libpurple/protocols/novell/nmevent.c +++ b/libpurple/protocols/novell/nmevent.c @@ -241,14 +241,9 @@ handle_receive_message(NMUser * user, NMEvent * event, gboolean autoreply) nm_release_conference(conference); } - if (msg) - g_free(msg); - - if (nortf) - g_free(nortf); - - if (guid) - g_free(guid); + g_free(msg); + g_free(nortf); + g_free(guid); return rc; } @@ -323,11 +318,8 @@ handle_conference_invite(NMUser * user, NMEvent * event) } } - if (msg) - g_free(msg); - - if (guid) - g_free(guid); + g_free(msg); + g_free(guid); return rc; } @@ -381,8 +373,7 @@ handle_conference_invite_notify(NMUser * user, NMEvent * event) } - if (guid) - g_free(guid); + g_free(guid); return rc; } @@ -417,8 +408,7 @@ handle_conference_reject(NMUser * user, NMEvent * event) } } - if (guid) - g_free(guid); + g_free(guid); return rc; } @@ -468,8 +458,7 @@ handle_conference_left(NMUser * user, NMEvent * event) } } - if (guid) - g_free(guid); + g_free(guid); return rc; } @@ -507,8 +496,7 @@ handle_conference_closed(NMUser * user, NMEvent * event) } } - if (guid) - g_free(guid); + g_free(guid); return rc; } @@ -569,8 +557,7 @@ handle_conference_joined(NMUser * user, NMEvent * event) } } - if (guid) - g_free(guid); + g_free(guid); return rc; } @@ -605,8 +592,7 @@ handle_typing(NMUser * user, NMEvent * event) } } - if (guid) - g_free(guid); + g_free(guid); return rc; } @@ -651,8 +637,7 @@ handle_status_change(NMUser * user, NMEvent * event) } } - if (text) - g_free(text); + g_free(text); return rc; } @@ -677,8 +662,7 @@ handle_undeliverable_status(NMUser * user, NMEvent * event) rc = nm_read_all(conn, guid, size); } - if (guid) - g_free(guid); + g_free(guid); return rc; } @@ -712,8 +696,7 @@ nm_release_event(NMEvent * event) if (--(event->ref_count) == 0) { - if (event->source) - g_free(event->source); + g_free(event->source); if (event->conference) nm_release_conference(event->conference); @@ -721,8 +704,7 @@ nm_release_event(NMEvent * event) if (event->user_record) nm_release_user_record(event->user_record); - if (event->text) - g_free(event->text); + g_free(event->text); g_free(event); } @@ -936,8 +918,7 @@ nm_process_event(NMUser * user, int type) } /* Cleanup */ - if (source) - g_free(source); + g_free(source); return rc; } diff --git a/libpurple/protocols/novell/nmmessage.c b/libpurple/protocols/novell/nmmessage.c index 70b00eed22..3bc69d5076 100644 --- a/libpurple/protocols/novell/nmmessage.c +++ b/libpurple/protocols/novell/nmmessage.c @@ -53,8 +53,7 @@ void nm_release_message(NMMessage * msg) { if (msg && (--(msg->ref_count) == 0)) { - if (msg->text) - g_free(msg->text); + g_free(msg->text); if (msg->conference) nm_release_conference(msg->conference); diff --git a/libpurple/protocols/novell/nmrequest.c b/libpurple/protocols/novell/nmrequest.c index edf85c9928..8258064e3c 100644 --- a/libpurple/protocols/novell/nmrequest.c +++ b/libpurple/protocols/novell/nmrequest.c @@ -60,8 +60,7 @@ void nm_release_request(NMRequest * req) { if (req && (--req->ref_count == 0)) { - if (req->cmd) - g_free(req->cmd); + g_free(req->cmd); g_free(req); purple_debug_info("novell", diff --git a/libpurple/protocols/novell/nmuserrecord.c b/libpurple/protocols/novell/nmuserrecord.c index 7fa4d1928e..5d27bc7a9b 100644 --- a/libpurple/protocols/novell/nmuserrecord.c +++ b/libpurple/protocols/novell/nmuserrecord.c @@ -191,64 +191,50 @@ nm_user_record_copy(NMUserRecord * dest, NMUserRecord * src) dest->status = src->status; /* Copy status text */ - if (dest->status_text) { - g_free(dest->status_text); - dest->status_text = NULL; - } + g_free(dest->status_text); + dest->status_text = NULL; if (src->status_text) dest->status_text = g_strdup(src->status_text); /* Copy DN */ - if (dest->dn) { - g_free(dest->dn); - dest->dn = NULL; - } + g_free(dest->dn); + dest->dn = NULL; if (src->dn) dest->dn = g_strdup(src->dn); /* Copy CN */ - if (dest->cn) { - g_free(dest->cn); - dest->cn = NULL; - } + g_free(dest->cn); + dest->cn = NULL; if (src->cn) dest->cn = g_strdup(src->cn); /* Copy display id */ - if (dest->display_id) { - g_free(dest->display_id); - dest->display_id = NULL; - } + g_free(dest->display_id); + dest->display_id = NULL; if (src->display_id) dest->display_id = g_strdup(src->display_id); /* Copy first name */ - if (dest->fname) { - g_free(dest->fname); - dest->fname = NULL; - } + g_free(dest->fname); + dest->fname = NULL; if (src->fname) dest->fname = g_strdup(src->fname); /* Copy last name */ - if (dest->lname) { - g_free(dest->lname); - dest->lname = NULL; - } + g_free(dest->lname); + dest->lname = NULL; if (src->lname) dest->lname = g_strdup(src->lname); /* Copy full name */ - if (dest->full_name) { - g_free(dest->full_name); - dest->full_name = NULL; - } + g_free(dest->full_name); + dest->full_name = NULL; if (src->full_name) dest->full_name = g_strdup(src->full_name); @@ -321,8 +307,7 @@ void nm_user_record_set_dn(NMUserRecord * user_record, const char *dn) { if (user_record != NULL && dn != NULL) { - if (user_record->dn) - g_free(user_record->dn); + g_free(user_record->dn); user_record->dn = g_strdup(dn); } @@ -341,8 +326,7 @@ void nm_user_record_set_userid(NMUserRecord * user_record, const char *userid) { if (user_record != NULL && userid != NULL) { - if (user_record->cn) - g_free(user_record->cn); + g_free(user_record->cn); user_record->cn = g_strdup(userid); } @@ -361,8 +345,7 @@ void nm_user_record_set_display_id(NMUserRecord * user_record, const char *display_id) { if (user_record != NULL && display_id != NULL) { - if (user_record->display_id) - g_free(user_record->display_id); + g_free(user_record->display_id); user_record->display_id = g_strdup(display_id); } @@ -445,10 +428,8 @@ nm_user_record_set_status(NMUserRecord * user_record, user_record->status = status; - if (user_record->status_text) { - g_free(user_record->status_text); - user_record->status_text = NULL; - } + g_free(user_record->status_text); + user_record->status_text = NULL; if (text) user_record->status_text = g_strdup(text); @@ -512,11 +493,9 @@ void nm_release_property(NMProperty * property) { if (property) { - if (property->tag) - g_free(property->tag); + g_free(property->tag); - if (property->value) - g_free(property->value); + g_free(property->value); g_free(property); } diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c index 0e4c4d13dc..86c1406c9f 100644 --- a/libpurple/protocols/novell/novell.c +++ b/libpurple/protocols/novell/novell.c @@ -572,8 +572,7 @@ _create_folder_resp_move_contact(NMUser * user, NMERR_T ret_code, if (user == NULL || folder_name == NULL || contact == NULL) { - if (folder_name) - g_free(folder_name); + g_free(folder_name); return; } @@ -606,8 +605,7 @@ _create_folder_resp_move_contact(NMUser * user, NMERR_T ret_code, g_free(err); } - if (folder_name) - g_free(folder_name); + g_free(folder_name); } /* Add contact to newly create folder */ @@ -625,8 +623,7 @@ _create_folder_resp_add_contact(NMUser * user, NMERR_T ret_code, if (contact) nm_release_contact(contact); - if (folder_name) - g_free(folder_name); + g_free(folder_name); return; } @@ -724,8 +721,7 @@ _get_details_resp_show_info(NMUser * user, NMERR_T ret_code, g_free(err); } - if (name) - g_free(name); + g_free(name); } /* Handle get details response add to privacy list */ @@ -824,8 +820,7 @@ _create_privacy_item_deny_resp_cb(NMUser *user, NMERR_T ret_code, } - if (who) - g_free(who); + g_free(who); } @@ -880,8 +875,7 @@ _create_privacy_item_permit_resp_cb(NMUser *user, NMERR_T ret_code, } - if (who) - g_free(who); + g_free(who); } static void @@ -949,8 +943,7 @@ _remove_privacy_item_resp_cb(NMUser *user, NMERR_T ret_code, g_free(err); } - if (who) - g_free(who); + g_free(who); } static void @@ -1678,8 +1671,7 @@ _get_conference_name(int id) { static char *name = NULL; - if (name) - g_free(name); + g_free(name); name = g_strdup_printf(_("GroupWise Conference %d"), id); @@ -3095,8 +3087,7 @@ novell_set_status(PurpleAccount *account, PurpleStatus *status) rc = nm_send_set_status(user, novellstatus, text, msg, NULL, NULL); _check_for_disconnect(user, rc); - if (text) - g_free(text); + g_free(text); } static void diff --git a/libpurple/protocols/novell/novell.h b/libpurple/protocols/novell/novell.h index f0171d84f9..63d8a07203 100644 --- a/libpurple/protocols/novell/novell.h +++ b/libpurple/protocols/novell/novell.h @@ -22,6 +22,8 @@ #ifndef _NOVELL_H_ #define _NOVELL_H_ +#include <gmodule.h> + #include "protocol.h" #define NOVELL_TYPE_PROTOCOL (novell_protocol_get_type()) diff --git a/libpurple/protocols/oscar/family_icq.c b/libpurple/protocols/oscar/family_icq.c index bd95a4d01e..2f53f31b46 100644 --- a/libpurple/protocols/oscar/family_icq.c +++ b/libpurple/protocols/oscar/family_icq.c @@ -254,7 +254,7 @@ int aim_icq_getallinfo(OscarData *od, const char *uin) byte_stream_destroy(&bs); /* Keep track of this request and the ICQ number and request ID */ - info = (struct aim_icq_info *)g_new0(struct aim_icq_info, 1); + info = g_new0(struct aim_icq_info, 1); info->reqid = snacid; info->uin = atoi(uin); od->icq_info = g_slist_prepend(od->icq_info, info); @@ -301,7 +301,7 @@ int aim_icq_getalias(OscarData *od, const char *uin, gboolean for_auth_request, byte_stream_destroy(&bs); /* Keep track of this request and the ICQ number and request ID */ - info = (struct aim_icq_info *)g_new0(struct aim_icq_info, 1); + info = g_new0(struct aim_icq_info, 1); info->reqid = snacid; info->uin = atoi(uin); info->for_auth_request = for_auth_request; @@ -472,7 +472,7 @@ icqresponse(OscarData *od, aim_modsnac_t *snac, ByteStream *bs) /* find other data from the same request */ info_ptr = g_slist_find_custom(od->icq_info, &reqid, compare_icq_infos); if (!info_ptr) { - struct aim_icq_info *new_info = (struct aim_icq_info *)g_new0(struct aim_icq_info, 1); + struct aim_icq_info *new_info = g_new0(struct aim_icq_info, 1); new_info->reqid = reqid; info_ptr = od->icq_info = g_slist_prepend(od->icq_info, new_info); } @@ -541,7 +541,7 @@ icqresponse(OscarData *od, aim_modsnac_t *snac, ByteStream *bs) case 0x00eb: { /* email address(es) */ int i; info->numaddresses = byte_stream_getle16(&qbs); - info->email2 = (char **)g_new0(char *, info->numaddresses); + info->email2 = g_new0(char *, info->numaddresses); for (i = 0; i < info->numaddresses; i++) { info->email2[i] = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); if (i+1 != info->numaddresses) diff --git a/libpurple/protocols/oscar/family_locate.c b/libpurple/protocols/oscar/family_locate.c index 024ad27de4..4a6ba5c448 100644 --- a/libpurple/protocols/oscar/family_locate.c +++ b/libpurple/protocols/oscar/family_locate.c @@ -549,14 +549,10 @@ aim_locate_adduserinfo(OscarData *od, aim_userinfo_t *userinfo) * We don't have an away message specified in this user_info * block, so clear any cached away message now. */ - if (cur->away) { - g_free(cur->away); - cur->away = NULL; - } - if (cur->away_encoding) { - g_free(cur->away_encoding); - cur->away_encoding = NULL; - } + g_free(cur->away); + cur->away = NULL; + g_free(cur->away_encoding); + cur->away_encoding = NULL; cur->away_len = 0; } } diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 35d683745b..a1388a2ce7 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -741,14 +741,7 @@ oscar_login(PurpleAccount *account) od->default_port = purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT); encryption_type = purple_account_get_string(account, "encryption", OSCAR_DEFAULT_ENCRYPTION); - if (!purple_ssl_is_supported() && strcmp(encryption_type, OSCAR_REQUIRE_ENCRYPTION) == 0) { - purple_connection_error( - gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("You required encryption in your account settings, but encryption is not supported by your system.")); - return; - } - od->use_ssl = purple_ssl_is_supported() && strcmp(encryption_type, OSCAR_NO_ENCRYPTION) != 0; + od->use_ssl = strcmp(encryption_type, OSCAR_NO_ENCRYPTION) != 0; /* Connect to core Purple signals */ purple_prefs_connect_callback(purple_connection_get_protocol(gc), "/purple/away/idle_reporting", idle_reporting_pref_cb, gc); diff --git a/libpurple/protocols/oscar/oscar.h b/libpurple/protocols/oscar/oscar.h index 02b9d701da..a54e40ccfe 100644 --- a/libpurple/protocols/oscar/oscar.h +++ b/libpurple/protocols/oscar/oscar.h @@ -45,6 +45,7 @@ #include <stdarg.h> #include <errno.h> #include <time.h> +#include <gmodule.h> #ifndef _WIN32 #include <sys/time.h> diff --git a/libpurple/protocols/sametime/sametime.h b/libpurple/protocols/sametime/sametime.h index 85e41b91d6..d76350fe9a 100644 --- a/libpurple/protocols/sametime/sametime.h +++ b/libpurple/protocols/sametime/sametime.h @@ -1,6 +1,8 @@ #ifndef _SAMETIME_H_ #define _SAMETIME_H_ +#include <gmodule.h> + #define MW_TYPE_PROTOCOL (mw_protocol_get_type()) #define MW_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), MW_TYPE_PROTOCOL, mwProtocol)) #define MW_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), MW_TYPE_PROTOCOL, mwProtocolClass)) diff --git a/libpurple/protocols/silc/silcpurple.h b/libpurple/protocols/silc/silcpurple.h index 2fa42f24cf..599a311e2c 100644 --- a/libpurple/protocols/silc/silcpurple.h +++ b/libpurple/protocols/silc/silcpurple.h @@ -20,6 +20,8 @@ #ifndef SILCPURPLE_H #define SILCPURPLE_H +#include <gmodule.h> + /* Purple includes */ #include "internal.h" #include "account.h" diff --git a/libpurple/protocols/simple/simple.h b/libpurple/protocols/simple/simple.h index d9779dea19..524441a98f 100644 --- a/libpurple/protocols/simple/simple.h +++ b/libpurple/protocols/simple/simple.h @@ -24,6 +24,7 @@ #define _PURPLE_SIMPLE_H #include <glib.h> +#include <gmodule.h> #include <gio/gio.h> #include <time.h> diff --git a/libpurple/protocols/yahoo/yahoo.h b/libpurple/protocols/yahoo/yahoo.h index 52149aee13..caf7c9207f 100644 --- a/libpurple/protocols/yahoo/yahoo.h +++ b/libpurple/protocols/yahoo/yahoo.h @@ -22,6 +22,8 @@ #ifndef _YAHOO_H_ #define _YAHOO_H_ +#include <gmodule.h> + #include "protocol.h" #define YAHOO_TYPE_PROTOCOL (yahoo_protocol_get_type()) diff --git a/libpurple/protocols/yahoo/yahoochat.c b/libpurple/protocols/yahoo/yahoochat.c index 32412baabc..305f4dbcd4 100644 --- a/libpurple/protocols/yahoo/yahoochat.c +++ b/libpurple/protocols/yahoo/yahoochat.c @@ -727,8 +727,7 @@ void yahoo_process_chat_message(PurpleConnection *gc, struct yahoo_packet *pkt) c = purple_conversations_find_chat(gc, YAHOO_CHAT_ID); if (!who || !c) { - if (room) - g_free(room); + g_free(room); /* we still get messages after we part, funny that */ return; } @@ -955,10 +954,8 @@ static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char yahoo_packet_send_and_free(pkt, yd); yd->in_chat = 0; - if (yd->chat_name) { - g_free(yd->chat_name); - yd->chat_name = NULL; - } + g_free(yd->chat_name); + yd->chat_name = NULL; if (purple_conversations_find_chat(gc, YAHOO_CHAT_ID) != NULL) purple_serv_got_chat_left(gc, YAHOO_CHAT_ID); diff --git a/libpurple/protocols/yahoo/ymsg.c b/libpurple/protocols/yahoo/ymsg.c index d2917d1ee3..e47278e6ad 100644 --- a/libpurple/protocols/yahoo/ymsg.c +++ b/libpurple/protocols/yahoo/ymsg.c @@ -1906,11 +1906,6 @@ static void yahoo_auth16_stage1(PurpleConnection *gc, const char *seed) purple_debug_info("yahoo", "Authentication: In yahoo_auth16_stage1\n"); - if(!purple_ssl_is_supported()) { - purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); - return; - } - auth_data = g_new0(struct yahoo_auth_data, 1); auth_data->gc = gc; auth_data->seed = g_strdup(seed); diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index 851b85e822..9d6f3d667a 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -2313,10 +2313,8 @@ static void zephyr_set_status(PurpleAccount *account, PurpleStatus *status) { zephyr_account *zephyr = purple_connection_get_protocol_data(gc); PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_status_type(status)); - if (zephyr->away) { - g_free(zephyr->away); - zephyr->away=NULL; - } + g_free(zephyr->away); + zephyr->away = NULL; if (primitive == PURPLE_STATUS_AWAY) { zephyr->away = g_strdup(purple_status_get_attr_string(status,"message")); diff --git a/libpurple/protocols/zephyr/zephyr.h b/libpurple/protocols/zephyr/zephyr.h index 10546b6576..4d0e17e3a4 100644 --- a/libpurple/protocols/zephyr/zephyr.h +++ b/libpurple/protocols/zephyr/zephyr.h @@ -22,6 +22,8 @@ #ifndef _ZEPHYR_H_ #define _ZEPHYR_H_ +#include <gmodule.h> + #include "protocol.h" #define ZEPHYR_TYPE_PROTOCOL (zephyr_protocol_get_type()) diff --git a/libpurple/proxy.c b/libpurple/proxy.c index 143f807e51..a6a12a7a90 100644 --- a/libpurple/proxy.c +++ b/libpurple/proxy.c @@ -332,18 +332,12 @@ purple_gnome_proxy_get_info(void) g_free(tmp); /* Free the old fields */ - if (info.host) { - g_free(info.host); - info.host = NULL; - } - if (info.username) { - g_free(info.username); - info.username = NULL; - } - if (info.password) { - g_free(info.password); - info.password = NULL; - } + g_free(info.host); + info.host = NULL; + g_free(info.username); + info.username = NULL; + g_free(info.password); + info.password = NULL; tmp = purple_gnome_proxy_get_parameter(GNOME_PROXY_USE_SAME_PROXY, gnome_version); if (!tmp) diff --git a/libpurple/purple-socket.c b/libpurple/purple-socket.c index cf821818f9..72b368b950 100644 --- a/libpurple/purple-socket.c +++ b/libpurple/purple-socket.c @@ -259,12 +259,6 @@ purple_socket_connect(PurpleSocket *ps, PurpleSocketConnectCb cb, ps->cb_data = user_data; if (ps->is_tls) { - if (!purple_ssl_is_supported()) { - purple_debug_error("socket", "TLS is not supported"); - ps->state = PURPLE_SOCKET_STATE_ERROR; - return FALSE; - } - ps->tls_connection = purple_ssl_connect(account, ps->host, ps->port, _purple_socket_connected_tls, _purple_socket_connected_tls_error, ps); diff --git a/libpurple/server.c b/libpurple/server.c index 87f2029ca7..e997447f43 100644 --- a/libpurple/server.c +++ b/libpurple/server.c @@ -103,7 +103,7 @@ get_last_auto_response(PurpleConnection *gc, const char *name) tmp = tmp->next; } - lar = (struct last_auto_response *)g_new0(struct last_auto_response, 1); + lar = g_new0(struct last_auto_response, 1); g_snprintf(lar->name, sizeof(lar->name), "%s", name); lar->gc = gc; lar->sent = 0; diff --git a/libpurple/sslconn.c b/libpurple/sslconn.c index f79385bd0e..4763d85fe8 100644 --- a/libpurple/sslconn.c +++ b/libpurple/sslconn.c @@ -56,17 +56,6 @@ ssl_init(void) return (_ssl_initialized = ops->init()); } -gboolean -purple_ssl_is_supported(void) -{ -#ifdef HAVE_SSL - ssl_init(); - return (purple_ssl_get_ops() != NULL); -#else - return FALSE; -#endif -} - static void purple_ssl_connect_cb(gpointer data, gint source, const gchar *error_message) { @@ -110,7 +99,6 @@ purple_ssl_connect_with_ssl_cn(PurpleAccount *account, const char *host, int por g_return_val_if_fail(host != NULL, NULL); g_return_val_if_fail(port != 0 && port != -1, NULL); g_return_val_if_fail(func != NULL, NULL); - g_return_val_if_fail(purple_ssl_is_supported(), NULL); if (!_ssl_initialized) { @@ -156,7 +144,6 @@ purple_ssl_input_add(PurpleSslConnection *gsc, PurpleSslInputFunction func, void *data) { g_return_if_fail(func != NULL); - g_return_if_fail(purple_ssl_is_supported()); purple_ssl_input_remove(gsc); @@ -203,7 +190,6 @@ purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd, g_return_val_if_fail(fd != -1, NULL); g_return_val_if_fail(func != NULL, NULL); - g_return_val_if_fail(purple_ssl_is_supported(), NULL); if (!_ssl_initialized) { diff --git a/libpurple/sslconn.h b/libpurple/sslconn.h index 5646fc78b1..7f217c4714 100644 --- a/libpurple/sslconn.h +++ b/libpurple/sslconn.h @@ -152,15 +152,6 @@ G_BEGIN_DECLS /**************************************************************************/ /** - * purple_ssl_is_supported: - * - * Returns whether or not SSL is currently supported. - * - * Returns: %TRUE if SSL is supported, or %FALSE otherwise. - */ -gboolean purple_ssl_is_supported(void); - -/** * purple_ssl_strerror: * @error: Error code * diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index 239d6a4fe0..247a1a57a7 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -114,11 +114,7 @@ typedef struct GtkWidget *password_box; gchar *password; GtkWidget *username_entry; -#if GTK_CHECK_VERSION(3,0,0) GdkRGBA username_entry_hint_color; -#else - GdkColor *username_entry_hint_color; -#endif GtkWidget *password_entry; GtkWidget *alias_entry; GtkWidget *remember_pass_check; @@ -325,11 +321,7 @@ username_focus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *d if(!strcmp(gtk_entry_get_text(GTK_ENTRY(widget)), label)) { gtk_entry_set_text(GTK_ENTRY(widget), ""); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_color(widget, GTK_STATE_NORMAL, NULL); -#else - gtk_widget_modify_text(widget, GTK_STATE_NORMAL,NULL); -#endif } g_hash_table_destroy(table); @@ -355,11 +347,7 @@ username_nofocus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog gtk_entry_set_text(GTK_ENTRY(widget), label); /* Make sure we can hit it again */ g_signal_handlers_unblock_by_func(widget, G_CALLBACK(username_changed_cb), dialog); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_color(widget, GTK_STATE_NORMAL, &dialog->username_entry_hint_color); -#else - gtk_widget_modify_text(widget, GTK_STATE_NORMAL, dialog->username_entry_hint_color); -#endif } g_hash_table_destroy(table); @@ -374,13 +362,8 @@ username_themechange_cb(GObject *widget, GdkEventFocus *event, AccountPrefsDialo GHashTable *table; const char *label, *text; char *temp_text = NULL; -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context; GtkBorder border; -#else - GtkStyle *style; - const GtkBorder *border = NULL; -#endif gint xsize; table = purple_protocol_client_iface_get_account_text_table(dialog->protocol, NULL); @@ -392,51 +375,25 @@ username_themechange_cb(GObject *widget, GdkEventFocus *event, AccountPrefsDialo if (strcmp(text, label)) { temp_text = g_strdup(text); gtk_entry_set_text(GTK_ENTRY(widget), label); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_color(GTK_WIDGET(widget), GTK_STATE_NORMAL, NULL); -#else - gtk_widget_modify_text(GTK_WIDGET(widget), GTK_STATE_NORMAL, NULL); -#endif } -#if GTK_CHECK_VERSION(3,0,0) context = gtk_widget_get_style_context(dialog->username_entry); gtk_style_context_get_color(context, GTK_STATE_FLAG_INSENSITIVE, &dialog->username_entry_hint_color); -#else - style = gtk_rc_get_style(dialog->username_entry); - dialog->username_entry_hint_color = &(style->fg[GTK_STATE_INSENSITIVE]); -#endif pango_layout_get_pixel_size(gtk_entry_get_layout(GTK_ENTRY(widget)), &xsize, NULL); -#if GTK_CHECK_VERSION(3,0,0) gtk_style_context_get_margin(context, GTK_STATE_FLAG_NORMAL, &border); xsize += border.left + border.right; gtk_style_context_get_padding(context, GTK_STATE_FLAG_NORMAL, &border); xsize += border.left + border.right; -#else - xsize += 2 * style->xthickness; - gtk_style_get(style, GTK_TYPE_ENTRY, "inner-border", &border, NULL); - if (border) - xsize += border->left + border->right; - else - xsize += 4; /* 2 * default inner-border */ -#endif gtk_widget_set_size_request(GTK_WIDGET(widget), xsize, -1); if (temp_text) { gtk_entry_set_text(GTK_ENTRY(widget), temp_text); g_free(temp_text); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_color(GTK_WIDGET(widget), GTK_STATE_NORMAL, NULL); -#else - gtk_widget_modify_text(GTK_WIDGET(widget), GTK_STATE_NORMAL, NULL); -#endif } else -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_color(GTK_WIDGET(widget), GTK_STATE_NORMAL, &dialog->username_entry_hint_color); -#else - gtk_widget_modify_text(GTK_WIDGET(widget), GTK_STATE_NORMAL, dialog->username_entry_hint_color); -#endif g_signal_handlers_unblock_by_func(widget, G_CALLBACK(username_themechange_cb), dialog); g_signal_handlers_unblock_by_func(widget, G_CALLBACK(username_changed_cb), dialog); @@ -548,12 +505,8 @@ account_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, static void update_editable(PurpleConnection *gc, AccountPrefsDialog *dialog) { -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *style; GdkRGBA color; -#else - GtkStyle *style; -#endif gboolean set; GList *l; @@ -566,7 +519,6 @@ update_editable(PurpleConnection *gc, AccountPrefsDialog *dialog) set = !(purple_account_is_connected(dialog->account) || purple_account_is_connecting(dialog->account)); gtk_widget_set_sensitive(dialog->protocol_menu, set); gtk_editable_set_editable(GTK_EDITABLE(dialog->username_entry), set); -#if GTK_CHECK_VERSION(3,0,0) style = set ? NULL : gtk_widget_get_style_context(dialog->username_entry); if (style) { gtk_style_context_get_background_color(style, GTK_STATE_FLAG_INSENSITIVE, &color); @@ -574,18 +526,12 @@ update_editable(PurpleConnection *gc, AccountPrefsDialog *dialog) } else { gtk_widget_override_background_color(dialog->username_entry, GTK_STATE_FLAG_NORMAL, NULL); } -#else - style = set ? NULL : gtk_widget_get_style(dialog->username_entry); - gtk_widget_modify_base(dialog->username_entry, GTK_STATE_NORMAL, - style ? &style->base[GTK_STATE_INSENSITIVE] : NULL); -#endif for (l = dialog->user_split_entries ; l != NULL ; l = l->next) { if (l->data == NULL) continue; if (GTK_IS_EDITABLE(l->data)) { gtk_editable_set_editable(GTK_EDITABLE(l->data), set); -#if GTK_CHECK_VERSION(3,0,0) style = set ? NULL : gtk_widget_get_style_context(GTK_WIDGET(l->data)); if (style) { gtk_style_context_get_background_color(style, GTK_STATE_FLAG_INSENSITIVE, &color); @@ -593,11 +539,6 @@ update_editable(PurpleConnection *gc, AccountPrefsDialog *dialog) } else { gtk_widget_override_background_color(GTK_WIDGET(l->data), GTK_STATE_FLAG_NORMAL, NULL); } -#else - style = set ? NULL : gtk_widget_get_style(GTK_WIDGET(l->data)); - gtk_widget_modify_base(GTK_WIDGET(l->data), GTK_STATE_NORMAL, - style ? &style->base[GTK_STATE_INSENSITIVE] : NULL); -#endif } else { gtk_widget_set_sensitive(GTK_WIDGET(l->data), set); } @@ -2574,11 +2515,7 @@ pidgin_accounts_window_show(void) width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/accounts/dialog/width"); height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/accounts/dialog/height"); -#if GTK_CHECK_VERSION(3,0,0) dialog->window = win = pidgin_create_dialog(_("Accounts"), 0, "accounts", TRUE); -#else - dialog->window = win = pidgin_create_dialog(_("Accounts"), PIDGIN_HIG_BORDER, "accounts", TRUE); -#endif gtk_window_set_default_size(GTK_WINDOW(win), width, height); g_signal_connect(G_OBJECT(win), "delete_event", diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 72bab4792c..b35092443c 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -122,11 +122,6 @@ typedef struct guint select_notebook_page_timeout; -#if !GTK_CHECK_VERSION(3,0,0) - GdkCursor *hand_cursor; /* Hand cursor */ - GdkCursor *arrow_cursor; /* Arrow cursor */ - gboolean changing_style; /* True when changing GTK+ theme style */ -#endif } PidginBuddyListPrivate; @@ -2943,11 +2938,7 @@ static struct tooltip_data * create_tip_for_node(PurpleBlistNode *node, gboolean static gboolean pidgin_blist_paint_tip(GtkWidget *widget, cairo_t *cr, gpointer null) { -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context; -#else - GtkStyle *style; -#endif int current_height, max_width; int max_text_width; int max_avatar_width; @@ -2959,12 +2950,8 @@ pidgin_blist_paint_tip(GtkWidget *widget, cairo_t *cr, gpointer null) if(gtkblist->tooltipdata == NULL) return FALSE; -#if GTK_CHECK_VERSION(3,0,0) context = gtk_widget_get_style_context(gtkblist->tipwindow); gtk_style_context_add_class(context, GTK_STYLE_CLASS_TOOLTIP); -#else - style = gtk_widget_get_style(gtkblist->tipwindow); -#endif max_text_width = 0; max_avatar_width = 0; @@ -2993,7 +2980,6 @@ pidgin_blist_paint_tip(GtkWidget *widget, cairo_t *cr, gpointer null) if (td->avatar && pidgin_gdk_pixbuf_is_opaque(td->avatar)) { -#if GTK_CHECK_VERSION(3,0,0) gtk_style_context_save(context); gtk_style_context_add_class(context, GTK_STYLE_CLASS_FRAME); if (dir == GTK_TEXT_DIR_RTL) { @@ -3007,22 +2993,6 @@ pidgin_blist_paint_tip(GtkWidget *widget, cairo_t *cr, gpointer null) td->avatar_width + 2, td->avatar_height + 2); } gtk_style_context_restore(context); -#else - if (dir == GTK_TEXT_DIR_RTL) { - gtk_paint_flat_box(style, gtkblist->tipwindow->window, - GTK_STATE_NORMAL, GTK_SHADOW_OUT, - NULL, gtkblist->tipwindow, "tooltip", - TOOLTIP_BORDER - 1, current_height - 1, - td->avatar_width + 2, td->avatar_height + 2); - } else { - gtk_paint_flat_box(style, gtkblist->tipwindow->window, - GTK_STATE_NORMAL, GTK_SHADOW_OUT, - NULL, gtkblist->tipwindow, "tooltip", - max_width - (td->avatar_width + TOOLTIP_BORDER) - 1, - current_height - 1, td->avatar_width + 2, - td->avatar_height + 2); - } -#endif } if (td->status_icon) { @@ -3059,7 +3029,6 @@ pidgin_blist_paint_tip(GtkWidget *widget, cairo_t *cr, gpointer null) } if (td->name_layout) { -#if GTK_CHECK_VERSION(3,0,0) if (dir == GTK_TEXT_DIR_RTL) { gtk_render_layout(context, cr, max_width - (TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000), @@ -3069,22 +3038,9 @@ pidgin_blist_paint_tip(GtkWidget *widget, cairo_t *cr, gpointer null) TOOLTIP_BORDER + status_size + SMALL_SPACE, current_height, td->name_layout); } -#else - if (dir == GTK_TEXT_DIR_RTL) { - gtk_paint_layout(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, gtkblist->tipwindow, "tooltip", - max_width -(TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000), - current_height, td->name_layout); - } else { - gtk_paint_layout(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, gtkblist->tipwindow, "tooltip", - TOOLTIP_BORDER + status_size + SMALL_SPACE, current_height, td->name_layout); - } -#endif } if (td->layout) { -#if GTK_CHECK_VERSION(3,0,0) if (dir != GTK_TEXT_DIR_RTL) { gtk_render_layout(context, cr, TOOLTIP_BORDER + status_size + SMALL_SPACE, @@ -3096,20 +3052,6 @@ pidgin_blist_paint_tip(GtkWidget *widget, cairo_t *cr, gpointer null) current_height + td->name_height, td->layout); } -#else - if (dir != GTK_TEXT_DIR_RTL) { - gtk_paint_layout(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, gtkblist->tipwindow, "tooltip", - TOOLTIP_BORDER + status_size + SMALL_SPACE, - current_height + td->name_height, td->layout); - } else { - gtk_paint_layout(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, gtkblist->tipwindow, "tooltip", - max_width - (TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000), - current_height + td->name_height, - td->layout); - } -#endif } current_height += MAX(td->name_height + td->height, td->avatar_height) + td->padding; @@ -5088,24 +5030,6 @@ gtk_blist_window_key_press_cb(GtkWidget *w, GdkEventKey *event, PidginBuddyList return FALSE; } -#if !GTK_CHECK_VERSION(3,0,0) -static gboolean -headline_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, - PidginBuddyListPrivate *priv) -{ - gdk_window_set_cursor(widget->window, priv->hand_cursor); - return FALSE; -} - -static gboolean -headline_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, - PidginBuddyListPrivate *priv) -{ - gdk_window_set_cursor(widget->window, priv->arrow_cursor); - return FALSE; -} -#endif - static void reset_headline(PidginBuddyList *gtkblist) { @@ -5124,8 +5048,6 @@ headline_click_callback(gpointer unused) return FALSE; } -#if GTK_CHECK_VERSION(3,0,0) - static gboolean headline_response_cb(GtkInfoBar *infobar, int resp, PidginBuddyList *gtkblist) { @@ -5163,31 +5085,6 @@ headline_press_cb(GtkWidget *widget, GdkEventButton *event, GtkInfoBar *infobar) return TRUE; } -#else - -static gboolean -headline_close_press_cb(GtkButton *button, PidginBuddyList *gtkblist) -{ - gtk_widget_hide(gtkblist->headline); - return FALSE; -} - -static gboolean -headline_box_press_cb(GtkWidget *widget, GdkEventButton *event, PidginBuddyList *gtkblist) -{ - gtk_widget_hide(gtkblist->headline); - if (gtkblist->headline_callback) - g_idle_add(headline_click_callback, NULL); - else { - if (gtkblist->headline_destroy) - gtkblist->headline_destroy(gtkblist->headline_data); - reset_headline(gtkblist); - } - return TRUE; -} - -#endif - /***********************************/ /* Connection error handling stuff */ /***********************************/ @@ -5611,27 +5508,6 @@ show_initial_account_errors(PidginBuddyList *gtkblist) } } -#if !GTK_CHECK_VERSION(3,0,0) -static gboolean -paint_headline_hbox (GtkWidget *widget, - GdkEventExpose *event, - gpointer user_data) -{ - gtk_paint_flat_box (widget->style, - widget->window, - GTK_STATE_NORMAL, - GTK_SHADOW_OUT, - NULL, - widget, - "tooltip", - widget->allocation.x + 1, - widget->allocation.y + 1, - widget->allocation.width - 2, - widget->allocation.height - 2); - return FALSE; -} -#endif - /* This assumes there are not things like groupless buddies or multi-leveled groups. * I'm sure other things in this code assumes that also. */ @@ -5648,34 +5524,6 @@ treeview_style_set (GtkWidget *widget, } } -#if !GTK_CHECK_VERSION(3,0,0) -static void -headline_style_set (GtkWidget *widget, - GtkStyle *prev_style) -{ - PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist); - GtkStyle *style; - GtkWidget *window; - - if (priv->changing_style) - return; - - /* This is a hack needed to use the tooltip background colour */ - window = gtk_window_new(GTK_WINDOW_POPUP); - gtk_widget_set_name(window, "gtk-tooltip"); - gtk_widget_ensure_style(window); - style = gtk_widget_get_style(window); - - priv->changing_style = TRUE; - gtk_widget_set_style(gtkblist->headline, style); - priv->changing_style = FALSE; - - gtk_widget_destroy(window); - - gtk_widget_queue_draw(gtkblist->headline); -} -#endif - /******************************************/ /* End of connection error handling stuff */ /******************************************/ @@ -5905,12 +5753,8 @@ static void pidgin_blist_show(PurpleBuddyList *list) GtkTreeViewColumn *column; GtkWidget *menu; GtkWidget *sep; -#if GTK_CHECK_VERSION(3,0,0) GtkWidget *infobar; GtkWidget *content_area; -#else - GtkWidget *ebox; -#endif GtkWidget *label; GtkWidget *close; char *pretty, *tmp; @@ -5919,9 +5763,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) GError *error; GtkAccelGroup *accel_group; GtkTreeSelection *selection; -#if ! GTK_CHECK_VERSION(3,0,0) - int blist_width; -#endif GtkTargetEntry dte[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW}, {"application/x-im-contact", 0, DRAG_BUDDY}, {"text/x-vcard", 0, DRAG_VCARD }, @@ -5956,11 +5797,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) g_signal_connect(G_OBJECT(gtkblist->window), "focus-out-event", G_CALLBACK(blist_focus_cb), gtkblist); - /* TODO: how is this done in gtk+ 3.0? */ -#if !GTK_CHECK_VERSION(3,0,0) - GTK_WINDOW(gtkblist->window)->allow_shrink = TRUE; -#endif - gtkblist->main_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show(gtkblist->main_vbox); gtk_container_add(GTK_CONTAINER(gtkblist->window), gtkblist->main_vbox); @@ -6043,7 +5879,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) pidgin_blist_select_notebook_page(gtkblist); /****************************** Headline **********************************/ -#if GTK_CHECK_VERSION(3,0,0) gtkblist->headline = gtk_event_box_new(); gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->headline, @@ -6078,50 +5913,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) g_signal_connect(gtkblist->headline, "button-press-event", G_CALLBACK(headline_press_cb), infobar); -#else - - ebox = gtk_event_box_new(); - gtk_box_pack_start(GTK_BOX(gtkblist->vbox), ebox, FALSE, FALSE, 0); - gtkblist->headline = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3); - gtk_container_set_border_width(GTK_CONTAINER(gtkblist->headline), 6); - gtk_container_add(GTK_CONTAINER(ebox), gtkblist->headline); - gtkblist->headline_image = gtk_image_new_from_pixbuf(NULL); - gtk_misc_set_alignment(GTK_MISC(gtkblist->headline_image), 0.0, 0); - gtkblist->headline_label = gtk_label_new(NULL); - blist_width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width") - 25; - if (blist_width < -1) - blist_width = -1; - gtk_widget_set_size_request(gtkblist->headline_label, blist_width, -1); - gtk_label_set_line_wrap(GTK_LABEL(gtkblist->headline_label), TRUE); - gtk_box_pack_start(GTK_BOX(gtkblist->headline), gtkblist->headline_image, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(gtkblist->headline), gtkblist->headline_label, TRUE, TRUE, 0); - g_signal_connect(gtkblist->headline_label, /* connecting on headline doesn't work, because - the signal is not emitted when theme is changed */ - "style-set", - G_CALLBACK(headline_style_set), - NULL); - g_signal_connect (gtkblist->headline, - "expose_event", - G_CALLBACK (paint_headline_hbox), - NULL); - gtk_widget_set_name(gtkblist->headline, "gtk-tooltips"); - - priv->hand_cursor = gdk_cursor_new (GDK_HAND2); - priv->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); - - /* Close button. */ - close = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); - close = pidgin_create_small_button(close); - gtk_box_pack_start(GTK_BOX(gtkblist->headline), close, FALSE, FALSE, 0); - gtk_widget_set_tooltip_text(close, _("Close")); - g_signal_connect(close, "clicked", G_CALLBACK(headline_close_press_cb), gtkblist); - - g_signal_connect(G_OBJECT(ebox), "enter-notify-event", G_CALLBACK(headline_box_enter_cb), priv); - g_signal_connect(G_OBJECT(ebox), "leave-notify-event", G_CALLBACK(headline_box_leave_cb), priv); - g_signal_connect(G_OBJECT(ebox), "button-press-event", G_CALLBACK(headline_box_press_cb), gtkblist); - -#endif - /****************************** GtkTreeView **********************************/ gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS, GDK_TYPE_PIXBUF, /* Status icon */ @@ -6220,9 +6011,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) gtkblist->statusbox = pidgin_status_box_new(); gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->statusbox, FALSE, TRUE, 0); gtk_widget_set_name(gtkblist->statusbox, "pidgin_blist_statusbox"); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_container_set_border_width(GTK_CONTAINER(gtkblist->statusbox), 3); -#endif gtk_widget_show(gtkblist->statusbox); /* set the Show Offline Buddies option. must be done @@ -7119,13 +6907,6 @@ static void pidgin_blist_destroy(PurpleBuddyList *list) priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist); -#if !GTK_CHECK_VERSION(3,0,0) - gdk_cursor_unref(priv->hand_cursor); - gdk_cursor_unref(priv->arrow_cursor); - priv->hand_cursor = NULL; - priv->arrow_cursor = NULL; -#endif - if (priv->current_theme) g_object_unref(priv->current_theme); if (priv->select_notebook_page_timeout) diff --git a/pidgin/gtkcertmgr.c b/pidgin/gtkcertmgr.c index a492cf8877..ccd56157ec 100644 --- a/pidgin/gtkcertmgr.c +++ b/pidgin/gtkcertmgr.c @@ -608,11 +608,7 @@ pidgin_certmgr_show(void) win = dlg->window = pidgin_create_dialog(_("Certificate Manager"),/* Title */ -#if GTK_CHECK_VERSION(3,0,0) 0, /*Window border*/ -#else - PIDGIN_HIG_BORDER, /*Window border*/ -#endif "certmgr", /* Role */ TRUE); /* Allow resizing */ g_signal_connect(G_OBJECT(win), "delete_event", diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index cd7e32ff64..52c1ac9425 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5198,12 +5198,8 @@ pidgin_conv_create_tooltip(GtkWidget *tipwindow, gpointer userdata, int *w, int static gboolean pidgin_conv_end_quickfind(PidginConversation *gtkconv) { -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context = gtk_widget_get_style_context(gtkconv->quickfind_entry); gtk_style_context_remove_class(context, "not-found"); -#else - gtk_widget_modify_base(gtkconv->quickfind_entry, GTK_STATE_NORMAL, NULL); -#endif webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(gtkconv->webview)); gtk_widget_hide(gtkconv->quickfind_container); @@ -5219,23 +5215,11 @@ quickfind_process_input(GtkWidget *entry, GdkEventKey *event, PidginConversation case GDK_KEY_Return: case GDK_KEY_KP_Enter: if (webkit_web_view_search_text(WEBKIT_WEB_VIEW(gtkconv->webview), gtk_entry_get_text(GTK_ENTRY(entry)), FALSE, TRUE, TRUE)) { -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context = gtk_widget_get_style_context(gtkconv->quickfind_entry); gtk_style_context_remove_class(context, "not-found"); -#else - gtk_widget_modify_base(gtkconv->quickfind_entry, GTK_STATE_NORMAL, NULL); -#endif } else { -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context = gtk_widget_get_style_context(gtkconv->quickfind_entry); gtk_style_context_add_class(context, "not-found"); -#else - GdkColor col; - col.red = 0xffff; - col.green = 0xafff; - col.blue = 0xafff; - gtk_widget_modify_base(gtkconv->quickfind_entry, GTK_STATE_NORMAL, &col); -#endif } break; case GDK_KEY_Escape: @@ -5252,7 +5236,6 @@ pidgin_conv_setup_quickfind(PidginConversation *gtkconv, GtkWidget *container) { GtkWidget *widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); GtkWidget *label, *entry, *close; -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context; GtkCssProvider *filter_css; const gchar filter_style[] = @@ -5262,7 +5245,6 @@ pidgin_conv_setup_quickfind(PidginConversation *gtkconv, GtkWidget *container) "background-image: none;" "background-color: @error_bg_color;" "}"; -#endif gtk_box_pack_start(GTK_BOX(container), widget, FALSE, FALSE, 0); @@ -5275,14 +5257,12 @@ pidgin_conv_setup_quickfind(PidginConversation *gtkconv, GtkWidget *container) entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(widget), entry, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION(3,0,0) filter_css = gtk_css_provider_new(); gtk_css_provider_load_from_data(filter_css, filter_style, -1, NULL); context = gtk_widget_get_style_context(entry); gtk_style_context_add_provider(context, GTK_STYLE_PROVIDER(filter_css), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); -#endif gtkconv->quickfind_entry = entry; gtkconv->quickfind_container = widget; @@ -8918,43 +8898,6 @@ pidgin_conversations_init(void) default_conv_theme = purple_theme_manager_load_theme(theme_dir, "conversation"); g_free(theme_dir); -#if !GTK_CHECK_VERSION(3,0,0) - { - /* Set default tab colors */ - GString *str = g_string_new(NULL); - GtkSettings *settings = gtk_settings_get_default(); - GtkStyle *parent = gtk_rc_get_style_by_paths(settings, "tab-container.tab-label*", NULL, G_TYPE_NONE), *now; - struct { - const char *stylename; - const char *labelname; - const char *color; - } styles[] = { - {"pidgin_tab_label_typing_default", "tab-label-typing", "#4e9a06"}, - {"pidgin_tab_label_typed_default", "tab-label-typed", "#c4a000"}, - {"pidgin_tab_label_attention_default", "tab-label-attention", "#006aff"}, - {"pidgin_tab_label_unreadchat_default", "tab-label-unreadchat", "#cc0000"}, - {"pidgin_tab_label_event_default", "tab-label-event", "#888a85"}, - {NULL, NULL, NULL} - }; - int iter; - for (iter = 0; styles[iter].stylename; iter++) { - now = gtk_rc_get_style_by_paths(settings, styles[iter].labelname, NULL, G_TYPE_NONE); - if (parent == now || - (parent && now && parent->rc_style == now->rc_style)) { - g_string_append_printf(str, "style \"%s\" {\n" - "fg[ACTIVE] = \"%s\"\n" - "}\n" - "widget \"*%s\" style \"%s\"\n", - styles[iter].stylename, - styles[iter].color, - styles[iter].labelname, styles[iter].stylename); - } - } - gtk_rc_parse_string(str->str); - g_string_free(str, TRUE); - gtk_rc_reset_styles(settings); - } -#endif } static void @@ -9242,9 +9185,7 @@ static void notebook_init_grab(PidginConvWindow *gtkwin, GtkWidget *widget, GdkEvent *event) { static GdkCursor *cursor = NULL; -#if GTK_CHECK_VERSION(3,0,0) GdkDevice *device; -#endif gtkwin->in_drag = TRUE; @@ -9259,23 +9200,12 @@ notebook_init_grab(PidginConvWindow *gtkwin, GtkWidget *widget, GdkEvent *event) /* Grab the pointer */ gtk_grab_add(gtkwin->notebook); -#if GTK_CHECK_VERSION(3,0,0) device = gdk_event_get_device(event); if (!gdk_display_device_is_grabbed(gdk_device_get_display(device), device)) gdk_device_grab(device, gtk_widget_get_window(gtkwin->notebook), GDK_OWNERSHIP_WINDOW, FALSE, GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, cursor, gdk_event_get_time(event)); -#else -#ifndef _WIN32 - /* Currently for win32 GTK+ (as of 2.2.1), gdk_pointer_is_grabbed will - always be true after a button press. */ - if (!gdk_pointer_is_grabbed()) -#endif - gdk_pointer_grab(gtk_widget_get_window(gtkwin->notebook), FALSE, - GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, - NULL, cursor, gdk_event_get_time(event)); -#endif } static gboolean @@ -9541,9 +9471,7 @@ notebook_release_cb(GtkWidget *widget, GdkEventButton *e, PidginConvWindow *win) gint dest_page_num = 0; gboolean new_window = FALSE; gboolean to_right = FALSE; -#if GTK_CHECK_VERSION(3,0,0) GdkDevice *device; -#endif /* * Don't check to make sure that the event's window matches the @@ -9553,18 +9481,11 @@ notebook_release_cb(GtkWidget *widget, GdkEventButton *e, PidginConvWindow *win) if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) return FALSE; -#if GTK_CHECK_VERSION(3,0,0) device = gdk_event_get_device((GdkEvent *)e); if (gdk_display_device_is_grabbed(gdk_device_get_display(device), device)) { gdk_device_ungrab(device, gdk_event_get_time((GdkEvent *)e)); gtk_grab_remove(widget); } -#else - if (gdk_pointer_is_grabbed()) { - gdk_pointer_ungrab(gdk_event_get_time((GdkEvent *)e)); - gtk_grab_remove(widget); - } -#endif if (!win->in_predrag && !win->in_drag) return FALSE; @@ -10367,7 +10288,6 @@ gtkconv_tab_set_tip(GtkWidget *widget, GdkEventCrossing *event, PidginConversati return FALSE; } -#if GTK_CHECK_VERSION(3,0,0) static void set_default_tab_colors(GtkWidget *widget) { @@ -10411,7 +10331,6 @@ set_default_tab_colors(GtkWidget *widget) g_error_free(error); g_string_free(str, TRUE); } -#endif void pidgin_conv_window_add_gtkconv(PidginConvWindow *win, PidginConversation *gtkconv) @@ -10448,9 +10367,7 @@ pidgin_conv_window_add_gtkconv(PidginConvWindow *win, PidginConversation *gtkcon /* Tab label. */ gtkconv->tab_label = gtk_label_new(tmp_lab = purple_conversation_get_title(conv)); -#if GTK_CHECK_VERSION(3,0,0) set_default_tab_colors(gtkconv->tab_label); -#endif gtk_widget_set_name(gtkconv->tab_label, "tab-label"); gtkconv->menu_tabby = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_BOX_SPACE); @@ -10671,12 +10588,8 @@ pidgin_conv_window_get_at_event(GdkEvent *event) GList *l; int x, y; -#if GTK_CHECK_VERSION(3,0,0) gdkwin = gdk_device_get_window_at_position(gdk_event_get_device(event), &x, &y); -#else - gdkwin = gdk_window_at_pointer(&x, &y); -#endif if (gdkwin) gdkwin = gdk_window_get_toplevel(gdkwin); diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c index 89b6d8293c..6be06780a8 100644 --- a/pidgin/gtkdebug.c +++ b/pidgin/gtkdebug.c @@ -148,18 +148,13 @@ pause_cb(GtkWidget *w, DebugWindow *win) *****************************************************************************/ static void regex_clear_color(GtkWidget *w) { -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context = gtk_widget_get_style_context(w); gtk_style_context_remove_class(context, "good-filter"); gtk_style_context_remove_class(context, "bad-filter"); -#else - gtk_widget_modify_base(w, GTK_STATE_NORMAL, NULL); -#endif } static void regex_change_color(GtkWidget *w, gboolean success) { -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context = gtk_widget_get_style_context(w); if (success) { @@ -169,21 +164,6 @@ regex_change_color(GtkWidget *w, gboolean success) { gtk_style_context_add_class(context, "bad-filter"); gtk_style_context_remove_class(context, "good-filter"); } -#else - GdkColor color; - - if (success) { - color.red = 0xAFFF; - color.green = 0xFFFF; - color.blue = 0xAFFF; - } else { - color.red = 0xFFFF; - color.green = 0xAFFF; - color.blue = 0xAFFF; - } - - gtk_widget_modify_base(w, GTK_STATE_NORMAL, &color); -#endif } static void @@ -438,7 +418,6 @@ debug_window_new(void) gint width, height; void *handle; GtkToolItem *item; -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context; GtkCssProvider *filter_css; const gchar filter_style[] = @@ -454,7 +433,6 @@ debug_window_new(void) "background-image: none;" "background-color: @success_color;" "}"; -#endif win = g_new0(DebugWindow, 1); @@ -548,14 +526,12 @@ debug_window_new(void) gtk_container_add(GTK_CONTAINER(item), GTK_WIDGET(win->expression)); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); -#if GTK_CHECK_VERSION(3,0,0) filter_css = gtk_css_provider_new(); gtk_css_provider_load_from_data(filter_css, filter_style, -1, NULL); context = gtk_widget_get_style_context(win->expression); gtk_style_context_add_provider(context, GTK_STYLE_PROVIDER(filter_css), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); -#endif /* this needs to be before the text is set from the pref if we want it * to colorize a stored expression. diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index b2bd111ec1..168d62dce7 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -467,13 +467,8 @@ pidgin_build_help_dialog(const char *title, const char *role, GString *string) AtkObject *obj; char *filename, *tmp; -#if GTK_CHECK_VERSION(3,0,0) win = pidgin_create_dialog(title, 0, role, TRUE); vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, 0); -#else - win = pidgin_create_dialog(title, PIDGIN_HIG_BORDER, role, TRUE); - vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, PIDGIN_HIG_BORDER); -#endif gtk_window_set_default_size(GTK_WINDOW(win), 475, 450); /* Generate a logo with a version number */ @@ -624,11 +619,7 @@ void pidgin_dialogs_buildinfo(void) g_string_append(str, "<dt>Plugins:</dt><dd>Disabled</dd>"); #endif -#ifdef HAVE_SSL g_string_append(str, "<dt>SSL:</dt><dd>SSL support is present.</dd>"); -#else - g_string_append(str, "<dt>SSL:</dt><dd>SSL support was <strong><em>NOT</em></strong> compiled!</dd>"); -#endif g_string_append_printf(str, "<dt>GTK+ Runtime:</dt><dd>%u.%u.%u</dd>" "<dt>GLib Runtime:</dt><dd>%u.%u.%u</dd>", diff --git a/pidgin/gtkdnd-hints.c b/pidgin/gtkdnd-hints.c index 11db9c4f1b..fa3f206767 100644 --- a/pidgin/gtkdnd-hints.c +++ b/pidgin/gtkdnd-hints.c @@ -48,8 +48,6 @@ static HintWindowInfo hint_windows[] = { { NULL, NULL, 0, 0 } }; -#if GTK_CHECK_VERSION(3,0,0) - static void dnd_hints_realized_cb(GtkWidget *window, GtkWidget *pix) { @@ -99,41 +97,6 @@ dnd_hints_init_window(const gchar *fname) return win; } -#else - -static GtkWidget * -dnd_hints_init_window(const gchar *fname) -{ - GdkPixbuf *pixbuf; - GdkPixmap *pixmap; - GdkBitmap *bitmap; - GtkWidget *pix; - GtkWidget *win; - GdkColormap *colormap; - - pixbuf = gdk_pixbuf_new_from_file(fname, NULL); - g_return_val_if_fail(pixbuf, NULL); - - win = gtk_window_new(GTK_WINDOW_POPUP); - colormap = gtk_widget_get_colormap(win); - gdk_pixbuf_render_pixmap_and_mask_for_colormap(pixbuf, colormap, - &pixmap, &bitmap, 128); - g_object_unref(G_OBJECT(pixbuf)); - - pix = gtk_image_new_from_pixmap(pixmap, bitmap); - gtk_container_add(GTK_CONTAINER(win), pix); - gtk_widget_shape_combine_mask(win, bitmap, 0, 0); - - g_object_unref(G_OBJECT(pixmap)); - g_object_unref(G_OBJECT(bitmap)); - - gtk_widget_show_all(pix); - - return win; -} - -#endif - static void get_widget_coords(GtkWidget *w, gint *x1, gint *y1, gint *x2, gint *y2) { diff --git a/pidgin/gtkdocklet.c b/pidgin/gtkdocklet.c index 2c86e20b94..fc0e192f30 100644 --- a/pidgin/gtkdocklet.c +++ b/pidgin/gtkdocklet.c @@ -107,18 +107,6 @@ docklet_gtk_status_update_icon(PurpleStatusPrimitive status, PidginDockletFlag n if (icon_name) { gtk_status_icon_set_from_icon_name(docklet, icon_name); } - -#if !GTK_CHECK_VERSION(3,0,0) - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")) { - gboolean pending = FALSE; - pending |= (newflag & PIDGIN_DOCKLET_EMAIL_PENDING); - pending |= (newflag & PIDGIN_DOCKLET_CONV_PENDING); - gtk_status_icon_set_blinking(docklet, pending && - !(newflag & PIDGIN_DOCKLET_CONNECTING)); - } else if (gtk_status_icon_get_blinking(docklet)) { - gtk_status_icon_set_blinking(docklet, FALSE); - } -#endif } static GList * @@ -341,15 +329,6 @@ docklet_toggle_mute(GtkWidget *toggle, void *data) gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); } -#if !GTK_CHECK_VERSION(3,0,0) -static void -docklet_toggle_blink(GtkWidget *toggle, void *data) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/blink", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); -} -#endif - static void docklet_toggle_blist(GtkWidget *toggle, void *data) { @@ -761,13 +740,6 @@ docklet_menu(void) g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_mute), NULL); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); -#if !GTK_CHECK_VERSION(3,0,0) - menuitem = gtk_check_menu_item_new_with_mnemonic(_("_Blink on New Message")); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")); - g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blink), NULL); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); -#endif - pidgin_separator(menu); /* add plugin actions */ diff --git a/pidgin/gtkmedia.c b/pidgin/gtkmedia.c index 101a0b3858..64e6890b4c 100644 --- a/pidgin/gtkmedia.c +++ b/pidgin/gtkmedia.c @@ -922,11 +922,7 @@ pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *si PidginMediaRealizeData *data; GtkWidget *aspect; GtkWidget *remote_video; -#if GTK_CHECK_VERSION(3,0,0) GdkRGBA color = {0.0, 0.0, 0.0, 1.0}; -#else - GdkColor color = {0, 0, 0, 0}; -#endif aspect = gtk_aspect_frame_new(NULL, 0, 0, 4.0/3.0, FALSE); gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN); @@ -938,11 +934,7 @@ pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *si data->participant = g_strdup(gtkmedia->priv->screenname); remote_video = gtk_drawing_area_new(); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_background_color(remote_video, GTK_STATE_FLAG_NORMAL, &color); -#else - gtk_widget_modify_bg(remote_video, GTK_STATE_NORMAL, &color); -#endif g_signal_connect(G_OBJECT(remote_video), "realize", G_CALLBACK(realize_cb), data); gtk_container_add(GTK_CONTAINER(aspect), remote_video); @@ -961,11 +953,7 @@ pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *si PidginMediaRealizeData *data; GtkWidget *aspect; GtkWidget *local_video; -#if GTK_CHECK_VERSION(3,0,0) GdkRGBA color = {0.0, 0.0, 0.0, 1.0}; -#else - GdkColor color = {0, 0, 0, 0}; -#endif aspect = gtk_aspect_frame_new(NULL, 0, 0, 4.0/3.0, TRUE); gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN); @@ -977,11 +965,7 @@ pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *si data->participant = NULL; local_video = gtk_drawing_area_new(); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_background_color(local_video, GTK_STATE_FLAG_NORMAL, &color); -#else - gtk_widget_modify_bg(local_video, GTK_STATE_NORMAL, &color); -#endif g_signal_connect(G_OBJECT(local_video), "realize", G_CALLBACK(realize_cb), data); gtk_container_add(GTK_CONTAINER(aspect), local_video); @@ -1141,8 +1125,7 @@ pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, break; } case PROP_SCREENNAME: - if (media->priv->screenname) - g_free(media->priv->screenname); + g_free(media->priv->screenname); media->priv->screenname = g_value_dup_string(value); break; default: diff --git a/pidgin/gtkmenutray.c b/pidgin/gtkmenutray.c index 0e3120421f..bd3c12a979 100644 --- a/pidgin/gtkmenutray.c +++ b/pidgin/gtkmenutray.c @@ -45,7 +45,6 @@ static GObjectClass *parent_class = NULL; /****************************************************************************** * Item Stuff *****************************************************************************/ -#if GTK_CHECK_VERSION(3,0,0) static void pidgin_menu_tray_select(GtkMenuItem *widget) { /* this may look like nothing, but it's really overriding the @@ -60,21 +59,6 @@ pidgin_menu_tray_deselect(GtkMenuItem *widget) { * overridding the select, so it makes sense to override deselect as well. */ } -#else -static void -pidgin_menu_tray_select(GtkItem *widget) { - /* this may look like nothing, but it's really overriding the - * GtkMenuItem's select function so that it doesn't get highlighted like - * a normal menu item would. - */ -} -static void -pidgin_menu_tray_deselect(GtkItem *widget) { - /* Probably not necessary, but I'd rather be safe than sorry. We're - * overridding the select, so it makes sense to override deselect as well. - */ -} -#endif /****************************************************************************** * Object Stuff @@ -125,11 +109,7 @@ pidgin_menu_tray_finalize(GObject *obj) static void pidgin_menu_tray_class_init(PidginMenuTrayClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); -#if GTK_CHECK_VERSION(3,0,0) GtkMenuItemClass *menu_item_class = GTK_MENU_ITEM_CLASS(klass); -#else - GtkItemClass *menu_item_class = GTK_ITEM_CLASS(klass); -#endif GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); GParamSpec *pspec; diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 0893f7668a..e70011ca7b 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -888,9 +888,6 @@ pidgin_notify_formatted(const char *title, const char *primary, window = gtk_dialog_new(); gtk_window_set_title(GTK_WINDOW(window), title); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_container_set_border_width(GTK_CONTAINER(window), PIDGIN_HIG_BORDER); -#endif gtk_window_set_resizable(GTK_WINDOW(window), TRUE); g_signal_connect(G_OBJECT(window), "delete_event", diff --git a/pidgin/gtkplugin.c b/pidgin/gtkplugin.c index 10ff00cafe..461f8b94b3 100644 --- a/pidgin/gtkplugin.c +++ b/pidgin/gtkplugin.c @@ -808,15 +808,9 @@ static gboolean pidgin_plugins_paint_tooltip(GtkWidget *tipwindow, cairo_t *cr, gpointer data) { PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context = gtk_widget_get_style_context(tipwindow); gtk_style_context_add_class(context, GTK_STYLE_CLASS_TOOLTIP); gtk_render_layout(context, cr, 6, 6, layout); -#else - gtk_paint_layout(tipwindow->style, tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, tipwindow, "tooltip", - 6, 6, layout); -#endif return TRUE; } diff --git a/pidgin/gtkpluginpref.c b/pidgin/gtkpluginpref.c index d005d21543..184b7e4203 100644 --- a/pidgin/gtkpluginpref.c +++ b/pidgin/gtkpluginpref.c @@ -203,9 +203,6 @@ pidgin_plugin_pref_create_frame(PurplePluginPrefFrame *frame) { sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); parent = ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 16); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER); -#endif gtk_widget_show(ret); for(pp = purple_plugin_pref_frame_get_prefs(frame); diff --git a/pidgin/gtkpounce.c b/pidgin/gtkpounce.c index f55c258f59..e5ee5827c1 100644 --- a/pidgin/gtkpounce.c +++ b/pidgin/gtkpounce.c @@ -545,9 +545,6 @@ pidgin_pounce_editor_show(PurpleAccount *account, const char *name, dialog->window = window = gtk_dialog_new(); gtk_window_set_title(GTK_WINDOW(window), (cur_pounce == NULL ? _("Add Buddy Pounce") : _("Modify Buddy Pounce"))); gtk_window_set_role(GTK_WINDOW(window), "buddy_pounce"); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_container_set_border_width(GTK_CONTAINER(dialog->window), PIDGIN_HIG_BORDER); -#endif g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_win_cb), dialog); @@ -1343,11 +1340,8 @@ pidgin_pounces_manager_show(void) width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/width"); height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/height"); -#if GTK_CHECK_VERSION(3,0,0) dialog->window = win = pidgin_create_dialog(_("Buddy Pounces"), 0, "pounces", TRUE); -#else - dialog->window = win = pidgin_create_dialog(_("Buddy Pounces"), PIDGIN_HIG_BORDER, "pounces", TRUE); -#endif + gtk_window_set_default_size(GTK_WINDOW(win), width, height); g_signal_connect(G_OBJECT(win), "delete_event", diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index 226110201c..2f029656ad 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -56,12 +56,7 @@ #include "pidginstock.h" #ifdef USE_VV #include "media-gst.h" -#if GST_CHECK_VERSION(1,0,0) #include <gst/video/videooverlay.h> -#else -#include <gst/interfaces/xoverlay.h> -#include <gst/interfaces/propertyprobe.h> -#endif #ifdef GDK_WINDOWING_WIN32 #include <gdk/gdkwin32.h> #endif @@ -1988,7 +1983,6 @@ conv_page(void) static void network_ip_changed(GtkEntry *entry, gpointer data) { -#if GTK_CHECK_VERSION(3,0,0) const gchar *text = gtk_entry_get_text(entry); GtkStyleContext *context = gtk_widget_get_style_context(GTK_WIDGET(entry)); @@ -2007,30 +2001,6 @@ network_ip_changed(GtkEntry *entry, gpointer data) gtk_style_context_remove_class(context, "bad-ip"); gtk_style_context_remove_class(context, "good-ip"); } -#else - const gchar *text = gtk_entry_get_text(entry); - GdkColor color; - - if (text && *text) { - if (purple_ip_address_is_valid(text)) { - color.red = 0xAFFF; - color.green = 0xFFFF; - color.blue = 0xAFFF; - - purple_network_set_public_ip(text); - } else { - color.red = 0xFFFF; - color.green = 0xAFFF; - color.blue = 0xAFFF; - } - - gtk_widget_modify_base(GTK_WIDGET(entry), GTK_STATE_NORMAL, &color); - - } else { - purple_network_set_public_ip(""); - gtk_widget_modify_base(GTK_WIDGET(entry), GTK_STATE_NORMAL, NULL); - } -#endif } static gboolean @@ -2153,7 +2123,6 @@ network_page(void) GtkWidget *vbox, *hbox, *entry; GtkWidget *label, *auto_ip_checkbox, *ports_checkbox, *spin_button; GtkSizeGroup *sg; -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context; GtkCssProvider *ip_css; const gchar ip_style[] = @@ -2169,7 +2138,6 @@ network_page(void) "background-image: none;" "background-color: @success_color;" "}"; -#endif ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, PIDGIN_HIG_CAT_SPACE); gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER); @@ -2211,14 +2179,12 @@ network_page(void) g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(network_ip_changed), NULL); -#if GTK_CHECK_VERSION(3,0,0) ip_css = gtk_css_provider_new(); gtk_css_provider_load_from_data(ip_css, ip_style, -1, NULL); context = gtk_widget_get_style_context(entry); gtk_style_context_add_provider(context, GTK_STYLE_PROVIDER(ip_css), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); -#endif hbox = pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("Public _IP:"), sg, entry, TRUE, NULL); @@ -3482,17 +3448,6 @@ get_vv_element_devices(const gchar *element_name) GList *ret = NULL; GstElement *element; GObjectClass *klass; -#if !GST_CHECK_VERSION(1,0,0) - GstPropertyProbe *probe; - const GParamSpec *pspec; - guint i; - GValueArray *array; - enum { - PROBE_NONE, - PROBE_DEVICE, - PROBE_NAME - } probe_attr; -#endif ret = g_list_prepend(ret, g_strdup(_("Default"))); ret = g_list_prepend(ret, g_strdup("")); @@ -3524,99 +3479,8 @@ get_vv_element_devices(const gchar *element_name) return g_list_reverse(ret); } -#if GST_CHECK_VERSION(1,0,0) purple_debug_info("vvconfig", "'%s' - gstreamer-1.0 doesn't suport " "property probing\n", element_name); -#else - if (g_object_class_find_property(klass, "device")) - probe_attr = PROBE_DEVICE; - else if (g_object_class_find_property(klass, "device-index") && - g_object_class_find_property(klass, "device-name")) - probe_attr = PROBE_NAME; - else - probe_attr = PROBE_NONE; - - if (!GST_IS_PROPERTY_PROBE(element)) - probe_attr = PROBE_NONE; - - if (probe_attr == PROBE_NONE) - { - purple_debug_info("vvconfig", "'%s' - no possibility to probe " - "for devices\n", element_name); - gst_object_unref(element); - return g_list_reverse(ret); - } - - probe = GST_PROPERTY_PROBE(element); - - if (probe_attr == PROBE_DEVICE) - pspec = gst_property_probe_get_property(probe, "device"); - else /* probe_attr == PROBE_NAME */ - pspec = gst_property_probe_get_property(probe, "device-name"); - - if (!pspec) { - purple_debug_info("vvconfig", "'%s' - creating probe failed\n", - element_name); - gst_object_unref(element); - return g_list_reverse(ret); - } - - /* Set autoprobe[-fps] to FALSE to avoid delays when probing. */ - if (g_object_class_find_property(klass, "autoprobe")) - g_object_set(G_OBJECT(element), "autoprobe", FALSE, NULL); - if (g_object_class_find_property(klass, "autoprobe-fps")) - g_object_set(G_OBJECT(element), "autoprobe-fps", FALSE, NULL); - - array = gst_property_probe_probe_and_get_values(probe, pspec); - if (array == NULL) { - purple_debug_info("vvconfig", "'%s' has no devices\n", - element_name); - gst_object_unref(element); - return g_list_reverse(ret); - } - - for (i = 0; i < array->n_values; i++) { - GValue *device; - const gchar *name; - const gchar *device_name; - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* GValueArray is in gstreamer-0.10 API */ - device = g_value_array_get_nth(array, i); -G_GNUC_END_IGNORE_DEPRECATIONS - - if (probe_attr == PROBE_DEVICE) { - g_object_set_property(G_OBJECT(element), "device", - device); - if (gst_element_set_state(element, GST_STATE_READY) - != GST_STATE_CHANGE_SUCCESS) - { - purple_debug_warning("vvconfig", "Error " - "changing state of %s\n", element_name); - continue; - } - - g_object_get(G_OBJECT(element), "device-name", &name, - NULL); - device_name = g_strdup(g_value_get_string(device)); - } else /* probe_attr == PROBE_NAME */ { - name = g_strdup(g_value_get_string(device)); - device_name = g_strdup_printf("%d", i); - } - - if (name == NULL) - name = _("Unknown"); - purple_debug_info("vvconfig", "Found device %s: %s for %s\n", - device_name, name, element_name); - ret = g_list_prepend(ret, (gpointer)name); - ret = g_list_prepend(ret, (gpointer)device_name); - gst_element_set_state(element, GST_STATE_NULL); - } -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* GValueArray is in gstreamer-0.10 API */ - g_value_array_free(array); -G_GNUC_END_IGNORE_DEPRECATIONS -#endif gst_object_unref(element); return g_list_reverse(ret); @@ -4011,19 +3875,11 @@ make_video_test(GtkWidget *vbox) { GtkWidget *test; GtkWidget *video; -#if GTK_CHECK_VERSION(3,0,0) GdkRGBA color = {0.0, 0.0, 0.0, 1.0}; -#else - GdkColor color = {0, 0, 0, 0}; -#endif video_drawing_area = video = gtk_drawing_area_new(); gtk_box_pack_start(GTK_BOX(vbox), video, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_background_color(video, GTK_STATE_FLAG_NORMAL, &color); -#else - gtk_widget_modify_bg(video, GTK_STATE_NORMAL, &color); -#endif gtk_widget_set_size_request(GTK_WIDGET(video), 240, 180); test = gtk_toggle_button_new_with_label(_("Test Video")); @@ -4208,11 +4064,7 @@ pidgin_prefs_show(void) /* Back to instant-apply! I win! BU-HAHAHA! */ /* Create the window */ -#if GTK_CHECK_VERSION(3,0,0) prefs = pidgin_create_dialog(_("Preferences"), 0, "preferences", FALSE); -#else - prefs = pidgin_create_dialog(_("Preferences"), PIDGIN_HIG_BORDER, "preferences", FALSE); -#endif g_signal_connect(G_OBJECT(prefs), "destroy", G_CALLBACK(delete_prefs), NULL); diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index 7d63394ec6..a6635b4b4e 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -37,9 +37,6 @@ #ifdef ENABLE_GCR #define GCR_API_SUBJECT_TO_CHANGE #include <gcr/gcr.h> -#if !GTK_CHECK_VERSION(3,0,0) -#include <gcr/gcr-simple-certificate.h> -#endif #endif #include "gtk3compat.h" diff --git a/pidgin/gtkroomlist.c b/pidgin/gtkroomlist.c index a8f934a8a0..ae149c0ad5 100644 --- a/pidgin/gtkroomlist.c +++ b/pidgin/gtkroomlist.c @@ -355,23 +355,16 @@ pidgin_roomlist_paint_tooltip(GtkWidget *widget, cairo_t *cr, gpointer user_data int current_height, max_width; int max_text_width; GtkTextDirection dir = gtk_widget_get_direction(GTK_WIDGET(grl->tree)); -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context; context = gtk_widget_get_style_context(grl->tipwindow); gtk_style_context_add_class(context, GTK_STYLE_CLASS_TOOLTIP); -#else - GtkStyle *style; - - style = gtk_widget_get_style(grl->tipwindow); -#endif max_text_width = MAX(grl->tip_width, grl->tip_name_width); max_width = TOOLTIP_BORDER + SMALL_SPACE + max_text_width + TOOLTIP_BORDER; current_height = 12; -#if GTK_CHECK_VERSION(3,0,0) if (dir == GTK_TEXT_DIR_RTL) { gtk_render_layout(context, cr, max_width - (TOOLTIP_BORDER + SMALL_SPACE) - PANGO_PIXELS(600000), @@ -394,34 +387,6 @@ pidgin_roomlist_paint_tooltip(GtkWidget *widget, cairo_t *cr, gpointer user_data current_height + grl->tip_name_height, grl->tip_layout); } -#else - if (dir == GTK_TEXT_DIR_RTL) { - gtk_paint_layout(style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, grl->tipwindow, "tooltip", - max_width - (TOOLTIP_BORDER + SMALL_SPACE) - PANGO_PIXELS(600000), - current_height, - grl->tip_name_layout); - } else { - gtk_paint_layout(style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, grl->tipwindow, "tooltip", - TOOLTIP_BORDER + SMALL_SPACE, - current_height, - grl->tip_name_layout); - } - if (dir != GTK_TEXT_DIR_RTL) { - gtk_paint_layout(style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, grl->tipwindow, "tooltip", - TOOLTIP_BORDER + SMALL_SPACE, - current_height + grl->tip_name_height, - grl->tip_layout); - } else { - gtk_paint_layout(style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, grl->tipwindow, "tooltip", - max_width - (TOOLTIP_BORDER + SMALL_SPACE) - PANGO_PIXELS(600000), - current_height + grl->tip_name_height, - grl->tip_layout); - } -#endif return FALSE; } @@ -567,11 +532,7 @@ pidgin_roomlist_dialog_new_with_account(PurpleAccount *account) dialog->account = account; /* Create the window. */ -#if GTK_CHECK_VERSION(3,0,0) dialog->window = window = pidgin_create_dialog(_("Room List"), 0, "room list", TRUE); -#else - dialog->window = window = pidgin_create_dialog(_("Room List"), PIDGIN_HIG_BORDER, "room list", TRUE); -#endif g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_win_cb), dialog); diff --git a/pidgin/gtksmiley-manager.c b/pidgin/gtksmiley-manager.c index 9e2fd3dc22..3e3f6d4115 100644 --- a/pidgin/gtksmiley-manager.c +++ b/pidgin/gtksmiley-manager.c @@ -339,47 +339,26 @@ edit_dialog_show(SmileyManager *manager, PurpleSmiley *smiley) g_object_ref(smiley); } -#if !GTK_CHECK_VERSION(3,0,0) - gtk_container_set_border_width( - GTK_CONTAINER(edit_dialog->window), PIDGIN_HIG_BORDER); -#endif /* The vbox */ -#if GTK_CHECK_VERSION(3,0,0) vbox = gtk_grid_new(); gtk_grid_set_row_spacing(GTK_GRID(vbox), PIDGIN_HIG_BORDER); -#else - vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); -#endif gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area( edit_dialog->window)), vbox); gtk_widget_show(vbox); /* The hbox */ -#if GTK_CHECK_VERSION(3,0,0) hbox = gtk_grid_new(); gtk_grid_set_column_spacing(GTK_GRID(hbox), PIDGIN_HIG_BORDER); gtk_grid_attach(GTK_GRID(vbox), hbox, 0, 0, 1, 1); -#else - hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(GTK_VBOX(vbox)), hbox); -#endif label = GTK_LABEL(gtk_label_new_with_mnemonic(_("_Image:"))); -#if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(hbox), GTK_WIDGET(label), 0, 0, 1, 1); -#else - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 0); -#endif gtk_widget_show(GTK_WIDGET(label)); filech = GTK_BUTTON(gtk_button_new()); -#if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach_next_to(GTK_GRID(hbox), GTK_WIDGET(filech), NULL, GTK_POS_RIGHT, 1, 1); -#else - gtk_box_pack_end(GTK_BOX(hbox), GTK_WIDGET(filech), FALSE, FALSE, 0); -#endif pidgin_set_accessible_label(GTK_WIDGET(filech), label); edit_dialog->thumbnail = GTK_IMAGE(gtk_image_new()); @@ -389,37 +368,23 @@ edit_dialog_show(SmileyManager *manager, PurpleSmiley *smiley) gtk_widget_show_all(hbox); /* info */ -#if GTK_CHECK_VERSION(3,0,0) hbox = gtk_grid_new(); gtk_grid_set_column_spacing(GTK_GRID(hbox), PIDGIN_HIG_BORDER); gtk_grid_attach_next_to(GTK_GRID(vbox), hbox, NULL, GTK_POS_BOTTOM, 1, 1); -#else - hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(GTK_VBOX(vbox)), hbox); -#endif /* Shortcut text */ label = GTK_LABEL(gtk_label_new_with_mnemonic(_("S_hortcut text:"))); -#if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(hbox), GTK_WIDGET(label), 0, 0, 1, 1); -#else - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 0); -#endif gtk_widget_show(GTK_WIDGET(label)); edit_dialog->shortcut = GTK_ENTRY(gtk_entry_new()); gtk_entry_set_activates_default(edit_dialog->shortcut, TRUE); pidgin_set_accessible_label(GTK_WIDGET(edit_dialog->shortcut), label); -#if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach_next_to(GTK_GRID(hbox), GTK_WIDGET(edit_dialog->shortcut), NULL, GTK_POS_RIGHT, 1, 1); -#else - gtk_box_pack_end(GTK_BOX(hbox), GTK_WIDGET(edit_dialog->shortcut), - FALSE, FALSE, 0); -#endif gtk_widget_show(GTK_WIDGET(edit_dialog->shortcut)); gtk_widget_show(hbox); @@ -810,9 +775,6 @@ pidgin_smiley_manager_show(void) gtk_window_set_default_size(GTK_WINDOW(win), 50, 400); gtk_window_set_role(GTK_WINDOW(win), "custom_smiley_manager"); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_container_set_border_width(GTK_CONTAINER(win), PIDGIN_HIG_BORDER); -#endif gtk_dialog_set_response_sensitive(win, GTK_RESPONSE_NO, FALSE); gtk_dialog_set_response_sensitive(win, PIDGIN_RESPONSE_MODIFY, FALSE); diff --git a/pidgin/gtksound.c b/pidgin/gtksound.c index 414483fed9..98892c55ba 100644 --- a/pidgin/gtksound.c +++ b/pidgin/gtksound.c @@ -554,11 +554,7 @@ pidgin_sound_play_file(const char *filename) return; } -#if GST_CHECK_VERSION(1,0,0) play = gst_element_factory_make("playbin", "play"); -#else - play = gst_element_factory_make("playbin2", "play"); -#endif if (play == NULL) { return; diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c index 7de8c6615f..1b1c369e3e 100644 --- a/pidgin/gtkstatusbox.c +++ b/pidgin/gtkstatusbox.c @@ -71,14 +71,9 @@ static void pidgin_status_box_refresh(PidginStatusBox *status_box); static void status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed); static void pidgin_status_box_regenerate(PidginStatusBox *status_box, gboolean status_changed); static void pidgin_status_box_changed(PidginStatusBox *box); -#if GTK_CHECK_VERSION(3,0,0) static void pidgin_status_box_get_preferred_height (GtkWidget *widget, gint *minimum_height, gint *natural_height); static gboolean pidgin_status_box_draw (GtkWidget *widget, cairo_t *cr); -#else -static void pidgin_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition); -static gboolean pidgin_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event); -#endif static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box); static void pidgin_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); @@ -451,13 +446,8 @@ destroy_icon_box(PidginStatusBox *statusbox) gtk_widget_destroy(statusbox->icon_box); -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(statusbox->hand_cursor); g_object_unref(statusbox->arrow_cursor); -#else - gdk_cursor_unref(statusbox->hand_cursor); - gdk_cursor_unref(statusbox->arrow_cursor); -#endif if (statusbox->buddy_icon_img) g_object_unref(statusbox->buddy_icon_img); @@ -566,13 +556,8 @@ pidgin_status_box_class_init (PidginStatusBoxClass *klass) parent_class = g_type_class_peek_parent(klass); widget_class = (GtkWidgetClass*)klass; -#if GTK_CHECK_VERSION(3,0,0) widget_class->get_preferred_height = pidgin_status_box_get_preferred_height; widget_class->draw = pidgin_status_box_draw; -#else - widget_class->size_request = pidgin_status_box_size_request; - widget_class->expose_event = pidgin_status_box_expose_event; -#endif widget_class->size_allocate = pidgin_status_box_size_allocate; container_class->child_type = pidgin_status_box_child_type; @@ -1325,7 +1310,6 @@ static gboolean popup_grab_on_window(GdkWindow *window, GdkEvent *event) { guint32 activate_time = gdk_event_get_time(event); -#if GTK_CHECK_VERSION(3,0,0) GdkDevice *device = gdk_event_get_device(event); GdkGrabStatus status; @@ -1346,23 +1330,6 @@ popup_grab_on_window(GdkWindow *window, GdkEvent *event) } return FALSE; -#else - if ((gdk_pointer_grab(window, TRUE, - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_MASK, - NULL, NULL, activate_time) == 0)) - { - if (gdk_keyboard_grab(window, TRUE, activate_time) == 0) - return TRUE; - else { - gdk_display_pointer_ungrab(gdk_window_get_display(window), - activate_time); - return FALSE; - } - } - - return FALSE; -#endif } @@ -1396,22 +1363,15 @@ static void pidgin_status_box_popdown(PidginStatusBox *box, GdkEvent *event) { guint32 time; -#if GTK_CHECK_VERSION(3,0,0) GdkDevice *device; -#endif gtk_widget_hide(box->popup_window); box->popup_in_progress = FALSE; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE); gtk_grab_remove(box->popup_window); time = gdk_event_get_time(event); -#if GTK_CHECK_VERSION(3,0,0) device = gdk_event_get_device(event); gdk_device_ungrab(device, time); gdk_device_ungrab(gdk_device_get_associated_device(device), time); -#else - gdk_pointer_ungrab(time); - gdk_keyboard_ungrab(time); -#endif } static gboolean @@ -1911,7 +1871,6 @@ pidgin_status_box_init (PidginStatusBox *status_box) } -#if GTK_CHECK_VERSION(3,0,0) static void pidgin_status_box_get_preferred_height(GtkWidget *widget, gint *minimum_height, gint *natural_height) @@ -1937,30 +1896,6 @@ pidgin_status_box_get_preferred_height(GtkWidget *widget, gint *minimum_height, *natural_height += box_nat_height + border_width * 2; } } -#else -static void -pidgin_status_box_size_request(GtkWidget *widget, - GtkRequisition *requisition) -{ - GtkRequisition box_req; - gint border_width = GTK_CONTAINER (widget)->border_width; - - gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->toggle_button, requisition); - - /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ - requisition->height = MAX(requisition->height, 34); - requisition->height += border_width * 2; - - /* If the gtkwebview is visible, then add some additional padding */ - if (PIDGIN_STATUS_BOX(widget)->webview_visible) { - gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->vbox, &box_req); - if (box_req.height > 1) - requisition->height += box_req.height + border_width * 2; - } - - requisition->width = 1; -} -#endif /* From gnome-panel */ static void @@ -2051,7 +1986,6 @@ pidgin_status_box_size_allocate(GtkWidget *widget, gtk_widget_set_allocation(GTK_WIDGET(status_box), allocation); } -#if GTK_CHECK_VERSION(3,0,0) static gboolean pidgin_status_box_draw(GtkWidget *widget, cairo_t *cr) { @@ -2069,22 +2003,6 @@ pidgin_status_box_draw(GtkWidget *widget, cairo_t *cr) } return FALSE; } -#else -static gboolean -pidgin_status_box_expose_event(GtkWidget *widget, - GdkEventExpose *event) -{ - PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); - gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->vbox, event); - gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->toggle_button, event); - if (status_box->icon_box && status_box->icon_opaque) { - gtk_paint_box(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, - status_box->icon_box, "button", status_box->icon_box->allocation.x-1, status_box->icon_box->allocation.y-1, - 34, 34); - } - return FALSE; -} -#endif static void pidgin_status_box_forall(GtkContainer *container, @@ -2396,11 +2314,8 @@ activate_currently_selected_status(PidginStatusBox *status_box) { gtk_widget_hide(status_box->vbox); status_box->webview_visible = FALSE; - if (message != NULL) - { - g_free(message); - message = NULL; - } + g_free(message); + message = NULL; } if (status_box->account == NULL) { diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 2b0d5f1893..69fc63da81 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -210,11 +210,6 @@ pidgin_create_small_button(GtkWidget *image) /* don't allow focus on the close button */ gtk_button_set_focus_on_click(GTK_BUTTON(button), FALSE); - /* set style to make it as small as possible */ -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_name(button, "pidgin-small-close-button"); -#endif - gtk_widget_show(image); gtk_container_add(GTK_CONTAINER(button), image); @@ -2116,11 +2111,7 @@ void pidgin_set_cursor(GtkWidget *widget, GdkCursorType cursor_type) cursor = gdk_cursor_new(cursor_type); gdk_window_set_cursor(gtk_widget_get_window(widget), cursor); -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(cursor); -#else - gdk_cursor_unref(cursor); -#endif gdk_display_flush(gdk_window_get_display(gtk_widget_get_window(widget))); } @@ -2805,14 +2796,8 @@ pidgin_text_combo_box_entry_new(const char *default_item, GList *items) GtkComboBoxText *ret = NULL; GtkWidget *the_entry = NULL; -#if GTK_CHECK_VERSION(2,24,0) ret = GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new_with_entry()); the_entry = gtk_bin_get_child(GTK_BIN(ret)); -#else - ret = GTK_COMBO_BOX(gtk_combo_box_entry_new_text()); - the_entry = gtk_entry_new(); - gtk_container_add(GTK_CONTAINER(ret), the_entry); -#endif if (default_item) gtk_entry_set_text(GTK_ENTRY(the_entry), default_item); @@ -3554,11 +3539,7 @@ pidgin_make_scrollable(GtkWidget *child, GtkPolicyType hscrollbar_policy, GtkPol #if GTK_CHECK_VERSION(3,8,0) gtk_container_add(GTK_CONTAINER(sw), child); #else -#if GTK_CHECK_VERSION(3,0,0) if (GTK_IS_SCROLLABLE(child)) -#else - if (GTK_WIDGET_GET_CLASS(child)->set_scroll_adjustments_signal) -#endif /* GTK_CHECK_VERSION(3,0,0) */ gtk_container_add(GTK_CONTAINER(sw), child); else gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), child); @@ -3584,21 +3565,6 @@ void pidgin_utils_init(void) /* Example custom URL handler. */ pidgin_webview_class_register_protocol("open://", open_dialog, dummy); - /* Used to make small buttons */ -#if !GTK_CHECK_VERSION(3,0,0) - gtk_rc_parse_string("style \"pidgin-small-close-button\"\n" - "{\n" - "GtkWidget::focus-padding = 0\n" - "GtkWidget::focus-line-width = 0\n" - "xthickness = 0\n" - "ythickness = 0\n" - "GtkContainer::border-width = 0\n" - "GtkButton::inner-border = {0, 0, 0, 0}\n" - "GtkButton::default-border = {0, 0, 0, 0}\n" - "}\n" - "widget \"*.pidgin-small-close-button\" style \"pidgin-small-close-button\""); -#endif - #ifdef _WIN32 winpidgin_register_win32_url_handlers(); #endif diff --git a/pidgin/gtkwhiteboard.c b/pidgin/gtkwhiteboard.c index 593460ff4b..c669fcf09f 100644 --- a/pidgin/gtkwhiteboard.c +++ b/pidgin/gtkwhiteboard.c @@ -87,11 +87,6 @@ static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventCon static gboolean pidgin_whiteboard_draw_event(GtkWidget *widget, cairo_t *cr, gpointer _gtkwb); -#if !GTK_CHECK_VERSION(3,0,0) -static gboolean -pidgin_whiteboard_expose_event(GtkWidget *widget, GdkEventExpose *event, - gpointer _gtkwb); -#endif static gboolean pidgin_whiteboard_brush_down(GtkWidget *widget, GdkEventButton *event, gpointer data); static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion *event, gpointer data); @@ -219,19 +214,11 @@ static void pidgin_whiteboard_create(PurpleWhiteboard *wb) gtk_widget_show(drawing_area); /* Signals used to handle backing pixmap */ -#if GTK_CHECK_VERSION(3,0,0) g_signal_connect(G_OBJECT(drawing_area), "draw", G_CALLBACK(pidgin_whiteboard_draw_event), gtkwb); g_signal_connect(G_OBJECT(drawing_area), "configure-event", G_CALLBACK(pidgin_whiteboard_configure_event), gtkwb); -#else - g_signal_connect(G_OBJECT(drawing_area), "expose_event", - G_CALLBACK(pidgin_whiteboard_expose_event), gtkwb); - - g_signal_connect(G_OBJECT(drawing_area), "configure_event", - G_CALLBACK(pidgin_whiteboard_configure_event), gtkwb); -#endif /* Event signals */ g_signal_connect(G_OBJECT(drawing_area), "button_press_event", @@ -389,9 +376,7 @@ static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventCon PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; cairo_t *cr; GtkAllocation allocation; -#if GTK_CHECK_VERSION(3,0,0) GdkRGBA white = {1.0, 1.0, 1.0, 1.0}; -#endif if (gtkwb->priv->cr) cairo_destroy(gtkwb->priv->cr); @@ -403,11 +388,7 @@ static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventCon gtkwb->priv->surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, allocation.width, allocation.height); gtkwb->priv->cr = cr = cairo_create(gtkwb->priv->surface); -#if GTK_CHECK_VERSION(3,0,0) gdk_cairo_set_source_rgba(cr, &white); -#else - gdk_cairo_set_source_color(cr, >k_widget_get_style(widget)->white); -#endif cairo_rectangle(cr, 0, 0, allocation.width, allocation.height); cairo_fill(cr); @@ -426,23 +407,6 @@ pidgin_whiteboard_draw_event(GtkWidget *widget, cairo_t *cr, return FALSE; } -#if !GTK_CHECK_VERSION(3,0,0) -static gboolean -pidgin_whiteboard_expose_event(GtkWidget *widget, GdkEventExpose *event, - gpointer _gtkwb) -{ - cairo_t *cr; - - cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); - - pidgin_whiteboard_draw_event(widget, cr, _gtkwb); - - cairo_destroy(cr); - - return FALSE; -} -#endif - static gboolean pidgin_whiteboard_brush_down(GtkWidget *widget, GdkEventButton *event, gpointer data) { PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; @@ -502,12 +466,8 @@ static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion GList *draw_list = purple_whiteboard_get_draw_list(wb); if(event->is_hint) -#if GTK_CHECK_VERSION(3,0,0) gdk_window_get_device_position(event->window, event->device, &x, &y, &state); -#else - gdk_window_get_pointer(event->window, &x, &y, &state); -#endif else { x = event->x; @@ -645,22 +605,16 @@ static void pidgin_whiteboard_draw_brush_point(PurpleWhiteboard *wb, int x, int GtkWidget *widget = gtkwb->drawing_area; cairo_t *gfx_con = gtkwb->priv->cr; GdkColor col; -#if GTK_CHECK_VERSION(3,0,0) GdkRGBA rgba; -#endif /* Interpret and convert color */ pidgin_whiteboard_rgb24_to_rgb48(color, &col); -#if GTK_CHECK_VERSION(3,0,0) rgba.red = col.red / 0xffff; rgba.green = col.green / 0xffff; rgba.blue = col.blue / 0xffff; rgba.alpha = 1.0; gdk_cairo_set_source_rgba(gfx_con, &rgba); -#else - gdk_cairo_set_source_color(gfx_con, &col); -#endif /* Draw a circle */ cairo_arc(gfx_con, @@ -763,18 +717,11 @@ static void pidgin_whiteboard_clear(PurpleWhiteboard *wb) GtkWidget *drawing_area = gtkwb->drawing_area; cairo_t *cr = gtkwb->priv->cr; GtkAllocation allocation; -#if GTK_CHECK_VERSION(3,0,0) GdkRGBA white = {1.0, 1.0, 1.0, 1.0}; -#endif gtk_widget_get_allocation(drawing_area, &allocation); -#if GTK_CHECK_VERSION(3,0,0) gdk_cairo_set_source_rgba(cr, &white); -#else - gdk_cairo_set_source_color(cr, - >k_widget_get_style(drawing_area)->white); -#endif cairo_rectangle(cr, 0, 0, allocation.width, allocation.height); cairo_fill(cr); diff --git a/pidgin/gtkxfer.c b/pidgin/gtkxfer.c index e6e9623ac7..67a773b410 100644 --- a/pidgin/gtkxfer.c +++ b/pidgin/gtkxfer.c @@ -718,11 +718,7 @@ pidgin_xfer_dialog_new(void) purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/filetransfer/clear_finished"); /* Create the window. */ -#if GTK_CHECK_VERSION(3,0,0) dialog->window = window = pidgin_create_dialog(_("File Transfers"), 0, "file transfer", TRUE); -#else - dialog->window = window = pidgin_create_dialog(_("File Transfers"), PIDGIN_HIG_BORDER, "file transfer", TRUE); -#endif gtk_window_set_default_size(GTK_WINDOW(window), 450, 250); g_signal_connect(G_OBJECT(window), "delete_event", diff --git a/pidgin/libpidgin.c b/pidgin/libpidgin.c index 72f0e86748..1058960e98 100644 --- a/pidgin/libpidgin.c +++ b/pidgin/libpidgin.c @@ -431,10 +431,8 @@ int pidgin_start(int argc, char *argv[]) char *opt_login_arg = NULL; char *opt_session_arg = NULL; char *search_path; -#if GTK_CHECK_VERSION(3,0,0) GtkCssProvider *provider; GdkScreen *screen; -#endif GList *accounts; #ifdef HAVE_SIGNAL_H int sig_indx; /* for setting up signal catching */ @@ -443,13 +441,11 @@ int pidgin_start(int argc, char *argv[]) GIOChannel *signal_channel; GIOStatus signal_status; guint signal_channel_watcher; + GError *error; #ifndef DEBUG char *segfault_message_tmp; -#endif -#endif -#if defined(HAVE_SIGNAL_H) || GTK_CHECK_VERSION(3,0,0) - GError *error; -#endif +#endif /* DEBUG */ +#endif /* HAVE_SIGNAL_N */ int opt; gboolean gui_check; gboolean debug_enabled, debug_colored; @@ -694,12 +690,6 @@ int pidgin_start(int argc, char *argv[]) purple_debug_set_enabled(debug_enabled); purple_debug_set_colored(debug_colored); -#if !GTK_CHECK_VERSION(3,0,0) - search_path = g_build_filename(purple_user_dir(), "gtkrc-2.0", NULL); - gtk_rc_add_default_file(search_path); - g_free(search_path); -#endif - gui_check = gtk_init_check(&argc, &argv); if (!gui_check) { char *display = gdk_get_display(); @@ -715,7 +705,6 @@ int pidgin_start(int argc, char *argv[]) return 1; } -#if GTK_CHECK_VERSION(3,0,0) search_path = g_build_filename(purple_user_dir(), "gtk-3.0.css", NULL); error = NULL; @@ -733,7 +722,6 @@ int pidgin_start(int argc, char *argv[]) } g_free(search_path); -#endif #ifdef _WIN32 winpidgin_init(); @@ -788,14 +776,10 @@ int pidgin_start(int argc, char *argv[]) #ifdef USE_SM pidgin_session_init(argv[0], opt_session_arg, opt_config_dir_arg); #endif - if (opt_session_arg != NULL) { - g_free(opt_session_arg); - opt_session_arg = NULL; - } - if (opt_config_dir_arg != NULL) { - g_free(opt_config_dir_arg); - opt_config_dir_arg = NULL; - } + g_free(opt_session_arg); + opt_session_arg = NULL; + g_free(opt_config_dir_arg); + opt_config_dir_arg = NULL; /* This needs to be before purple_blist_show() so the * statusbox gets the forced online status. */ @@ -822,10 +806,8 @@ int pidgin_start(int argc, char *argv[]) purple_savedstatus_activate(purple_savedstatus_get_startup()); /* now enable the requested ones */ dologin_named(opt_login_arg); - if (opt_login_arg != NULL) { - g_free(opt_login_arg); - opt_login_arg = NULL; - } + g_free(opt_login_arg); + opt_login_arg = NULL; } else if (opt_nologin) { /* Set all accounts to "offline" */ PurpleSavedStatus *saved_status; diff --git a/pidgin/minidialog.c b/pidgin/minidialog.c index fa7b953e26..071d1c2428 100644 --- a/pidgin/minidialog.c +++ b/pidgin/minidialog.c @@ -446,38 +446,10 @@ pidgin_mini_dialog_class_init(PidginMiniDialogClass *klass) g_object_class_install_properties(object_class, LAST_PROPERTY, properties); } -#if !GTK_CHECK_VERSION(3,0,0) -/* 16 is the width of the icon, due to PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL */ -#define BLIST_WIDTH_OTHER_THAN_LABEL \ - ((PIDGIN_HIG_BOX_SPACE * 3) + 16) - -#define BLIST_WIDTH_PREF \ - (PIDGIN_PREFS_ROOT "/blist/width") - -static void -blist_width_changed_cb(const char *name, - PurplePrefType type, - gconstpointer val, - gpointer data) -{ - PidginMiniDialog *self = PIDGIN_MINI_DIALOG(data); - PidginMiniDialogPrivate *priv = PIDGIN_MINI_DIALOG_GET_PRIVATE(self); - guint blist_width = GPOINTER_TO_INT(val); - guint label_width = blist_width - BLIST_WIDTH_OTHER_THAN_LABEL; - - gtk_widget_set_size_request(GTK_WIDGET(priv->title), label_width, -1); - gtk_widget_set_size_request(GTK_WIDGET(priv->desc), label_width, -1); -} -#endif - static void pidgin_mini_dialog_init(PidginMiniDialog *self) { GtkBox *self_box = GTK_BOX(self); -#if !GTK_CHECK_VERSION(3,0,0) - guint blist_width = purple_prefs_get_int(BLIST_WIDTH_PREF); - guint label_width = blist_width - BLIST_WIDTH_OTHER_THAN_LABEL; -#endif PidginMiniDialogPrivate *priv = g_new0(PidginMiniDialogPrivate, 1); self->priv = priv; @@ -490,9 +462,6 @@ pidgin_mini_dialog_init(PidginMiniDialog *self) gtk_misc_set_alignment(GTK_MISC(priv->icon), 0, 0); priv->title = GTK_LABEL(gtk_label_new(NULL)); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_size_request(GTK_WIDGET(priv->title), label_width, -1); -#endif gtk_label_set_line_wrap(priv->title, TRUE); gtk_label_set_selectable(priv->title, TRUE); gtk_misc_set_alignment(GTK_MISC(priv->title), 0, 0); @@ -501,9 +470,6 @@ pidgin_mini_dialog_init(PidginMiniDialog *self) gtk_box_pack_start(priv->title_box, GTK_WIDGET(priv->title), TRUE, TRUE, 0); priv->desc = GTK_LABEL(gtk_label_new(NULL)); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_size_request(GTK_WIDGET(priv->desc), label_width, -1); -#endif gtk_label_set_line_wrap(priv->desc, TRUE); gtk_misc_set_alignment(GTK_MISC(priv->desc), 0, 0); gtk_label_set_selectable(priv->desc, TRUE); @@ -512,11 +478,6 @@ pidgin_mini_dialog_init(PidginMiniDialog *self) */ g_object_set(G_OBJECT(priv->desc), "no-show-all", TRUE, NULL); -#if !GTK_CHECK_VERSION(3,0,0) - purple_prefs_connect_callback(self, BLIST_WIDTH_PREF, - blist_width_changed_cb, self); -#endif - self->contents = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0)); priv->buttons = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); diff --git a/pidgin/pidginstock.c b/pidgin/pidginstock.c index c8247b44a3..15a680dfa9 100644 --- a/pidgin/pidginstock.c +++ b/pidgin/pidginstock.c @@ -388,13 +388,7 @@ add_sized_icon(GtkIconSet *iconset, GtkIconSize sizeid, PidginIconTheme *theme, static void reload_settings(void) { -#if GTK_CHECK_VERSION(3,0,0) gtk_style_context_reset_widgets(gdk_screen_get_default()); -#else - GtkSettings *setting = NULL; - setting = gtk_settings_get_default(); - gtk_rc_reset_styles(setting); -#endif } /***************************************************************************** @@ -522,13 +516,8 @@ pidgin_stock_load_stock_icon_theme(PidginStockIconTheme *theme) if (stock_icons[i].dir == NULL) { /* GTK+ Stock icon */ -#if GTK_CHECK_VERSION(3,0,0) iconset = gtk_style_context_lookup_icon_set(gtk_widget_get_style_context(win), stock_icons[i].filename); -#else - iconset = gtk_style_lookup_icon_set(gtk_widget_get_style(win), - stock_icons[i].filename); -#endif } else { filename = find_file(stock_icons[i].dir, stock_icons[i].filename); diff --git a/pidgin/pidgintooltip.c b/pidgin/pidgintooltip.c index d46be2e4a8..5eb884b6ed 100644 --- a/pidgin/pidgintooltip.c +++ b/pidgin/pidgintooltip.c @@ -88,7 +88,6 @@ void pidgin_tooltip_destroy() } } -#if GTK_CHECK_VERSION(3,0,0) static gboolean pidgin_tooltip_draw_cb(GtkWidget *widget, cairo_t *cr, gpointer data) { @@ -105,20 +104,6 @@ pidgin_tooltip_draw_cb(GtkWidget *widget, cairo_t *cr, gpointer data) } return FALSE; } -#else -static gboolean -pidgin_tooltip_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) -{ - if (pidgin_tooltip.paint_tooltip) { - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(widget))); - gtk_paint_flat_box(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - NULL, widget, "tooltip", 0, 0, -1, -1); - pidgin_tooltip.paint_tooltip(widget, cr, data); - cairo_destroy(cr); - } - return FALSE; -} -#endif static GtkWidget* setup_tooltip_window(void) @@ -149,17 +134,12 @@ setup_tooltip_window_position(gpointer data, int w, int h) GdkRectangle mon_size; GtkWidget *tipwindow = pidgin_tooltip.tipwindow; -#if GTK_CHECK_VERSION(3,0,0) GdkDeviceManager *devmgr; GdkDevice *dev; devmgr = gdk_display_get_device_manager(gdk_display_get_default()); dev = gdk_device_manager_get_client_pointer(devmgr); gdk_device_get_position(dev, &screen, &x, &y); -#else - gdk_display_get_pointer(gdk_display_get_default(), - &screen, &x, &y, NULL); -#endif mon_num = gdk_screen_get_monitor_at_point(screen, x, y); gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size); @@ -209,13 +189,8 @@ setup_tooltip_window_position(gpointer data, int w, int h) gtk_window_move(GTK_WINDOW(tipwindow), x, y); gtk_widget_show(tipwindow); -#if GTK_CHECK_VERSION(3,0,0) g_signal_connect(G_OBJECT(tipwindow), "draw", G_CALLBACK(pidgin_tooltip_draw_cb), data); -#else - g_signal_connect(G_OBJECT(tipwindow), "expose_event", - G_CALLBACK(pidgin_tooltip_expose_event), data); -#endif /* Hide the tooltip when the widget is destroyed */ sig = g_signal_connect(G_OBJECT(pidgin_tooltip.widget), "destroy", G_CALLBACK(pidgin_tooltip_destroy), NULL); diff --git a/pidgin/pixmaps/emotes/default/24/scalable/shout.svg b/pidgin/pixmaps/emotes/default/24/scalable/shout.svg index 7245108a35..d10f236ca6 100644 --- a/pidgin/pixmaps/emotes/default/24/scalable/shout.svg +++ b/pidgin/pixmaps/emotes/default/24/scalable/shout.svg @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- Created with Inkscape (http://www.inkscape.org/) --> + <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" @@ -13,18 +14,38 @@ height="24" id="svg2" sodipodi:version="0.32" - inkscape:version="0.46" + inkscape:version="0.48.5 r10040" version="1.0" - sodipodi:docbase="/home/hbons/Desktop/untitled folder 1" sodipodi:docname="shout.svg" - inkscape:export-filename="/home/hbons/Desktop/newstyle.png" + inkscape:export-filename="/home/steve/src/hg/pidgin/pidgin/pidgin/pixmaps/emotes/default/24/scalable/path1307.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" inkscape:output_extension="org.inkscape.output.svg.inkscape"> <defs id="defs4"> <linearGradient - inkscape:collect="always" + id="linearGradient9179"> + <stop + style="stop-color:#4f371a;stop-opacity:0.97254902;" + offset="0" + id="stop9181" /> + <stop + style="stop-color:#ad8248;stop-opacity:0.96470588;" + offset="1" + id="stop9183" /> + </linearGradient> + <linearGradient + id="linearGradient9171"> + <stop + style="stop-color:#edd400;stop-opacity:1;" + offset="0" + id="stop9173" /> + <stop + style="stop-color:#ff9422;stop-opacity:1;" + offset="1" + id="stop9175" /> + </linearGradient> + <linearGradient id="linearGradient3104"> <stop style="stop-color:#eeeeec;stop-opacity:1;" @@ -39,13 +60,13 @@ inkscape:collect="always" xlink:href="#linearGradient3104" id="radialGradient3114" - cx="8.3343515" - cy="14.186539" - fx="8.3343515" - fy="14.186539" + cx="5.588686" + cy="17.183115" + fx="5.588686" + fy="17.183115" r="9.975256" gradientUnits="userSpaceOnUse" - gradientTransform="matrix(-0.9327,0.932656,-0.947494,-0.947449,33.02126,11.96667)" /> + gradientTransform="matrix(-0.99399656,1.0132041,-1.0209557,-1.0015021,34.62613,12.445313)" /> <filter inkscape:collect="always" x="-0.27879594" @@ -79,6 +100,25 @@ y1="16.037401" x2="10.698112" y2="15.449714" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient9171" + id="radialGradient9177" + cx="11.806158" + cy="10.983024" + fx="11.806158" + fy="10.983024" + r="10.501386" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient9179" + id="linearGradient9185" + x1="1.304772" + y1="10.983024" + x2="22.307544" + y2="10.983024" + gradientUnits="userSpaceOnUse" /> </defs> <sodipodi:namedview id="base" @@ -87,17 +127,18 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="22.4" - inkscape:cx="26.111884" + inkscape:zoom="15.839192" + inkscape:cx="11.494979" inkscape:cy="11.540302" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" fill="#fce94f" - inkscape:window-width="1440" - inkscape:window-height="845" - inkscape:window-x="0" - inkscape:window-y="0" /> + inkscape:window-width="1012" + inkscape:window-height="834" + inkscape:window-x="-2" + inkscape:window-y="154" + inkscape:window-maximized="0" /> <metadata id="metadata7"> <rdf:RDF> @@ -106,90 +147,95 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> <g inkscape:label="Layer 1" inkscape:groupmode="layer" - id="layer1"> + id="layer1" + style="display:inline"> <path sodipodi:type="arc" - style="opacity:0.64044944;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter3405)" + style="opacity:0.64044949;fill:#2e3436;fill-opacity:1;stroke:none;filter:url(#filter3405)" id="path3140" sodipodi:cx="10.748654" sodipodi:cy="10.457643" sodipodi:rx="6.6449099" sodipodi:ry="2.3675451" - d="M 17.393564 10.457643 A 6.6449099 2.3675451 0 1 1 4.1037445,10.457643 A 6.6449099 2.3675451 0 1 1 17.393564 10.457643 z" + d="m 17.393564,10.457643 a 6.6449099,2.3675451 0 1 1 -13.2898195,0 6.6449099,2.3675451 0 1 1 13.2898195,0 z" transform="matrix(1.2039291,0,0,1.055946,-0.9406174,8.4572942)" /> <path sodipodi:type="arc" - style="opacity:1;fill:#edd400;fill-opacity:1;stroke:#cc6400;stroke-width:1.05276573;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:url(#radialGradient9177);fill-opacity:1;stroke:url(#linearGradient9185);stroke-width:1.05226015;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="path1307" sodipodi:cx="11.806158" sodipodi:cy="10.983024" sodipodi:rx="9.975256" sodipodi:ry="9.975256" - d="M 21.781414 10.983024 A 9.975256 9.975256 0 1 1 1.8309021,10.983024 A 9.975256 9.975256 0 1 1 21.781414 10.983024 z" - transform="matrix(0.952236,0,0,0.952236,0.757713,1.541608)" /> + d="m 21.781414,10.983024 a 9.975256,9.975256 0 1 1 -19.9505119,0 9.975256,9.975256 0 1 1 19.9505119,0 z" + transform="matrix(0.952236,0,0,0.952236,0.757713,1.541608)" + inkscape:export-xdpi="108.01644" + inkscape:export-ydpi="108.01644" /> <path sodipodi:type="arc" - style="opacity:0.79545455;fill:url(#radialGradient3114);fill-opacity:1.0;stroke:none;stroke-width:1.05274069;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="opacity:0.79545456;fill:url(#radialGradient3114);fill-opacity:1;stroke:none" id="path3102" sodipodi:cx="11.806158" sodipodi:cy="10.983024" sodipodi:rx="9.975256" sodipodi:ry="9.975256" - d="M 21.781414 10.983024 A 9.975256 9.975256 0 1 1 1.8309021,10.983024 A 9.975256 9.975256 0 1 1 21.781414 10.983024 z" + d="m 21.781414,10.983024 a 9.975256,9.975256 0 1 1 -19.9505119,0 9.975256,9.975256 0 1 1 19.9505119,0 z" transform="matrix(0.8019,0,0,0.801938,2.532654,3.191833)" /> <path sodipodi:type="arc" - style="opacity:0.64044944;fill:none;fill-opacity:1.0;stroke:#ffffff;stroke-width:1.17343897;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="opacity:0.64044949;fill:none;stroke:#ffffff;stroke-width:1.17343903;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="path2184" sodipodi:cx="11.806158" sodipodi:cy="10.983024" sodipodi:rx="9.975256" sodipodi:ry="9.975256" - d="M 21.781414 10.983024 A 9.975256 9.975256 0 1 1 1.8309021,10.983024 A 9.975256 9.975256 0 1 1 21.781414 10.983024 z" + d="m 21.781414,10.983024 a 9.975256,9.975256 0 1 1 -19.9505119,0 9.975256,9.975256 0 1 1 19.9505119,0 z" transform="matrix(0.852176,0,0,0.852216,1.93909,2.639626)" /> <path style="fill:#eeeeec;fill-opacity:1;stroke:#fea523;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1" - d="M 11.499998,10 C 11.499998,11.38 10.379999,12.5 8.9999982,12.5 C 7.6199981,12.5 6.4999979,11.38 6.4999979,10 C 6.4999979,8.62 7.6199981,7.5 8.9999982,7.5 C 10.379999,7.5 11.499998,8.62 11.499998,10 z " - id="path3154" /> + d="m 11.499998,10 c 0,1.38 -1.119999,2.5 -2.4999998,2.5 -1.3800001,0 -2.5000003,-1.12 -2.5000003,-2.5 0,-1.38 1.1200002,-2.5 2.5000003,-2.5 1.3800008,0 2.4999998,1.12 2.4999998,2.5 z" + id="path3154" + inkscape:connector-curvature="0" /> <path sodipodi:type="arc" - style="opacity:1;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:0.98640186;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#2e3436;fill-opacity:1;stroke:none" id="path2172" sodipodi:cx="9.7069349" sodipodi:cy="9.6526775" sodipodi:rx="1.0259361" sodipodi:ry="1.9413869" - d="M 10.732871 9.6526775 A 1.0259361 1.9413869 0 1 1 8.6809988,9.6526775 A 1.0259361 1.9413869 0 1 1 10.732871 9.6526775 z" + d="m 10.732871,9.6526775 a 1.0259361,1.9413869 0 1 1 -2.0518722,0 1.0259361,1.9413869 0 1 1 2.0518722,0 z" transform="matrix(0.9747196,0,0,0.7726436,0.5384595,3.0419202)" /> <path sodipodi:type="arc" - style="opacity:1;fill:#eeeeec;fill-opacity:1;stroke:#fea523;stroke-width:0.56451595;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#eeeeec;fill-opacity:1;stroke:#fea523;stroke-width:0.56451595;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="path3152" sodipodi:cx="9.7069349" sodipodi:cy="9.6526775" sodipodi:rx="1.0259361" sodipodi:ry="1.9413869" - d="M 10.732871 9.6526775 A 1.0259361 1.9413869 0 1 1 8.6809988,9.6526775 A 1.0259361 1.9413869 0 1 1 10.732871 9.6526775 z" + d="m 10.732871,9.6526775 a 1.0259361,1.9413869 0 1 1 -2.0518722,0 1.0259361,1.9413869 0 1 1 2.0518722,0 z" transform="matrix(2.4367992,0,0,1.2877391,-8.6538516,-2.4301299)" /> <path sodipodi:type="arc" - style="opacity:1;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:0.98640186;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#2e3436;fill-opacity:1;stroke:none" id="path3148" sodipodi:cx="9.7069349" sodipodi:cy="9.6526775" sodipodi:rx="1.0259361" sodipodi:ry="1.9413869" - d="M 10.732871 9.6526775 A 1.0259361 1.9413869 0 1 1 8.6809988,9.6526775 A 1.0259361 1.9413869 0 1 1 10.732871 9.6526775 z" + d="m 10.732871,9.6526775 a 1.0259361,1.9413869 0 1 1 -2.0518722,0 1.0259361,1.9413869 0 1 1 2.0518722,0 z" transform="matrix(0.9747195,0,0,0.7726435,4.5384605,3.0419215)" /> <path sodipodi:type="arc" - style="opacity:0.64044949;fill:none;fill-opacity:1;stroke:#f57900;stroke-width:0.73675901;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="opacity:0.64044949;fill:none;stroke:#f57900;stroke-width:0.73675901;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="path2228" sodipodi:cx="8.3258924" sodipodi:cy="9.2232141" @@ -202,7 +248,7 @@ sodipodi:open="true" /> <path sodipodi:type="arc" - style="opacity:0.64044949;fill:none;fill-opacity:1;stroke:#f57900;stroke-width:0.73675901;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="opacity:0.64044949;fill:none;stroke:#f57900;stroke-width:0.73675901;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="path2230" sodipodi:cx="8.3258924" sodipodi:cy="9.2232141" @@ -215,23 +261,23 @@ sodipodi:open="true" /> <path sodipodi:type="arc" - style="fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#2e3436;fill-opacity:1;stroke:none" id="path3259" sodipodi:cx="11.830358" sodipodi:cy="15.741072" sodipodi:rx="2.0982144" sodipodi:ry="1.7857143" - d="M 13.928572 15.741072 A 2.0982144 1.7857143 0 1 1 9.7321432,15.741072 A 2.0982144 1.7857143 0 1 1 13.928572 15.741072 z" + d="m 13.928572,15.741072 a 2.0982144,1.7857143 0 1 1 -4.1964288,0 2.0982144,1.7857143 0 1 1 4.1964288,0 z" transform="matrix(1.4297873,0,0,1.3999999,-4.9148947,-5.5374983)" /> <path sodipodi:type="arc" - style="fill:url(#linearGradient2388);fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:url(#linearGradient2388);fill-opacity:1;stroke:none" id="path3261" sodipodi:cx="11.830358" sodipodi:cy="15.741072" sodipodi:rx="2.0982144" sodipodi:ry="1.7857143" - d="M 13.928572 15.741072 A 2.0982144 1.7857143 0 1 1 9.7321432,15.741072 A 2.0982144 1.7857143 0 1 1 13.928572 15.741072 z" + d="m 13.928572,15.741072 a 2.0982144,1.7857143 0 1 1 -4.1964288,0 2.0982144,1.7857143 0 1 1 4.1964288,0 z" transform="matrix(1.4297873,0,0,1.3999999,-4.9148947,-5.5374983)" /> </g> </svg> diff --git a/pidgin/pixmaps/emotes/default/24/shout.png b/pidgin/pixmaps/emotes/default/24/shout.png Binary files differindex 1fe2fa9dbd..7ce4cf1fad 100644 --- a/pidgin/pixmaps/emotes/default/24/shout.png +++ b/pidgin/pixmaps/emotes/default/24/shout.png diff --git a/pidgin/plugins/disco/gtkdisco.c b/pidgin/plugins/disco/gtkdisco.c index 9bd4ed4de6..b54f083d26 100644 --- a/pidgin/plugins/disco/gtkdisco.c +++ b/pidgin/plugins/disco/gtkdisco.c @@ -435,17 +435,9 @@ static gboolean disco_paint_tooltip(GtkWidget *tipwindow, cairo_t *cr, gpointer data) { PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context = gtk_widget_get_style_context(tipwindow); gtk_style_context_add_class(context, GTK_STYLE_CLASS_TOOLTIP); gtk_render_layout(context, cr, 6, 6, layout); -#else - gtk_paint_layout(gtk_widget_get_style(tipwindow), - gtk_widget_get_window(tipwindow), - GTK_STATE_NORMAL, FALSE, - NULL, tipwindow, "tooltip", - 6, 6, layout); -#endif return TRUE; } diff --git a/pidgin/plugins/gestures/stroke-draw.c b/pidgin/plugins/gestures/stroke-draw.c index 71da590d7f..783009c9fa 100644 --- a/pidgin/plugins/gestures/stroke-draw.c +++ b/pidgin/plugins/gestures/stroke-draw.c @@ -57,21 +57,15 @@ record_stroke_segment(GtkWidget *widget) { gint x, y; struct gstroke_metrics *metrics; -#if GTK_CHECK_VERSION(3,0,0) GdkDeviceManager *devmgr; GdkDevice *dev; -#endif g_return_if_fail(widget != NULL); -#if GTK_CHECK_VERSION(3,0,0) devmgr = gdk_display_get_device_manager(gtk_widget_get_display(widget)); dev = gdk_device_manager_get_client_pointer(devmgr); gdk_window_get_device_position(gtk_widget_get_window(widget), dev, &x, &y, NULL); -#else - gtk_widget_get_pointer(widget, &x, &y); -#endif if (last_mouse_position.invalid) last_mouse_position.invalid = FALSE; @@ -125,11 +119,7 @@ static void gstroke_cancel(GdkEvent *event) timer_id = 0; if( event != NULL ) -#if GTK_CHECK_VERSION(3,0,0) gdk_device_ungrab(gdk_event_get_device(event), event->button.time); -#else - gdk_pointer_ungrab (event->button.time); -#endif if (gstroke_draw_strokes() && gstroke_disp != NULL) { /* get rid of the invisible stroke window */ @@ -167,16 +157,10 @@ process_event (GtkWidget *widget, GdkEvent *event, gpointer data G_GNUC_UNUSED) if (cursor == NULL) cursor = gdk_cursor_new(GDK_PENCIL); -#if GTK_CHECK_VERSION(3,0,0) gdk_device_grab(gdk_event_get_device(event), gtk_widget_get_window(widget), GDK_OWNERSHIP_WINDOW, FALSE, GDK_BUTTON_RELEASE_MASK, cursor, event->button.time); -#else - gdk_pointer_grab (gtk_widget_get_window(widget), FALSE, - GDK_BUTTON_RELEASE_MASK, NULL, cursor, - event->button.time); -#endif timer_id = g_timeout_add (GSTROKE_TIMEOUT_DURATION, gstroke_timeout, widget); return TRUE; @@ -195,11 +179,7 @@ process_event (GtkWidget *widget, GdkEvent *event, gpointer data G_GNUC_UNUSED) last_mouse_position.invalid = TRUE; original_widget = NULL; g_source_remove (timer_id); -#if GTK_CHECK_VERSION(3,0,0) gdk_device_ungrab(gdk_event_get_device(event), event->button.time); -#else - gdk_pointer_ungrab (event->button.time); -#endif timer_id = 0; { @@ -341,8 +321,7 @@ gstroke_cleanup (GtkWidget *widget) metrics = (struct gstroke_metrics*)g_object_get_data(G_OBJECT(widget), GSTROKE_METRICS); - if (metrics) - g_free (metrics); + g_free(metrics); g_object_steal_data(G_OBJECT(widget), GSTROKE_METRICS); } diff --git a/pidgin/plugins/gestures/stroke.c b/pidgin/plugins/gestures/stroke.c index bd49f06520..4d991acfd7 100644 --- a/pidgin/plugins/gestures/stroke.c +++ b/pidgin/plugins/gestures/stroke.c @@ -197,7 +197,7 @@ _gstroke_record (gint x, gint y, struct gstroke_metrics *metrics) #endif if (metrics->point_count < GSTROKE_MAX_POINTS) { - new_point_p = (p_point) g_malloc (sizeof (struct s_point)); + new_point_p = g_malloc(sizeof (struct s_point)); if (metrics->pointList == NULL) { @@ -239,7 +239,7 @@ _gstroke_record (gint x, gint y, struct gstroke_metrics *metrics) if (((gint) iy) > metrics->max_y) metrics->max_y = (gint) iy; metrics->point_count++; - new_point_p = (p_point) malloc (sizeof(struct s_point)); + new_point_p = malloc(sizeof(struct s_point)); } } else { /* same thing, but for dely larger than delx case... */ ix = LAST_POINT->x; @@ -263,7 +263,7 @@ _gstroke_record (gint x, gint y, struct gstroke_metrics *metrics) if (((gint) iy) > metrics->max_y) metrics->max_y = (gint) iy; metrics->point_count++; - new_point_p = (p_point) malloc (sizeof(struct s_point)); + new_point_p = malloc(sizeof(struct s_point)); } } diff --git a/pidgin/plugins/screencap.c b/pidgin/plugins/screencap.c index fe759f4d2d..f32e132ad5 100644 --- a/pidgin/plugins/screencap.c +++ b/pidgin/plugins/screencap.c @@ -276,21 +276,6 @@ scrncap_draw_window_paint(GtkWidget *widget, cairo_t *cr, gpointer _surface) return FALSE; } -#if !GTK_CHECK_VERSION(3,0,0) -static gboolean -scrncap_draw_window_expose(GtkWidget *widget, GdkEventExpose *event, - gpointer _surface) -{ - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); - - scrncap_draw_window_paint(widget, cr, _surface); - - cairo_destroy(cr); - - return FALSE; -} -#endif - static void scrncap_draw_window_response(GtkDialog *draw_window, gint response_id, gpointer _webview) @@ -372,13 +357,8 @@ scrncap_draw_window(PidginWebView *webview, GdkPixbuf *screen) G_CALLBACK(scrncap_draw_window_close), NULL); draw_cursor = gdk_cursor_new(GDK_PENCIL); -#if GTK_CHECK_VERSION(3,0,0) g_object_set_data_full(G_OBJECT(draw_window), "draw-cursor", draw_cursor, g_object_unref); -#else - g_object_set_data_full(G_OBJECT(draw_window), "draw-cursor", - draw_cursor, (GDestroyNotify)gdk_cursor_unref); -#endif width = gdk_pixbuf_get_width(screen); height = gdk_pixbuf_get_height(screen); @@ -397,13 +377,8 @@ scrncap_draw_window(PidginWebView *webview, GdkPixbuf *screen) drawing_area = gtk_drawing_area_new(); gtk_widget_set_size_request(drawing_area, width, height); -#if GTK_CHECK_VERSION(3,0,0) g_signal_connect(G_OBJECT(drawing_area), "draw", G_CALLBACK(scrncap_draw_window_paint), surface); -#else - g_signal_connect(G_OBJECT(drawing_area), "expose_event", - G_CALLBACK(scrncap_draw_window_expose), surface); -#endif gtk_widget_add_events(drawing_area, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); @@ -423,9 +398,7 @@ scrncap_draw_window(PidginWebView *webview, GdkPixbuf *screen) scroll_area = pidgin_make_scrollable(box, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1); -#if GTK_CHECK_VERSION(3,0,0) g_object_set(G_OBJECT(scroll_area), "expand", TRUE, NULL); -#endif gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area( GTK_DIALOG(draw_window))), scroll_area); @@ -585,11 +558,7 @@ scrncap_crop_window_realize(GtkWidget *crop_window, gpointer _unused) cursor = gdk_cursor_new(GDK_CROSSHAIR); gdk_window_set_cursor(gdkwindow, cursor); -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(cursor); -#else - gdk_cursor_unref(cursor); -#endif } static gboolean diff --git a/pidgin/plugins/ticker/gtkticker.c b/pidgin/plugins/ticker/gtkticker.c index f47f410de6..5d3efd38dd 100644 --- a/pidgin/plugins/ticker/gtkticker.c +++ b/pidgin/plugins/ticker/gtkticker.c @@ -31,17 +31,12 @@ static void gtk_ticker_class_init (GtkTickerClass *klass); static void gtk_ticker_init (GtkTicker *ticker); static void gtk_ticker_map (GtkWidget *widget); static void gtk_ticker_realize (GtkWidget *widget); -#if GTK_CHECK_VERSION(3,0,0) static void gtk_ticker_get_preferred_width (GtkWidget *widget, gint *minimal_width, gint *natural_width); static void gtk_ticker_get_preferred_height (GtkWidget *widget, gint *minimal_height, gint *natural_height); -#else -static void gtk_ticker_size_request (GtkWidget *widget, - GtkRequisition *requisition); -#endif static void gtk_ticker_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_ticker_add_real (GtkContainer *container, @@ -82,12 +77,8 @@ static void gtk_ticker_class_init (GtkTickerClass *class) widget_class->map = gtk_ticker_map; widget_class->realize = gtk_ticker_realize; -#if GTK_CHECK_VERSION(3,0,0) widget_class->get_preferred_width = gtk_ticker_get_preferred_width; widget_class->get_preferred_height = gtk_ticker_get_preferred_height; -#else - widget_class->size_request = gtk_ticker_size_request; -#endif widget_class->size_allocate = gtk_ticker_size_allocate; container_class->add = gtk_ticker_add_real; @@ -262,11 +253,7 @@ static void gtk_ticker_realize (GtkWidget *widget) GdkWindowAttr attributes; gint attributes_mask; GdkWindow *window; -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context; -#else - GtkStyle *style; -#endif GtkAllocation allocation; g_return_if_fail (widget != NULL); @@ -282,36 +269,22 @@ static void gtk_ticker_realize (GtkWidget *widget) attributes.height = allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); -#if !GTK_CHECK_VERSION(3,0,0) - attributes.colormap = gtk_widget_get_colormap (widget); -#endif attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK; -#if GTK_CHECK_VERSION(3,0,0) attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; -#else - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; -#endif window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gtk_widget_set_window (widget, window); gdk_window_set_user_data (window, widget); -#if GTK_CHECK_VERSION(3,0,0) context = gtk_widget_get_style_context(widget); gtk_style_context_add_class(context, GTK_STYLE_CLASS_BACKGROUND); gtk_style_context_set_state(context, GTK_STATE_FLAG_NORMAL); gtk_style_context_set_background(context, window); -#else - style = gtk_style_attach (gtk_widget_get_style (widget), window); - gtk_widget_set_style (widget, style); - gtk_style_set_background (style, window, GTK_STATE_NORMAL); -#endif } -#if GTK_CHECK_VERSION(3,0,0) static void gtk_ticker_get_preferred_width (GtkWidget *widget, gint *minimal_width, @@ -384,47 +357,6 @@ gtk_ticker_get_preferred_height (GtkWidget *widget, *minimal_height = *natural_height = height; } -#else - -static void gtk_ticker_size_request (GtkWidget *widget, GtkRequisition *requisition) -{ - GtkTicker *ticker; - GtkTickerChild *child; - GList *children; - GtkRequisition child_requisition; - guint border_width; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_TICKER (widget)); - g_return_if_fail (requisition != NULL); - - ticker = GTK_TICKER (widget); - requisition->width = 0; - requisition->height = 0; - - children = ticker->children; - while (children) - { - child = children->data; - children = children->next; - - if (gtk_widget_get_visible (child->widget)) - { - gtk_widget_size_request (child->widget, &child_requisition); - - requisition->height = MAX (requisition->height, - child_requisition.height); - requisition->width += child_requisition.width + ticker->spacing; - } - } - if ( requisition->width > ticker->spacing ) - requisition->width -= ticker->spacing; - - border_width = gtk_container_get_border_width (GTK_CONTAINER (ticker)); - requisition->height += border_width * 2; - requisition->width += border_width * 2; -} -#endif static void gtk_ticker_compute_offsets (GtkTicker *ticker) { |