Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libcloudproviders for openSUSE:Factory checked in at 2023-08-12 15:05:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libcloudproviders (Old) and /work/SRC/openSUSE:Factory/.libcloudproviders.new.11712 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libcloudproviders" Sat Aug 12 15:05:48 2023 rev:8 rq:1103421 version:0.3.2 Changes: -------- --- /work/SRC/openSUSE:Factory/libcloudproviders/libcloudproviders.changes 2022-12-21 16:06:27.858497449 +0100 +++ /work/SRC/openSUSE:Factory/.libcloudproviders.new.11712/libcloudproviders.changes 2023-08-12 15:05:50.994370947 +0200 @@ -1,0 +2,6 @@ +Wed Aug 9 15:53:24 UTC 2023 - Bjørn Lie <bjorn....@gmail.com> + +- Update to version 0.3.2: + + No upstream changes provided. + +------------------------------------------------------------------- Old: ---- libcloudproviders-0.3.1.tar.xz New: ---- libcloudproviders-0.3.2.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libcloudproviders.spec ++++++ --- /var/tmp/diff_new_pack.oknbNz/_old 2023-08-12 15:05:51.850376477 +0200 +++ /var/tmp/diff_new_pack.oknbNz/_new 2023-08-12 15:05:51.854376502 +0200 @@ -1,7 +1,7 @@ # # spec file for package libcloudproviders # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %define _typelibdir %(pkg-config --variable=typelibdir gobject-introspection-1.0) %define _girdir %(pkg-config --variable=girdir gobject-introspection-1.0) Name: libcloudproviders -Version: 0.3.1 +Version: 0.3.2 Release: 0 Summary: Library/Client to integrate cloud storage providers License: LGPL-3.0-or-later ++++++ libcloudproviders-0.3.1.tar.xz -> libcloudproviders-0.3.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/.editorconfig new/libcloudproviders-0.3.2/.editorconfig --- old/libcloudproviders-0.3.1/.editorconfig 1970-01-01 01:00:00.000000000 +0100 +++ new/libcloudproviders-0.3.2/.editorconfig 2023-08-09 16:36:01.000000000 +0200 @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: 2023 The libcloudproviders authors +# SPDX-License-Identifier: CC0-1.0 + +root = true + +[*] +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true + +[*.[ch]] +indent_size = 4 +indent_style = space +insert_final_newline = true + +[*.xml] +indent_size = 2 +indent_style = space + +[meson.build] +indent_size = 2 +indent_style = space \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/.gitignore new/libcloudproviders-0.3.2/.gitignore --- old/libcloudproviders-0.3.1/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/libcloudproviders-0.3.2/.gitignore 2023-08-09 16:36:01.000000000 +0200 @@ -0,0 +1,2 @@ +/build +/src/*-generated.* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/.gitlab-ci.yml new/libcloudproviders-0.3.2/.gitlab-ci.yml --- old/libcloudproviders-0.3.1/.gitlab-ci.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/libcloudproviders-0.3.2/.gitlab-ci.yml 2023-08-09 16:36:01.000000000 +0200 @@ -0,0 +1,11 @@ +image: fedora:37 +stages: + - build +before_script: + - dnf install -y gcc meson ninja-build gettext gtk-doc glib2-devel gobject-introspection-devel vala redhat-rpm-config +build-libcloudproviders: + stage: build + script: + - meson _build . + - ninja -C _build + - ninja -C _build install diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/README.md new/libcloudproviders-0.3.2/README.md --- old/libcloudproviders-0.3.1/README.md 2020-06-08 21:30:27.959037500 +0200 +++ new/libcloudproviders-0.3.2/README.md 2023-08-09 16:36:01.000000000 +0200 @@ -4,7 +4,7 @@ their services. Clients such as file managers and desktop environments can then provide integrated access to the cloud providers services. -More informantion on its uses in [this blog post](https://csorianognome.wordpress.com/2015/07/07/cloud-providers/). +More information on its uses in [this blog post](https://csorianognome.wordpress.com/2015/07/07/cloud-providers/). ## API Documentation @@ -16,4 +16,4 @@ - Nextcloud client 2.5 ### Client - GNOME Nautilus (file manager used by default in Fedora, Ubuntu, OpenSuse, Debian, RHEL, Suse..) -- Elementary OS on Juno \ No newline at end of file +- Elementary OS on Juno diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/libcloudproviders.doap new/libcloudproviders-0.3.2/libcloudproviders.doap --- old/libcloudproviders-0.3.1/libcloudproviders.doap 2020-06-08 21:30:27.959037500 +0200 +++ new/libcloudproviders-0.3.2/libcloudproviders.doap 2023-08-09 16:36:01.000000000 +0200 @@ -30,6 +30,14 @@ </foaf:Person> </maintainer> + <maintainer> + <foaf:Person> + <foaf:name>Corentin Noël</foaf:name> + <foaf:mbox rdf:resource="mailto:corentin.n...@collabora.com" /> + <gnome:userid>corentinnoel</gnome:userid> + </foaf:Person> + </maintainer> + <license rdf:resource="https://www.gnu.org/licenses/lgpl-3.0.txt" /> </Project> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/meson.build new/libcloudproviders-0.3.2/meson.build --- old/libcloudproviders-0.3.1/meson.build 2020-06-08 21:30:27.959037500 +0200 +++ new/libcloudproviders-0.3.2/meson.build 2023-08-09 16:36:01.000000000 +0200 @@ -1,6 +1,6 @@ project ('libcloudproviders', 'c', - version: '0.3.1', - meson_version: '>=0.42.0', + version: '0.3.2', + meson_version: '>=0.54.0', license: 'LGPL3+', default_options: [ 'c_std=gnu99', @@ -36,7 +36,13 @@ glib_ver = '>= 2.51.2' glib = dependency ('glib-2.0', version: glib_ver) gio = dependency ('gio-2.0', version: glib_ver) -gio_unix = dependency ('gio-unix-2.0', version: glib_ver) + +host_os = host_machine.system().to_lower() +if host_os.contains('mingw') or host_os.contains('cygwin') or host_os.contains('windows') + gio_platform = dependency ('gio-windows-2.0', version: glib_ver) +else + gio_platform = dependency ('gio-unix-2.0', version: glib_ver) +endif add_project_arguments( '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_52', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/src/cloudprovidersaccount.c new/libcloudproviders-0.3.2/src/cloudprovidersaccount.c --- old/libcloudproviders-0.3.1/src/cloudprovidersaccount.c 2020-06-08 21:30:27.960037500 +0200 +++ new/libcloudproviders-0.3.2/src/cloudprovidersaccount.c 2023-08-09 16:36:01.000000000 +0200 @@ -267,31 +267,44 @@ } static void +cloud_providers_account_dispose (GObject *object) +{ + CloudProvidersAccount *self = (CloudProvidersAccount *)object; + + g_clear_object (&self->icon); + g_clear_object (&self->action_group); + g_clear_object (&self->menu_model); + if (self->proxy) + g_signal_handlers_disconnect_by_data (self->proxy, self); + g_clear_object (&self->proxy); + g_clear_object (&self->bus); + + G_OBJECT_CLASS (cloud_providers_account_parent_class)->dispose (object); +} + +static void cloud_providers_account_finalize (GObject *object) { - CloudProvidersAccount *self = (CloudProvidersAccount *)object; + CloudProvidersAccount *self = (CloudProvidersAccount *)object; - g_signal_handlers_disconnect_by_data (self->proxy, self); - g_free (self->name); - g_free (self->path); - g_clear_object (&self->icon); - g_clear_object (&self->action_group); - g_clear_object (&self->bus); - g_clear_object (&self->proxy); - g_free (self->bus_name); - g_free (self->object_path); + g_clear_pointer (&self->name, g_free); + g_clear_pointer (&self->path, g_free); + g_clear_pointer (&self->bus_name, g_free); + g_clear_pointer (&self->object_path, g_free); + g_clear_pointer (&self->status_details, g_free); - G_OBJECT_CLASS (cloud_providers_account_parent_class)->finalize (object); + G_OBJECT_CLASS (cloud_providers_account_parent_class)->finalize (object); } static void cloud_providers_account_class_init (CloudProvidersAccountClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->set_property = cloud_providers_account_set_property; - object_class->get_property = cloud_providers_account_get_property; - object_class->finalize = cloud_providers_account_finalize; + object_class->dispose = cloud_providers_account_dispose; + object_class->finalize = cloud_providers_account_finalize; + object_class->set_property = cloud_providers_account_set_property; + object_class->get_property = cloud_providers_account_get_property; properties [PROP_NAME] = g_param_spec_string ("name", @@ -300,8 +313,6 @@ NULL, (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, PROP_NAME, - properties [PROP_NAME]); properties [PROP_PATH] = g_param_spec_string ("path", "Path", @@ -309,8 +320,6 @@ NULL, (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, PROP_PATH, - properties [PROP_PATH]); properties [PROP_STATUS] = g_param_spec_enum ("status", "Status", @@ -319,8 +328,6 @@ CLOUD_PROVIDERS_ACCOUNT_STATUS_INVALID, (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, PROP_STATUS, - properties [PROP_STATUS]); properties [PROP_STATUS_DETAILS] = g_param_spec_string ("status-details", "StatusDetails", @@ -328,8 +335,6 @@ NULL, (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, PROP_STATUS_DETAILS, - properties [PROP_STATUS_DETAILS]); properties [PROP_ICON] = g_param_spec_object ("icon", "Icon", @@ -337,8 +342,6 @@ G_TYPE_ICON, (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, PROP_ICON, - properties [PROP_ICON]); properties [PROP_MENU_MODEL] = g_param_spec_object ("menu-model", "MenuModel", @@ -346,8 +349,6 @@ G_TYPE_MENU_MODEL, (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, PROP_MENU_MODEL, - properties [PROP_MENU_MODEL]); properties [PROP_ACTION_GROUP] = g_param_spec_object ("action-group", "ActionGroup", @@ -355,10 +356,10 @@ G_TYPE_ACTION_GROUP, (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, PROP_ACTION_GROUP, - properties [PROP_ACTION_GROUP]); - + g_object_class_install_properties (object_class, + N_PROPS, + properties); } static void @@ -464,3 +465,4 @@ { return self->path; } + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/src/cloudprovidersaccount.h new/libcloudproviders-0.3.2/src/cloudprovidersaccount.h --- old/libcloudproviders-0.3.1/src/cloudprovidersaccount.h 2020-06-08 21:30:27.960037500 +0200 +++ new/libcloudproviders-0.3.2/src/cloudprovidersaccount.h 2023-08-09 16:36:01.000000000 +0200 @@ -31,7 +31,7 @@ * @CLOUD_PROVIDERS_ACCOUNT_STATUS_INVALID: Set if the initial state of the account is unknown * @CLOUD_PROVIDERS_ACCOUNT_STATUS_IDLE: Set if the account is in idle mode * @CLOUD_PROVIDERS_ACCOUNT_STATUS_SYNCING: Set if the account is currently synchronizing data - * @CLOUD_PROVIDERS_ACCOUNT_STATUS_ERROR: Set if an error occured + * @CLOUD_PROVIDERS_ACCOUNT_STATUS_ERROR: Set if an error occurred * * Enum values used to describe the sync status of a cloud providers account **/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/src/cloudprovidersaccountexporter.c new/libcloudproviders-0.3.2/src/cloudprovidersaccountexporter.c --- old/libcloudproviders-0.3.1/src/cloudprovidersaccountexporter.c 2020-06-08 21:30:27.960037500 +0200 +++ new/libcloudproviders-0.3.2/src/cloudprovidersaccountexporter.c 2023-08-09 16:36:01.000000000 +0200 @@ -32,7 +32,7 @@ gchar *bus_name; CloudProvidersDbusAccount *skeleton; - GDBusConnection *bus; + GDBusConnection *bus; // unowned, owned by the provider gchar *object_path; gchar *name; gchar *path; @@ -76,16 +76,14 @@ static void export_menu_model (CloudProvidersAccountExporter *self) { - GError *error = NULL; + g_autoptr(GError) error = NULL; - self->menu_model_export_id = g_dbus_connection_export_menu_model (self->bus, - self->object_path, - self->menu_model, - &error); - if (self->menu_model_export_id == 0) - { + self->menu_model_export_id = g_dbus_connection_export_menu_model (self->bus, + self->object_path, + self->menu_model, + &error); + if (self->menu_model_export_id == 0) g_warning ("Menu export failed: %s", error->message); - } } static void @@ -94,49 +92,55 @@ if(self->menu_model_export_id != 0) { g_dbus_connection_unexport_menu_model(self->bus, self->menu_model_export_id); + self->menu_model_export_id = 0; } } static void -export_action_group(CloudProvidersAccountExporter *self) +export_action_group (CloudProvidersAccountExporter *self) { - GError *error = NULL; + g_autoptr(GError) error = NULL; - self->action_group_export_id = g_dbus_connection_export_action_group (self->bus, - self->object_path, - self->action_group, - &error); - if (self->action_group_export_id == 0) - { - g_warning ("Action export failed: %s", error->message); - } + self->action_group_export_id = g_dbus_connection_export_action_group (self->bus, + self->object_path, + self->action_group, + &error); + if (self->action_group_export_id == 0) + g_warning ("Action export failed: %s", error->message); } static void -unexport_action_group(CloudProvidersAccountExporter *self) +unexport_action_group (CloudProvidersAccountExporter *self) { - if (self->action_group_export_id != 0) - { - g_dbus_connection_unexport_action_group(self->bus, self->action_group_export_id); - } + if (self->action_group_export_id != 0) + { + g_dbus_connection_unexport_action_group(self->bus, self->action_group_export_id); + self->action_group_export_id = 0; + } } gchar * cloud_providers_account_exporter_get_object_path (CloudProvidersAccountExporter *self) { - return self->object_path; + g_return_val_if_fail (CLOUD_PROVIDERS_IS_ACCOUNT_EXPORTER (self), NULL); + + return self->object_path; } gchar * cloud_providers_account_exporter_get_bus_name (CloudProvidersAccountExporter *self) { + g_return_val_if_fail (CLOUD_PROVIDERS_IS_ACCOUNT_EXPORTER (self), NULL); + return self->bus_name; } CloudProvidersDbusAccount* cloud_providers_account_exporter_get_skeleton (CloudProvidersAccountExporter *self) { - return self->skeleton; + g_return_val_if_fail (CLOUD_PROVIDERS_IS_ACCOUNT_EXPORTER (self), NULL); + + return self->skeleton; } /** @@ -151,13 +155,13 @@ cloud_providers_account_exporter_new (CloudProvidersProviderExporter *provider, const gchar *bus_name) { - CloudProvidersAccountExporter *self; + CloudProvidersAccountExporter *self; - self = g_object_new (CLOUD_PROVIDERS_TYPE_ACCOUNT_EXPORTER, - "provider", provider, - "bus-name", bus_name, - NULL); - return self; + self = g_object_new (CLOUD_PROVIDERS_TYPE_ACCOUNT_EXPORTER, + "provider", provider, + "bus-name", bus_name, + NULL); + return self; } static void @@ -205,7 +209,7 @@ g_autoptr (GIcon) icon = NULL; icon = g_icon_new_for_string (self->icon, NULL); - g_value_set_object (value, icon); + g_value_take_object (value, g_icon_new_for_string (self->icon, NULL)); } break; @@ -248,7 +252,7 @@ case PROP_NAME: { g_free (self->name); - self->name = g_strdup (g_value_get_string (value)); + self->name = g_value_dup_string (value); cloud_providers_dbus_account_set_name (self->skeleton, self->name); } break; @@ -256,14 +260,14 @@ case PROP_BUS_NAME: { g_return_if_fail (self->bus_name == NULL); - self->bus_name = g_strdup (g_value_get_string (value)); + self->bus_name = g_value_dup_string (value); } break; case PROP_PROVIDER: { g_return_if_fail (self->provider == NULL); - self->provider = g_object_ref (g_value_get_object (value)); + g_set_weak_pointer (&self->provider, g_value_get_object (value)); } break; @@ -277,7 +281,7 @@ case PROP_STATUS_DETAILS: { g_free (self->status_details); - self->status_details = g_strdup (g_value_get_string (value)); + self->status_details = g_value_dup_string (value); cloud_providers_dbus_account_set_status_details (self->skeleton, self->status_details); } break; @@ -294,26 +298,20 @@ case PROP_PATH: { g_free (self->path); - self->path = g_strdup (g_value_get_string (value)); + self->path = g_value_dup_string (value); cloud_providers_dbus_account_set_path (self->skeleton, self->path); } break; case PROP_ACTION_GROUP: { - g_return_if_fail (self->action_group == NULL); - - self->action_group = g_object_ref (g_value_get_object (value)); - export_action_group (self); + cloud_providers_account_exporter_set_action_group (self, (GActionGroup *) g_value_get_object (value)); } break; case PROP_MENU_MODEL: { - g_return_if_fail (self->menu_model == NULL); - - self->menu_model = g_object_ref (g_value_get_object (value)); - export_menu_model (self); + cloud_providers_account_exporter_set_menu_model (self, (GMenuModel *) g_value_get_object (value)); } break; @@ -328,6 +326,8 @@ cloud_providers_account_exporter_set_name (CloudProvidersAccountExporter *self, const gchar *name) { + g_return_if_fail (CLOUD_PROVIDERS_IS_ACCOUNT_EXPORTER (self)); + g_object_set (self, "name", name, NULL); } @@ -335,6 +335,8 @@ cloud_providers_account_exporter_set_status (CloudProvidersAccountExporter *self, CloudProvidersAccountStatus status) { + g_return_if_fail (CLOUD_PROVIDERS_IS_ACCOUNT_EXPORTER (self)); + g_object_set (self, "status", status, NULL); } @@ -342,13 +344,17 @@ cloud_providers_account_exporter_set_status_details (CloudProvidersAccountExporter *self, const gchar *status_details) { - g_object_set (self, "status_details", status_details, NULL); + g_return_if_fail (CLOUD_PROVIDERS_IS_ACCOUNT_EXPORTER (self)); + + g_object_set (self, "status-details", status_details, NULL); } void cloud_providers_account_exporter_set_icon (CloudProvidersAccountExporter *self, GIcon *icon) { + g_return_if_fail (CLOUD_PROVIDERS_IS_ACCOUNT_EXPORTER (self)); + g_object_set (self, "icon", icon, NULL); } @@ -359,13 +365,19 @@ * * One of the benefits of the integration is to display a menu with available * options for an account. Use this function to export a GMenuModel menu to be - * displayed by the choosen integration by the desktop environment or application. + * displayed by the chosen integration by the desktop environment or application. */ void cloud_providers_account_exporter_set_menu_model (CloudProvidersAccountExporter *self, GMenuModel *menu_model) { - g_object_set (self, "menu_model", menu_model, NULL); + g_return_if_fail (CLOUD_PROVIDERS_IS_ACCOUNT_EXPORTER (self)); + + g_return_if_fail (self->menu_model == NULL); + + if (g_set_object (&self->menu_model, menu_model)) { + export_menu_model (self); + } } /** @@ -374,40 +386,57 @@ * @action_group: The GActionGroup to be used by the menu exported by cloud_providers_account_exporter_export_menu * * In order for a menu exported with cloud_providers_account_exporter_export_menu to receive events - * that will eventually call your callbacks, it needs the corresponding GAcionGroup. + * that will eventually call your callbacks, it needs the corresponding GActionGroup. * Use this function to export it. */ void cloud_providers_account_exporter_set_action_group (CloudProvidersAccountExporter *self, GActionGroup *action_group) { - g_object_set (self, "action_group", action_group, NULL); + g_return_if_fail (CLOUD_PROVIDERS_IS_ACCOUNT_EXPORTER (self)); + + g_return_if_fail (self->action_group == NULL); + + if (g_set_object (&self->action_group, action_group)) { + export_action_group (self); + } } void cloud_providers_account_exporter_set_path (CloudProvidersAccountExporter *self, const gchar *path) { + g_return_if_fail (CLOUD_PROVIDERS_IS_ACCOUNT_EXPORTER (self)); + g_object_set (self, "path", path, NULL); } static void -cloud_providers_account_exporter_finalize (GObject *object) +cloud_providers_account_exporter_dispose (GObject *object) { CloudProvidersAccountExporter *self = (CloudProvidersAccountExporter *)object; unexport_menu_model (self); unexport_action_group (self); - g_free (self->bus_name); - g_object_unref (self->skeleton); - g_free (self->name); - g_free (self->object_path); - g_free (self->status_details); - g_free (self->path); - g_free (self->icon); - g_object_unref (self->action_group); - g_object_unref (self->menu_model); - g_object_unref (self->provider); + g_clear_object (&self->skeleton); + g_clear_object (&self->action_group); + g_clear_object (&self->menu_model); + g_clear_weak_pointer (&self->provider); + + G_OBJECT_CLASS (cloud_providers_account_exporter_parent_class)->dispose (object); +} + +static void +cloud_providers_account_exporter_finalize (GObject *object) +{ + CloudProvidersAccountExporter *self = (CloudProvidersAccountExporter *)object; + + g_clear_pointer (&self->bus_name, g_free); + g_clear_pointer (&self->name, g_free); + g_clear_pointer (&self->object_path, g_free); + g_clear_pointer (&self->status_details, g_free); + g_clear_pointer (&self->path, g_free); + g_clear_pointer (&self->icon, g_free); G_OBJECT_CLASS (cloud_providers_account_exporter_parent_class)->finalize (object); } @@ -415,31 +444,31 @@ static void cloud_providers_account_exporter_constructed (GObject *object) { - const gchar *provider_object_path; - g_autofree gchar *object_path = NULL; - CloudProvidersAccountExporter *self = CLOUD_PROVIDERS_ACCOUNT_EXPORTER (object); - - self->bus = cloud_providers_provider_exporter_get_bus (self->provider); - self->skeleton = cloud_providers_dbus_account_skeleton_new (); - provider_object_path = cloud_providers_provider_exporter_get_object_path (self->provider); - self->object_path = g_strconcat (provider_object_path, "/", self->bus_name, NULL); - cloud_providers_provider_exporter_add_account (self->provider, self); + CloudProvidersAccountExporter *self = CLOUD_PROVIDERS_ACCOUNT_EXPORTER (object); + const gchar *provider_object_path; + + self->bus = cloud_providers_provider_exporter_get_bus (self->provider); + provider_object_path = cloud_providers_provider_exporter_get_object_path (self->provider); + self->object_path = g_strconcat (provider_object_path, "/", self->bus_name, NULL); + cloud_providers_provider_exporter_add_account (self->provider, self); } static void cloud_providers_account_exporter_init (CloudProvidersAccountExporter *self) { + self->skeleton = cloud_providers_dbus_account_skeleton_new (); } static void cloud_providers_account_exporter_class_init (CloudProvidersAccountExporterClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->get_property = cloud_providers_account_exporter_get_property; - object_class->set_property = cloud_providers_account_exporter_set_property; - object_class->constructed = cloud_providers_account_exporter_constructed; - object_class->finalize = cloud_providers_account_exporter_finalize; + object_class->get_property = cloud_providers_account_exporter_get_property; + object_class->set_property = cloud_providers_account_exporter_set_property; + object_class->constructed = cloud_providers_account_exporter_constructed; + object_class->dispose = cloud_providers_account_exporter_dispose; + object_class->finalize = cloud_providers_account_exporter_finalize; properties [PROP_NAME] = g_param_spec_string ("name", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/src/cloudproviderscollector.c new/libcloudproviders-0.3.2/src/cloudproviderscollector.c --- old/libcloudproviders-0.3.1/src/cloudproviderscollector.c 2020-06-08 21:30:27.960037500 +0200 +++ new/libcloudproviders-0.3.2/src/cloudproviderscollector.c 2023-08-09 16:36:01.000000000 +0200 @@ -32,7 +32,6 @@ GObject parent; GList *providers; - GHashTable* provider_object_managers; GDBusConnection *bus; GCancellable *cancellable; GList *monitors; @@ -68,11 +67,10 @@ GAsyncResult *res, gpointer user_data) { - GError *error = NULL; - CloudProvidersCollector *self; - GDBusConnection *bus; + CloudProvidersCollector *self = CLOUD_PROVIDERS_COLLECTOR (user_data); + g_autoptr(GError) error = NULL; - bus = g_bus_get_finish (res, &error); + self->bus = g_bus_get_finish (res, &error); if (error != NULL) { if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) @@ -80,11 +78,6 @@ return; } - self = CLOUD_PROVIDERS_COLLECTOR (user_data); - self->bus = bus; - g_clear_object (&self->cancellable); - self->cancellable = g_cancellable_new (); - update_cloud_providers (self); } @@ -95,6 +88,7 @@ GList *l; g_cancellable_cancel (self->cancellable); + g_clear_object (&self->cancellable); for (l = self->monitors; l != NULL; l = l->next) { g_signal_handlers_disconnect_by_data (G_OBJECT (l->data), self); @@ -119,7 +113,7 @@ /** * CloudProviderCollector::providers-changed * - * This signal is emmited by the ammount of providers changed. + * This signal is emitted by the amount of providers changed. */ signals [PROVIDERS_CHANGED] = g_signal_new ("providers-changed", G_TYPE_FROM_CLASS (klass), @@ -135,6 +129,12 @@ static void cloud_providers_collector_init (CloudProvidersCollector *self) { + self->cancellable = g_cancellable_new (); + + g_bus_get (G_BUS_TYPE_SESSION, + self->cancellable, + on_bus_acquired, + self); } /** @@ -226,16 +226,16 @@ const gchar* const *data_dirs; gint i; gint len; - gchar *key_files_directory_path; - GFile *key_files_directory_file; - GError *error = NULL; - GFileEnumerator *file_enumerator; data_dirs = g_get_system_data_dirs (); len = g_strv_length ((gchar **)data_dirs); for (i = 0; i < len; i++) { - GFileInfo *info; + g_autofree gchar *key_files_directory_path = NULL; + g_autoptr (GFile) key_files_directory_file = NULL; + g_autoptr (GError) error = NULL; + g_autoptr (GFileEnumerator) file_enumerator = NULL; + g_autoptr (GFileInfo) info = NULL; GFileMonitor *monitor; key_files_directory_path = g_build_filename (data_dirs[i], "cloud-providers", NULL); @@ -251,7 +251,6 @@ &error); if (error) { - error = NULL; continue; } @@ -259,18 +258,14 @@ if (error) { g_warning ("Error while enumerating file %s error: %s\n", key_files_directory_path, error->message); - error = NULL; continue; } while (info != NULL && error == NULL) { load_cloud_provider (self, g_file_enumerator_get_child (file_enumerator, info)); - g_object_unref (info); + g_clear_object (&info); info = g_file_enumerator_next_file (file_enumerator, NULL, &error); } - g_object_unref (file_enumerator); - g_free (key_files_directory_path); - g_object_unref (key_files_directory_file); } } @@ -280,6 +275,7 @@ GList *l; g_cancellable_cancel (self->cancellable); + g_clear_object (&self->cancellable); self->cancellable = g_cancellable_new (); for (l = self->monitors; l != NULL; l = l->next) { @@ -299,6 +295,12 @@ g_signal_emit_by_name (G_OBJECT (self), "providers-changed"); } +static gpointer +singleton_creation_thread (gpointer data) +{ + return g_object_new (CLOUD_PROVIDERS_TYPE_COLLECTOR, NULL); +} + /** * cloud_providers_collector_dup_singleton: * Main object to track changes in all providers. @@ -308,19 +310,12 @@ CloudProvidersCollector * cloud_providers_collector_dup_singleton (void) { - static CloudProvidersCollector *self = NULL; + static GOnce collector_singleton = G_ONCE_INIT; + CloudProvidersCollector *self; - if (self == NULL) - { - self = CLOUD_PROVIDERS_COLLECTOR (g_object_new (CLOUD_PROVIDERS_TYPE_COLLECTOR, NULL)); - self->provider_object_managers = g_hash_table_new(g_str_hash, g_str_equal); - - g_bus_get (G_BUS_TYPE_SESSION, - self->cancellable, - on_bus_acquired, - self); - } + g_once (&collector_singleton, singleton_creation_thread, NULL); - return g_object_ref (self); + self = CLOUD_PROVIDERS_COLLECTOR (collector_singleton.retval); + return g_object_ref (self); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/src/cloudprovidersprovider.c new/libcloudproviders-0.3.2/src/cloudprovidersprovider.c --- old/libcloudproviders-0.3.1/src/cloudprovidersprovider.c 2020-06-08 21:30:27.960037500 +0200 +++ new/libcloudproviders-0.3.2/src/cloudprovidersprovider.c 2023-08-09 16:36:01.000000000 +0200 @@ -31,9 +31,7 @@ GList *accounts; gchar *manager_bus_name; gchar *manager_object_path; - gchar *provider_object_path; - GHashTable* accounts_object_managers; GDBusConnection *bus; CloudProvidersDbusProvider *proxy; GCancellable *cancellable; @@ -47,7 +45,7 @@ * @short_description: Base object for representing a single provider for clients. * @include: src/cloudprovidersprovider.h * - * #CloudProvidersProvider is the basic object object for client implementators + * #CloudProvidersProvider is the basic object object for client implementers * that contains the properties of the provider such as name, and the accounts * associated with it. */ @@ -71,6 +69,20 @@ static void on_name_changed (CloudProvidersProvider *self); +static void +on_cloud_providers_object_manager_object_added (GDBusObjectManager *manager, + GDBusObject *object, + gpointer user_data); + +static void +on_cloud_providers_object_manager_object_removed (GDBusObjectManager *manager, + GDBusObject *object, + gpointer user_data); + +static void +on_cloud_providers_object_manager_name_owner_changed (GObject *object, + GParamSpec *pspec, + gpointer user_data); CloudProvidersProvider * cloud_providers_provider_new (const gchar *bus_name, @@ -86,22 +98,47 @@ } static void -cloud_providers_provider_finalize (GObject *object) +cloud_providers_provider_dispose (GObject *object) { CloudProvidersProvider *self = (CloudProvidersProvider *)object; + g_cancellable_cancel (self->cancellable); + g_clear_object (&self->cancellable); + g_list_free_full (self->accounts, g_object_unref); - g_free (self->name); - if (self->proxy != NULL) - { - g_signal_handlers_disconnect_by_data (self->proxy, self); - } + self->accounts = NULL; + + if (self->proxy) + g_signal_handlers_disconnect_by_func (self->proxy, G_CALLBACK (on_name_changed), self); g_clear_object (&self->proxy); + if (self->manager) { - g_signal_handlers_disconnect_by_data (self->manager, self); + g_signal_handlers_disconnect_by_func (self->manager, + G_CALLBACK (on_cloud_providers_object_manager_name_owner_changed), + self); + g_signal_handlers_disconnect_by_func (self->manager, + G_CALLBACK (on_cloud_providers_object_manager_object_added), + self); + g_signal_handlers_disconnect_by_func (self->manager, + G_CALLBACK (on_cloud_providers_object_manager_object_removed), + self); } + g_clear_object (&self->manager); + g_clear_object (&self->bus); + + G_OBJECT_CLASS (cloud_providers_provider_parent_class)->dispose (object); +} + +static void +cloud_providers_provider_finalize (GObject *object) +{ + CloudProvidersProvider *self = (CloudProvidersProvider *)object; + + g_clear_pointer (&self->name, g_free); + g_clear_pointer (&self->manager_bus_name, g_free); + g_clear_pointer (&self->manager_object_path, g_free); G_OBJECT_CLASS (cloud_providers_provider_parent_class)->finalize (object); } @@ -143,7 +180,7 @@ case PROP_NAME: { g_free (self->name); - self->name = g_strdup (g_value_get_string (value)); + self->name = g_value_dup_string (value); g_object_notify_by_pspec (object, properties[PROP_NAME]); } break; @@ -162,6 +199,7 @@ { GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->dispose = cloud_providers_provider_dispose; object_class->finalize = cloud_providers_provider_finalize; object_class->get_property = cloud_providers_provider_get_property; object_class->set_property = cloud_providers_provider_set_property; @@ -172,13 +210,14 @@ "Name of the provider", NULL, (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, PROP_NAME, - properties [PROP_NAME]); + g_object_class_install_properties (object_class, + N_PROPS, + properties); /** * CloudProviderProvider::accounts-changed * - * This signal is emmited by a provider if the number of accounts changed. + * This signal is emitted by a provider if the number of accounts changed. */ signals [ACCOUNTS_CHANGED] = g_signal_new ("accounts-changed", @@ -193,7 +232,7 @@ /** * CloudProviderProvider::removed * - * This signal is emmited by a provider when the provider is removed in DBUS. + * This signal is emitted by a provider when the provider is removed in DBUS. */ signals [REMOVED] = g_signal_new ("removed", @@ -291,7 +330,7 @@ static void on_cloud_providers_object_manager_name_owner_changed (GObject *object, GParamSpec *pspec, - gpointer user_data) + gpointer user_data) { CloudProvidersProvider *self; @@ -318,15 +357,13 @@ GAsyncResult *res, gpointer user_data) { - CloudProvidersProvider *self; - GError *error = NULL; + CloudProvidersProvider *self = CLOUD_PROVIDERS_PROVIDER (user_data); + g_autoptr(GError) error = NULL; - self = CLOUD_PROVIDERS_PROVIDER (user_data); - self->manager = cloud_providers_dbus_object_manager_client_new_for_bus_finish (res, &error); + self->manager = cloud_providers_dbus_object_manager_client_new_finish (res, &error); if (error != NULL) { g_printerr ("Error getting object manager client: %s", error->message); - g_error_free (error); return; } @@ -348,11 +385,10 @@ GAsyncResult *res, gpointer user_data) { - GError *error = NULL; - CloudProvidersProvider *self; - GDBusConnection *bus; + CloudProvidersProvider *self = CLOUD_PROVIDERS_PROVIDER (user_data); + g_autoptr(GError) error = NULL; - bus = g_bus_get_finish (res, &error); + self->bus = g_bus_get_finish (res, &error); if (error != NULL) { if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) @@ -360,24 +396,20 @@ return; } - self = CLOUD_PROVIDERS_PROVIDER (user_data); - self->bus = bus; - g_clear_object (&self->cancellable); - self->cancellable = g_cancellable_new (); - - cloud_providers_dbus_object_manager_client_new_for_bus (G_BUS_TYPE_SESSION, - G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, - self->manager_bus_name, - self->manager_object_path, - NULL, - on_object_manager_created, - self); + cloud_providers_dbus_object_manager_client_new (self->bus, + G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, + self->manager_bus_name, + self->manager_object_path, + self->cancellable, + on_object_manager_created, + self); } static void cloud_providers_provider_init (CloudProvidersProvider *self) { + self->cancellable = g_cancellable_new (); g_bus_get (G_BUS_TYPE_SESSION, self->cancellable, on_bus_acquired, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/src/cloudprovidersproviderexporter.c new/libcloudproviders-0.3.2/src/cloudprovidersproviderexporter.c --- old/libcloudproviders-0.3.1/src/cloudprovidersproviderexporter.c 2020-06-08 21:30:27.960037500 +0200 +++ new/libcloudproviders-0.3.2/src/cloudprovidersproviderexporter.c 2023-08-09 16:36:01.000000000 +0200 @@ -31,8 +31,6 @@ CloudProvidersDbusProvider *skeleton; GDBusConnection *bus; GDBusObjectManagerServer *manager; - gchar *manager_bus_name; - gchar *manager_bus_path; gchar *bus_name; gchar *bus_path; @@ -40,7 +38,6 @@ gchar *name; GList *accounts; - GVariant *dbus_accounts; }; G_DEFINE_TYPE (CloudProvidersProviderExporter, cloud_providers_provider_exporter, G_TYPE_OBJECT) @@ -118,7 +115,7 @@ * * Each cloud provider can have a variety of account associated with it. Use this * function to add the accounts the user set up. This function is currently only internal, - * as we do automation for hte dbus handling for adding and exporting an account. + * as we do automation for the dbus handling for adding and exporting an account. * This is handled in cloud_providers_account_exporter_new(). */ void @@ -205,7 +202,7 @@ case PROP_NAME: { g_free (self->name); - self->name = g_strdup (g_value_get_string (value)); + self->name = g_value_dup_string (value); g_debug ("setting name %s\n", self->name); cloud_providers_dbus_provider_set_name (self->skeleton, self->name); } @@ -214,21 +211,21 @@ case PROP_BUS_NAME: { g_return_if_fail (self->bus_name == NULL); - self->bus_name = g_strdup (g_value_get_string (value)); + self->bus_name = g_value_dup_string (value); } break; case PROP_BUS_PATH: { g_return_if_fail (self->bus_path == NULL); - self->bus_path = g_strdup (g_value_get_string (value)); + self->bus_path = g_value_dup_string (value); } break; case PROP_BUS: { g_return_if_fail (self->bus == NULL); - self->bus = g_object_ref (g_value_get_object (value)); + self->bus = g_value_dup_object (value); } break; @@ -240,22 +237,31 @@ } static void -cloud_providers_provider_exporter_finalize (GObject *object) +cloud_providers_provider_exporter_dispose (GObject *object) { - CloudProvidersProviderExporter *self = (CloudProvidersProviderExporter *)object; + CloudProvidersProviderExporter *self = (CloudProvidersProviderExporter *)object; - g_debug ("finalize provider"); - g_clear_object (&self->skeleton); - g_clear_object (&self->bus); - g_free (self->bus_name); - g_free (self->bus_path); - g_free (self->provider_bus_path); - g_clear_object (&self->manager); - g_free (self->name); + g_clear_object (&self->skeleton); + g_clear_object (&self->manager); + g_clear_object (&self->bus); - g_list_free_full (self->accounts, g_object_unref); + g_list_free_full (self->accounts, g_object_unref); + self->accounts = NULL; - G_OBJECT_CLASS (cloud_providers_provider_exporter_parent_class)->finalize (object); + G_OBJECT_CLASS (cloud_providers_provider_exporter_parent_class)->dispose (object); +} + +static void +cloud_providers_provider_exporter_finalize (GObject *object) +{ + CloudProvidersProviderExporter *self = (CloudProvidersProviderExporter *)object; + + g_clear_pointer (&self->bus_name, g_free); + g_clear_pointer (&self->bus_path, g_free); + g_clear_pointer (&self->provider_bus_path, g_free); + g_clear_pointer (&self->name, g_free); + + G_OBJECT_CLASS (cloud_providers_provider_exporter_parent_class)->finalize (object); } static void @@ -279,12 +285,12 @@ static void cloud_providers_provider_exporter_class_init (CloudProvidersProviderExporterClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->set_property = cloud_providers_provider_exporter_set_property; - object_class->get_property = cloud_providers_provider_exporter_get_property; - object_class->constructed = cloud_providers_provider_exporter_constructed; - object_class->finalize = cloud_providers_provider_exporter_finalize; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->set_property = cloud_providers_provider_exporter_set_property; + object_class->get_property = cloud_providers_provider_exporter_get_property; + object_class->constructed = cloud_providers_provider_exporter_constructed; + object_class->dispose = cloud_providers_provider_exporter_dispose; + object_class->finalize = cloud_providers_provider_exporter_finalize; properties [PROP_NAME] = g_param_spec_string ("name", @@ -293,9 +299,6 @@ NULL, (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, PROP_NAME, - properties [PROP_NAME]); - properties [PROP_BUS_NAME] = g_param_spec_string ("bus-name", "BusName", @@ -304,9 +307,6 @@ (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property (object_class, PROP_BUS_NAME, - properties [PROP_BUS_NAME]); - properties [PROP_BUS_PATH] = g_param_spec_string ("bus-path", "BusPath", @@ -315,8 +315,6 @@ (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property (object_class, PROP_BUS_PATH, - properties [PROP_BUS_PATH]); properties [PROP_BUS] = g_param_spec_object ("bus", @@ -326,8 +324,9 @@ (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property (object_class, PROP_BUS, - properties [PROP_BUS]); + g_object_class_install_properties (object_class, + N_PROPS, + properties); } void @@ -344,7 +343,7 @@ } /** - * cloud_providers_provider_exporter_new: + * cloud_providers_provider_exporter_new * @bus: A #GDbusConnection to export the objects to * @bus_name: A DBus name to bind to * @bus_path: A DBus object path @@ -376,4 +375,3 @@ { return self->bus_path; } - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/src/meson.build new/libcloudproviders-0.3.2/src/meson.build --- old/libcloudproviders-0.3.1/src/meson.build 2020-06-08 21:30:27.961037400 +0200 +++ new/libcloudproviders-0.3.2/src/meson.build 2023-08-09 16:36:01.000000000 +0200 @@ -1,4 +1,4 @@ -libcloudproviders_deps = [glib, gio, gio_unix] +libcloudproviders_deps = [glib, gio, gio_platform] libcloudproviders_headers = [ 'cloudproviders.h', @@ -56,6 +56,7 @@ dependencies: libcloudproviders_deps, include_directories: include_directories('.') ) +meson.override_dependency('libcloudproviders', libcloudproviders_dep) if get_option('introspection') libcloudproviders_gir = gnome.generate_gir( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/test/meson.build new/libcloudproviders-0.3.2/test/meson.build --- old/libcloudproviders-0.3.1/test/meson.build 2020-06-08 21:30:27.961037400 +0200 +++ new/libcloudproviders-0.3.2/test/meson.build 2023-08-09 16:36:01.000000000 +0200 @@ -10,7 +10,7 @@ configure_file(input : 'icon.svg', output : 'icon.svg', - configuration : configuration_data()) + copy : true) if installed service_conf = configuration_data () diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/test/testcloudprovidersclient.c new/libcloudproviders-0.3.2/test/testcloudprovidersclient.c --- old/libcloudproviders-0.3.1/test/testcloudprovidersclient.c 2020-06-08 21:30:27.961037400 +0200 +++ new/libcloudproviders-0.3.2/test/testcloudprovidersclient.c 2023-08-09 16:36:01.000000000 +0200 @@ -92,9 +92,7 @@ { GList *l; gint status; - gchar *status_string; GIcon *icon; - gchar *icon_representation; GList *accounts; GMenuModel *menu; @@ -102,6 +100,8 @@ for (l = accounts; l != NULL; l = l->next) { CloudProvidersAccount *account; + g_autofree gchar *status_string = NULL; + g_autofree gchar *icon_representation = NULL; account = CLOUD_PROVIDERS_ACCOUNT (l->data); g_signal_connect (account, @@ -111,7 +111,7 @@ status = cloud_providers_account_get_status (account); status_string = get_status_string (status); icon = cloud_providers_account_get_icon (account); - icon_representation = icon != NULL ? g_icon_to_string (icon) : "no icon"; + icon_representation = icon != NULL ? g_icon_to_string (icon) : g_strdup ("no icon"); g_print ("Account: Name - %s, Status - %s (%s), Path - %s, Icon - %s\n", cloud_providers_account_get_name (account), @@ -120,8 +120,6 @@ cloud_providers_account_get_path (account), icon_representation); - g_free (icon_representation); - menu = cloud_providers_account_get_menu_model (account); g_print ("\nMenu\n"); print_gmenu_model (menu); @@ -142,9 +140,7 @@ GList *l; GList *l2; gint status; - gchar *status_string; GIcon *icon; - gchar *icon_representation; GMenuModel *menu; providers = cloud_providers_collector_get_providers (collector); @@ -164,6 +160,8 @@ for (l2 = accounts; l2 != NULL; l2 = l2->next) { CloudProvidersAccount *account; + g_autofree gchar *status_string = NULL; + g_autofree gchar *icon_representation = NULL; account = CLOUD_PROVIDERS_ACCOUNT (l2->data); g_signal_connect_swapped (account, @@ -182,8 +180,6 @@ cloud_providers_account_get_path (account), icon_representation); - g_free (icon_representation); - menu = cloud_providers_account_get_menu_model (account); g_print ("\nMenu\n"); print_gmenu_model (menu); @@ -210,9 +206,9 @@ on_collector_changed (collector); g_print("Waiting for cloud providers\n\n"); - g_main_loop_run(loop); - g_free(loop); + g_main_loop_unref(loop); + g_object_unref (collector); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcloudproviders-0.3.1/test/testcloudprovidersserver.c new/libcloudproviders-0.3.2/test/testcloudprovidersserver.c --- old/libcloudproviders-0.3.1/test/testcloudprovidersserver.c 2020-06-08 21:30:27.961037400 +0200 +++ new/libcloudproviders-0.3.2/test/testcloudprovidersserver.c 2023-08-09 16:36:01.000000000 +0200 @@ -29,7 +29,6 @@ GIcon *icon; gchar *path; guint timeout_handler; - GDBusConnection *connection; CloudProvidersProviderExporter *exporter; }; @@ -50,10 +49,12 @@ { CloudProvidersTestServer *self = CLOUD_PROVIDERS_TEST_SERVER (object); - g_hash_table_unref (self->accounts); - g_free (self->name); - g_free (self->path); + g_clear_handle_id (&self->timeout_handler, g_source_remove); + g_clear_pointer (&self->accounts, g_hash_table_unref); + g_clear_pointer (&self->name, g_free); + g_clear_pointer (&self->path, g_free); g_clear_object (&self->icon); + g_clear_object (&self->exporter); G_OBJECT_CLASS (cloud_providers_test_server_parent_class)->finalize (object); } @@ -61,22 +62,18 @@ static void cloud_providers_test_server_init (CloudProvidersTestServer *self) { - GFile *icon_file; - gchar *current_dir; - gchar *uri; + g_autoptr(GFile) icon_file = NULL; + g_autofree gchar *current_dir = NULL; + g_autofree gchar *uri = NULL; current_dir = g_get_current_dir (); self->accounts = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref); - self->name = "MyCloud"; + self->name = g_strdup ("MyCloud"); self->path = g_strdup (current_dir); uri = g_build_filename (current_dir, "icon.svg", NULL); icon_file = g_file_new_for_uri (uri); self->icon = g_file_icon_new (icon_file); - - g_object_unref (icon_file); - g_free (uri); - g_free (current_dir); } static void @@ -143,51 +140,56 @@ { "buy", activate_radio, "s", NULL, NULL }, }; -struct menu { +static GMenuModel * +get_model (void) +{ + GMenu *section; GMenu *mainMenu; GMenuItem *website; GMenuItem *photos; GMenuItem *notes; GMenuItem *allowSync; - GMenuItem *buy; -}; - -static GMenuModel * -get_model (void) -{ - GMenu *section; - struct menu *m; GMenuItem *item; GMenu *submenu; - m = g_new0(struct menu, 1); - m->mainMenu = g_menu_new(); + mainMenu = g_menu_new(); section = g_menu_new(); - m->website = g_menu_item_new("MyCloud website", "cloudprovider.website"); - g_menu_append_item(section, m->website); - m->photos = g_menu_item_new("MyCloud photos", "cloudprovider.photos"); - g_menu_append_item(section, m->photos); - m->notes = g_menu_item_new("MyCloud notes", "cloudprovider.notes"); - g_menu_append_item(section, m->notes); - g_menu_append_section(m->mainMenu, NULL, G_MENU_MODEL(section)); + website = g_menu_item_new("MyCloud website", "cloudprovider.website"); + g_menu_append_item(section, website); + g_object_unref (website); + photos = g_menu_item_new("MyCloud photos", "cloudprovider.photos"); + g_menu_append_item(section, photos); + g_object_unref (photos); + notes = g_menu_item_new("MyCloud notes", "cloudprovider.notes"); + g_menu_append_item(section, notes); + g_object_unref (notes); + g_menu_append_section(mainMenu, NULL, G_MENU_MODEL(section)); + g_object_unref (section); section = g_menu_new(); - m->allowSync = g_menu_item_new("Allow Synchronization", "cloudprovider.allow-sync"); - g_menu_append_item(section, m->allowSync); + allowSync = g_menu_item_new("Allow Synchronization", "cloudprovider.allow-sync"); + g_menu_append_item(section, allowSync); + g_object_unref (allowSync); submenu = g_menu_new(); item = g_menu_item_new("5GB", "5"); g_menu_append_item(submenu, item); + g_object_unref (item); item = g_menu_item_new("10GB", "10"); g_menu_append_item(submenu, item); + g_object_unref (item); item = g_menu_item_new("50GB", "50"); g_menu_append_item(submenu, item); + g_object_unref (item); item = g_menu_item_new_submenu("Buy storage", G_MENU_MODEL(submenu)); g_menu_append_item(section, item); - g_menu_append_section(m->mainMenu, NULL, G_MENU_MODEL(section)); + g_object_unref (item); + g_object_unref (submenu); + g_menu_append_section(mainMenu, NULL, G_MENU_MODEL(section)); + g_object_unref (section); - return G_MENU_MODEL(m->mainMenu); + return G_MENU_MODEL(mainMenu); } static GActionGroup * @@ -218,6 +220,7 @@ new_status = g_rand_int_range (rand, CLOUD_PROVIDERS_ACCOUNT_STATUS_IDLE, CLOUD_PROVIDERS_ACCOUNT_STATUS_ERROR + 1); + g_rand_free (rand); g_print ("Change status of %03d to %d\n", account_id, new_status); account = g_hash_table_lookup (self->accounts, GINT_TO_POINTER (account_id)); @@ -226,7 +229,7 @@ return TRUE; } -static gchar * +static const gchar * get_status_details (CloudProvidersAccountStatus status) { gchar *description = ""; @@ -258,6 +261,8 @@ g_autoptr (CloudProvidersAccountExporter) account = NULL; g_autofree gchar *account_object_name = NULL; g_autofree gchar *account_name = NULL; + GActionGroup *action_group = get_action_group (); + g_autoptr(GMenuModel) menu_model = get_model (); account_object_name = g_strdup_printf ("MyAccount%d", n); account_name = g_strdup_printf ("MyAccount %d", n); @@ -272,9 +277,10 @@ CLOUD_PROVIDERS_ACCOUNT_STATUS_INVALID); cloud_providers_account_exporter_set_status_details (account, get_status_details (CLOUD_PROVIDERS_ACCOUNT_STATUS_INVALID)); - cloud_providers_account_exporter_set_menu_model (account, get_model ()); - cloud_providers_account_exporter_set_action_group (account, get_action_group ()); - g_hash_table_insert (self->accounts, GINT_TO_POINTER (n), account); + cloud_providers_account_exporter_set_menu_model (account, menu_model); + cloud_providers_account_exporter_set_action_group (account, action_group); + g_hash_table_insert (self->accounts, GINT_TO_POINTER (n), g_steal_pointer (&account)); + g_object_unref (action_group); } return G_SOURCE_REMOVE; @@ -287,12 +293,11 @@ { CloudProvidersTestServer *self = CLOUD_PROVIDERS_TEST_SERVER (user_data); - g_debug ("Bus adquired: %s\n", name); + g_debug ("Bus acquired: %s\n", name); g_debug ("Registering cloud provider server 'MyCloud'\n"); - self->connection = connection; - self->exporter = cloud_providers_provider_exporter_new(self->connection, + self->exporter = cloud_providers_provider_exporter_new(connection, TEST_CLOUD_PROVIDERS_BUS_NAME, TEST_CLOUD_PROVIDERS_OBJECT_PATH); cloud_providers_provider_exporter_set_name (self->exporter, "My cloud"); @@ -309,7 +314,7 @@ self->timeout_handler = g_timeout_add (TIMEOUT, (GSourceFunc) change_random_cloud_provider_state, self); - g_debug ("Server test name adquired"); + g_debug ("Server test name acquired"); change_random_cloud_provider_state (self); } @@ -341,7 +346,7 @@ loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); - + g_main_loop_unref (loop); g_debug("going oooooout/n"); g_bus_unown_name (owner_id); g_object_unref (test_cloud_provider);