diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | INSTALL | 370 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | telepathy-account-widgets-uninstalled.pc.in | 2 | ||||
-rw-r--r-- | tp-account-widgets/Makefile.am | 6 | ||||
-rw-r--r-- | tp-account-widgets/tpaw-account-settings.c | 25 | ||||
-rw-r--r-- | tp-account-widgets/tpaw-account-widget.c | 2 | ||||
-rw-r--r-- | tp-account-widgets/tpaw-avatar-chooser.c | 93 | ||||
-rw-r--r-- | tp-account-widgets/tpaw-connection-managers.c | 15 | ||||
-rw-r--r-- | tp-account-widgets/tpaw-pixbuf-utils.c | 6 | ||||
-rw-r--r-- | tp-account-widgets/tpaw-pixbuf-utils.h | 4 | ||||
-rw-r--r-- | tp-account-widgets/tpaw-protocol.c | 2 | ||||
-rw-r--r-- | tp-account-widgets/tpaw-user-info.c | 2 | ||||
-rw-r--r-- | tp-account-widgets/tpaw-utils.c | 5 |
14 files changed, 95 insertions, 447 deletions
@@ -43,5 +43,6 @@ tags TAGS ABOUT-NLS config.rpath +/INSTALL telepathy-account-widgets-uninstalled.pc diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 007e9396..00000000 --- a/INSTALL +++ /dev/null @@ -1,370 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, -Inc. - - Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without warranty of any kind. - -Basic Installation -================== - - Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. Some packages provide this -`INSTALL' file but do not implement all of the features documented -below. The lack of an optional feature in a given package is not -necessarily a bug. More recommendations for GNU packages can be found -in *note Makefile Conventions: (standards)Makefile Conventions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - - The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package, generally using the just-built uninstalled binaries. - - 4. Type `make install' to install the programs and any data files and - documentation. When installing into a prefix owned by root, it is - recommended that the package be configured and built as a regular - user, and only the `make install' phase executed with root - privileges. - - 5. Optionally, type `make installcheck' to repeat any self-tests, but - this time using the binaries in their final installed location. - This target does not install anything. Running this target as a - regular user, particularly if the prior `make install' required - root privileges, verifies that the installation completed - correctly. - - 6. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - - 7. Often, you can also type `make uninstall' to remove the installed - files again. In practice, not all packages have tested that - uninstallation works correctly, even though it is required by the - GNU Coding Standards. - - 8. Some packages, particularly those that use Automake, provide `make - distcheck', which can by used by developers to test that all other - targets like `make install' and `make uninstall' work correctly. - This target is generally not run by end users. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. This -is known as a "VPATH" build. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - - On MacOS X 10.5 and later systems, you can create libraries and -executables that work on multiple system types--known as "fat" or -"universal" binaries--by specifying multiple `-arch' options to the -compiler but only a single `-arch' option to the preprocessor. Like -this: - - ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CPP="gcc -E" CXXCPP="g++ -E" - - This is not guaranteed to produce working output in all cases, you -may have to build one architecture at a time and combine the results -using the `lipo' tool if you have problems. - -Installation Names -================== - - By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX', where PREFIX must be an -absolute file name. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. In general, the -default for these options is expressed in terms of `${prefix}', so that -specifying just `--prefix' will affect all of the other directory -specifications that were not explicitly provided. - - The most portable way to affect installation locations is to pass the -correct locations to `configure'; however, many packages provide one or -both of the following shortcuts of passing variable assignments to the -`make install' command line to change installation locations without -having to reconfigure or recompile. - - The first method involves providing an override variable for each -affected directory. For example, `make install -prefix=/alternate/directory' will choose an alternate location for all -directory configuration variables that were expressed in terms of -`${prefix}'. Any directories that were specified during `configure', -but not in terms of `${prefix}', must each be overridden at install -time for the entire installation to be relocated. The approach of -makefile variable overrides for each directory variable is required by -the GNU Coding Standards, and ideally causes no recompilation. -However, some platforms have known limitations with the semantics of -shared libraries that end up requiring recompilation when using this -method, particularly noticeable in packages that use GNU Libtool. - - The second method involves providing the `DESTDIR' variable. For -example, `make install DESTDIR=/alternate/directory' will prepend -`/alternate/directory' before all installation names. The approach of -`DESTDIR' overrides is not required by the GNU Coding Standards, and -does not work on platforms that have drive letters. On the other hand, -it does better at avoiding recompilation issues, and works well even -when some directory options were not specified in terms of `${prefix}' -at `configure' time. - -Optional Features -================= - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - - Some packages offer the ability to configure how verbose the -execution of `make' will be. For these packages, running `./configure ---enable-silent-rules' sets the default to minimal output, which can be -overridden with `make V=1'; while running `./configure ---disable-silent-rules' sets the default to verbose, which can be -overridden with `make V=0'. - -Particular systems -================== - - On HP-UX, the default C compiler is not ANSI C compatible. If GNU -CC is not installed, it is recommended to use the following options in -order to use an ANSI C compiler: - - ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" - -and if that doesn't work, install pre-built binaries of GCC for HP-UX. - - HP-UX `make' updates targets which have the same time stamps as -their prerequisites, which makes it generally unusable when shipped -generated files such as `configure' are involved. Use GNU `make' -instead. - - On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot -parse its `<wchar.h>' header file. The option `-nodtk' can be used as -a workaround. If GNU CC is not installed, it is therefore recommended -to try - - ./configure CC="cc" - -and if that doesn't work, try - - ./configure CC="cc -nodtk" - - On Solaris, don't put `/usr/ucb' early in your `PATH'. This -directory contains several dysfunctional programs; working variants of -these programs are available in `/usr/bin'. So, if you need `/usr/ucb' -in your `PATH', put it _after_ `/usr/bin'. - - On Haiku, software installed for all users goes in `/boot/common', -not `/usr/local'. It is recommended to use the following options: - - ./configure --prefix=/boot/common - -Specifying the System Type -========================== - - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS - KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - - Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf limitation. Until the limitation is lifted, you can use -this workaround: - - CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - - `configure' recognizes the following options to control how it -operates. - -`--help' -`-h' - Print a summary of all of the options to `configure', and exit. - -`--help=short' -`--help=recursive' - Print a summary of the options unique to this package's - `configure', and exit. The `short' variant lists options used - only in the top level, while the `recursive' variant lists options - also present in any nested packages. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--prefix=DIR' - Use DIR as the installation prefix. *note Installation Names:: - for more details, including other options available for fine-tuning - the installation locations. - -`--no-create' -`-n' - Run the configure checks, but stop before creating any output - files. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. diff --git a/configure.ac b/configure.ac index 7a5b070d..bd267099 100644 --- a/configure.ac +++ b/configure.ac @@ -19,9 +19,9 @@ GTK_REQUIRED=3.5.1 AC_DEFINE(GDK_VERSION_MIN_REQUIRED, GDK_VERSION_3_4, [Ignore post 3.4 deprecations]) AC_DEFINE(GDK_VERSION_MAX_ALLOWED, GDK_VERSION_3_4, [Prevent post 3.4 APIs]) -TELEPATHY_GLIB_REQUIRED=0.22.0 -AC_DEFINE(TP_VERSION_MIN_REQUIRED, TP_VERSION_0_22, [Ignore post 0.22 deprecations]) -AC_DEFINE(TP_VERSION_MAX_ALLOWED, TP_VERSION_0_22, [Prevent post 0.22 APIs]) +TELEPATHY_GLIB_REQUIRED=0.99.1 +AC_DEFINE(TP_VERSION_MIN_REQUIRED, TP_VERSION_1_0, [Ignore post 1.0 deprecations]) +AC_DEFINE(TP_VERSION_MAX_ALLOWED, TP_VERSION_1_0, [Prevent post 1.0 APIs]) AC_DEFINE(TP_SEAL_ENABLE, 1, [Prevent to use sealed variables]) AC_DEFINE(TP_DISABLE_SINGLE_INCLUDE, 1, [Disable single include header]) @@ -185,7 +185,8 @@ PKG_CHECK_MODULES(TPAW, libsecret-1 >= $LIBSECRET_REQUIRED gobject-2.0 libxml-2.0 - telepathy-glib >= $TELEPATHY_GLIB_REQUIRED + telepathy-glib-1 >= $TELEPATHY_GLIB_REQUIRED + telepathy-glib-1-dbus >= $TELEPATHY_GLIB_REQUIRED x11 gtk+-3.0 >= $GTK_REQUIRED ]) diff --git a/telepathy-account-widgets-uninstalled.pc.in b/telepathy-account-widgets-uninstalled.pc.in index 1acc1fc1..e91f8c55 100644 --- a/telepathy-account-widgets-uninstalled.pc.in +++ b/telepathy-account-widgets-uninstalled.pc.in @@ -8,6 +8,6 @@ uoa_provider=@TPAW_UOA_PROVIDER@ Name: telepathy-account-widgets (uninstalled copy) Description: Widgets and utility functions for configuring Telepathy accounts Version: @VERSION@ -Requires: pkg-config >= 0.21, glib-2.0 >= 2.33.3, gobject-2.0 >= 2.33.3, gtk+-3.0 >= 3.5.1, telepathy-glib >= 0.19.9, libxml-2.0, libsecret-1 >= 0.5@REQUIRE_CHEESE@@REQUIRE_UDEV@ +Requires: pkg-config >= 0.21, glib-2.0 >= 2.33.3, gobject-2.0 >= 2.33.3, gtk+-3.0 >= 3.5.1, telepathy-glib-1 >= 0.99.1, telepathy-glib-1-dbus >= 0.99.1, libxml-2.0, libsecret-1 >= 0.5 Libs: ${abs_top_builddir}/tp-account-widgets/libtp-account-widgets.la Cflags: -I${abs_top_srcdir} -I${abs_top_builddir} diff --git a/tp-account-widgets/Makefile.am b/tp-account-widgets/Makefile.am index ff60c4ac..fade6d9e 100644 --- a/tp-account-widgets/Makefile.am +++ b/tp-account-widgets/Makefile.am @@ -90,6 +90,12 @@ libtp_account_widgets_la_SOURCES = \ $(nocheck_sources) \ $(NULL) +libtp_account_widgets_la_LIBADD = \ + $(TPAW_LIBS) \ + $(UDEV_LIBS) \ + $(CHEESE_LIBS) \ + $(NULL) + # these are sources that depend on Ubuntu Online Accounts uoa_sources = \ tpaw-uoa-utils.c \ diff --git a/tp-account-widgets/tpaw-account-settings.c b/tp-account-widgets/tpaw-account-settings.c index e0d2a128..4c1fdc42 100644 --- a/tp-account-widgets/tpaw-account-settings.c +++ b/tp-account-widgets/tpaw-account-settings.c @@ -499,7 +499,7 @@ tpaw_account_settings_check_readyness (TpawAccountSettings *self) if (self->priv->protocol_obj == NULL) { self->priv->protocol_obj = g_object_ref ( - tp_connection_manager_get_protocol_object (self->priv->manager, + tp_connection_manager_get_protocol (self->priv->manager, self->priv->protocol)); } @@ -516,7 +516,7 @@ tpaw_account_settings_check_readyness (TpawAccountSettings *self) { if (tp_strv_contains (tp_protocol_get_authentication_types ( self->priv->protocol_obj), - TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION)) + TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION1)) { self->priv->supports_sasl = TRUE; } @@ -772,8 +772,7 @@ tpaw_account_settings_dup (TpawAccountSettings *settings, { GVariant *parameters; - parameters = tp_account_dup_parameters_vardict ( - settings->priv->account); + parameters = tp_account_dup_parameters (settings->priv->account); result = g_variant_lookup_value (parameters, param, NULL); g_variant_unref (parameters); @@ -1277,7 +1276,7 @@ tpaw_account_settings_account_updated (GObject *source, GError *error = NULL; GStrv reconnect_required = NULL; - if (!tp_account_update_parameters_vardict_finish (TP_ACCOUNT (source), + if (!tp_account_update_parameters_finish (TP_ACCOUNT (source), result, &reconnect_required, &error)) { g_simple_async_result_set_from_error (settings->priv->apply_result, @@ -1462,7 +1461,7 @@ tpaw_account_settings_apply_async (TpawAccountSettings *settings, } else { - tp_account_update_parameters_vardict_async (settings->priv->account, + tp_account_update_parameters_async (settings->priv->account, build_parameters_variant (settings), (const gchar **) settings->priv->unset_parameters->data, tpaw_account_settings_account_updated, settings); @@ -1549,12 +1548,16 @@ tpaw_account_settings_parameter_is_valid ( if (settings->priv->account != NULL && !tpaw_account_settings_is_unset (settings, param)) { - const GHashTable *account_params; + GVariant *account_params; - account_params = tp_account_get_parameters ( - settings->priv->account); - if (tp_asv_lookup (account_params, param)) - goto test_regex; + account_params = tp_account_dup_parameters (settings->priv->account); + + if (tp_vardict_has_key (account_params, param)) + { + g_variant_unref (account_params); + goto test_regex; + } + g_variant_unref (account_params); } return FALSE; diff --git a/tp-account-widgets/tpaw-account-widget.c b/tp-account-widgets/tpaw-account-widget.c index f4e3cd72..464f5102 100644 --- a/tp-account-widgets/tpaw-account-widget.c +++ b/tp-account-widgets/tpaw-account-widget.c @@ -1795,7 +1795,7 @@ do_constructed (GObject *obj) const char *file; GtkWidget * (*func)(TpawAccountWidget *self, const gchar *filename); } widgets [] = { - { "salut", "local-xmpp", TPAW_ACCOUNT_WIDGETS_RESOURCES_PREFIX "/tpaw-account-widget-local-xmpp.ui", + { "salut", "local_xmpp", TPAW_ACCOUNT_WIDGETS_RESOURCES_PREFIX "/tpaw-account-widget-local-xmpp.ui", account_widget_build_salut }, WIDGET (gabble, jabber), WIDGET (haze, msn), diff --git a/tp-account-widgets/tpaw-avatar-chooser.c b/tp-account-widgets/tpaw-avatar-chooser.c index c2f34221..b6959198 100644 --- a/tp-account-widgets/tpaw-avatar-chooser.c +++ b/tp-account-widgets/tpaw-avatar-chooser.c @@ -75,7 +75,7 @@ struct _TpawAvatarChooserPrivate { TpAccount *account; - GArray *avatar; + GBytes *avatar; gchar *mime_type; gboolean changed; @@ -112,7 +112,7 @@ static const GtkTargetEntry drop_types[] = }; static void avatar_chooser_set_image (TpawAvatarChooser *self, - GArray *avatar, + GBytes *avatar, gchar *mime_type, GdkPixbuf *pixbuf, gboolean maybe_convert); @@ -125,7 +125,8 @@ get_avatar_cb (GObject *source, { TpWeakRef *wr = user_data; TpawAvatarChooser *self = tp_weak_ref_dup_object (wr); - const GArray *avatar; + GBytes *avatar; + gsize len; GdkPixbuf *pixbuf; gchar *mime_type; GError *error = NULL; @@ -136,7 +137,8 @@ get_avatar_cb (GObject *source, return; } - avatar = tp_account_get_avatar_finish (self->priv->account, result, &error); + avatar = tp_account_dup_avatar_finish (self->priv->account, result, NULL, + &error); if (avatar == NULL) { DEBUG ("Error getting account's avatar: %s", error->message); @@ -144,21 +146,23 @@ get_avatar_cb (GObject *source, goto out; } - if (avatar->len == 0) + len = g_bytes_get_size (avatar); + + if (len == 0) { avatar_chooser_clear_image (self); goto out; } - pixbuf = tpaw_pixbuf_from_data_and_mime ((gchar *) avatar->data, - avatar->len, &mime_type); + pixbuf = tpaw_pixbuf_from_data_and_mime (g_bytes_get_data (avatar, NULL), + len, &mime_type); if (pixbuf == NULL) { DEBUG ("couldn't make a pixbuf from avatar; giving up"); goto out; } - avatar_chooser_set_image (self, (GArray *) avatar, mime_type, pixbuf, FALSE); + avatar_chooser_set_image (self, avatar, mime_type, pixbuf, FALSE); g_free (mime_type); self->priv->changed = FALSE; @@ -175,7 +179,7 @@ avatar_changed_cb (TpAccount *account, { TpawAvatarChooser *self = (TpawAvatarChooser *) weak_object; - tp_account_get_avatar_async (self->priv->account, + tp_account_dup_avatar_async (self->priv->account, NULL, get_avatar_cb, tp_weak_ref_new (self, NULL, NULL)); } @@ -186,12 +190,12 @@ avatar_chooser_constructed (GObject *object) G_OBJECT_CLASS (tpaw_avatar_chooser_parent_class)->constructed (object); - tp_account_get_avatar_async (self->priv->account, + tp_account_dup_avatar_async (self->priv->account, NULL, get_avatar_cb, tp_weak_ref_new (self, NULL, NULL)); /* FIXME: no signal on TpAccount, yet. * See https://bugs.freedesktop.org/show_bug.cgi?id=52938 */ - tp_cli_account_interface_avatar_connect_to_avatar_changed ( + tp_cli_account_interface_avatar1_connect_to_avatar_changed ( self->priv->account, avatar_changed_cb, NULL, NULL, (GObject *) self, NULL); } @@ -256,7 +260,7 @@ avatar_chooser_dispose (GObject *object) TpawAvatarChooser *self = (TpawAvatarChooser *) object; tp_clear_object (&self->priv->account); - tp_clear_pointer (&self->priv->avatar, g_array_unref); + tp_clear_pointer (&self->priv->avatar, g_bytes_unref); tp_clear_pointer (&self->priv->mime_type, g_free); #ifdef ENABLE_SETTINGS tp_clear_object (&self->priv->gsettings_ui); @@ -387,7 +391,7 @@ avatar_chooser_clear_image (TpawAvatarChooser *self) { GtkWidget *image; - tp_clear_pointer (&self->priv->avatar, g_array_unref); + tp_clear_pointer (&self->priv->avatar, g_bytes_unref); tp_clear_pointer (&self->priv->mime_type, g_free); self->priv->changed = TRUE; @@ -533,9 +537,9 @@ get_requirements (TpawAvatarChooser *self) static gboolean avatar_chooser_maybe_convert_and_scale (TpawAvatarChooser *self, GdkPixbuf *pixbuf, - GArray *avatar, + GBytes *avatar, gchar *mime_type, - GArray **ret_avatar, + GBytes **ret_avatar, gchar **ret_mime_type) { TpAvatarRequirements *req; @@ -604,12 +608,13 @@ avatar_chooser_maybe_convert_and_scale (TpawAvatarChooser *self, /* If the data len is too big and no other conversion is needed, * try with a lower factor. */ - if (req->maximum_bytes > 0 && avatar->len > req->maximum_bytes && + if (req->maximum_bytes > 0 && + g_bytes_get_size (avatar) > req->maximum_bytes && !needs_conversion) { - DEBUG ("Image data (%u bytes) is too big " + DEBUG ("Image data (%" G_GSIZE_FORMAT " bytes) is too big " "(max is %u bytes), conversion needed.", - avatar->len, req->maximum_bytes); + g_bytes_get_size (avatar), req->maximum_bytes); factor = 0.5; needs_conversion = TRUE; @@ -618,7 +623,7 @@ avatar_chooser_maybe_convert_and_scale (TpawAvatarChooser *self, /* If no conversion is needed, return the avatar */ if (!needs_conversion) { - *ret_avatar = g_array_ref (avatar); + *ret_avatar = g_bytes_ref (avatar); *ret_mime_type = g_strdup (mime_type); return TRUE; } @@ -714,12 +719,7 @@ avatar_chooser_maybe_convert_and_scale (TpawAvatarChooser *self, g_free (new_format_name); - /* FIXME: there is no way to create a GArray with zero copy? */ - *ret_avatar = g_array_sized_new (FALSE, FALSE, sizeof (gchar), - best_image_size); - g_array_append_vals (*ret_avatar, best_image_data, best_image_size); - g_free (best_image_data); - + *ret_avatar = g_bytes_new_take (best_image_data, best_image_size); *ret_mime_type = new_mime_type; return TRUE; @@ -728,7 +728,7 @@ avatar_chooser_maybe_convert_and_scale (TpawAvatarChooser *self, /* Take ownership of @pixbuf */ static void avatar_chooser_set_image (TpawAvatarChooser *self, - GArray *avatar, + GBytes *avatar, gchar *mime_type, GdkPixbuf *pixbuf, gboolean maybe_convert) @@ -741,7 +741,7 @@ avatar_chooser_set_image (TpawAvatarChooser *self, if (maybe_convert) { - GArray *conv_avatar = NULL; + GBytes *conv_avatar = NULL; gchar *conv_mime_type = NULL; if (!avatar_chooser_maybe_convert_and_scale (self, @@ -749,7 +749,7 @@ avatar_chooser_set_image (TpawAvatarChooser *self, return; /* Transfer ownership */ - tp_clear_pointer (&self->priv->avatar, g_array_unref); + g_clear_pointer (&self->priv->avatar, g_bytes_unref); self->priv->avatar = conv_avatar; g_free (self->priv->mime_type); @@ -757,8 +757,8 @@ avatar_chooser_set_image (TpawAvatarChooser *self, } else { - tp_clear_pointer (&self->priv->avatar, g_array_unref); - self->priv->avatar = g_array_ref (avatar); + tp_clear_pointer (&self->priv->avatar, g_bytes_unref); + self->priv->avatar = g_bytes_ref (avatar); g_free (self->priv->mime_type); self->priv->mime_type = g_strdup (mime_type); @@ -783,7 +783,7 @@ avatar_chooser_set_image_from_data (TpawAvatarChooser *self, gsize size) { GdkPixbuf *pixbuf; - GArray *avatar; + GBytes *avatar; gchar *mime_type = NULL; if (data == NULL) @@ -799,15 +799,11 @@ avatar_chooser_set_image_from_data (TpawAvatarChooser *self, return; } - /* FIXME: there is no way to create a GArray with zero copy? */ - avatar = g_array_sized_new (FALSE, FALSE, sizeof (gchar), size); - g_array_append_vals (avatar, data, size); + avatar = g_bytes_new_take (data, size); avatar_chooser_set_image (self, avatar, mime_type, pixbuf, TRUE); g_free (mime_type); - g_array_unref (avatar); - g_free (data); } static void @@ -933,7 +929,7 @@ avatar_chooser_set_avatar_from_pixbuf (TpawAvatarChooser *self, { gsize size; gchar *buf; - GArray *avatar; + GBytes *avatar; GError *error = NULL; if (!gdk_pixbuf_save_to_buffer (pb, &buf, &size, "png", &error, NULL)) @@ -945,14 +941,11 @@ avatar_chooser_set_avatar_from_pixbuf (TpawAvatarChooser *self, return; } - /* FIXME: there is no way to create a GArray with zero copy? */ - avatar = g_array_sized_new (FALSE, FALSE, sizeof (gchar), size); - g_array_append_vals (avatar, buf, size); + avatar = g_bytes_new_take (buf, size); avatar_chooser_set_image (self, avatar, "image/png", pb, TRUE); - g_free (buf); - g_array_unref (avatar); + g_bytes_unref (avatar); } static gboolean @@ -1237,6 +1230,8 @@ tpaw_avatar_chooser_apply_async (TpawAvatarChooser *self, gpointer user_data) { GSimpleAsyncResult *result; + gconstpointer blob; + gsize len; g_return_if_fail (TPAW_IS_AVATAR_CHOOSER (self)); @@ -1255,9 +1250,17 @@ tpaw_avatar_chooser_apply_async (TpawAvatarChooser *self, DEBUG ("%s Account.Avatar on %s", self->priv->avatar != NULL ? "Set": "Clear", tp_proxy_get_object_path (self->priv->account)); - tp_account_set_avatar_async (self->priv->account, - self->priv->avatar != NULL ? (guchar *) self->priv->avatar->data : NULL, - self->priv->avatar != NULL ? self->priv->avatar->len : 0, + if (self->priv->avatar == NULL) + { + blob = NULL; + len = 0; + } + else + { + blob = g_bytes_get_data (self->priv->avatar, &len); + } + + tp_account_set_avatar_async (self->priv->account, blob, len, self->priv->mime_type, set_avatar_cb, result); } diff --git a/tp-account-widgets/tpaw-connection-managers.c b/tp-account-widgets/tpaw-connection-managers.c index d7cd8b69..1d005344 100644 --- a/tp-account-widgets/tpaw-connection-managers.c +++ b/tp-account-widgets/tpaw-connection-managers.c @@ -53,17 +53,20 @@ struct _TpawConnectionManagersPriv GList *cms; - TpDBusDaemon *dbus; + TpClientFactory *factory; }; static void tpaw_connection_managers_init (TpawConnectionManagers *obj) { + GError *error = NULL; + obj->priv = G_TYPE_INSTANCE_GET_PRIVATE ((obj), TPAW_TYPE_CONNECTION_MANAGERS, TpawConnectionManagersPriv); - obj->priv->dbus = tp_dbus_daemon_dup (NULL); - g_assert (obj->priv->dbus != NULL); + obj->priv->factory = tp_client_factory_dup (&error); + g_assert_no_error (error); + g_assert (obj->priv->factory != NULL); tpaw_connection_managers_update (obj); @@ -163,9 +166,7 @@ tpaw_connection_managers_dispose (GObject *object) self->priv->dispose_has_run = TRUE; - if (self->priv->dbus != NULL) - g_object_unref (self->priv->dbus); - self->priv->dbus = NULL; + g_clear_object (&self->priv->factory); tpaw_connection_managers_free_cm_list (self); @@ -239,7 +240,7 @@ out: void tpaw_connection_managers_update (TpawConnectionManagers *self) { - tp_list_connection_managers_async (self->priv->dbus, + tp_list_connection_managers_async (self->priv->factory, tpaw_connection_managers_listed_cb, tp_weak_ref_new (self, NULL, NULL)); } diff --git a/tp-account-widgets/tpaw-pixbuf-utils.c b/tp-account-widgets/tpaw-pixbuf-utils.c index 1d73f53c..b90bb04f 100644 --- a/tp-account-widgets/tpaw-pixbuf-utils.c +++ b/tp-account-widgets/tpaw-pixbuf-utils.c @@ -32,14 +32,14 @@ #include "tpaw-debug.h" GdkPixbuf * -tpaw_pixbuf_from_data (gchar *data, +tpaw_pixbuf_from_data (gconstpointer data, gsize data_size) { return tpaw_pixbuf_from_data_and_mime (data, data_size, NULL); } GdkPixbuf * -tpaw_pixbuf_from_data_and_mime (gchar *data, +tpaw_pixbuf_from_data_and_mime (gconstpointer data, gsize data_size, gchar **mime_type) { @@ -53,7 +53,7 @@ tpaw_pixbuf_from_data_and_mime (gchar *data, return NULL; loader = gdk_pixbuf_loader_new (); - if (!gdk_pixbuf_loader_write (loader, (guchar *) data, data_size, &error)) + if (!gdk_pixbuf_loader_write (loader, data, data_size, &error)) { DEBUG ("Failed to write to pixbuf loader: %s", error ? error->message : "No error given"); diff --git a/tp-account-widgets/tpaw-pixbuf-utils.h b/tp-account-widgets/tpaw-pixbuf-utils.h index 0521f71a..4da42740 100644 --- a/tp-account-widgets/tpaw-pixbuf-utils.h +++ b/tp-account-widgets/tpaw-pixbuf-utils.h @@ -29,9 +29,9 @@ G_BEGIN_DECLS -GdkPixbuf * tpaw_pixbuf_from_data (gchar *data, +GdkPixbuf * tpaw_pixbuf_from_data (gconstpointer data, gsize data_size); -GdkPixbuf * tpaw_pixbuf_from_data_and_mime (gchar *data, +GdkPixbuf * tpaw_pixbuf_from_data_and_mime (gconstpointer data, gsize data_size, gchar **mime_type); GdkPixbuf * tpaw_pixbuf_scale_down_if_necessary (GdkPixbuf *pixbuf, diff --git a/tp-account-widgets/tpaw-protocol.c b/tp-account-widgets/tpaw-protocol.c index e3973771..0c13cdda 100644 --- a/tp-account-widgets/tpaw-protocol.c +++ b/tp-account-widgets/tpaw-protocol.c @@ -427,7 +427,7 @@ sort_protocol_value (const gchar *protocol_name) guint i; const gchar *names[] = { "jabber", - "local-xmpp", + "local_xmpp", "gtalk", NULL }; diff --git a/tp-account-widgets/tpaw-user-info.c b/tp-account-widgets/tpaw-user-info.c index bfb177ed..b2d6c867 100644 --- a/tp-account-widgets/tpaw-user-info.c +++ b/tp-account-widgets/tpaw-user-info.c @@ -444,7 +444,7 @@ reload_contact_info (TpawUserInfo *self) } if (!tp_proxy_has_interface_by_id (connection, - TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACT_INFO)) + TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACT_INFO1)) return; flags = tp_connection_get_contact_info_flags (connection); diff --git a/tp-account-widgets/tpaw-utils.c b/tp-account-widgets/tpaw-utils.c index 184247b6..1cbcb4c5 100644 --- a/tp-account-widgets/tpaw-utils.c +++ b/tp-account-widgets/tpaw-utils.c @@ -100,6 +100,9 @@ tpaw_protocol_icon_name (const gchar *protocol) protocol = "sip"; else if (!tp_strdiff (protocol, "sms")) return g_strdup ("phone"); + else if (!tp_strdiff (protocol, "local_xmpp")) + /* Icon names can't have '_' in their name */ + return g_strdup ("im-local-xmpp"); return g_strdup_printf ("im-%s", protocol); } @@ -115,7 +118,7 @@ tpaw_protocol_name_to_display_name (const gchar *proto_name) } names[] = { { "jabber", "Jabber", FALSE }, { "msn", "Windows Live (MSN)", FALSE, }, - { "local-xmpp", N_("People Nearby"), TRUE }, + { "local_xmpp", N_("People Nearby"), TRUE }, { "irc", "IRC", FALSE }, { "icq", "ICQ", FALSE }, { "aim", "AIM", FALSE }, |