[devhelp] DconfMigration: improve API



commit f0e4c449aec15b4bcf8e1b131a47dc6eaed608fb
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed May 29 15:10:37 2019 +0200

    DconfMigration: improve API
    
    Just rename free() to sync_and_free(), since the sync is important to
    do (so it's better to be aware of it).
    
    And move the function in such a manner that it is the same order as how
    the functions should be called (the sync_and_free() is done at the end).
    
    Note, DhDconfMigration is actually not used by Devhelp, it was written
    as an experiment for future-proofness of DhSettings. But
    DhDconfMigration *is* used by GNOME LaTeX, to handle the app rename
    (LaTeXila -> GNOME LaTeX). But this place is the upstream place for
    DhDconfMigration.

 devhelp/future/dh-dconf-migration.c | 26 +++++++++++++-------------
 devhelp/future/dh-dconf-migration.h | 14 +++++++-------
 2 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/devhelp/future/dh-dconf-migration.c b/devhelp/future/dh-dconf-migration.c
index 653a96ca..304b6973 100644
--- a/devhelp/future/dh-dconf-migration.c
+++ b/devhelp/future/dh-dconf-migration.c
@@ -2,7 +2,7 @@
 /*
  * This file is part of Devhelp.
  *
- * Copyright (C) 2018 Sébastien Wilmet <swilmet gnome org>
+ * Copyright (C) 2018, 2019 Sébastien Wilmet <swilmet gnome org>
  *
  * Devhelp is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published
@@ -63,18 +63,6 @@ _dh_dconf_migration_new (void)
         return migration;
 }
 
-void
-_dh_dconf_migration_free (DhDconfMigration *migration)
-{
-        if (migration == NULL)
-                return;
-
-        dconf_client_sync (migration->client);
-
-        g_object_unref (migration->client);
-        g_free (migration);
-}
-
 /*
  * _dh_dconf_migration_migrate_key:
  * @migration: a #DhDconfMigration.
@@ -140,3 +128,15 @@ _dh_dconf_migration_migrate_key (DhDconfMigration *migration,
 
         va_end (old_key_paths);
 }
+
+void
+_dh_dconf_migration_sync_and_free (DhDconfMigration *migration)
+{
+        if (migration == NULL)
+                return;
+
+        dconf_client_sync (migration->client);
+
+        g_object_unref (migration->client);
+        g_free (migration);
+}
diff --git a/devhelp/future/dh-dconf-migration.h b/devhelp/future/dh-dconf-migration.h
index 3e671044..5b263f9b 100644
--- a/devhelp/future/dh-dconf-migration.h
+++ b/devhelp/future/dh-dconf-migration.h
@@ -2,7 +2,7 @@
 /*
  * This file is part of Devhelp.
  *
- * Copyright (C) 2018 Sébastien Wilmet <swilmet gnome org>
+ * Copyright (C) 2018, 2019 Sébastien Wilmet <swilmet gnome org>
  *
  * Devhelp is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published
@@ -28,16 +28,16 @@ G_BEGIN_DECLS
 typedef struct _DhDconfMigration DhDconfMigration;
 
 G_GNUC_INTERNAL
-DhDconfMigration *      _dh_dconf_migration_new         (void);
+DhDconfMigration *      _dh_dconf_migration_new                 (void);
 
 G_GNUC_INTERNAL
-void                    _dh_dconf_migration_free        (DhDconfMigration *migration);
+void                    _dh_dconf_migration_migrate_key         (DhDconfMigration *migration,
+                                                                 const gchar      *new_key_path,
+                                                                 const gchar      *first_old_key_path,
+                                                                 ...);
 
 G_GNUC_INTERNAL
-void                    _dh_dconf_migration_migrate_key (DhDconfMigration *migration,
-                                                         const gchar      *new_key_path,
-                                                         const gchar      *first_old_key_path,
-                                                         ...);
+void                    _dh_dconf_migration_sync_and_free       (DhDconfMigration *migration);
 
 G_END_DECLS
 


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