[libcloudproviders/wip/rename-exporter: 5/7] libcloudproviders: rename CloudProvider to CloudProviderExporter



commit c62e47366ad787a4fd3743e2f89f39577107221f
Author: Julius Härtl <jus bitgrid net>
Date:   Fri Sep 1 20:18:26 2017 +0200

    libcloudproviders: rename CloudProvider to CloudProviderExporter

 src/cloudprovider.h                              |  92 --------------------
 src/{cloudprovider.c => cloudproviderexporter.c} | 106 +++++++++++------------
 src/cloudproviderexporter.h                      |  93 ++++++++++++++++++++
 src/meson.build                                  |   4 +-
 test/testcloudproviderserver.c                   |  20 ++---
 5 files changed, 158 insertions(+), 157 deletions(-)
---
diff --git a/src/cloudprovider.c b/src/cloudproviderexporter.c
similarity index 70%
rename from src/cloudprovider.c
rename to src/cloudproviderexporter.c
index 8e63770..3a04107 100644
--- a/src/cloudprovider.c
+++ b/src/cloudproviderexporter.c
@@ -1,4 +1,4 @@
-/* cloudprovider.c
+/* cloudproviderexporter.c
  *
  * Copyright (C) 2015 Carlos Soriano <csoriano gnome org>
  * Copyright (C) 2017 Julius Haertl <jus bitgrid net>
@@ -17,7 +17,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "cloudprovider.h"
+#include "cloudproviderexporter.h"
 #include "cloudprovideraccountexporterpriv.h"
 #include "cloudprovider-generated.h"
 #include <gio/gio.h>
@@ -31,17 +31,17 @@ typedef struct
   GCancellable *cancellable;
   GHashTable *menuModels;
   GHashTable *actionGroups;
-} CloudProviderPrivate;
+} CloudProviderExporterPrivate;
 
-G_DEFINE_TYPE_WITH_PRIVATE (CloudProvider, cloud_provider, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (CloudProviderExporter, cloud_provider_exporter, G_TYPE_OBJECT)
 
 /**
- * SECTION:cloudprovider
- * @title: CloudProvider
+ * SECTION:cloudproviderexporter
+ * @title: CloudProviderExporter
  * @short_description: Base object for representing a single provider
- * @include: src/cloudprovider.h
+ * @include: src/cloudproviderexporter.h
  *
- * #CloudProvider is the basic object that interacts with UI and actions that a
+ * #CloudProviderExporter is the basic object that interacts with UI and actions that a
  * provider will present to the user.
  * list view. Extensions can provide #NautilusColumn by registering a
  * #NautilusColumnProvider and returning them from
@@ -50,7 +50,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (CloudProvider, cloud_provider, G_TYPE_OBJECT)
  */
 
 /**
- * cloud_provider_add_account:
+ * cloud_provider_exporter_add_account:
  * @self: The cloud provider
  * @account: The account object
  *
@@ -58,10 +58,10 @@ G_DEFINE_TYPE_WITH_PRIVATE (CloudProvider, cloud_provider, G_TYPE_OBJECT)
  * function to export the accounts the user set up.
  */
 void
-cloud_provider_add_account (CloudProvider                *cloud_provider,
-                            CloudProviderAccountExporter *account)
+cloud_provider_exporter_add_account (CloudProviderExporter        *cloud_provider,
+                                     CloudProviderAccountExporter *account)
 {
-  CloudProviderPrivate *priv = cloud_provider_get_instance_private(cloud_provider);
+  CloudProviderExporterPrivate *priv = cloud_provider_exporter_get_instance_private(cloud_provider);
   CloudProviderObjectSkeleton *object;
   gchar *object_path = g_strconcat (priv->object_path, "/", cloud_provider_account_exporter_get_object_name 
(account), NULL);
   object = cloud_provider_object_skeleton_new(object_path);
@@ -71,11 +71,11 @@ cloud_provider_add_account (CloudProvider                *cloud_provider,
 }
 
 void
-cloud_provider_export_account(CloudProvider* self,
+cloud_provider_exporter_export_account(CloudProviderExporter * self,
                               const gchar *account_name,
                               CloudProviderAccount1 *account)
 {
-  CloudProviderPrivate *priv = cloud_provider_get_instance_private(self);
+  CloudProviderExporterPrivate *priv = cloud_provider_exporter_get_instance_private(self);
   CloudProviderObjectSkeleton *object;
   gchar *object_path = g_strconcat (priv->object_path, "/", account_name, NULL);
   object = cloud_provider_object_skeleton_new(object_path);
@@ -86,7 +86,7 @@ cloud_provider_export_account(CloudProvider* self,
 }
 
 /**
- * cloud_provider_unexport_account:
+ * cloud_provider_exporter_unexport_account:
  * @self: The cloud provider
  * @account_name: The name of the account
  *
@@ -94,10 +94,10 @@ cloud_provider_export_account(CloudProvider* self,
  * function to remove an already set up account.
  */
 void
-cloud_provider_unexport_account(CloudProvider *self,
+cloud_provider_exporter_unexport_account(CloudProviderExporter *self,
                                 const gchar   *account_name)
 {
-  CloudProviderPrivate *priv = cloud_provider_get_instance_private(self);
+  CloudProviderExporterPrivate *priv = cloud_provider_exporter_get_instance_private(self);
   gchar *object_path = g_strconcat (priv->object_path, "/", account_name, NULL);
   g_dbus_object_manager_server_unexport (priv->manager, object_path);
   guint *export_id;
@@ -115,7 +115,7 @@ cloud_provider_unexport_account(CloudProvider *self,
 }
 
 /**
- * cloud_provider_export_menu:
+ * cloud_provider_exporter_export_menu:
  * @self: The cloud provider
  * @account_name: The name of the account
  *
@@ -124,11 +124,11 @@ cloud_provider_unexport_account(CloudProvider *self,
  * displayed by the choosen integration by the desktop environment or application.
  */
 guint
-cloud_provider_export_menu(CloudProvider *self,
+cloud_provider_exporter_export_menu(CloudProviderExporter *self,
                            const gchar   *account_name,
                            GMenuModel    *model)
 {
-  CloudProviderPrivate *priv = cloud_provider_get_instance_private(self);
+  CloudProviderExporterPrivate *priv = cloud_provider_exporter_get_instance_private(self);
   gchar *object_path = g_strconcat(priv->object_path, "/", account_name, NULL);
   GError *error = NULL;
   guint *export_id = g_new0(guint, 1);
@@ -143,17 +143,17 @@ cloud_provider_export_menu(CloudProvider *self,
 }
 
 /**
- * cloud_provider_unexport_menu:
+ * cloud_provider_exporter_unexport_menu:
  * @self: The cloud provider
  * @account_name: The name of the account
  *
- * Remove the menu added with cloud_provider_export_menu
+ * Remove the menu added with cloud_provider_exporter_export_menu
  */
 void
-cloud_provider_unexport_menu(CloudProvider *self,
+cloud_provider_exporter_unexport_menu(CloudProviderExporter *self,
                              const gchar   *account_name)
 {
-  CloudProviderPrivate *priv = cloud_provider_get_instance_private(self);
+  CloudProviderExporterPrivate *priv = cloud_provider_exporter_get_instance_private(self);
   guint *export_id;
   export_id = (guint*)g_hash_table_lookup(priv->menuModels, account_name);
   if(export_id != NULL) {
@@ -164,21 +164,21 @@ cloud_provider_unexport_menu(CloudProvider *self,
 }
 
 /**
- * cloud_provider_action_group:
+ * cloud_provider_exporter_action_group:
  * @self: The cloud provider
  * @account_name: The name of the account
- * @action_group: The GActionGroup to be used by the menu exported by cloud_provider_export_menu
+ * @action_group: The GActionGroup to be used by the menu exported by cloud_provider_exporter_export_menu
  *
- * In order for a menu exported with cloud_provider_export_menu to receive events
+ * In order for a menu exported with cloud_provider_exporter_export_menu to receive events
  * that will eventually call your callbacks, it needs the corresponding GAcionGroup.
  * Use this function to export it.
  */
 guint
-cloud_provider_export_action_group(CloudProvider *self,
+cloud_provider_exporter_export_action_group(CloudProviderExporter *self,
                                    const gchar   *account_name,
                                    GActionGroup  *action_group)
 {
-  CloudProviderPrivate *priv = cloud_provider_get_instance_private(self);
+  CloudProviderExporterPrivate *priv = cloud_provider_exporter_get_instance_private(self);
   gchar *object_path = g_strconcat(priv->object_path, "/", account_name, NULL);
   GError *error = NULL;
   guint *export_id = g_new0(guint, 1);
@@ -193,17 +193,17 @@ cloud_provider_export_action_group(CloudProvider *self,
 }
 
 /**
- * cloud_provider_unexport_action_group:
+ * cloud_provider_exporter_unexport_action_group:
  * @self: The cloud provider
  * @account_name: The name of the account
  *
- * Unexport the GActionGroup exported by cloud_provider_export_action_group
+ * Unexport the GActionGroup exported by cloud_provider_exporter_export_action_group
  */
 void
-cloud_provider_unexport_action_group(CloudProvider *self,
+cloud_provider_exporter_unexport_action_group(CloudProviderExporter *self,
                                      const gchar   *account_name)
 {
-  CloudProviderPrivate *priv = cloud_provider_get_instance_private(self);
+  CloudProviderExporterPrivate *priv = cloud_provider_exporter_get_instance_private(self);
   guint *export_id;
   export_id = (guint*)g_hash_table_lookup(priv->actionGroups, account_name);
   if(export_id != NULL) {
@@ -214,23 +214,23 @@ cloud_provider_unexport_action_group(CloudProvider *self,
 }
 
 /**
- * cloud_provider_export_objects:
+ * cloud_provider_exporter_export_objects:
  * @self: The cloud provider
  *
- * Export all objects assigned previously with functions like cloud_provider_export_menu
+ * Export all objects assigned previously with functions like cloud_provider_exporter_export_account
  * to DBUS.
  * Use this function after exporting all the required object to avoid multiple signals
  * being emitted in a short time.
  */
 void
-cloud_provider_export_objects(CloudProvider* self)
+cloud_provider_exporter_export_objects(CloudProviderExporter * self)
 {
-  CloudProviderPrivate *priv = cloud_provider_get_instance_private(self);
+  CloudProviderExporterPrivate *priv = cloud_provider_exporter_get_instance_private(self);
   g_dbus_object_manager_server_set_connection (priv->manager, priv->bus);
 }
 
 /**
- * cloud_provider_emit_changed:
+ * cloud_provider_exporter_emit_changed:
  * @self: The cloud provider
  * @account_name: The name of the account
  *
@@ -238,10 +238,10 @@ cloud_provider_export_objects(CloudProvider* self)
  * so clients are aware of the change.
  */
 void
-cloud_provider_emit_changed (CloudProvider *self,
+cloud_provider_exporter_emit_changed (CloudProviderExporter *self,
                              const gchar   *account_name)
 {
-  CloudProviderPrivate *priv = cloud_provider_get_instance_private(self);
+  CloudProviderExporterPrivate *priv = cloud_provider_exporter_get_instance_private(self);
   gchar *object_path = g_strconcat(priv->object_path, "/", account_name, NULL);
   GDBusObject *object = g_dbus_object_manager_get_object((GDBusObjectManager*)priv->manager, object_path);
   CloudProviderAccount1 *account = cloud_provider_object_get_account1 (CLOUD_PROVIDER_OBJECT(object));
@@ -251,16 +251,16 @@ cloud_provider_emit_changed (CloudProvider *self,
   g_free (object_path);
 }
 
-CloudProvider*
-cloud_provider_new (GDBusConnection *bus,
+CloudProviderExporter *
+cloud_provider_exporter_new (GDBusConnection *bus,
                     const gchar     *bus_name,
                     const gchar     *object_path)
 {
-  CloudProvider *self;
-  CloudProviderPrivate *priv;
+  CloudProviderExporter *self;
+  CloudProviderExporterPrivate *priv;
 
-  self = g_object_new (TYPE_CLOUD_PROVIDER, NULL);
-  priv = cloud_provider_get_instance_private (self);
+  self = g_object_new (TYPE_CLOUD_PROVIDER_EXPORTER, NULL);
+  priv = cloud_provider_exporter_get_instance_private (self);
 
   priv->bus_name = g_strdup (bus_name);
   priv->object_path = g_strdup (object_path);
@@ -274,10 +274,10 @@ cloud_provider_new (GDBusConnection *bus,
 }
 
 static void
-cloud_provider_finalize (GObject *object)
+cloud_provider_exporter_finalize (GObject *object)
 {
-  CloudProvider *self = (CloudProvider *)object;
-  CloudProviderPrivate *priv = cloud_provider_get_instance_private (self);
+  CloudProviderExporter *self = (CloudProviderExporter *)object;
+  CloudProviderExporterPrivate *priv = cloud_provider_exporter_get_instance_private (self);
 
   g_cancellable_cancel (priv->cancellable);
   g_clear_object (&priv->cancellable);
@@ -291,17 +291,17 @@ cloud_provider_finalize (GObject *object)
   g_hash_table_remove_all(priv->actionGroups);
   g_object_unref(priv->actionGroups);
 
-  G_OBJECT_CLASS (cloud_provider_parent_class)->finalize (object);
+  G_OBJECT_CLASS (cloud_provider_exporter_parent_class)->finalize (object);
 }
 
 static void
-cloud_provider_class_init (CloudProviderClass *klass)
+cloud_provider_exporter_class_init (CloudProviderExporterClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  object_class->finalize = cloud_provider_finalize;
+  object_class->finalize = cloud_provider_exporter_finalize;
 }
 
 static void
-cloud_provider_init (CloudProvider *self)
+cloud_provider_exporter_init (CloudProviderExporter *self)
 {
 }
diff --git a/src/cloudproviderexporter.h b/src/cloudproviderexporter.h
new file mode 100644
index 0000000..4023999
--- /dev/null
+++ b/src/cloudproviderexporter.h
@@ -0,0 +1,93 @@
+/* cloudprovider.h
+ *
+ * Copyright (C) 2017 Julius Haertl <jus bitgrid net>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef CLOUD_PROVIDER_EXPORTER_H
+#define CLOUD_PROVIDER_EXPORTER_H
+
+#include "cloudprovider-generated.h"
+/* for CloudProviderStatus enum */
+#include "cloudprovideraccount.h"
+#include "cloudprovideraccountexporter.h"
+
+G_BEGIN_DECLS
+
+#define TYPE_CLOUD_PROVIDER_EXPORTER             (cloud_provider_exporter_get_type())
+#define CLOUD_PROVIDER_EXPORTER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
TYPE_CLOUD_PROVIDER_EXPORTER, CloudProviderExporter))
+#define CLOUD_PROVIDER_EXPORTER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), 
TYPE_CLOUD_PROVIDER_EXPORTER, CloudProviderExporterClass))
+#define IS_CLOUD_PROVIDER_EXPORTER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
TYPE_CLOUD_PROVIDER_EXPORTER))
+#define IS_CLOUD_PROVIDER_EXPORTER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), 
TYPE_CLOUD_PROVIDER_EXPORTER))
+#define CLOUD_PROVIDER_EXPORTER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), 
TYPE_CLOUD_PROVIDER_EXPORTER, CloudProviderExporterClass))
+
+typedef struct _CloudProviderExporter CloudProviderExporter;
+typedef struct _CloudProviderExporterClass CloudProviderExporterClass;
+
+
+struct _CloudProviderExporterClass
+{
+  GObjectClass parent_class;
+};
+
+struct _CloudProviderExporter
+{
+  GObject parent_instance;
+};
+
+GType
+cloud_provider_exporter_get_type (void) G_GNUC_CONST;
+void
+cloud_provider_exporter_export_account (CloudProviderExporter *cloud_provider_exporter,
+                                        const gchar           *account_name,
+                                        CloudProviderAccount1 *account);
+void
+cloud_provider_exporter_unexport_account (CloudProviderExporter *cloud_provider_exporter,
+                                          const gchar           *account_name);
+guint
+cloud_provider_exporter_export_menu (CloudProviderExporter *cloud_provider_exporter,
+                                     const gchar           *account_name,
+                                     GMenuModel            *model);
+void
+cloud_provider_exporter_unexport_menu (CloudProviderExporter *cloud_provider_exporter,
+                                       const gchar           *account_name);
+guint
+cloud_provider_exporter_export_action_group (CloudProviderExporter *cloud_provider_exporter,
+                                             const gchar           *account_name,
+                                             GActionGroup          *action_group);
+void
+cloud_provider_exporter_unexport_action_group (CloudProviderExporter *cloud_provider_exporter,
+                                               const gchar           *account_name);
+
+void
+cloud_provider_exporter_add_account (CloudProviderExporter        *cloud_provider_exporter,
+                                     CloudProviderAccountExporter *account);
+
+void
+cloud_provider_exporter_export_objects (CloudProviderExporter *cloud_provider_exporter);
+
+void
+cloud_provider_exporter_emit_changed (CloudProviderExporter *cloud_provider_exporter,
+                                      const gchar           *account_name);
+
+CloudProviderExporter*
+cloud_provider_exporter_new (GDBusConnection *bus,
+                             const gchar     *bus_name,
+                             const gchar     *object_path);
+
+G_END_DECLS
+
+
+#endif /* CLOUD_PROVIDER_EXPORTER_H */
diff --git a/src/meson.build b/src/meson.build
index f60d3b8..777b900 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -2,7 +2,7 @@ libcloudproviders_headers = [
   'cloudprovidermanager.h',
   'cloudprovideraccount.h',
   'cloudproviders.h',
-  'cloudprovider.h',
+  'cloudproviderexporter.h',
   'cloudprovideraccountexporter.h',
 ]
 
@@ -10,7 +10,7 @@ libcloudproviders_sources = [
   'cloudprovidermanager.c',
   'cloudprovideraccount.c',
   'cloudproviders.c',
-  'cloudprovider.c',
+  'cloudproviderexporter.c',
   'cloudprovideraccountexporter.c',
 ]
 
diff --git a/test/testcloudproviderserver.c b/test/testcloudproviderserver.c
index b276464..19d0853 100644
--- a/test/testcloudproviderserver.c
+++ b/test/testcloudproviderserver.c
@@ -1,7 +1,7 @@
 #include <glib.h>
 #include <stdlib.h>
 #include <gio/gio.h>
-#include <cloudprovider.h>
+#include <cloudproviderexporter.h>
 #include <cloudprovideraccountexporter.h>
 /* for CLoudProviderStatus enum */
 #include <cloudprovideraccount.h>
@@ -30,7 +30,7 @@ struct _TestCloudProvider
   gchar *path;
   guint timeout_handler;
   GDBusConnection *connection;
-  CloudProvider *cloud_provider;
+  CloudProviderExporter *cloud_provider;
   GDBusObjectManagerServer *manager;
 };
 
@@ -232,7 +232,7 @@ change_random_cloud_provider_state (gpointer user_data)
   account_object_name = g_strdup_printf ("MyCloud%d", account_id);
   g_print ("Change status of %03d to %d\n", account_id, new_status);
   test_cloud_provider_set_status (test_cloud_provider, new_status);
-  cloud_provider_emit_changed (test_cloud_provider->cloud_provider, account_object_name);
+  cloud_provider_exporter_emit_changed (test_cloud_provider->cloud_provider, account_object_name);
   return TRUE;
 }
 
@@ -298,9 +298,9 @@ on_bus_acquired (GDBusConnection *connection,
   guint n;
 
   self->connection = connection;
-  self->cloud_provider = cloud_provider_new(self->connection,
-                                            TEST_CLOUD_PROVIDER_BUS_NAME,
-                                            TEST_CLOUD_PROVIDER_OBJECT_PATH);
+  self->cloud_provider = cloud_provider_exporter_new(self->connection,
+                                                     TEST_CLOUD_PROVIDER_BUS_NAME,
+                                                     TEST_CLOUD_PROVIDER_OBJECT_PATH);
 
   g_debug ("Registering cloud provider server 'MyCloud'\n");
 
@@ -317,14 +317,14 @@ on_bus_acquired (GDBusConnection *connection,
       g_signal_connect(cloud_provider_account_exporter, "handle_get_status", G_CALLBACK (on_get_status), 
self);
       g_signal_connect(cloud_provider_account_exporter, "handle_get_status_details", G_CALLBACK 
(on_get_status_details), self);
 
-      cloud_provider_add_account(self->cloud_provider, cloud_provider_account_exporter);
-      cloud_provider_export_menu (self->cloud_provider, account_object_name, get_model ());
-      cloud_provider_export_action_group (self->cloud_provider, account_object_name, get_action_group ());
+      cloud_provider_exporter_add_account(self->cloud_provider, cloud_provider_account_exporter);
+      cloud_provider_exporter_export_menu (self->cloud_provider, account_object_name, get_model ());
+      cloud_provider_exporter_export_action_group (self->cloud_provider, account_object_name, 
get_action_group ());
 
       g_free(account_object_name);
     }
 
-  cloud_provider_export_objects (self->cloud_provider);
+  cloud_provider_exporter_export_objects (self->cloud_provider);
 
   return;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]