[dconf] rename client to engine



commit e77a72c307042710b3f3ad8f35cc7e93676b566c
Author: Ryan Lortie <desrt desrt ca>
Date:   Fri May 21 18:49:13 2010 -0400

    rename client to engine

 client/dconf-client.c => engine/dconf-engine.c |  102 ++++++++++++------------
 client/dconf-client.h => engine/dconf-engine.h |   68 ++++++++--------
 gsettings/Makefile.am                          |    4 +-
 gsettings/dconfsettingsbackend.c               |   56 +++++++-------
 4 files changed, 115 insertions(+), 115 deletions(-)
---
diff --git a/client/dconf-client.c b/engine/dconf-engine.c
similarity index 50%
rename from client/dconf-client.c
rename to engine/dconf-engine.c
index d1a959c..1ab84a7 100644
--- a/client/dconf-client.c
+++ b/engine/dconf-engine.c
@@ -1,49 +1,49 @@
 
-#include "dconf-client.h"
+#include "dconf-engine.h"
 #include <gvdb/gvdb-reader.h>
 
-struct _DConfClient
+struct _DConfEngine
 {
   gint ref_count;
 };
 
-DConfClient *
-dconf_client_new (DConfClientServiceFunc service_func)
+DConfEngine *
+dconf_engine_new (DConfEngineServiceFunc service_func)
 {
-  DConfClient *client;
+  DConfEngine *engine;
 
-  client = g_slice_new (DConfClient);
-  client->ref_count = 1;
+  engine = g_slice_new (DConfEngine);
+  engine->ref_count = 1;
 
-  return client;
+  return engine;
 }
 
-DConfClient *
-dconf_client_ref (DConfClient *client)
+DConfEngine *
+dconf_engine_ref (DConfEngine *engine)
 {
-  g_atomic_int_inc (&client->ref_count);
+  g_atomic_int_inc (&engine->ref_count);
 
-  return client;
+  return engine;
 }
 
 void
-dconf_client_unref (DConfClient *client)
+dconf_engine_unref (DConfEngine *engine)
 {
-  if (g_atomic_int_dec_and_test (&client->ref_count))
-    g_slice_free (DConfClient, client);
+  if (g_atomic_int_dec_and_test (&engine->ref_count))
+    g_slice_free (DConfEngine, engine);
 }
 
 GVariant *
-dconf_client_read (DConfClient        *client,
+dconf_engine_read (DConfEngine        *engine,
                    const gchar        *key,
                    const GVariantType *required_type,
-                   DConfClientReadType type)
+                   DConfEngineReadType type)
 {
   GvdbTable *table;
   GVariant *value;
   gchar *filename;
 
-  if (type == DCONF_CLIENT_READ_RESET)
+  if (type == DCONF_ENGINE_READ_RESET)
     return NULL;
 
   filename = g_build_filename (g_get_user_config_dir (), "dconf", NULL);
@@ -58,47 +58,47 @@ dconf_client_read (DConfClient        *client,
 }
 
 static void
-dconf_client_make_match_rule (DConfClient        *client,
-                              DConfClientMessage *dccm,
+dconf_engine_make_match_rule (DConfEngine        *engine,
+                              DConfEngineMessage *dcem,
                               const gchar        *name)
 {
   gchar *rule;
 
   rule = g_strdup_printf ("interface='ca.desrt.dconf.Writer',"
                           "arg1path='%s'", name);
-  dccm->bus_type = 'e';
-  dccm->destination = "org.freedesktop.DBus";
-  dccm->object_path = "/";
-  dccm->interface = "org.freedesktop.DBus";
-  dccm->body = g_variant_ref_sink (g_variant_new ("(s)", rule));
+  dcem->bus_type = 'e';
+  dcem->destination = "org.freedesktop.DBus";
+  dcem->object_path = "/";
+  dcem->interface = "org.freedesktop.DBus";
+  dcem->body = g_variant_ref_sink (g_variant_new ("(s)", rule));
   g_free (rule);
 }
 
 void
-dconf_client_watch (DConfClient        *client,
-                    DConfClientMessage *dccm,
+dconf_engine_watch (DConfEngine        *engine,
+                    DConfEngineMessage *dcem,
                     const gchar        *name)
 {
-  dconf_client_make_match_rule (client, dccm, name);
-  dccm->method = "AddMatch";
+  dconf_engine_make_match_rule (engine, dcem, name);
+  dcem->method = "AddMatch";
 }
 
 void
-dconf_client_unwatch (DConfClient        *client,
-                      DConfClientMessage *dccm,
+dconf_engine_unwatch (DConfEngine        *engine,
+                      DConfEngineMessage *dcem,
                       const gchar        *name)
 {
-  dconf_client_make_match_rule (client, dccm, name);
-  dccm->method = "RemoveMatch";
+  dconf_engine_make_match_rule (engine, dcem, name);
+  dcem->method = "RemoveMatch";
 }
 
 gboolean
-dconf_client_is_writable (DConfClient        *client,
-                          DConfClientMessage *dccm,
+dconf_engine_is_writable (DConfEngine        *engine,
+                          DConfEngineMessage *dcem,
                           const gchar        *name)
 {
-  dccm->bus_type = 'e';
-  dccm->body = NULL;
+  dcem->bus_type = 'e';
+  dcem->body = NULL;
 
   return TRUE;
 }
@@ -117,33 +117,33 @@ fake_maybe (GVariant *value)
 }
 
 static void
-dconf_client_dccm (DConfClient        *client,
-                   DConfClientMessage *dccm,
+dconf_engine_dcem (DConfEngine        *engine,
+                   DConfEngineMessage *dcem,
                    const gchar        *method,
                    const gchar        *format_string,
                    ...)
 {
   va_list ap;
 
-  dccm->bus_type = 'e';
-  dccm->destination = "ca.desrt.dconf";
-  dccm->object_path = "/";
-  dccm->interface = "ca.desrt.dconf.Writer";
-  dccm->method = method;
+  dcem->bus_type = 'e';
+  dcem->destination = "ca.desrt.dconf";
+  dcem->object_path = "/";
+  dcem->interface = "ca.desrt.dconf.Writer";
+  dcem->method = method;
 
   va_start (ap, format_string);
-  dccm->body = g_variant_ref_sink (g_variant_new_va (format_string,
+  dcem->body = g_variant_ref_sink (g_variant_new_va (format_string,
                                                      NULL, &ap));
   va_end (ap);
 }
 
 gboolean
-dconf_client_write (DConfClient        *client,
-                    DConfClientMessage *dccm,
+dconf_engine_write (DConfEngine        *engine,
+                    DConfEngineMessage *dcem,
                     const gchar        *name,
                     GVariant           *value)
 {
-  dconf_client_dccm (client, dccm,
+  dconf_engine_dcem (engine, dcem,
                      "Write", "(s av)",
                      name, fake_maybe (value));
 
@@ -151,8 +151,8 @@ dconf_client_write (DConfClient        *client,
 }
 
 gboolean
-dconf_client_write_many (DConfClient          *client,
-                         DConfClientMessage   *dccm,
+dconf_engine_write_many (DConfEngine          *engine,
+                         DConfEngineMessage   *dcem,
                          const gchar          *prefix,
                          const gchar * const  *keys,
                          GVariant            **values)
@@ -166,7 +166,7 @@ dconf_client_write_many (DConfClient          *client,
     g_variant_builder_add (&builder, "(s av)",
                            keys[i], fake_maybe (values[i]));
 
-  dconf_client_dccm (client, dccm, "Merge", "(sa(sav))", prefix, &builder);
+  dconf_engine_dcem (engine, dcem, "Merge", "(sa(sav))", prefix, &builder);
 
   return TRUE;
 }
diff --git a/client/dconf-client.h b/engine/dconf-engine.h
similarity index 51%
rename from client/dconf-client.h
rename to engine/dconf-engine.h
index b6ae36a..e3d8b40 100644
--- a/client/dconf-client.h
+++ b/engine/dconf-engine.h
@@ -1,17 +1,17 @@
-#ifndef _dconf_client_h_
-#define _dconf_client_h_
+#ifndef _dconf_engine_h_
+#define _dconf_engine_h_
 
 #include <glib.h>
 
-typedef struct _DConfClient DConfClient;
-typedef struct _DConfClientResetList DConfClientResetList;
+typedef struct _DConfEngine DConfEngine;
+typedef struct _DConfEngineResetList DConfEngineResetList;
 
 typedef enum
 {
-  DCONF_CLIENT_READ_NORMAL,
-  DCONF_CLIENT_READ_SET,
-  DCONF_CLIENT_READ_RESET
-} DConfClientReadType;
+  DCONF_ENGINE_READ_NORMAL,
+  DCONF_ENGINE_READ_SET,
+  DCONF_ENGINE_READ_RESET
+} DConfEngineReadType;
 
 typedef struct
 {
@@ -21,54 +21,54 @@ typedef struct
   const gchar *interface;
   const gchar *method;
   GVariant    *body;
-} DConfClientMessage;
+} DConfEngineMessage;
 
 
 
-typedef GVariant *    (*DConfClientServiceFunc)                         (DConfClient             *client,
-                                                                         DConfClientMessage      *message);
+typedef GVariant *    (*DConfEngineServiceFunc)                         (DConfEngine             *engine,
+                                                                         DConfEngineMessage      *message);
 
-DConfClient *           dconf_client_new                                (DConfClientServiceFunc   service_func);
-void                    dconf_client_unref                              (DConfClient             *client);
-DConfClient *           dconf_client_ref                                (DConfClient             *client);
+DConfEngine *           dconf_engine_new                                (DConfEngineServiceFunc   service_func);
+void                    dconf_engine_unref                              (DConfEngine             *engine);
+DConfEngine *           dconf_engine_ref                                (DConfEngine             *engine);
 
-GVariant *              dconf_client_read                               (DConfClient             *client,
+GVariant *              dconf_engine_read                               (DConfEngine             *engine,
                                                                          const gchar             *key,
                                                                          const GVariantType      *required_type,
-                                                                         DConfClientReadType      type);
-gchar **                dconf_client_list                               (DConfClient             *client,
+                                                                         DConfEngineReadType      type);
+gchar **                dconf_engine_list                               (DConfEngine             *engine,
                                                                          const gchar             *path,
-                                                                         DConfClientResetList    *resets);
+                                                                         DConfEngineResetList    *resets);
 
-void                    dconf_client_get_service_info                   (DConfClient             *client,
+void                    dconf_engine_get_service_info                   (DConfEngine             *engine,
                                                                          const gchar            **bus_type,
                                                                          const gchar            **destination,
                                                                          const gchar            **object_path);
-gboolean                dconf_client_is_writable                        (DConfClient             *client,
-                                                                         DConfClientMessage      *message,
+gboolean                dconf_engine_is_writable                        (DConfEngine             *engine,
+                                                                         DConfEngineMessage      *message,
                                                                          const gchar             *name);
-gboolean                dconf_client_write                              (DConfClient             *client,
-                                                                         DConfClientMessage      *message,
+gboolean                dconf_engine_write                              (DConfEngine             *engine,
+                                                                         DConfEngineMessage      *message,
                                                                          const gchar             *key,
                                                                          GVariant                *value);
-gboolean                dconf_client_write_tree                         (DConfClient             *client,
-                                                                         DConfClientMessage      *message,
+gboolean                dconf_engine_write_tree                         (DConfEngine             *engine,
+                                                                         DConfEngineMessage      *message,
                                                                          GTree                   *tree);
-void                    dconf_client_watch                              (DConfClient             *client,
-                                                                         DConfClientMessage      *message,
+void                    dconf_engine_watch                              (DConfEngine             *engine,
+                                                                         DConfEngineMessage      *message,
                                                                          const gchar             *name);
-void                    dconf_client_unwatch                            (DConfClient             *client,
-                                                                         DConfClientMessage      *message,
+void                    dconf_engine_unwatch                            (DConfEngine             *engine,
+                                                                         DConfEngineMessage      *message,
                                                                          const gchar             *name);
-void                    dconf_client_decode_notify                      (DConfClient             *client,
+void                    dconf_engine_decode_notify                      (DConfEngine             *engine,
                                                                          const gchar            **prefix,
                                                                          const gchar           ***keys,
                                                                          GVariant                *body);
 
-void                    dconf_client_reset_list_init                    (DConfClientResetList    *resets,
+void                    dconf_engine_reset_list_init                    (DConfEngineResetList    *resets,
                                                                          const gchar * const     *list);
-void                    dconf_client_reset_list_add                     (DConfClientResetList    *resets,
+void                    dconf_engine_reset_list_add                     (DConfEngineResetList    *resets,
                                                                          const gchar             *item);
-void                    dconf_client_reset_list_clear                   (DConfClientResetList    *resets);
+void                    dconf_engine_reset_list_clear                   (DConfEngineResetList    *resets);
 
-#endif /* _dconf_client_h_ */
+#endif /* _dconf_engine_h_ */
diff --git a/gsettings/Makefile.am b/gsettings/Makefile.am
index c19a92f..3e8f4c0 100644
--- a/gsettings/Makefile.am
+++ b/gsettings/Makefile.am
@@ -5,8 +5,8 @@ giomodules_LTLIBRARIES = libdconfsettings.la
 libdconfsettings_la_LIBADD = $(gio_LIBS)
 libdconfsettings_la_LDFLAGS = -module -avoid-version -shared
 libdconfsettings_la_SOURCES = \
-	../client/dconf-client.h\
-	../client/dconf-client.c\
+	../engine/dconf-engine.h\
+	../engine/dconf-engine.c\
 	../gvdb/gvdb-reader.c	\
 	dconfsettingsbackend.c
 
diff --git a/gsettings/dconfsettingsbackend.c b/gsettings/dconfsettingsbackend.c
index 0c49865..b0ff876 100644
--- a/gsettings/dconfsettingsbackend.c
+++ b/gsettings/dconfsettingsbackend.c
@@ -21,7 +21,7 @@
 
 #define G_SETTINGS_ENABLE_BACKEND
 #include <gio/gsettingsbackend.h>
-#include <client/dconf-client.h>
+#include <engine/dconf-engine.h>
 #include <gio/gio.h>
 
 #include <string.h>
@@ -34,7 +34,7 @@ typedef struct
   GSettingsBackend backend;
   GStaticMutex lock;
 
-  DConfClient *client;
+  DConfEngine *engine;
 
   Outstanding *outstanding;
   GDBusConnection *bus;
@@ -248,7 +248,7 @@ dconf_settings_backend_read (GSettingsBackend   *backend,
                              gboolean            default_value)
 {
   DConfSettingsBackend *dcsb = (DConfSettingsBackend *) backend;
-  DConfClientReadType type;
+  DConfEngineReadType type;
 
   if (!default_value)
     {
@@ -257,26 +257,26 @@ dconf_settings_backend_read (GSettingsBackend   *backend,
       if (dconf_settings_backend_scan_outstanding (dcsb, key, &value))
         return value;
 
-      type = DCONF_CLIENT_READ_NORMAL;
+      type = DCONF_ENGINE_READ_NORMAL;
     }
   else
-    type = DCONF_CLIENT_READ_RESET;
+    type = DCONF_ENGINE_READ_RESET;
 
-  return dconf_client_read (dcsb->client, key, expected_type, type);
+  return dconf_engine_read (dcsb->engine, key, expected_type, type);
 }
 
 static void
 dconf_settings_backend_send (GDBusConnection    *bus,
-                             DConfClientMessage *dccm,
+                             DConfEngineMessage *dcem,
                              volatile guint32   *serial)
 {
   GDBusMessage *message;
 
-  message = g_dbus_message_new_method_call (dccm->destination,
-                                            dccm->object_path,
-                                            dccm->interface,
-                                            dccm->method);
-  g_dbus_message_set_body (message, dccm->body);
+  message = g_dbus_message_new_method_call (dcem->destination,
+                                            dcem->object_path,
+                                            dcem->interface,
+                                            dcem->method);
+  g_dbus_message_set_body (message, dcem->body);
 
   if (serial)
     g_dbus_connection_send_message (bus, message, serial, NULL);
@@ -284,15 +284,15 @@ dconf_settings_backend_send (GDBusConnection    *bus,
     g_dbus_connection_send_message_with_reply_sync (bus, message, -1,
                                                     NULL, NULL, NULL);
 
-  g_variant_unref (dccm->body);
+  g_variant_unref (dcem->body);
   g_object_unref (message);
 }
 
 static gboolean
 dconf_settings_backend_get_bus (GDBusConnection    **bus,
-                                DConfClientMessage  *dccm)
+                                DConfEngineMessage  *dcem)
 {
-  switch (dccm->bus_type)
+  switch (dcem->bus_type)
     {
     case 'e':
       *bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
@@ -306,8 +306,8 @@ dconf_settings_backend_get_bus (GDBusConnection    **bus,
       g_assert_not_reached ();
     }
 
-  if (*bus == NULL && dccm->body)
-    g_variant_unref (dccm->body);
+  if (*bus == NULL && dcem->body)
+    g_variant_unref (dcem->body);
 
   return *bus != NULL;
 }
@@ -319,11 +319,11 @@ dconf_settings_backend_write (GSettingsBackend *backend,
                               gpointer          origin_tag)
 {
   DConfSettingsBackend *dcsb = (DConfSettingsBackend *) backend;
-  DConfClientMessage message;
+  DConfEngineMessage message;
   volatile guint32 *serial;
   GDBusConnection *bus;
 
-  if (!dconf_client_write (dcsb->client, &message, path_or_key, value))
+  if (!dconf_engine_write (dcsb->engine, &message, path_or_key, value))
     return FALSE;
 
   if (!dconf_settings_backend_get_bus (&bus, &message))
@@ -350,7 +350,7 @@ dconf_settings_backend_write_tree (GSettingsBackend *backend,
                                    gpointer          origin_tag)
 {
   DConfSettingsBackend *dcsb = (DConfSettingsBackend *) backend;
-  DConfClientMessage message;
+  DConfEngineMessage message;
   volatile guint32 *serial;
   GDBusConnection *bus;
   const gchar **keys;
@@ -359,7 +359,7 @@ dconf_settings_backend_write_tree (GSettingsBackend *backend,
 
   g_settings_backend_flatten_tree (tree, &prefix, &keys, &values);
 
-  if (dconf_client_write_many (dcsb->client, &message, prefix, keys, values))
+  if (dconf_engine_write_many (dcsb->engine, &message, prefix, keys, values))
     {
       if (dconf_settings_backend_get_bus (&bus, &message))
         {
@@ -394,10 +394,10 @@ dconf_settings_backend_get_writable (GSettingsBackend *backend,
                                      const gchar      *name)
 {
   DConfSettingsBackend *dcsb = (DConfSettingsBackend *) backend;
-  DConfClientMessage message;
+  DConfEngineMessage message;
   GDBusConnection *bus;
 
-  if (!dconf_client_is_writable (dcsb->client, &message, name))
+  if (!dconf_engine_is_writable (dcsb->engine, &message, name))
     return FALSE;
 
   return dconf_settings_backend_get_bus (&bus, &message);
@@ -408,10 +408,10 @@ dconf_settings_backend_subscribe (GSettingsBackend *backend,
                                   const gchar      *name)
 {
   DConfSettingsBackend *dcsb = (DConfSettingsBackend *) backend;
-  DConfClientMessage message;
+  DConfEngineMessage message;
   GDBusConnection *bus;
 
-  dconf_client_watch (dcsb->client, &message, name);
+  dconf_engine_watch (dcsb->engine, &message, name);
 
   if (dconf_settings_backend_get_bus (&bus, &message))
     dconf_settings_backend_send (bus, &message, NULL);
@@ -422,10 +422,10 @@ dconf_settings_backend_unsubscribe (GSettingsBackend *backend,
                                     const gchar      *name)
 {
   DConfSettingsBackend *dcsb = (DConfSettingsBackend *) backend;
-  DConfClientMessage message;
+  DConfEngineMessage message;
   GDBusConnection *bus;
 
-  dconf_client_unwatch (dcsb->client, &message, name);
+  dconf_engine_unwatch (dcsb->engine, &message, name);
 
   if (dconf_settings_backend_get_bus (&bus, &message))
     dconf_settings_backend_send (bus, &message, NULL);
@@ -439,7 +439,7 @@ dconf_settings_backend_sync (GSettingsBackend *backend)
 static void
 dconf_settings_backend_init (DConfSettingsBackend *dcsb)
 {
-  dcsb->client = dconf_client_new (NULL);
+  dcsb->engine = dconf_engine_new (NULL);
 }
 
 static void



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