Control: tags -1 + patch

Attached is a patch that switches from GConf to GSettings.  I didn't
bother with the data conversion because src:gconf2 is likely to be
removed from the archive during this cycle so it won't be available to
users upgrading from buster to bullseye.
Description: Port to GSettings.
Author: Yavor Doganov <ya...@gnu.org>
Bug-Debian: https://bugs.debian.org/886074
Forwarded: no
Last-Update: 2019-10-22
---

--- gnome-phone-manager-0.69.orig/configure.in
+++ gnome-phone-manager-0.69/configure.in
@@ -26,7 +26,7 @@
 # i18n
 # ****
 
-IT_PROG_INTLTOOL([0.35.0])
+IT_PROG_INTLTOOL([0.50.1])
 
 GETTEXT_PACKAGE=gnome-phone-manager
 AC_SUBST([GETTEXT_PACKAGE])
@@ -35,8 +35,7 @@
 
 # ****
 
-AC_PATH_PROG(GCONFTOOL, gconftool-2)
-AM_GCONF_SOURCE_2
+GLIB_GSETTINGS
 
 dnl Evolution address book
 PKG_CHECK_MODULES(TMP_EVO, libebook-1.2,
@@ -46,7 +45,7 @@
 PKG_CHECK_MODULES(LIBGSM, glib-2.0 gobject-2.0 $GNOKII_REQS gthread-2.0 bluez 
$evo_pc_file)
 
 PKG_CHECK_MODULES(PHONEMGR, gtk+-3.0 >= 3.0 glib-2.0 >= 2.31.0
-       libcanberra-gtk3 gconf-2.0
+       libcanberra-gtk3
        $GNOME_BLUETOOTH_REQS $evo_pc_file
        gmodule-2.0 dbus-glib-1 gnome-icon-theme >= 2.19.1
 )
@@ -107,12 +106,6 @@
 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal, no)
 AC_SUBST(GLIB_GENMARSHAL)
 
-AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
-
-if test x"$GCONFTOOL" = xno; then
-  AC_MSG_ERROR([gconftool-2 executable not found in your path - should be 
installed with GConf])
-fi
-
 dnl ================================================================
 dnl set up data dir
 if test "x${datadir}" = 'x${prefix}/share'; then
@@ -144,7 +137,6 @@
 libgsm/Makefile
 cut-n-paste/Makefile
 cut-n-paste/e-contact-entry/Makefile
-cut-n-paste/gconf-bridge/Makefile
 src/Makefile
 gnome-bluetooth/Makefile
 telepathy/Makefile
--- gnome-phone-manager-0.69.orig/cut-n-paste/Makefile.am
+++ gnome-phone-manager-0.69/cut-n-paste/Makefile.am
@@ -1 +1 @@
-SUBDIRS = e-contact-entry gconf-bridge
+SUBDIRS = e-contact-entry
--- gnome-phone-manager-0.69.orig/data/Makefile.am
+++ gnome-phone-manager-0.69/data/Makefile.am
@@ -6,19 +6,8 @@
 uidir = $(pkgdatadir)
 ui_DATA = phonemgr.ui
 
-schema_in_files = gnome-phone-manager.schemas.in
-schemadir = $(GCONF_SCHEMA_FILE_DIR)
-schema_DATA = $(schema_in_files:.schemas.in=.schemas)
-@INTLTOOL_SCHEMAS_RULE@
-
-install-data-local: $(schema_DATA)
-if GCONF_SCHEMAS_INSTALL
-       if test -z "$(DESTDIR)" ; then \
-       for p in $^ ; do \
-               GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) 
--makefile-install-rule $$p 2>&1 > /dev/null; \
-       done \
-       fi
-endif
+gsettings_SCHEMAS = org.gnome.PhoneManager.gschema.xml
+@GSETTINGS_RULES@
 
 gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
 
@@ -33,6 +22,5 @@
                echo "***   $(gtk_update_icon_cache)"; \
        fi
 
-CLEANFILES = $(schema_DATA)
-EXTRA_DIST = $(ui_DATA) $(schema_in_files) $(man_MANS)
+EXTRA_DIST = $(ui_DATA) $(gsettings_SCHEMAS) $(man_MANS)
 
--- gnome-phone-manager-0.69.orig/data/gnome-phone-manager.schemas.in
+++ /dev/null
@@ -1,112 +0,0 @@
-<gconfschemafile>
-    <schemalist>    
-
-      <schema>
-        <key>/schemas/apps/gnome-phone-manager/connection_type</key>
-       <applyto>/apps/gnome-phone-manager/connection_type</applyto>
-       <owner>gnome-phone-manager</owner>
-       <type>int</type>
-       <default>0</default>
-       <locale name="C">
-         <short>The connection type used by gnome-phone-manager</short>
-         <long>
-           The connection type used by gnome-phone-manager:
-           Bluetooth is 0
-           Serial 1 is 1
-           Serial 2 is 2
-           IrDa is 3
-           Other connection types are 4
-         </long>
-       </locale>
-      </schema>
-
-      <schema>
-        <key>/schemas/apps/gnome-phone-manager/bluetooth_addr</key>
-       <applyto>/apps/gnome-phone-manager/bluetooth_addr</applyto>
-       <owner>gnome-phone-manager</owner>
-       <type>string</type>
-       <default></default>
-       <locale name="C">
-         <short>Bluetooth address of the device to connect to</short>
-         <long>
-           Bluetooth address of the device to connect to. Requires
-           connection_type to be 1 to be used.
-         </long>
-       </locale>
-      </schema>
-
-      <schema>
-        <key>/schemas/apps/gnome-phone-manager/other_serial</key>
-       <applyto>/apps/gnome-phone-manager/other_serial</applyto>
-       <owner>gnome-phone-manager</owner>
-       <type>string</type>
-       <default></default>
-       <locale name="C">
-         <short>The device node for the serial device to connect to</short>
-         <long>
-           The device node for the serial device to connect to. Requires
-           connection_type to be 4 to be used.
-         </long>
-       </locale>
-      </schema>
-
-      <schema>
-        <key>/schemas/apps/gnome-phone-manager/auto_retry</key>
-       <applyto>/apps/gnome-phone-manager/auto_retry</applyto>
-       <owner>gnome-phone-manager</owner>
-       <type>bool</type>
-       <default>true</default>
-       <locale name="C">
-         <short>Whether to retry connecting to the mobile phone</short>
-         <long>
-           Whether to retry connecting to the mobile phone if the connection
-           fails at some point.
-         </long>
-       </locale>
-      </schema>
-
-      <schema>
-        <key>/schemas/apps/gnome-phone-manager/sync_clock</key>
-       <applyto>/apps/gnome-phone-manager/sync_clock</applyto>
-       <owner>gnome-phone-manager</owner>
-       <type>bool</type>
-       <default>true</default>
-       <locale name="C">
-         <short>Whether to synchronise the phone clock with the 
computer's</short>
-         <long>
-           Whether to synchronise the phone clock with the computer's.
-         </long>
-       </locale>
-      </schema>
-
-      <schema>
-        <key>/schemas/apps/gnome-phone-manager/popup_messages</key>
-       <applyto>/apps/gnome-phone-manager/popup_messages</applyto>
-       <owner>gnome-phone-manager</owner>
-       <type>bool</type>
-       <default>false</default>
-       <locale name="C">
-         <short>Whether to popup new messages on the desktop</short>
-         <long>
-           Whether to popup new messages on the desktop as soon as they're
-           received, as opposed to showing them when clicking on the tray icon.
-         </long>
-       </locale>
-      </schema>
-
-      <schema>
-        <key>/schemas/apps/gnome-phone-manager/sound_alert</key>
-       <applyto>/apps/gnome-phone-manager/sound_alert</applyto>
-       <owner>gnome-phone-manager</owner>
-       <type>bool</type>
-       <default>true</default>
-       <locale name="C">
-         <short>Whether to play a sound alert when a new message comes 
in</short>
-         <long>
-           Whether to play a sound alert when a new message comes in.
-         </long>
-       </locale>
-      </schema>
-
-  </schemalist>
-</gconfschemafile>
--- gnome-phone-manager-0.69.orig/src/app.h
+++ gnome-phone-manager-0.69/src/app.h
@@ -23,7 +23,7 @@
 #define _APP_H
 
 #include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
+#include <gio/gio.h>
 
 #include "phonemgr-listener.h"
 #include "phonemgr-object.h"
@@ -39,7 +39,7 @@
        gboolean flashon;
 
        /* auxilliary controllers */
-       GConfClient *client;
+       GSettings *client;
        PhonemgrListener    *listener;
        PhonemgrObject      *object;
 
--- gnome-phone-manager-0.69.orig/src/connection.c
+++ gnome-phone-manager-0.69/src/connection.c
@@ -33,15 +33,13 @@
        char *dev = NULL;
        gboolean changed;
 
-       ctype = gconf_client_get_int (app->client,
-                                     CONFBASE"/connection_type", NULL);
+       ctype = g_settings_get_int (app->client, "connection-type");
        changed = FALSE;
 
        switch (ctype) {
                case CONNECTION_BLUETOOTH:
-                       dev = gconf_client_get_string (app->client,
-                                                      
CONFBASE"/bluetooth_addr",
-                                                      NULL);
+                       dev = g_settings_get_string (app->client,
+                                                    "bluetooth-addr");
                        if (!dev || strlen (dev) != 17) {
                                g_free (dev);
                                dev = NULL;
@@ -57,8 +55,8 @@
                        dev = g_strdup ("/dev/ircomm0");
                        break;
                case CONNECTION_OTHER:
-                       dev = gconf_client_get_string (app->client,
-                                       CONFBASE"/other_serial", NULL);
+                       dev = g_settings_get_string (app->client,
+                                                    "other-serial");
                        break;
        }
 
@@ -82,8 +80,7 @@
 static gboolean
 attempt_reconnect (MyApp *app)
 {
-       if (gconf_client_get_bool (app->client,
-                               CONFBASE"/auto_retry", NULL) &&
+       if (g_settings_get_boolean (app->client, "auto-retry") &&
                        phonemgr_listener_connected (app->listener) == FALSE &&
                        app->connecting == FALSE) {
                g_message ("Auto-retrying the connection");
@@ -95,8 +92,7 @@
 static gboolean
 sync_clock (MyApp *app)
 {
-       if (gconf_client_get_bool (app->client,
-                               CONFBASE"/sync_clock", NULL)) {
+       if (g_settings_get_boolean (app->client, "sync-clock")) {
                g_message ("Syncing phone clock");
                phonemgr_listener_set_time (app->listener,
                                            time(NULL));
--- gnome-phone-manager-0.69.orig/src/main.c
+++ gnome-phone-manager-0.69/src/main.c
@@ -80,16 +80,12 @@
                return 0;
        }
 
-       gconf_init (argc, argv, NULL);
-
        app = g_new0 (MyApp, 1);
 
        /* Setup the D-Bus object */
        app->object = g_object_new (phonemgr_object_get_type (), NULL);
 
-       app->client = gconf_client_get_default ();
-       gconf_client_add_dir (app->client, CONFBASE,
-                             GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+       app->client = g_settings_new ("org.gnome.PhoneManager");
 
        /* Setup the listener */
        app->listener = phonemgr_listener_new (debug);
--- gnome-phone-manager-0.69.orig/src/phonemgr-conf.h
+++ gnome-phone-manager-0.69/src/phonemgr-conf.h
@@ -22,10 +22,6 @@
 #ifndef _PHONEMGR_CONF_H
 #define _PHONEMGR_CONF_H
 
-#include <gconf/gconf-client.h>
-
-#define CONFBASE "/apps/gnome-phone-manager"
-
 enum {
        CONNECTION_BLUETOOTH,
        CONNECTION_SERIAL1,
--- gnome-phone-manager-0.69.orig/src/ui.c
+++ gnome-phone-manager-0.69/src/ui.c
@@ -30,7 +30,6 @@
 
 #include "app.h"
 #include "e-phone-entry.h"
-#include "gconf-bridge.h"
 #include "phonemgr-utils.h"
 
 #define MAX_MESSAGE_LENGTH 160
@@ -102,7 +101,7 @@
 static gboolean
 idle_play_alert (MyApp *app)
 {
-       if (gconf_client_get_bool (app->client, CONFBASE"/sound_alert", NULL)) {
+       if (g_settings_get_boolean (app->client, "sound-alert")) {
                ca_context *ctx;
                ctx = ca_gtk_context_get ();
                ca_context_play (ctx, 0,
@@ -162,9 +161,7 @@
 
        widget_set_dependent_sensitive (widget, port, active);
        if (active) {
-               gconf_client_set_int (app->client,
-                                     CONFBASE"/connection_type",
-                                     port, NULL);
+               g_settings_set_int (app->client, "connection-type", port);
        }
 }
 
@@ -208,8 +205,7 @@
        char *widgetname;
        int ctype;
 
-       ctype = gconf_client_get_int (app->client,
-                                     CONFBASE"/connection_type", NULL);
+       ctype = g_settings_get_int (app->client, "connection-type");
        switch (ctype) {
        case CONNECTION_BLUETOOTH:
                widgetname = "btdevice";
@@ -385,11 +381,9 @@
 }
 
 static void
-initialise_dequeuer (GConfClient *client, guint cnxn_id,
-               GConfEntry *entry, MyApp *app)
+initialise_dequeuer (GSettings *settings, gchar *key, MyApp *app)
 {
-       if (gconf_client_get_bool (app->client,
-                               CONFBASE"/popup_messages", NULL)) {
+       if (g_settings_get_boolean (app->client, "popup-messages")) {
                app->popup_cb = g_timeout_add (250,
                                (GSourceFunc) dequeue_message, (gpointer) app);
        } else if (app->popup_cb) {
@@ -402,7 +396,6 @@
 ui_init (MyApp *app)
 {
        GtkWidget *btchooser, *btdevice;
-       GConfBridge *bridge;
        GtkWidget *ep = e_phone_entry_new ();
 
        app->ui = get_ui (app, NULL);
@@ -440,44 +433,32 @@
        s_connect (app, "otherport", "otherportentry", CONNECTION_OTHER);
 
        /* Connect a few toggle buttons */
-       bridge = gconf_bridge_get ();
-
-       gconf_bridge_bind_property (bridge,
-                                   CONFBASE"/auto_retry",
-                                   G_OBJECT (gtk_builder_get_object (app->ui, 
"auto_retry")),
-                                   "active");
-       gconf_bridge_bind_property (bridge,
-                                   CONFBASE"/sync_clock",
-                                   G_OBJECT (gtk_builder_get_object (app->ui, 
"sync_clock")),
-                                   "active");
-       gconf_bridge_bind_property (bridge,
-                                   CONFBASE"/popup_messages",
-                                   G_OBJECT (gtk_builder_get_object (app->ui, 
"prefs_popup")),
-                                   "active");
-       gconf_bridge_bind_property (bridge,
-                                   CONFBASE"/sound_alert",
-                                   G_OBJECT (gtk_builder_get_object (app->ui, 
"prefs_sound")),
-                                   "active");
+       g_settings_bind (app->client, "auto-retry",
+                        gtk_builder_get_object (app->ui, "auto_retry"),
+                        "active", G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind (app->client, "sync-clock",
+                        gtk_builder_get_object (app->ui, "sync_clock"),
+                        "active", G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind (app->client, "popup-messages",
+                        gtk_builder_get_object (app->ui, "prefs_popup"),
+                        "active", G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind (app->client, "sound-alert",
+                        gtk_builder_get_object (app->ui, "prefs_sound"),
+                        "active", G_SETTINGS_BIND_DEFAULT);
 
        /* The other port address */
-       gconf_bridge_bind_property_delayed (bridge,
-                                   CONFBASE"/other_serial",
-                                   G_OBJECT (gtk_builder_get_object (app->ui, 
"otherportentry")),
-                                   "text");
+       g_settings_bind (app->client, "other-serial",
+                        gtk_builder_get_object (app->ui, "otherportentry"),
+                        "text", G_SETTINGS_BIND_DEFAULT);
 
        /* And the address chooser */
-       gconf_bridge_bind_property (bridge,
-                                   CONFBASE"/bluetooth_addr",
-                                   G_OBJECT (btchooser),
-                                   "device");
+       g_settings_bind (app->client, "bluetooth-addr", btchooser,
+                        "device", G_SETTINGS_BIND_DEFAULT);
 
        /* set up popup on message */
-       initialise_dequeuer (NULL, 0, NULL, app);
-       gconf_client_notify_add (app->client,
-                       CONFBASE"/popup_messages",
-                       (GConfClientNotifyFunc) initialise_dequeuer,
-                       (gpointer) app,
-                       NULL, NULL);
+       g_signal_connect (app->client, "changed::popup-messages",
+                         G_CALLBACK (initialise_dequeuer), app);
+       initialise_dequeuer (NULL, NULL, app);
 }
 
 void
--- gnome-phone-manager-0.69.orig/src/Makefile.am
+++ gnome-phone-manager-0.69/src/Makefile.am
@@ -9,8 +9,6 @@
        -I$(builddir)/../libgsm \
        -I$(srcdir)/../cut-n-paste/e-contact-entry      \
        -I$(builddir)/../cut-n-paste/e-contact-entry    \
-       -I$(srcdir)/../cut-n-paste/gconf-bridge         \
-       -I$(builddir)/../cut-n-paste/gconf-bridge       \
        -I$(builddir)/src                               \
        $(WARN_CFLAGS)
 
@@ -33,8 +31,7 @@
 gnome_phone_manager_LDADD = \
        ../cut-n-paste/e-contact-entry/libecontact-entry.la     \
        $(PHONEMGR_LIBS) \
-       ../libgsm/libgsmwrap.la         \
-       ../cut-n-paste/gconf-bridge/libgconf-bridge.la
+       ../libgsm/libgsmwrap.la
 
 BUILT_SOURCES = phone-manager-interface.h
 
@@ -51,8 +48,7 @@
 test_entry_SOURCES = test-entry.c e-phone-entry.c e-phone-entry.h 
 test_entry_LDADD = \
                   ../cut-n-paste/e-contact-entry/libecontact-entry.la  \
-                  $(PHONEMGR_LIBS) \
-                  ../cut-n-paste/gconf-bridge/libgconf-bridge.la
+                  $(PHONEMGR_LIBS)
 
 BUILT_SOURCES += $(MARSHALFILES)
 
--- /dev/null
+++ gnome-phone-manager-0.69/data/org.gnome.PhoneManager.gschema.xml
@@ -0,0 +1,51 @@
+<schemalist>
+  <schema id="org.gnome.PhoneManager" path="/org/gnome/PhoneManager/"
+          gettext-domain="gnome-phone-manager">
+    <key name="connection-type" type="i">
+      <default>0</default>
+      <summary>The connection type used by gnome-phone-manager</summary>
+      <description>The connection type used by gnome-phone-manager:
+      Bluetooth is 0 Serial 1 is 1 Serial 2 is 2 IrDa is 3 Other
+      connection types are 4</description>
+    </key>
+    <key name="bluetooth-addr" type="s">
+      <default>''</default>
+      <summary>Bluetooth address of the device to connect to</summary>
+      <description>Bluetooth address of the device to connect
+      to. Requires connection_type to be 1 to be used.</description>
+    </key>
+    <key name="other-serial" type="s">
+      <default>''</default>
+      <summary>The device node for the serial device to connect to</summary>
+      <description>The device node for the serial device to connect
+      to. Requires connection_type to be 4 to be used.</description>
+    </key>
+    <key name="auto-retry" type="b">
+      <default>true</default>
+      <summary>Whether to retry connecting to the mobile phone</summary>
+      <description>Whether to retry connecting to the mobile phone if
+      the connection fails at some point.</description>
+    </key>
+    <key name="sync-clock" type="b">
+      <default>true</default>
+      <summary>Whether to synchronise the phone clock with the
+      computer's</summary>
+      <description>Whether to synchronise the phone clock with the
+      computer's.</description>
+    </key>
+    <key name="popup-messages" type="b">
+      <default>false</default>
+      <summary>Whether to popup new messages on the desktop</summary>
+      <description>Whether to popup new messages on the desktop as
+      soon as they're received, as opposed to showing them when
+      clicking on the tray icon.</description>
+    </key>
+    <key name="sound-alert" type="b">
+      <default>true</default>
+      <summary>Whether to play a sound alert when a new message comes
+      in</summary>
+      <description>Whether to play a sound alert when a new message
+      comes in.</description>
+    </key>
+  </schema>
+</schemalist>
--- gnome-phone-manager-0.69.orig/po/POTFILES.in
+++ gnome-phone-manager-0.69/po/POTFILES.in
@@ -2,7 +2,7 @@
 # Please keep this file sorted alphabetically.
 cut-n-paste/e-contact-entry/e-contact-entry.c
 cut-n-paste/gconf-bridge/gconf-bridge.c
-data/gnome-phone-manager.schemas.in
+[type: gettext/gsettings]data/org.gnome.PhoneManager.gschema.xml
 [type: gettext/glade]data/phonemgr.ui
 gnome-bluetooth/phonemgr.c
 libgsm/glibgsmtest.c

Reply via email to