diff options
author | Alberto Mardegan <mardy@users.sourceforge.net> | 2008-08-18 13:20:49 +0000 |
---|---|---|
committer | Alberto Mardegan <mardy@users.sourceforge.net> | 2008-08-18 13:20:49 +0000 |
commit | e57cda074e91e022eea60efd8932781fb4e648c9 (patch) | |
tree | 4387f03708dd054a89e50bf8b989baa413a6c45f | |
parent | 493f306d9b93cc1fcfbfa58bc3b1820e5b6b9b5d (diff) | |
download | telepathy-mission-control-e57cda074e91e022eea60efd8932781fb4e648c9.tar.gz |
Lots of cleanup, most made by smcv.
git-svn-id: https://mission-control.svn.sourceforge.net/svnroot/mission-control/trunk@513 d91c8aed-3f2b-0410-a83d-924a1c20a0ba
48 files changed, 541 insertions, 313 deletions
@@ -1,3 +1,117 @@ +2008-08-18 Alberto Mardegan <alberto.mardegan@nokia.com> + + * src/mcd-service.c: + Remove mission_control_error_quark(), and wonder why it was there. + + * configure.ac: + Remove -Wextra, it breaks the build unless some -Wno-* are options are + available too. + + * libmissioncontrol/test.c: + Remove unused functions. + +2008-08-13 Simon McVittie <simon.mcvittie@collabora.co.uk> + + * autogen.sh, configure.ac, debian/control, debian/rules: + Use and require automake 1.9 and tar-ustar, to make distributable + tarballs without missing files (mostly copied from telepathy-glib) + + * various: + Add some more svn:ignore patterns + + * autogen.sh: Enable gtk-doc by default + + * src/Makefile.am: + Avoid exporting internal symbols + + * libmcclient/Makefile.am, libmissioncontrol/Makefile.am, + src/Makefile.am: + Quote libtool c:r:a arguments so they don't look like errors to vim + + * Makefile.am, configure.ac, m4/Makefile.am (added), + m4/as-compiler-flag.m4 (added, copied from autostars via + telepathy-glib): + Enable more warnings (the recommended warnings from telepathy-glib) + and make them actually take effect + + * various: + Fix declarations with unspecified arguments (foo ()) so they correctly + have no arguments (foo (void)) + + * various: + Make functions static if they are internal to a translation unit + + * src/Makefile.am, libmissioncontrol/Makefile.am, + libmcclient/Makefile.am: + Give generated marshallers proper definitions + + * src/mcd-account-conditions.c, util/mc-account-convert.c: + Use g_snprintf (snprintf is C99 and so requires a feature-test macro) + + * various: + Use guint rather than gint when iterating over a GArray, GPtrArray, + etc. (fixing signed/unsigned comparison warnings) + + * src/mcd-manager.c: + Order #includes according to Telepathy coding style + + * src/mcd-account-manager-query.c: + Remove unused internal code + + * src/mcd-manager.c: + Use feature test macro _POSIX_C_SOURCE to declare that we expect a + POSIX environment, so we can use strtok_r + + * various: + Stop using C99/C++-style local variable declarations + + * util/mc-account-convert.c, libmissioncontrol/mc-protocol.c: + Don't shadow a local variable with a more narrowly scoped local of the + same name + + * examples/mc-example.c, test/mc-client.c, configure.ac, + examples/Makefile.am, test/Makefile.am: + Build (but do not install) example and test by default, and fix them + so they actually compile + + * test/Makefile.am: + Fix out-of-tree builds + + * src/Makefile.am, src/mcd-*.c: + Rename signals marshallers to _mcd_* so they're not in the library + ABI, and use g_cclosure_* where possible rather than duplicating them + + * src/mcd-service.c: + Fix the marshaller for McdService::presence-requested to match the + signal's arguments + + * configure.ac, src/Makefile.am, libmissioncontrol/Makefile.am: + Check for GModule, and explicitly depend on it in the libraries that + use it + + * libmcclient/Makefile.am: + Don't add a useless dependency on gconf + + * libmcclient.pc.in, libmissioncontrol.pc.in: + Remove dependencies' CFLAGS and LIBS from the Libs, Cflags lines - + the Requires line will already provide those - and add + Requires.private for various missing dependencies + + * various: + Avoid warnings when implementing deprecated functions + + * various: + Remove all C++-style // comments, they don't work in -ansi mode + + * libmissioncontrol/mc-account-manager-proxy.c: + Fix inclusion of generated implementations + + * libmcclient/Makefile.am, libmissioncontrol/Makefile.am, + src/Makefile.am, configure.ac: + Use gmodule-no-export-2.0 and remove -export-dynamic from libraries' + linker flags - libraries export selected dynamic symbols anyway, and + -export-dynamic exports *all* symbols, defeating -export-symbols-regex + === telepathy-mission-control 5.0.beta25 === 2008-07-28 Alberto Mardegan <alberto.mardegan@nokia.com> diff --git a/Makefile.am b/Makefile.am index 508266c0..2375a71d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,6 @@ -SUBDIRS = tools xml libmcclient libmissioncontrol src doc server test util +ACLOCAL_AMFLAGS = -I m4 + +SUBDIRS = m4 tools xml libmcclient libmissioncontrol src doc server test util if HAVE_EXAMPLES SUBDIRS += examples @@ -1,5 +1,36 @@ #!/bin/sh -echo 'Running gtkdocize'; gtkdocize -echo 'Running autoreconf -i --force'; autoreconf -i --force -echo "Running ./configure --enable-maintainer-mode $*"; ./configure --enable-maintainer-mode $* +set -e +echo 'Running gtkdocize' +gtkdocize + +if test -n "$AUTOMAKE"; then + : # don't override an explicit user request +elif automake-1.9 --version >/dev/null 2>/dev/null && \ + aclocal-1.9 --version >/dev/null 2>/dev/null; then + # If we have automake-1.9, use it. This helps to ensure that our build + # system doesn't accidentally grow automake-1.10 dependencies. + AUTOMAKE=automake-1.9 + export AUTOMAKE + ACLOCAL=aclocal-1.9 + export ACLOCAL +fi + +echo 'Running autoreconf -i --force' +autoreconf -i --force + +run_configure=true +for arg in $*; do + case $arg in + --no-configure) + run_configure=false + ;; + *) + ;; + esac +done + +if test $run_configure = true; then + echo "Running ./configure --enable-maintainer-mode --enable-gtk-doc $*" + ./configure --enable-maintainer-mode --enable-gtk-doc "$@" +fi diff --git a/configure.ac b/configure.ac index 126b2518..47c1e9ab 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,7 @@ -AC_INIT(telepathy-mission-control, 5.0.beta25) +AC_INIT(telepathy-mission-control, 5.0.beta25.smcv5) +AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR(Makefile.am) -AM_INIT_AUTOMAKE([tar-ustar]) +AM_INIT_AUTOMAKE([1.9 tar-ustar -Wno-portability]) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST @@ -16,6 +17,27 @@ AC_HEADER_STDC AM_CFLAGS="$CFLAGS -Wall -fno-strict-aliasing -ansi -DDMALLOC" +# Recommended CFLAGS for pedantic checking, from telepathy-glib + +AS_COMPILER_FLAG([-Wdeclaration-after-statement], + [AM_CFLAGS="$AM_CFLAGS -Wdeclaration-after-statement"]) +AS_COMPILER_FLAG([-Wstrict-prototypes], + [AM_CFLAGS="$AM_CFLAGS -Wstrict-prototypes"]) +AS_COMPILER_FLAG([-Wmissing-prototypes], + [AM_CFLAGS="$AM_CFLAGS -Wmissing-prototypes"]) +AS_COMPILER_FLAG([-Wmissing-declarations], + [AM_CFLAGS="$AM_CFLAGS -Wmissing-declarations"]) + +AC_ARG_ENABLE([Werror], + AC_HELP_STRING([--enable-Werror],[compile with -Werror]), + [werror=$enableval], [werror=no]) + +if test "$werror" = yes; then + AS_COMPILER_FLAG([-Werror], [AM_CFLAGS="$AM_CFLAGS -Werror"]) +fi + +AC_SUBST([AM_CFLAGS]) + define([EXPAND_VARIABLE], [$2=[$]$1 while true; do @@ -99,32 +121,32 @@ fi AC_SUBST(CHANDLERS_DIR) AC_DEFINE_UNQUOTED(CHANDLERS_DIR,"$CHANDLERS_DIR", [Directory for channel handlers]) -test_enabled="no" +test_enabled="yes" AC_MSG_CHECKING(whether to build tests) AC_ARG_ENABLE(tests, - [ --enable-tests build tests. default=no], + [ --disable-tests don't build tests. default: enable them], [ AC_MSG_RESULT(${enableval}) test_enabled="${enableval}" ], [ - AC_MSG_RESULT(no) - test_enabled="no" + AC_MSG_RESULT([yes (default)]) + test_enabled="yes" ] ) AM_CONDITIONAL(HAVE_TESTS, [test x$test_enabled = xyes]) -examples_enabled="no" +examples_enabled="yes" AC_MSG_CHECKING(whether to build examples) AC_ARG_ENABLE(examples, - [ --enable-examples build examples. default=no], + [ --disable-examples don't build examples. default: build them], [ AC_MSG_RESULT(${enableval}) examples_enabled="${enableval}" ], [ - AC_MSG_RESULT(no) - examples_enabled="no" + AC_MSG_RESULT([yes (default)]) + examples_enabled="yes" ] ) AM_CONDITIONAL(HAVE_EXAMPLES, [test x$examples_enabled = xyes]) @@ -161,10 +183,14 @@ PKG_CHECK_MODULES(GCONF, gconf-2.0 >= $GCONF_REQUIRED_VERSION) AC_SUBST(GCONF_CFLAGS) AC_SUBST(GCONF_LIBS) -PKG_CHECK_MODULES(GLIB, glib-2.0) +PKG_CHECK_MODULES(GLIB, glib-2.0 gobject-2.0) AC_SUBST(GLIB_LIBS) AC_SUBST(GLIB_CFLAGS) +PKG_CHECK_MODULES(GMODULE, gmodule-no-export-2.0) +AC_SUBST(GMODULE_LIBS) +AC_SUBST(GMODULE_CFLAGS) + dnl docs/Makefile.am needs to know whether it's an out of tree build dnl (srcdir != builddir) AM_CONDITIONAL([OUT_OF_TREE_BUILD], [test "z$ac_srcdir" != z.]) @@ -184,21 +210,22 @@ AC_SUBST(pluginlibdir) AC_OUTPUT([ Makefile \ -libmcclient.pc \ -mission-control.pc \ -libmissioncontrol.pc \ -src/Makefile \ -xml/Makefile \ doc/Makefile \ -test/Makefile \ -tools/Makefile \ doc/reference/Makefile \ doc/reference/libmcclient/Makefile \ -doc/reference/libmissioncontrol/Makefile \ doc/reference/libmissioncontrol-server/Makefile \ +doc/reference/libmissioncontrol/Makefile \ +examples/Makefile \ +libmcclient.pc \ libmcclient/Makefile \ +libmissioncontrol.pc \ libmissioncontrol/Makefile \ +m4/Makefile \ +mission-control.pc \ server/Makefile \ -examples/Makefile \ +src/Makefile \ +test/Makefile \ +tools/Makefile \ util/Makefile \ +xml/Makefile \ ]) diff --git a/doc/reference/libmcclient/tmpl/dummy.sgml b/doc/reference/libmcclient/tmpl/dummy.sgml new file mode 100644 index 00000000..e70c3972 --- /dev/null +++ b/doc/reference/libmcclient/tmpl/dummy.sgml @@ -0,0 +1 @@ +this file only exists because gtkdoc gets confused easily diff --git a/doc/reference/libmissioncontrol-server/tmpl/dummy.sgml b/doc/reference/libmissioncontrol-server/tmpl/dummy.sgml new file mode 100644 index 00000000..e70c3972 --- /dev/null +++ b/doc/reference/libmissioncontrol-server/tmpl/dummy.sgml @@ -0,0 +1 @@ +this file only exists because gtkdoc gets confused easily diff --git a/doc/reference/libmissioncontrol/tmpl/dummy.sgml b/doc/reference/libmissioncontrol/tmpl/dummy.sgml new file mode 100644 index 00000000..e70c3972 --- /dev/null +++ b/doc/reference/libmissioncontrol/tmpl/dummy.sgml @@ -0,0 +1 @@ +this file only exists because gtkdoc gets confused easily diff --git a/examples/Makefile.am b/examples/Makefile.am index ae4db334..03820346 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,6 +1,6 @@ INCLUDES = $(TELEPATHY_CFLAGS) -I$(top_srcdir) -bin_PROGRAMS = mc-example +noinst_PROGRAMS = mc-example mc_example_SOURCES = mc-example.c mc_example_LDADD = $(TELEPATHY_LIBS) $(top_builddir)/libmcclient/libmcclient.la diff --git a/examples/mc-example.c b/examples/mc-example.c index b6acb248..bd69d8f5 100644 --- a/examples/mc-example.c +++ b/examples/mc-example.c @@ -25,7 +25,6 @@ #include <glib.h> #include <stdio.h> #include <string.h> -//#include <dbus/dbus-glib.h> #include <telepathy-glib/dbus.h> #include <libmcclient/dbus-api.h> #include <libmcclient/mc-account-manager.h> @@ -86,7 +85,7 @@ set_conditions (McAccount *account) conditions = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free); g_hash_table_insert (conditions, "ip-route", g_strdup ("true")); - mc_account_set_conditions (account, conditions, + mc_account_conditions_set (account, conditions, NULL, NULL, NULL, NULL); g_hash_table_destroy (conditions); } @@ -320,7 +319,6 @@ watch_account (McAccount *account) MC_IFACE_QUARK_ACCOUNT, MC_IFACE_QUARK_ACCOUNT_INTERFACE_AVATAR, 0); - //g_timeout_add (2000, unref_test_object, to); unref_test_object (to); } @@ -348,12 +346,13 @@ am_ready (McAccountManager *am, const GError *error, gpointer user_data) } -void find_accounts_cb (TpProxy *proxy, const GPtrArray *accounts, - const GError *error, gpointer user_data, - GObject *weak_object) +static void +find_accounts_cb (TpProxy *proxy, const GPtrArray *accounts, + const GError *error, gpointer user_data, + GObject *weak_object) { gchar *name; - gint i; + guint i; g_debug ("%s called", G_STRFUNC); if (error) @@ -411,7 +410,9 @@ on_account_created (McAccountManager *am, const gchar *account_path, g_debug ("%s: %s (%d)", G_STRFUNC, account_path, valid); } -int main () +int +main (int argc, + char **argv) { McAccountManager *am; DBusGConnection *dbus_conn; diff --git a/libmcclient.pc.in b/libmcclient.pc.in index 0f9d4d16..821f09e1 100644 --- a/libmcclient.pc.in +++ b/libmcclient.pc.in @@ -7,6 +7,7 @@ profiles_dir=@PROFILES_DIR@ Name: libmcclient Description: Mission Control Client Library Requires: dbus-1 >= 0.50, telepathy-glib >= 0.7.1 +Requires.private: dbus-glib-1, glib-2.0, gobject-2.0 Version: @VERSION@ -Libs: -L${libdir} -lmcclient @DBUS_LIBS@ @TELEPATHY_LIBS@ -Cflags: -I${includedir} @DBUS_CFLAGS@ @TELEPATHY_CFLAGS@ +Libs: -L${libdir} -lmcclient +Cflags: -I${includedir} diff --git a/libmcclient/Makefile.am b/libmcclient/Makefile.am index 7b025a84..028841ad 100644 --- a/libmcclient/Makefile.am +++ b/libmcclient/Makefile.am @@ -1,6 +1,7 @@ INCLUDES = \ - $(DBUS_CFLAGS) \ $(TELEPATHY_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(GLIB_CFLAGS) \ -I$(top_srcdir) \ -I$(top_builddir) \ -DLIBDIR="@libdir@" -DLIBVERSION="0" @@ -16,7 +17,7 @@ CLEANFILES = $(BUILT_SOURCES) lib_LTLIBRARIES = libmcclient.la -libmcclient_la_CFLAGS = $(GLIB_CFLAGS) $(GCONF_CFLAGS) +libmcclient_la_CFLAGS = $(GLIB_CFLAGS) libmcclient_la_SOURCES = \ dbus-api.c \ mc-account.c \ @@ -60,11 +61,16 @@ nodist_libmcclient_la_SOURCES = \ _gen/signals-marshal.h \ _gen/signals-marshal.list -libmcclient_la_LIBADD = $(GCONF_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) $(TELEPATHY_LIBS) +libmcclient_la_LIBADD = \ + $(TELEPATHY_LIBS) \ + $(DBUS_LIBS) \ + $(GLIB_LIBS) -libmcclient_la_LDFLAGS = $(common_ldflags) \ - -export-symbols-regex "^(mc_)|(mission_control_)" \ - -version-info 7:0:1 +libmcclient_la_LDFLAGS = \ + -export-symbols-regex "^(mc_)|(mission_control_)" \ + -version-info "7":"0":"1" +# the redundant quoting here is to prevent the libtool command line from +# looking like an error message in an oddly named file %-marshal.h: %-marshal.list Makefile.am glib-genmarshal --header --prefix=$(subst -,_,$*)_marshal $< > $*-marshal.h diff --git a/libmcclient/mc-profile.c b/libmcclient/mc-profile.c index 388ae29d..70cb86ca 100644 --- a/libmcclient/mc-profile.c +++ b/libmcclient/mc-profile.c @@ -354,7 +354,7 @@ _mc_profile_load (McProfile *profile) g_free (caps); } - // fill in the defaul settings hash + /* fill in the defaul settings hash */ priv->default_settings = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) g_free); @@ -372,7 +372,7 @@ _mc_profile_load (McProfile *profile) } g_strfreev (keys); - // fill in the vcard mangling hashtable + /* fill in the vcard mangling hashtable */ priv->vcard_mangle_hash = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) g_free); @@ -386,7 +386,6 @@ _mc_profile_load (McProfile *profile) k = g_strdup (key + 7); v = g_key_file_get_string (keyfile, PROFILE_GROUP, key, NULL); g_hash_table_insert (MC_PROFILE_PRIV (profile)->vcard_mangle_hash, k, v); - //g_debug("inserted mangle: %s -> %s", k, v); } } g_strfreev (keys); diff --git a/libmissioncontrol.pc.in b/libmissioncontrol.pc.in index efdac24b..9cb2f446 100644 --- a/libmissioncontrol.pc.in +++ b/libmissioncontrol.pc.in @@ -7,6 +7,7 @@ profiles_dir=@PROFILES_DIR@ Name: libmissioncontrol Description: Mission Control Client Library Requires: dbus-1 >= 0.50, libtelepathy >= 0.3.2, telepathy-glib >= 0.7.1 +Requires.private: gconf-2.0, dbus-glib-1, gmodule-2.0, gobject-2.0, glib-2.0 Version: @VERSION@ -Libs: -L${libdir} -lmissioncontrol-client @DBUS_LIBS@ -Cflags: -I${includedir} @DBUS_CFLAGS@ +Libs: -L${libdir} -lmissioncontrol-client +Cflags: -I${includedir} diff --git a/libmissioncontrol/Makefile.am b/libmissioncontrol/Makefile.am index f3a24a59..4579c666 100644 --- a/libmissioncontrol/Makefile.am +++ b/libmissioncontrol/Makefile.am @@ -1,7 +1,10 @@ INCLUDES = \ - $(DBUS_CFLAGS) \ - $(TELEPATHY_CFLAGS) \ + $(GCONF_CFLAGS) \ $(LIBTELEPATHY_CFLAGS) \ + $(TELEPATHY_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(GMODULE_CFLAGS) \ + $(GLIB_CFLAGS) \ -I$(top_srcdir) \ -I$(top_builddir) \ -DMC_DISABLE_DEPRECATED \ @@ -24,7 +27,6 @@ CLEANFILES = $(BUILT_SOURCES) stamp-mc-enum-types.h lib_LTLIBRARIES = libmissioncontrol-client.la -libmissioncontrol_client_la_CFLAGS = $(GLIB_CFLAGS) $(GCONF_CFLAGS) libmissioncontrol_client_la_SOURCES = \ cli-nmc4.c \ dbus-api.c \ @@ -88,12 +90,19 @@ nodist_libmissioncontrol_client_la_SOURCES = \ _gen/signals-marshal.list \ _gen/svc-nmc4.c -libmissioncontrol_client_la_LIBADD = $(GCONF_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) \ - $(TELEPATHY_LIBS) $(LIBTELEPATHY_LIBS) +libmissioncontrol_client_la_LIBADD = \ + $(GCONF_LIBS) \ + $(LIBTELEPATHY_LIBS) \ + $(TELEPATHY_LIBS) \ + $(DBUS_LIBS) \ + $(GMODULE_LIBS) \ + $(GLIB_LIBS) -libmissioncontrol_client_la_LDFLAGS = $(common_ldflags) \ - -export-symbols-regex "^(mc_)|(omc_)|(mission_control_)" \ - -version-info 5:0:0 +libmissioncontrol_client_la_LDFLAGS = \ + -export-symbols-regex "^((mc_)|(omc_)|(mission_control_|m_cerror))" \ + -version-info "5":"0":"0" +# the redundant quoting here is to prevent the libtool command line from +# looking like an error message in an oddly named file mission_control_include = \ mission-control-signals-marshal.h \ @@ -108,6 +117,7 @@ mc-client-lib-gen.h: $(top_builddir)/xml/MissionControl-gen.xml %-marshal.c: %-marshal.list Makefile.am echo "#include <libmissioncontrol/mc-remap.h>" > $*-marshal.c + echo '#include "$*-marshal.h"' >> $*-marshal.c glib-genmarshal --body --prefix=$(subst -,_,$*)_marshal $< >> $*-marshal.c mc-enum-types.h: stamp-mc-enum-types.h @@ -171,7 +181,9 @@ _gen/signals-marshal.h: _gen/signals-marshal.list $(GLIB_GENMARSHAL) --header --prefix=_mc_ext_marshal $< > $@ _gen/signals-marshal.c: _gen/signals-marshal.list - $(GLIB_GENMARSHAL) --body --prefix=_mc_ext_marshal $< > $@ + { echo '#include "_gen/signals-marshal.h"' && \ + $(GLIB_GENMARSHAL) --body --prefix=_mc_ext_marshal $<; } \ + > $@ _gen/register-dbus-glib-marshallers-body.h: _gen/all.xml \ $(tools_dir)/glib-client-marshaller-gen.py diff --git a/libmissioncontrol/mc-account-manager-proxy.c b/libmissioncontrol/mc-account-manager-proxy.c index bdb4750b..d4f42e23 100644 --- a/libmissioncontrol/mc-account-manager-proxy.c +++ b/libmissioncontrol/mc-account-manager-proxy.c @@ -22,9 +22,13 @@ #include <telepathy-glib/proxy-subclass.h> #include <telepathy-glib/errors.h> #include "_gen/interfaces.h" -#include "_gen/cli-Account_Manager-body.h" #include "_gen/signals-marshal.h" + +/* auto-generated stub code */ + +static void _mc_ext_register_dbus_glib_marshallers (void); #include "_gen/register-dbus-glib-marshallers-body.h" +#include "_gen/cli-Account_Manager-body.h" struct _McAccountManagerProxyClass { TpProxyClass parent_class; diff --git a/libmissioncontrol/mc-account-monitor.c b/libmissioncontrol/mc-account-monitor.c index 2a0029e2..9127fd21 100644 --- a/libmissioncontrol/mc-account-monitor.c +++ b/libmissioncontrol/mc-account-monitor.c @@ -378,7 +378,7 @@ static void merge_presences (gpointer key, McAccount *account, GArray *presences) { const McPresence *account_presences; - gint i; + guint i; if (!mc_account_is_enabled (account)) return; diff --git a/libmissioncontrol/mc-account.c b/libmissioncontrol/mc-account.c index 12efed49..d3f88e35 100644 --- a/libmissioncontrol/mc-account.c +++ b/libmissioncontrol/mc-account.c @@ -21,6 +21,11 @@ * */ +#include "config.h" +#undef MC_DISABLE_DEPRECATED +#include "mc-account.h" +#define MC_DISABLE_DEPRECATED + #define DBUS_API_SUBJECT_TO_CHANGE #include <dbus/dbus.h> @@ -32,14 +37,11 @@ #include <stdio.h> #include <glib/gstdio.h> -#include "mc-account.h" #include "mc-account-proxy.h" #include "mc-account-priv.h" #include "mc-account-monitor.h" #include "mc-account-monitor-priv.h" -#include "mc-profile.h" #include "mc.h" -#include <config.h> #define MC_ACCOUNTS_MAX 1024 #define MC_AVATAR_FILENAME "avatar.bin" @@ -141,13 +143,13 @@ static void on_account_property_changed (TpProxy *proxy, GHashTable *properties, gpointer user_data, GObject *weak_object) { - //McAccount *account = MC_ACCOUNT (weak_object); McAccountPrivate *priv = user_data; const GValue *value; + McAccountMonitor *monitor; g_hash_table_foreach (properties, print_prop, NULL); - McAccountMonitor *monitor = mc_account_monitor_new (); + monitor = mc_account_monitor_new (); value = g_hash_table_lookup (properties, MC_ACCOUNTS_GCONF_KEY_VALID); if (value) @@ -196,11 +198,12 @@ on_account_avatar_changed (TpProxy *proxy, gpointer user_data, GObject *weak_object) { McAccountPrivate *priv = user_data; + McAccountMonitor *monitor; g_debug ("%s called", G_STRFUNC); priv->avatar_id = time(0); /* emit the account-changed signal */ - McAccountMonitor *monitor = mc_account_monitor_new (); + monitor = mc_account_monitor_new (); g_signal_emit_by_name (monitor, "account-changed", priv->unique_name); g_object_unref (monitor); } @@ -374,7 +377,7 @@ mc_account_lookup (const gchar *unique_name) return ret; } -gboolean +static gboolean _filter_account (McAccount *acct, gpointer data) { const gchar *compare_account, *normalized_name; @@ -407,7 +410,7 @@ _filter_account (McAccount *acct, gpointer data) return ret; } -McAccount * +static McAccount * _free_all_but_one (GList *list) { McAccount *ret = NULL; @@ -1838,6 +1841,7 @@ mc_account_set_avatar_from_data (McAccount *account, const gchar *data, GError *error = NULL; GArray avatar; GType type; + GValueArray *va; avatar.data = (gchar *)data; avatar.len = len; @@ -1848,7 +1852,7 @@ mc_account_set_avatar_from_data (McAccount *account, const gchar *data, G_TYPE_INVALID); g_value_init (&value, type); g_value_set_static_boxed (&value, dbus_g_type_specialized_construct (type)); - GValueArray *va = (GValueArray *) g_value_get_boxed (&value); + va = (GValueArray *) g_value_get_boxed (&value); g_value_take_boxed (va->values, &avatar); g_value_set_static_string (va->values + 1, mime_type); mc_cli_dbus_properties_do_set (priv->proxy, -1, @@ -1942,10 +1946,13 @@ mc_account_get_avatar (McAccount *account, gchar **filename, if (mime_type) { + GValueArray *va; + mc_cli_dbus_properties_do_get (priv->proxy, -1, MC_IFACE_ACCOUNT, MC_ACCOUNTS_GCONF_KEY_AVATAR, &val_avatar, &error); + if (error) { g_warning ("%s: getting avatar for %s failed: %s", @@ -1953,7 +1960,8 @@ mc_account_get_avatar (McAccount *account, gchar **filename, g_error_free (error); return FALSE; } - GValueArray *va = (GValueArray *) g_value_get_boxed (val_avatar); + + va = (GValueArray *) g_value_get_boxed (val_avatar); *mime_type = g_value_dup_string (va->values + 1); g_value_unset (val_avatar); g_free (val_avatar); diff --git a/libmissioncontrol/mc-manager.c b/libmissioncontrol/mc-manager.c index aba6ed57..4a0c4bba 100644 --- a/libmissioncontrol/mc-manager.c +++ b/libmissioncontrol/mc-manager.c @@ -21,6 +21,11 @@ * */ +#include "config.h" +#undef MC_DISABLE_DEPRECATED +#include "mc-manager.h" +#define MC_DISABLE_DEPRECATED + #include <string.h> #include <sys/types.h> @@ -30,9 +35,7 @@ #include "mc-protocol.h" #include "mc-protocol-priv.h" -#include "mc-manager.h" #include "mc-manager-priv.h" -#include <config.h> #define MANAGER_SUFFIX ".manager" #define MANAGER_SUFFIX_LEN 8 @@ -103,7 +106,7 @@ mc_manager_new (gchar *unique_name, gchar *bus_name, gchar *object_path, } static const gchar** -_mc_manager_get_dirs () +_mc_manager_get_dirs (void) { GSList *dir_list = NULL, *slist; const gchar *dirname; diff --git a/libmissioncontrol/mc-profile.c b/libmissioncontrol/mc-profile.c index 141c2e7b..cc547326 100644 --- a/libmissioncontrol/mc-profile.c +++ b/libmissioncontrol/mc-profile.c @@ -21,15 +21,18 @@ * */ +#include "config.h" +#undef MC_DISABLE_DEPRECATED +#include "mc-profile.h" +#define MC_DISABLE_DEPRECATED + #include <glib.h> #include <glib/gstdio.h> #include <string.h> #include <sys/types.h> #include <libintl.h> -#include "mc-profile.h" #include "mc-enum-types.h" -#include <config.h> #define PROFILE_SUFFIX ".profile" #define PROFILE_SUFFIX_LEN 8 @@ -176,7 +179,7 @@ OUT: } static const gchar** -_mc_profile_get_dirs () +_mc_profile_get_dirs (void) { GSList *dir_list = NULL, *slist; const gchar *dirname; @@ -258,7 +261,7 @@ _mc_profile_load (McProfile *profile) gchar **presences_str; GEnumClass *presences_class; gsize length; - gint i; + guint i; priv = MC_PROFILE_PRIV (profile); @@ -338,7 +341,7 @@ _mc_profile_load (McProfile *profile) g_free (caps); } - // fill in the defaul settings hash + /* fill in the defaul settings hash */ priv->default_settings = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) g_free); @@ -356,7 +359,7 @@ _mc_profile_load (McProfile *profile) } g_strfreev (keys); - // fill in the vcard mangling hashtable + /* fill in the vcard mangling hashtable */ priv->vcard_mangle_hash = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) g_free); @@ -370,7 +373,7 @@ _mc_profile_load (McProfile *profile) k = g_strdup (key + 7); v = g_key_file_get_string (keyfile, PROFILE_GROUP, key, NULL); g_hash_table_insert (MC_PROFILE_PRIV (profile)->vcard_mangle_hash, k, v); - //g_debug("inserted mangle: %s -> %s", k, v); + /* g_debug("inserted mangle: %s -> %s", k, v); */ } } g_strfreev (keys); diff --git a/libmissioncontrol/mc-protocol.c b/libmissioncontrol/mc-protocol.c index a3d3bf67..2ccb13a2 100644 --- a/libmissioncontrol/mc-protocol.c +++ b/libmissioncontrol/mc-protocol.c @@ -21,6 +21,11 @@ * */ +#include "config.h" +#undef MC_DISABLE_DEPRECATED +#include "mc-protocol.h" +#define MC_DISABLE_DEPRECATED + #define DBUS_API_SUBJECT_TO_CHANGE 1 #include <dbus/dbus.h> @@ -30,7 +35,6 @@ #include "mc-manager.h" #include "mc-manager-priv.h" -#include "mc-protocol.h" #include "mc-protocol-priv.h" #define MC_PROTOCOL_PRIV(protocol) ((McProtocolPrivate *)protocol->priv) @@ -304,23 +308,23 @@ _mc_protocol_from_keyfile (GKeyFile *keyfile, const gchar *manager_name, for (i = keys; NULL != *i; i++) { McProtocolParam *param; - const gchar *name = *i; - gchar *value = g_key_file_get_string (keyfile, group_name, *i, NULL); + const gchar *key = *i; + gchar *value = g_key_file_get_string (keyfile, group_name, key, NULL); - if (0 == strncmp (*i, PREFIX_PARAM, PREFIX_PARAM_LEN)) + if (0 == strncmp (key, PREFIX_PARAM, PREFIX_PARAM_LEN)) { - name += PREFIX_PARAM_LEN; - param = _parse_parameter (name, value); + key += PREFIX_PARAM_LEN; + param = _parse_parameter (key, value); if (param) params = g_slist_prepend (params, param); } - else if (0 == strncmp (*i, PREFIX_DEFAULT, PREFIX_DEFAULT_LEN)) + else if (0 == strncmp (key, PREFIX_DEFAULT, PREFIX_DEFAULT_LEN)) { GSList *node; - name += PREFIX_DEFAULT_LEN; - node = g_slist_find_custom (params, name, find_param_by_name_func); + key += PREFIX_DEFAULT_LEN; + node = g_slist_find_custom (params, key, find_param_by_name_func); if (node) { @@ -334,7 +338,7 @@ _mc_protocol_from_keyfile (GKeyFile *keyfile, const gchar *manager_name, } else { - g_debug ("%s: unrecognised protocol key \"%s\"", G_STRFUNC, *i); + g_debug ("%s: unrecognised protocol key \"%s\"", G_STRFUNC, key); } g_free (value); diff --git a/libmissioncontrol/mission-control.c b/libmissioncontrol/mission-control.c index 6eca844d..e0f6feb5 100644 --- a/libmissioncontrol/mission-control.c +++ b/libmissioncontrol/mission-control.c @@ -396,9 +396,10 @@ mission_control_get_type (void) MissionControl * mission_control_new (DBusGConnection * connection) { - g_return_val_if_fail (connection != NULL, NULL); MissionControl *mc_obj = NULL; + g_return_val_if_fail (connection != NULL, NULL); + /* Create the proxy object that is used for performing * the method calls on the Mission Control service */ @@ -705,10 +706,11 @@ mission_control_request_channel_with_string_handle_and_vcard_field (MissionContr gpointer user_data) { struct dbus_cb_data *cb_data; - operation_id++; const gchar *account_name = mc_account_get_unique_name (account); char * mangled_handle = NULL; + operation_id++; + if (account_name == NULL) { INVOKE_CALLBACK (self, callback, user_data, MC_INVALID_ACCOUNT_ERROR, @@ -731,12 +733,13 @@ mission_control_request_channel_with_string_handle_and_vcard_field (MissionContr { const char * profile_vcard_field = mc_profile_get_vcard_field (profile); - // TODO: this is where from the profiles or from the provisioning - // we must figure out how to actually mangle user addresses from - // foreign vcard fields to something the connection manager will - // understand. - // For now this is just lowercasing the vcard field and prepending - // it to the address + /* TODO: this is where from the profiles or from the provisioning + * we must figure out how to actually mangle user addresses from + * foreign vcard fields to something the connection manager will + * understand. + * For now this is just lowercasing the vcard field and prepending + * it to the address + */ /* only mangle if it is not the default vcard field */ if (profile_vcard_field == NULL || @@ -748,12 +751,12 @@ mission_control_request_channel_with_string_handle_and_vcard_field (MissionContr mangled_handle = g_strdup_printf(mangle, handle); } else { if (strcmp(vcard_field, "TEL") == 0) { - // TEL mangling + /* TEL mangling */ char ** split = g_strsplit_set(handle, " -,.:;", -1); mangled_handle = g_strjoinv("", split); g_strfreev(split); } else { - // generic mangling + /* generic mangling */ char * lower_vcard_field = g_utf8_strdown(vcard_field, -1); mangled_handle = g_strdup_printf("%s:%s", lower_vcard_field, handle); g_free(lower_vcard_field); @@ -1266,7 +1269,7 @@ get_current_status_cb (DBusGProxy * proxy, McAccountStatus *accounts, *account; GType type; gsize n_accounts; - gint i; + guint i; if (error) g_debug ("%s: Error: %s (%u)", G_STRFUNC, error->message, error->code); @@ -1274,6 +1277,7 @@ get_current_status_cb (DBusGProxy * proxy, type = dbus_g_type_get_struct ("GValueArray", G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID); accounts = g_new (McAccountStatus, accounts_array->len); + for (i = 0, account = accounts; i < accounts_array->len; i++, account++) { GValue account_value = { 0, }; diff --git a/libmissioncontrol/test.c b/libmissioncontrol/test.c index 3054c7c8..100753d3 100644 --- a/libmissioncontrol/test.c +++ b/libmissioncontrol/test.c @@ -34,54 +34,8 @@ #include "mc-account-monitor.h" #include "mc-profile.h" -void print_profile (McProfile *profile) -{ - const gchar *name, *protocol_name; - McProtocol *protocol; - - g_assert (NULL != profile); - name = mc_profile_get_unique_name (profile); - protocol = mc_profile_get_protocol (profile); - protocol_name = mc_protocol_get_name (protocol); - printf ("profile: %s (%s)\n", name, protocol_name); -} - -void print_account (McAccount *account) -{ - const gchar *name = mc_account_get_unique_name (account); - printf ("account: %p (%s)\n", account, name); -} - -void print_manager (McManager *manager) -{ - const gchar *name = mc_manager_get_unique_name (manager); - printf ("manager: %p (%s)\n", manager, name); -} - -void print_protocol (McProtocol *protocol) -{ - printf ("protocol: %s/%s\n", - mc_manager_get_unique_name ( - mc_protocol_get_manager (protocol)), - mc_protocol_get_name (protocol)); -} - -void print_protocol_detailed (McProtocol *protocol) -{ - GSList *i; - - g_assert (NULL != protocol); - print_protocol (protocol); - - for (i = mc_protocol_get_params (protocol); NULL != i; i = i->next) - { - McProtocolParam *param = (McProtocolParam *) i->data; - - printf(" %s:%s\n", param->signature, param->name); - } -} - -void test_profile () +static void +test_profile (void) { McProfile *profile1, *profile2; McProtocol *protocol; @@ -103,7 +57,8 @@ void test_profile () g_object_unref (profile2); } -void test_profile_list () +static void +test_profile_list (void) { GList *list, *i; McProfile *profile1, *profile2; @@ -133,7 +88,8 @@ void test_profile_list () mc_profiles_free_list (list); } -void test_profile_stat () +static void +test_profile_stat (void) { McProfile *profile1, *profile2; @@ -143,7 +99,8 @@ void test_profile_stat () g_assert (profile1 != profile2); } -void check_account_param (gpointer key, gpointer value, gpointer data) +static void +check_account_param (gpointer key, gpointer value, gpointer data) { if (0 == strcmp (key, "account")) { @@ -162,7 +119,8 @@ void check_account_param (gpointer key, gpointer value, gpointer data) g_warning ("got unexpected parameter \"%s\" for account", (gchar *) key); } -void test_account() +static void +test_account (void) { McAccount *account1, *account2; @@ -183,26 +141,8 @@ void test_account() g_object_unref(account2); } -void print_accounts_list () -{ - GList *i, *accounts; - - accounts = mc_accounts_list (); - - for (i = accounts; NULL != i; i = i->next) - { - McAccount *account = (McAccount *) i->data; - const gchar *name = mc_account_get_unique_name (account); - const gchar *display_name = mc_account_get_display_name (account); - - if (display_name) - g_print (" %s (\"%s\")\n", name, display_name); - else - g_print (" %s\n", name); - } -} - -gint account_has_name (gconstpointer account_p, gconstpointer name_p) +static gint +account_has_name (gconstpointer account_p, gconstpointer name_p) { McAccount *account = (McAccount *) account_p; const gchar *name = (gchar *) name_p; @@ -210,7 +150,8 @@ gint account_has_name (gconstpointer account_p, gconstpointer name_p) return strcmp (mc_account_get_unique_name (account), name); } -void test_mc_account_list () +static void +test_mc_account_list (void) { GList *accounts; McAccount *account; @@ -228,41 +169,47 @@ void test_mc_account_list () mc_account_delete (account); } -void cb_account_created(McAccountMonitor *monitor, gchar *name, gpointer data) +static void +cb_account_created(McAccountMonitor *monitor, gchar *name, gpointer data) { GSList **created = (GSList **) data; *created = g_slist_append (*created, g_strdup (name)); /*printf ("account created: %s\n", name); */ } -void cb_account_deleted(McAccountMonitor *monitor, gchar *name, gpointer data) +static void +cb_account_deleted(McAccountMonitor *monitor, gchar *name, gpointer data) { GSList **deleted = (GSList **) data; *deleted = g_slist_append (*deleted, g_strdup (name)); /*printf ("account deleted: %s\n", name); */ } -void cb_account_enabled (McAccountMonitor *monitor, gchar *name, gpointer data) +static void +cb_account_enabled (McAccountMonitor *monitor, gchar *name, gpointer data) { GSList **enabled = (GSList **) data; *enabled = g_slist_append (*enabled, g_strdup (name)); /* printf ("account enabled: %s\n", name); */ } -void cb_account_disabled (McAccountMonitor *monitor, gchar *name, gpointer data) +static void +cb_account_disabled (McAccountMonitor *monitor, gchar *name, gpointer data) { GSList **disabled = (GSList **) data; *disabled = g_slist_append (*disabled, g_strdup (name)); /* printf ("account disabled: %s\n", name); */ } -void cb_account_changed (McAccountMonitor *monitor, gchar *name, gpointer data) +static void +cb_account_changed (McAccountMonitor *monitor, gchar *name, gpointer data) { GSList **disabled = (GSList **) data; *disabled = g_slist_append (*disabled, g_strdup (name)); } -void test_account_monitor() +static void +test_account_monitor (void) { McAccountMonitor *monitor; McProfile *profile1, *profile2; @@ -379,7 +326,8 @@ void test_account_monitor() g_object_unref (monitor); } -void test_manager() +static void +test_manager (void) { McManager *manager1, *manager2; @@ -403,7 +351,8 @@ void test_manager() g_object_unref (manager2); } -void test_protocol () +static void +test_protocol (void) { McManager *manager1, *manager2; McProtocol *protocol1, *protocol2; @@ -456,7 +405,8 @@ void test_protocol () g_object_unref (protocol2); } -int main () +int +main (int argc, char **argv) { g_setenv ("MC_PROFILE_DIR", "../test", FALSE); g_setenv ("MC_MANAGER_DIR", "../test", FALSE); diff --git a/m4/Makefile.am b/m4/Makefile.am new file mode 100644 index 00000000..dc791da9 --- /dev/null +++ b/m4/Makefile.am @@ -0,0 +1,3 @@ +EXTRA_DIST = \ + as-compiler-flag.m4 \ + gtk-doc.m4 diff --git a/m4/as-compiler-flag.m4 b/m4/as-compiler-flag.m4 new file mode 100644 index 00000000..605708a5 --- /dev/null +++ b/m4/as-compiler-flag.m4 @@ -0,0 +1,33 @@ +dnl as-compiler-flag.m4 0.1.0 + +dnl autostars m4 macro for detection of compiler flags + +dnl David Schleef <ds@schleef.org> + +dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $ + +dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) +dnl Tries to compile with the given CFLAGS. +dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, +dnl and ACTION-IF-NOT-ACCEPTED otherwise. + +AC_DEFUN([AS_COMPILER_FLAG], +[ + AC_MSG_CHECKING([to see if compiler understands $1]) + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + + AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + $2 + true + else + $3 + true + fi + AC_MSG_RESULT([$flag_ok]) +]) + diff --git a/mission-control.pc.in b/mission-control.pc.in index c2c096e8..0e42779f 100644 --- a/mission-control.pc.in +++ b/mission-control.pc.in @@ -7,7 +7,7 @@ pluginlibdir=@pluginlibdir@ Name: mission-control Description: Mission control filters interface library Requires: dbus-1 >= 0.50, libtelepathy >= 0.0.54 +Requires.private: libmcclient, telepathy-glib, gconf-2.0, dbus-1, dbus-glib-1, gmodule-2.0, glib-2.0, gobject-2.0 Version: @VERSION@ Libs: -L${libdir} -lmissioncontrol-server Cflags: -I${includedir}/mission-control - diff --git a/src/Makefile.am b/src/Makefile.am index 843d9941..cec7d8f1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,9 @@ -INCLUDES = $(DBUS_CFLAGS) $(GCONF_CFLAGS) $(TELEPATHY_CFLAGS) \ +INCLUDES = \ + $(GCONF_CFLAGS) \ + $(TELEPATHY_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(GMODULE_CFLAGS) \ + $(GLIB_CFLAGS) \ -DMCD_DEFAULT_FILTER_PLUGIN_DIR=\"@pluginlibdir@\" \ -DDBUS_API_SUBJECT_TO_CHANGE \ -DMC_DISABLE_DEPRECATED -I$(top_srcdir) @@ -83,12 +88,19 @@ CLEANFILES = $(BUILT_SOURCES) lib_LTLIBRARIES = libmissioncontrol-server.la -libmissioncontrol_server_la_LIBADD = $(DBUS_LIBS) $(GCONF_LIBS) $(TELEPATHY_LIBS) \ - $(top_builddir)/libmcclient/libmcclient.la +libmissioncontrol_server_la_LIBADD = \ + $(top_builddir)/libmcclient/libmcclient.la \ + $(GCONF_LIBS) \ + $(TELEPATHY_LIBS) \ + $(DBUS_LIBS) \ + $(GMODULE_LIBS) \ + $(GLIB_LIBS) -# we want to export symbols so that the plugins can see them -libmissioncontrol_server_la_LDFLAGS = -export-dynamic \ - -version-info 5:0:0 +libmissioncontrol_server_la_LDFLAGS = \ + -export-symbols-regex '^((mc_)|(mcd_)|(mission_control_))' \ + -version-info "5":"0":"0" +# the redundant quoting here is to prevent the libtool command line from +# looking like an error message in an oddly named file libmissioncontrol_server_la_SOURCES = \ mcd-account.c \ @@ -129,10 +141,12 @@ libmissioncontrol_server_la_SOURCES = \ # mcd-main.c %-signals-marshal.h: %-signals-marshal.list Makefile - glib-genmarshal --header --prefix=$(subst -,_,$*)_marshal $< > $*-signals-marshal.h + glib-genmarshal --header --prefix=_$(subst -,_,$*)_marshal $< > $*-signals-marshal.h %-signals-marshal.c: %-signals-marshal.list Makefile - glib-genmarshal --body --prefix=$(subst -,_,$*)_marshal $< > $*-signals-marshal.c + { echo '#include "$*-signals-marshal.h"' && \ + glib-genmarshal --body --prefix=_$(subst -,_,$*)_marshal $<; } \ + > $*-signals-marshal.c mcd-enum-types.h: stamp-mcd-enum-types.h @true @@ -189,7 +203,9 @@ _gen/signals-marshal.h: _gen/signals-marshal.list $(GLIB_GENMARSHAL) --header --prefix=_mc_ext_marshal $< > $@ _gen/signals-marshal.c: _gen/signals-marshal.list - $(GLIB_GENMARSHAL) --body --prefix=_mc_ext_marshal $< > $@ + { echo '#include "_gen/signals-marshal.h"' && \ + $(GLIB_GENMARSHAL) --body --prefix=_mc_ext_marshal $<; } \ + > $@ _gen/register-dbus-glib-marshallers-body.h: _gen/all.xml \ $(tools_dir)/glib-client-marshaller-gen.py diff --git a/src/mcd-account-conditions.c b/src/mcd-account-conditions.c index f832b8c7..a8df4ff6 100644 --- a/src/mcd-account-conditions.c +++ b/src/mcd-account-conditions.c @@ -49,7 +49,7 @@ store_condition (gpointer key, gpointer value, gpointer userdata) keyfile = mcd_account_get_keyfile (account); unique_name = mcd_account_get_unique_name (account); - snprintf (condition_key, sizeof (condition_key), "condition-%s", name); + g_snprintf (condition_key, sizeof (condition_key), "condition-%s", name); g_key_file_set_string (keyfile, unique_name, condition_key, condition); } diff --git a/src/mcd-account-manager-query.c b/src/mcd-account-manager-query.c index f119105e..527cda67 100644 --- a/src/mcd-account-manager-query.c +++ b/src/mcd-account-manager-query.c @@ -85,11 +85,6 @@ const McdDBusProp account_manager_query_properties[] = { { 0 }, }; -const McdDBusProp * -_mcd_account_manager_query_get_properties (void) -{ - return account_manager_query_properties; -} static gboolean match_account_parameter (McdAccount *account, const gchar *name, @@ -198,7 +193,7 @@ find_accounts (gpointer key, gpointer value, gpointer userdata) McdFindData *fd = userdata; TpConnectionPresenceType presence; const gchar *object_path, *string, *status, *message; - gint i; + guint i; g_debug ("%s: %s", G_STRFUNC, (gchar *)key); if (fd->manager) diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c index ececf045..68220712 100644 --- a/src/mcd-account-manager.c +++ b/src/mcd-account-manager.c @@ -392,8 +392,8 @@ properties_iface_init (TpSvcDBusPropertiesClass *iface, gpointer iface_data) /* Returns the location of the account configuration file. * Returned string must be freed by caller. */ static gchar * -get_account_conf_filename () -{ +get_account_conf_filename (void) +{ const gchar *base; base = g_getenv ("MC_ACCOUNT_DIR"); diff --git a/src/mcd-account.c b/src/mcd-account.c index 15d39aa7..add51891 100644 --- a/src/mcd-account.c +++ b/src/mcd-account.c @@ -22,17 +22,19 @@ * */ +#include "config.h" +#include "mcd-account.h" + #include <stdio.h> #include <string.h> -#include <glib/gstdio.h> -#include <glib/gi18n.h> -#include <config.h> #include <dbus/dbus.h> +#include <glib/gi18n.h> +#include <glib/gstdio.h> +#include <telepathy-glib/gtypes.h> #include <telepathy-glib/svc-generic.h> #include <telepathy-glib/util.h> -#include <telepathy-glib/gtypes.h> -#include "mcd-account.h" + #include "mcd-account-priv.h" #include "mcd-account-compat.h" #include "mcd-account-conditions.h" @@ -540,6 +542,7 @@ get_avatar (TpSvcDBusProperties *self, const gchar *name, GValue *value) gchar *mime_type; GArray *avatar = NULL; GType type; + GValueArray *va; g_debug ("%s called for %s", G_STRFUNC, priv->unique_name); @@ -552,7 +555,7 @@ get_avatar (TpSvcDBusProperties *self, const gchar *name, GValue *value) G_TYPE_INVALID); g_value_init (value, type); g_value_take_boxed (value, dbus_g_type_specialized_construct (type)); - GValueArray *va = (GValueArray *) g_value_get_boxed (value); + va = (GValueArray *) g_value_get_boxed (value); g_value_take_boxed (va->values, avatar); g_value_take_string (va->values + 1, mime_type); } @@ -655,6 +658,7 @@ get_automatic_presence (TpSvcDBusProperties *self, gchar *presence, *message; gint presence_type; GType type; + GValueArray *va; g_debug ("%s called for %s", G_STRFUNC, priv->unique_name); @@ -665,7 +669,7 @@ get_automatic_presence (TpSvcDBusProperties *self, type = MC_STRUCT_TYPE_ACCOUNT_PRESENCE; g_value_init (value, type); g_value_take_boxed (value, dbus_g_type_specialized_construct (type)); - GValueArray *va = (GValueArray *) g_value_get_boxed (value); + va = (GValueArray *) g_value_get_boxed (value); g_value_set_uint (va->values, presence_type); g_value_set_static_string (va->values + 1, presence); g_value_set_static_string (va->values + 2, message); @@ -765,6 +769,7 @@ get_current_presence (TpSvcDBusProperties *self, const gchar *name, gchar *status, *message; gint presence_type; GType type; + GValueArray *va; g_debug ("%s called for %s", G_STRFUNC, priv->unique_name); @@ -775,7 +780,7 @@ get_current_presence (TpSvcDBusProperties *self, const gchar *name, type = MC_STRUCT_TYPE_ACCOUNT_PRESENCE; g_value_init (value, type); g_value_take_boxed (value, dbus_g_type_specialized_construct (type)); - GValueArray *va = (GValueArray *) g_value_get_boxed (value); + va = (GValueArray *) g_value_get_boxed (value); g_value_set_uint (va->values, presence_type); g_value_set_static_string (va->values + 1, status); g_value_set_static_string (va->values + 2, message); @@ -813,6 +818,7 @@ get_requested_presence (TpSvcDBusProperties *self, gchar *presence, *message; gint presence_type; GType type; + GValueArray *va; g_debug ("%s called for %s", G_STRFUNC, priv->unique_name); @@ -823,7 +829,7 @@ get_requested_presence (TpSvcDBusProperties *self, type = MC_STRUCT_TYPE_ACCOUNT_PRESENCE; g_value_init (value, type); g_value_take_boxed (value, dbus_g_type_specialized_construct (type)); - GValueArray *va = (GValueArray *) g_value_get_boxed (value); + va = (GValueArray *) g_value_get_boxed (value); g_value_set_uint (va->values, presence_type); g_value_set_static_string (va->values + 1, presence); g_value_set_static_string (va->values + 2, message); @@ -908,7 +914,7 @@ has_param (McdAccountPrivate *priv, const gchar *name) { gchar key[MAX_KEY_LENGTH]; - snprintf (key, sizeof (key), "param-%s", name); + g_snprintf (key, sizeof (key), "param-%s", name); return g_key_file_has_key (priv->keyfile, priv->unique_name, key, NULL); } @@ -972,7 +978,7 @@ mcd_account_check_parameters (McdAccount *account) McdAccountPrivate *priv = account->priv; const GArray *parameters; gboolean valid; - gint i; + guint i; g_debug ("%s called for %s", G_STRFUNC, priv->unique_name); parameters = mcd_manager_get_parameters (priv->manager, @@ -1008,7 +1014,8 @@ set_parameter (gpointer ht_key, gpointer ht_value, gpointer userdata) const GValue *value = ht_value; gchar key[MAX_KEY_LENGTH]; - snprintf (key, sizeof (key), "param-%s", name); + g_snprintf (key, sizeof (key), "param-%s", name); + switch (G_VALUE_TYPE (value)) { case G_TYPE_STRING: @@ -1090,7 +1097,7 @@ mcd_account_unset_parameters (McdAccount *account, const gchar **params) for (param = params; *param != NULL; param++) { - snprintf (key, sizeof (key), "param-%s", *param); + g_snprintf (key, sizeof (key), "param-%s", *param); g_key_file_remove_key (priv->keyfile, priv->unique_name, key, NULL); g_debug ("unset param %s", *param); @@ -1383,7 +1390,7 @@ mcd_account_class_init (McdAccountClass * klass) G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__UINT_UINT, + NULL, NULL, _mcd_marshal_VOID__UINT_UINT, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); _mcd_account_signals[CURRENT_PRESENCE_CHANGED] = @@ -1391,7 +1398,7 @@ mcd_account_class_init (McdAccountClass * klass) G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__UINT_STRING_STRING, + NULL, NULL, _mcd_marshal_VOID__UINT_STRING_STRING, G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING); _mcd_account_signals[REQUESTED_PRESENCE_CHANGED] = @@ -1399,7 +1406,7 @@ mcd_account_class_init (McdAccountClass * klass) G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__UINT_STRING_STRING, + NULL, NULL, _mcd_marshal_VOID__UINT_STRING_STRING, G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING); _mcd_account_signals[VALIDITY_CHANGED] = @@ -1407,7 +1414,7 @@ mcd_account_class_init (McdAccountClass * klass) G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__BOOLEAN, + NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); _mcd_account_signals[AVATAR_CHANGED] = @@ -1415,7 +1422,7 @@ mcd_account_class_init (McdAccountClass * klass) G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__BOXED_STRING, + NULL, NULL, _mcd_marshal_VOID__BOXED_STRING, G_TYPE_NONE, 2, dbus_g_type_get_collection ("GArray", G_TYPE_UCHAR), G_TYPE_STRING); @@ -1525,7 +1532,7 @@ add_parameter (McdAccountPrivate *priv, McdProtocolParam *param, g_return_if_fail (param->name != NULL); g_return_if_fail (param->signature != NULL); - snprintf (key, sizeof (key), "param-%s", param->name); + g_snprintf (key, sizeof (key), "param-%s", param->name); switch (param->signature[0]) { @@ -1595,7 +1602,7 @@ mcd_account_get_parameters (McdAccount *account) McdAccountPrivate *priv = MCD_ACCOUNT_PRIV (account); GHashTable *params; const GArray *parameters; - gint i; + guint i; g_debug ("%s called", G_STRFUNC); if (!priv->manager && !load_manager (priv)) return NULL; @@ -1633,11 +1640,12 @@ mcd_account_request_presence (McdAccount *account, { GValue value = { 0 }; GType type; + GValueArray *va; type = MC_STRUCT_TYPE_ACCOUNT_PRESENCE; g_value_init (&value, type); g_value_take_boxed (&value, dbus_g_type_specialized_construct (type)); - GValueArray *va = (GValueArray *) g_value_get_boxed (&value); + va = (GValueArray *) g_value_get_boxed (&value); g_value_set_uint (va->values, presence); g_value_set_static_string (va->values + 1, status); g_value_set_static_string (va->values + 2, message); @@ -1664,7 +1672,7 @@ mcd_account_set_current_presence (McdAccount *account, gboolean changed = FALSE; GValue value = { 0 }; GType type; - + GValueArray *va; if (priv->curr_presence_type != presence) { @@ -1689,7 +1697,7 @@ mcd_account_set_current_presence (McdAccount *account, type = MC_STRUCT_TYPE_ACCOUNT_PRESENCE; g_value_init (&value, type); g_value_take_boxed (&value, dbus_g_type_specialized_construct (type)); - GValueArray *va = (GValueArray *) g_value_get_boxed (&value); + va = (GValueArray *) g_value_get_boxed (&value); g_value_set_uint (va->values, presence); g_value_set_static_string (va->values + 1, status); g_value_set_static_string (va->values + 2, message); diff --git a/src/mcd-chan-handler.c b/src/mcd-chan-handler.c index 52872577..f0c37be2 100644 --- a/src/mcd-chan-handler.c +++ b/src/mcd-chan-handler.c @@ -57,7 +57,7 @@ _mcd_channel_handler_packer(GHashTable *handlers, gchar **string_list, gchar *object_path, const gchar *cm_protocol, gint handler_version) { - gint i; + gsize i; McdChannelHandler *handler; GHashTable *channel_handler; diff --git a/src/mcd-channel.c b/src/mcd-channel.c index 925ec79e..d3401b11 100644 --- a/src/mcd-channel.c +++ b/src/mcd-channel.c @@ -128,7 +128,7 @@ on_members_changed (TpChannel *proxy, const gchar *message, if (l_pending && l_pending->len > 0) { - int i; + guint i; /* FIXME: Add duplicity check */ for (i = 0; i < l_pending->len; i++) { @@ -146,7 +146,7 @@ on_members_changed (TpChannel *proxy, const gchar *message, if (added && added->len > 0) { - int i, j; + guint i, j; g_debug ("%u added members", added->len); for (i = 0; i < added->len; i++) { @@ -178,7 +178,7 @@ on_members_changed (TpChannel *proxy, const gchar *message, * array, even if we don't need the info */ if (removed && removed->len > 0) { - int i; + guint i; if (actor != priv->self_handle) { @@ -229,7 +229,7 @@ lookup_actor (McdChannel *channel) McdChannelPrivate *priv = channel->priv; PendingMemberInfo *pmi; gboolean found = FALSE; - gint i; + guint i; g_debug ("%s called", G_STRFUNC); for (i = 0; i < priv->pending_local_members->len; i++) @@ -293,7 +293,7 @@ group_get_local_pending_members_with_info (TpChannel *proxy, if (l_pending) { - int i; + guint i; g_debug ("%u local pending members, adding", l_pending->len); /* FIXME: Add duplicity check */ for (i = 0; i < l_pending->len; i++) diff --git a/src/mcd-connection.c b/src/mcd-connection.c index 18d6e47c..3feb9e82 100644 --- a/src/mcd-connection.c +++ b/src/mcd-connection.c @@ -221,7 +221,7 @@ _mcd_connection_free_presence_info (McdConnection * conn) if (priv->recognized_presence_info_array != NULL) { struct presence_info *pi; - gint i; + guint i; for (i = 0; i < priv->recognized_presence_info_array->len; i++) { @@ -327,7 +327,7 @@ enable_well_known_presences (McdConnectionPrivate *priv) { if (priv->presence_to_set[mapping->mc_presence - 1] == NULL) { - gint i; + guint i; /* see if this presence is supported by the connection */ for (i = 0; i < priv->recognized_presence_info_array->len; i++) { @@ -635,7 +635,7 @@ on_capabilities_changed (TpConnection *proxy, const GPtrArray *caps, gchar *chan_type; guint chan_handle, chan_handle_type; TpProxyPendingCall *call; - gint i; + guint i; g_debug ("%s: got capabilities for channel %p handle %d, type %s", G_STRFUNC, channel, mcd_channel_get_handle (channel), mcd_channel_get_channel_type (channel)); @@ -755,10 +755,10 @@ _mcd_connection_setup_capabilities (McdConnection *connection) { McdConnectionPrivate *priv = MCD_CONNECTION_PRIV (connection); GPtrArray *capabilities; - const gchar *remove = NULL; + const gchar *removed = NULL; const gchar *protocol_name; GType type; - gint i; + guint i; if (!priv->has_capabilities_if) { @@ -772,7 +772,7 @@ _mcd_connection_setup_capabilities (McdConnection *connection) g_debug ("%s: advertising capabilities", G_STRFUNC); tp_cli_connection_interface_capabilities_call_advertise_capabilities (priv->tp_conn, -1, capabilities, - &remove, + &removed, capabilities_advertise_cb, priv, NULL, (GObject *) connection); @@ -1074,7 +1074,7 @@ on_aliases_changed (TpConnection *proxy, const GPtrArray *aliases, GType type; gchar *alias; guint contact; - gint i; + guint i; g_debug ("%s called", G_STRFUNC); type = dbus_g_type_get_struct ("GValueArray", G_TYPE_UINT, G_TYPE_STRING, diff --git a/src/mcd-controller.c b/src/mcd-controller.c index 1286cfda..774f9c96 100644 --- a/src/mcd-controller.c +++ b/src/mcd-controller.c @@ -98,11 +98,12 @@ _mcd_controller_exit_by_timeout (gpointer data) void mcd_controller_shutdown (McdController *controller, const gchar *reason) { + McdControllerPrivate *priv; + g_return_if_fail (MCD_IS_CONTROLLER (controller)); - - McdControllerPrivate *priv = MCD_CONTROLLER_PRIV (controller); - - if(!priv->shutdown_timeout_id) + priv = MCD_CONTROLLER_PRIV (controller); + + if(!priv->shutdown_timeout_id) { g_debug ("MC will bail out because of \"%s\" out exit after %i", reason ? reason : "No reason specified", @@ -123,10 +124,11 @@ mcd_controller_shutdown (McdController *controller, const gchar *reason) void mcd_controller_cancel_shutdown (McdController *controller) { + McdControllerPrivate *priv; + g_return_if_fail (MCD_IS_CONTROLLER (controller)); - - McdControllerPrivate *priv = MCD_CONTROLLER_PRIV (controller); - + priv = MCD_CONTROLLER_PRIV (controller); + if (priv->shutdown_timeout_id) { g_debug ("Cancelling exit timeout"); diff --git a/src/mcd-dbusprop.c b/src/mcd-dbusprop.c index 70d74e69..ffdb332f 100644 --- a/src/mcd-dbusprop.c +++ b/src/mcd-dbusprop.c @@ -29,10 +29,10 @@ #define MCD_INTERFACES_QUARK get_interfaces_quark() static GQuark -get_interfaces_quark () +get_interfaces_quark (void) { static GQuark interfaces_quark = 0; - + if (G_UNLIKELY (!interfaces_quark)) interfaces_quark = g_quark_from_static_string ("interfaces"); return interfaces_quark; diff --git a/src/mcd-dbusprop.h b/src/mcd-dbusprop.h index 6eee9918..8445124b 100644 --- a/src/mcd-dbusprop.h +++ b/src/mcd-dbusprop.h @@ -44,7 +44,7 @@ typedef struct _McdDBusProp typedef struct _McdInterfaceData { - GType (*get_type)(); + GType (*get_type)(void); const gchar *interface; const McdDBusProp *properties; GInterfaceInitFunc iface_init; diff --git a/src/mcd-debug.h b/src/mcd-debug.h index 8b3318f0..2ece6fa7 100644 --- a/src/mcd-debug.h +++ b/src/mcd-debug.h @@ -33,9 +33,9 @@ G_BEGIN_DECLS #define g_object_ref(obj) (mcd_debug_ref (obj, __FILE__, __LINE__)) #define g_object_unref(obj) (mcd_debug_unref (obj, __FILE__, __LINE__)) -void mcd_debug_init (); +void mcd_debug_init (void); -inline gint mcd_debug_get_level (); +inline gint mcd_debug_get_level (void); void mcd_debug_ref (gpointer obj, const gchar *filename, gint linenum); void mcd_debug_unref (gpointer obj, const gchar *filename, gint linenum); diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c index a137d500..016efd01 100644 --- a/src/mcd-dispatcher.c +++ b/src/mcd-dispatcher.c @@ -563,10 +563,11 @@ _mcd_dispatcher_handle_channel_async_cb (DBusGProxy * proxy, GError * error, { DBusGConnection *dbus_connection; GError *unique_proxy_error = NULL; + DBusGProxy *unique_name_proxy; dbus_connection = TP_PROXY (priv->dbus_daemon)->dbus_connection; - DBusGProxy *unique_name_proxy = + unique_name_proxy = dbus_g_proxy_new_for_name_owner (dbus_connection, chandler->bus_name, chandler->obj_path, @@ -634,7 +635,7 @@ _mcd_dispatcher_start_channel_handler (McdDispatcherContext * context) struct cancel_call_data *call_data; DBusGProxyCall *call; TpConnection *tp_conn; - + DBusGProxy *handler_proxy; const McdConnection *connection = mcd_dispatcher_context_get_connection (context); DBusGConnection *dbus_connection; @@ -642,7 +643,7 @@ _mcd_dispatcher_start_channel_handler (McdDispatcherContext * context) g_object_get (G_OBJECT (connection), "tp-connection", &tp_conn, NULL); - DBusGProxy *handler_proxy = dbus_g_proxy_new_for_name (dbus_connection, + handler_proxy = dbus_g_proxy_new_for_name (dbus_connection, chandler->bus_name, chandler->obj_path, "org.freedesktop.Telepathy.ChannelHandler"); @@ -1022,7 +1023,7 @@ mcd_dispatcher_class_init (McdDispatcherClass * klass) G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET (McdDispatcherClass, channel_added_signal), - NULL, NULL, mcd_marshal_VOID__OBJECT, + NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, MCD_TYPE_CHANNEL); mcd_dispatcher_signals[CHANNEL_REMOVED] = @@ -1031,7 +1032,7 @@ mcd_dispatcher_class_init (McdDispatcherClass * klass) G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET (McdDispatcherClass, channel_removed_signal), - NULL, NULL, mcd_marshal_VOID__OBJECT, + NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, MCD_TYPE_CHANNEL); mcd_dispatcher_signals[DISPATCHED] = @@ -1040,7 +1041,7 @@ mcd_dispatcher_class_init (McdDispatcherClass * klass) G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET (McdDispatcherClass, dispatched_signal), - NULL, NULL, mcd_marshal_VOID__OBJECT, + NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, MCD_TYPE_CHANNEL); mcd_dispatcher_signals[DISPATCH_FAILED] = @@ -1049,7 +1050,7 @@ mcd_dispatcher_class_init (McdDispatcherClass * klass) G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET (McdDispatcherClass, dispatch_failed_signal), - NULL, NULL, mcd_marshal_VOID__OBJECT_POINTER, + NULL, NULL, _mcd_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2, MCD_TYPE_CHANNEL, G_TYPE_POINTER); /* Properties */ diff --git a/src/mcd-manager.c b/src/mcd-manager.c index 9f907fdc..9dc7216d 100644 --- a/src/mcd-manager.c +++ b/src/mcd-manager.c @@ -33,18 +33,21 @@ * FIXME */ -#include <string.h> +#define _POSIX_C_SOURCE 200112L /* for strtok_r() */ +#include "config.h" +#include "mcd-manager.h" + #include <stdio.h> +#include <string.h> + #include <glib/gi18n.h> -#include <config.h> +#include <telepathy-glib/connection-manager.h> #include <telepathy-glib/dbus.h> #include <telepathy-glib/interfaces.h> -#include <telepathy-glib/connection-manager.h> #include <libmcclient/mc-errors.h> #include "mcd-connection.h" -#include "mcd-manager.h" #define MANAGER_SUFFIX ".manager" @@ -79,7 +82,7 @@ enum }; static const gchar** -_mc_manager_get_dirs () +_mc_manager_get_dirs (void) { GSList *dir_list = NULL, *slist; const gchar *dirname; @@ -339,7 +342,7 @@ _mcd_manager_finalize (GObject * object) McdManagerPrivate *priv = MCD_MANAGER_PRIV (object); McdProtocolParam *param; McdProtocol *protocol; - gint i, j; + guint i, j; for (i = 0; i < priv->protocols->len; i++) { @@ -767,7 +770,7 @@ mcd_manager_get_parameters (McdManager *manager, const gchar *protocol) { McdManagerPrivate *priv = manager->priv; McdProtocol *proto; - gint i; + guint i; for (i = 0; i < priv->protocols->len; i++) { diff --git a/src/mcd-master.c b/src/mcd-master.c index 9035545b..68c8c765 100644 --- a/src/mcd-master.c +++ b/src/mcd-master.c @@ -227,7 +227,8 @@ static void mcd_master_connect_automatic_accounts (McdMaster *master) { McdMasterPrivate *priv = MCD_MASTER_PRIV (master); - gint i; + guint i; + for (i = 0; i < priv->transport_plugins->len; i++) { McdTransportPlugin *plugin; @@ -269,7 +270,7 @@ mcd_master_unload_plugins (McdMaster *master) { McdMasterPrivate *priv = MCD_MASTER_PRIV (master); GModule *module; - gint i; + guint i; for (i = 0; i < priv->plugins->len; i++) { @@ -518,7 +519,8 @@ _mcd_master_dispose (GObject * object) if (priv->transport_plugins) { - gint i; + guint i; + for (i = 0; i < priv->transport_plugins->len; i++) { McdTransportPlugin *plugin; @@ -842,7 +844,7 @@ mcd_master_get_online_connection_names (McdMaster * master, if (names->len != 0) { - int i; + guint i; /* Copy the collected names to the array of strings */ *connected_names = diff --git a/src/mcd-operation.c b/src/mcd-operation.c index d0bfbe44..9d831fea 100644 --- a/src/mcd-operation.c +++ b/src/mcd-operation.c @@ -303,18 +303,21 @@ mcd_operation_remove_mission (McdOperation * operation, McdMission * mission) const GList * mcd_operation_get_missions (McdOperation * operation) { + McdOperationPrivate *priv; + g_return_val_if_fail (MCD_IS_OPERATION (operation), NULL); + priv = MCD_OPERATION_PRIV (operation); - McdOperationPrivate *priv = MCD_OPERATION_PRIV (operation); return priv->missions; } void mcd_operation_foreach (McdOperation * operation, GFunc func, gpointer user_data) { - g_return_if_fail (MCD_IS_OPERATION (operation)); + McdOperationPrivate *priv; - McdOperationPrivate *priv = MCD_OPERATION_PRIV (operation); + g_return_if_fail (MCD_IS_OPERATION (operation)); + priv = MCD_OPERATION_PRIV (operation); g_list_foreach (priv->missions, (GFunc) func, user_data); } diff --git a/src/mcd-presence-frame.c b/src/mcd-presence-frame.c index 62458a3c..b8d15628 100644 --- a/src/mcd-presence-frame.c +++ b/src/mcd-presence-frame.c @@ -247,7 +247,7 @@ mcd_presence_frame_class_init (McdPresenceFrameClass * klass) G_STRUCT_OFFSET (McdPresenceFrameClass, presence_requested_signal), NULL, NULL, - mcd_marshal_VOID__INT_STRING, + _mcd_marshal_VOID__INT_STRING, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING); mcd_presence_frame_signals[PRESENCE_CHANGED] = g_signal_new ("presence-changed", @@ -256,7 +256,7 @@ mcd_presence_frame_class_init (McdPresenceFrameClass * klass) G_STRUCT_OFFSET (McdPresenceFrameClass, presence_set_signal), NULL, NULL, - mcd_marshal_VOID__OBJECT_INT_STRING, + _mcd_marshal_VOID__OBJECT_INT_STRING, G_TYPE_NONE, 3, MCD_TYPE_ACCOUNT, G_TYPE_INT, G_TYPE_STRING); mcd_presence_frame_signals[STATUS_CHANGED] = g_signal_new ("status-changed", @@ -265,7 +265,7 @@ mcd_presence_frame_class_init (McdPresenceFrameClass * klass) G_STRUCT_OFFSET (McdPresenceFrameClass, status_changed_signal), NULL, NULL, - mcd_marshal_VOID__OBJECT_INT_INT, + _mcd_marshal_VOID__OBJECT_INT_INT, G_TYPE_NONE, 3, MCD_TYPE_ACCOUNT, G_TYPE_INT, G_TYPE_INT); mcd_presence_frame_signals[PRESENCE_ACTUAL] = g_signal_new ("presence-actual", @@ -274,7 +274,7 @@ mcd_presence_frame_class_init (McdPresenceFrameClass * klass) G_STRUCT_OFFSET (McdPresenceFrameClass, presence_actual_signal), NULL, NULL, - mcd_marshal_VOID__INT_STRING, + _mcd_marshal_VOID__INT_STRING, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING); mcd_presence_frame_signals[STATUS_ACTUAL] = g_signal_new ("status-actual", @@ -282,7 +282,7 @@ mcd_presence_frame_class_init (McdPresenceFrameClass * klass) G_SIGNAL_RUN_FIRST, 0, NULL, NULL, - mcd_marshal_VOID__INT, + g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); } diff --git a/src/mcd-service.c b/src/mcd-service.c index 008c44e2..c966733a 100644 --- a/src/mcd-service.c +++ b/src/mcd-service.c @@ -484,7 +484,7 @@ mcd_service_register_filter(GObject *obj, if (!initialized) { - dbus_g_object_register_marshaller (mcd_marshal_VOID__UINT_BOOLEAN, + dbus_g_object_register_marshaller (_mcd_marshal_VOID__UINT_BOOLEAN, G_TYPE_NONE, G_TYPE_UINT, G_TYPE_BOOLEAN, @@ -891,7 +891,7 @@ mcd_service_class_init (McdServiceClass * self) G_OBJECT_CLASS_TYPE (self), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__UINT_UINT_UINT_STRING, + NULL, NULL, _mcd_marshal_VOID__UINT_UINT_UINT_STRING, G_TYPE_NONE, 4, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING); #ifndef NO_NEW_PRESENCE_SIGNALS @@ -901,7 +901,7 @@ mcd_service_class_init (McdServiceClass * self) G_OBJECT_CLASS_TYPE (self), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__UINT_UINT_UINT_STRING, + NULL, NULL, _mcd_marshal_VOID__UINT_UINT_UINT_STRING, G_TYPE_NONE, 5, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING); #endif @@ -911,14 +911,14 @@ mcd_service_class_init (McdServiceClass * self) G_OBJECT_CLASS_TYPE (self), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__UINT_STRING_UINT, G_TYPE_NONE, + NULL, NULL, _mcd_marshal_VOID__UINT_STRING_UINT, G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_UINT); /* PresenceStatusRequested signal */ g_signal_new ("presence-status-requested", G_OBJECT_CLASS_TYPE (self), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__UINT, + NULL, NULL, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); #ifndef NO_NEW_PRESENCE_SIGNALS /* PresenceRequested signal */ @@ -926,7 +926,7 @@ mcd_service_class_init (McdServiceClass * self) G_OBJECT_CLASS_TYPE (self), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__UINT, + NULL, NULL, _mcd_marshal_VOID__UINT_STRING, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING); #endif /* PresenceStatusActual signal */ @@ -934,7 +934,7 @@ mcd_service_class_init (McdServiceClass * self) G_OBJECT_CLASS_TYPE (self), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__UINT, + NULL, NULL, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); #ifndef NO_NEW_PRESENCE_SIGNALS /* PresenceChanged signal */ @@ -942,7 +942,7 @@ mcd_service_class_init (McdServiceClass * self) G_OBJECT_CLASS_TYPE (self), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__UINT, + NULL, NULL, _mcd_marshal_VOID__UINT_STRING, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING); #endif /* UsedChannelsCountChanged signal */ @@ -951,7 +951,7 @@ mcd_service_class_init (McdServiceClass * self) G_OBJECT_CLASS_TYPE (self), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__STRING_UINT, + NULL, NULL, _mcd_marshal_VOID__STRING_UINT, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_UINT); /* StatusActual signal */ signals[STATUS_ACTUAL] = @@ -959,7 +959,7 @@ mcd_service_class_init (McdServiceClass * self) G_OBJECT_CLASS_TYPE (self), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, - NULL, NULL, mcd_marshal_VOID__UINT_UINT, + NULL, NULL, _mcd_marshal_VOID__UINT_UINT, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (self), @@ -980,15 +980,3 @@ mcd_service_run (McdService * self) g_main_loop_run (self->main_loop); } -/* FIXME: This is defined twice. The other definition is in - * libmissioncontrol/mission-control.c - */ -GQuark -mission_control_error_quark (void) -{ - static GQuark quark = 0; - if (quark == 0) - quark = g_quark_from_static_string ("mission-control-quark"); - return quark; -} - diff --git a/src/mcd-signals-marshal.list b/src/mcd-signals-marshal.list index dfbac344..91838dcd 100644 --- a/src/mcd-signals-marshal.list +++ b/src/mcd-signals-marshal.list @@ -1,18 +1,15 @@ VOID:UINT,UINT,UINT,STRING VOID:UINT,STRING,UINT VOID:STRING,UINT -VOID:UINT +VOID:UINT,STRING VOID:UINT,UINT VOID:OBJECT,ENUM,STRING VOID:ENUM,STRING VOID:OBJECT,ENUM,ENUM VOID:INT,STRING -VOID:INT VOID:OBJECT,INT,STRING VOID:OBJECT,INT,INT -VOID:OBJECT VOID:OBJECT,POINTER -VOID:BOOLEAN VOID:UINT,BOOLEAN VOID:UINT,STRING,STRING VOID:BOXED,STRING diff --git a/src/mcd-transport.c b/src/mcd-transport.c index 5081258b..d93ea620 100644 --- a/src/mcd-transport.c +++ b/src/mcd-transport.c @@ -71,7 +71,7 @@ mcd_transport_plugin_base_init (gpointer iface) G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (McdTransportPluginIface, status_changed), NULL, NULL, - mcd_marshal_VOID__POINTER_UINT, + _mcd_marshal_VOID__POINTER_UINT, G_TYPE_NONE, 2, G_TYPE_POINTER, MCD_TYPE_TRANSPORT_STATUS); initialized = TRUE; diff --git a/test/Makefile.am b/test/Makefile.am index 90e19728..4a04ab02 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -5,8 +5,8 @@ INCLUDES = $(DBUS_CFLAGS) $(TELEPATHY_CFLAGS) -I$(top_srcdir) \ if HAVE_TESTS -bin_PROGRAMS = mc-client +noinst_PROGRAMS = mc-client mc_client_SOURCES = mc-client.c -mc_client_LDADD = $(top_srcdir)/libmissioncontrol/libmissioncontrol-client.la +mc_client_LDADD = $(top_builddir)/libmissioncontrol/libmissioncontrol-client.la endif diff --git a/test/mc-client.c b/test/mc-client.c index 42dac402..28da27c2 100644 --- a/test/mc-client.c +++ b/test/mc-client.c @@ -57,7 +57,8 @@ static void mc_callback (MissionControl *mc, GError *error, gpointer data) g_debug ("%s: data is %p", G_STRFUNC, data); } -int main () +int +main (int argc, char **argv) { MissionControl *mc; DBusGConnection *dbus_conn = NULL; diff --git a/util/mc-account-convert.c b/util/mc-account-convert.c index 137af2ec..4e37f3e3 100644 --- a/util/mc-account-convert.c +++ b/util/mc-account-convert.c @@ -111,7 +111,7 @@ gc_dup_string (const GConfValue *value) } static const gchar** -_mc_manager_get_dirs () +_mc_manager_get_dirs (void) { GSList *dir_list = NULL, *slist; const gchar *dirname; @@ -182,7 +182,7 @@ _mc_manager_filename (const gchar *unique_name) } static const gchar** -_mc_profile_get_dirs () +_mc_profile_get_dirs (void) { GSList *dir_list = NULL, *slist; const gchar *dirname; @@ -257,7 +257,7 @@ account_key (const gchar *account, const gchar *key) { static gchar buffer[2048]; - snprintf (buffer, sizeof (buffer), "%s/%s/%s", MC_ACCOUNTS_GCONF_BASE, account, key); + g_snprintf (buffer, sizeof (buffer), "%s/%s/%s", MC_ACCOUNTS_GCONF_BASE, account, key); return buffer; } @@ -301,7 +301,7 @@ read_gconf_data (AccountInfo *ai, const gchar *unique_name) ParamValue pv; gint len; - len = snprintf (dir, sizeof (dir), "%s/%s", MC_ACCOUNTS_GCONF_BASE, unique_name); + len = g_snprintf (dir, sizeof (dir), "%s/%s", MC_ACCOUNTS_GCONF_BASE, unique_name); len++; entries = gconf_client_all_entries (client, dir, NULL); for (list = entries; list != NULL; list = list->next) @@ -366,11 +366,11 @@ read_gconf_data (AccountInfo *ai, const gchar *unique_name) { GError *error = NULL; gchar *data; - gsize len; - if (g_file_get_contents (avatar_filename, &data, &len, &error)) + gsize avatar_len; + if (g_file_get_contents (avatar_filename, &data, &avatar_len, &error)) { ai->avatar.data = (gchar *)data; - ai->avatar.len = len; + ai->avatar.len = avatar_len; } else { @@ -392,7 +392,7 @@ parse_profile_param (AccountInfo *ai, GKeyFile *profile, const gchar *key) /* read the parameter signature from the manager file */ /* key + 8, to skip the "Default-" */ - snprintf (param_str, sizeof (param_str), "param-%s", key + 8); + g_snprintf (param_str, sizeof (param_str), "param-%s", key + 8); param_info = g_key_file_get_string (ai->manager_cfg, ai->protocol_grp, param_str, NULL); if (!param_info) return FALSE; signature = param_info[0]; @@ -557,6 +557,8 @@ create_account_cb (TpProxy *proxy, const gchar *obj_path, const GError *error, if (ai->avatar.data && ai->avatar_mime) { + GValueArray *va; + type = dbus_g_type_get_struct ("GValueArray", dbus_g_type_get_collection ("GArray", G_TYPE_UCHAR), @@ -564,7 +566,7 @@ create_account_cb (TpProxy *proxy, const gchar *obj_path, const GError *error, G_TYPE_INVALID); g_value_init (&value, type); g_value_take_boxed (&value, dbus_g_type_specialized_construct (type)); - GValueArray *va = (GValueArray *) g_value_get_boxed (&value); + va = (GValueArray *) g_value_get_boxed (&value); g_value_set_static_boxed (va->values, &ai->avatar); g_value_set_static_string (va->values + 1, ai->avatar_mime); ok = set_account_prop (account, @@ -718,7 +720,8 @@ convert_accounts (McAccountManager *am) return FALSE; } -int main () +int +main (int argc, char **argv) { McAccountManager *am; DBusGConnection *dbus_conn; |