[Xfce4-commits] <xfconf:master> Remove unusable import and export options.

Nick Schermer noreply at xfce.org
Wed May 25 22:54:01 CEST 2011


Updating branch refs/heads/master
         to 4da808ec52afec087b82c16840bbe05aafa0135e (commit)
       from 86f5002978a8a232e0e9b9048ac3db62c703c4c2 (commit)

commit 4da808ec52afec087b82c16840bbe05aafa0135e
Author: Nick Schermer <nick at xfce.org>
Date:   Wed May 25 22:00:01 2011 +0200

    Remove unusable import and export options.
    
    We can add this back when it is actually implemented.

 xfconf-query/main.c |  113 +--------------------------------------------------
 1 files changed, 1 insertions(+), 112 deletions(-)

diff --git a/xfconf-query/main.c b/xfconf-query/main.c
index cae5164..bfc6dcc 100644
--- a/xfconf-query/main.c
+++ b/xfconf-query/main.c
@@ -73,8 +73,6 @@ static gchar *channel_name = NULL;
 static gchar *property_name = NULL;
 static gchar **set_value = NULL;
 static gchar **type = NULL;
-static gchar *import_file = NULL;
-static gchar *export_file = NULL;
 
 static void
 xfconf_query_monitor (XfconfChannel *channel, const gchar *changed_property, GValue *property_value)
@@ -103,34 +101,6 @@ xfconf_query_monitor (XfconfChannel *channel, const gchar *changed_property, GVa
     }
 }
 
-static gboolean
-xfconf_query_import_channel (XfconfChannel *channel, gint fd, GError **error)
-{
-    if (error != NULL)
-    {
-        g_set_error (error, G_FILE_ERROR, 1, _("Export method not yet implemented"));
-    }
-    else
-    {
-        g_warning ("--import: Method not implemented");
-    }
-    return FALSE;
-}
-
-static gboolean
-xfconf_query_export_channel (XfconfChannel *channel, gint fd, GError **error)
-{
-    if (error != NULL)
-    {
-        g_set_error (error, G_FILE_ERROR, 1, _("Export not yet implemented"));
-    }
-    else
-    {
-        g_warning ("--export: Method not implemented");
-    }
-    return FALSE;
-}
-
 static void
 xfconf_query_get_propname_size (gpointer key, gpointer value, gpointer user_data)
 {
@@ -235,16 +205,6 @@ static GOptionEntry entries[] =
         N_("Invert an existing boolean property"),
         NULL
     },
-/*
-    {   "export", 'x', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &export_file,
-        N_("Export channel to file"),
-        NULL,
-    },
-    {   "import", 'i', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &import_file,
-        N_("Import channel from file"),
-        NULL,
-    },
-*/
     {   "monitor", 'm', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &monitor,
         N_("Monitor a channel for property changes"),
         NULL,
@@ -259,7 +219,6 @@ main(int argc, char **argv)
     GError *error= NULL;
     XfconfChannel *channel = NULL;
     gboolean prop_exists;
-    gint fd = -1;
     GOptionContext *context;
 
 #ifdef ENABLE_NLS
@@ -311,7 +270,7 @@ main(int argc, char **argv)
     }
 
     /** Check if the property is specified */
-    if(!property_name && !list && !export_file && !import_file && !monitor)
+    if(!property_name && !list && !monitor)
     {
         g_printerr("No property specified, aborting...\n");
         return 1;
@@ -329,18 +288,6 @@ main(int argc, char **argv)
         return 1;
     }
 
-    if (import_file && export_file)
-    {
-        g_printerr("--import and --export options can not be used together,\naborting...\n");
-        return 1;
-    }
-
-    if ((import_file || export_file) && (list || property_name || create || reset))
-    {
-        g_printerr("--import and --export options can not be used together with\n --create, --reset, --property and --list,\naborting...\n");
-        return 1;
-    }
-
     channel = xfconf_channel_new(channel_name);
     
     if (monitor)
@@ -586,63 +533,5 @@ main(int argc, char **argv)
         }
     }
 
-    if (export_file)
-    {
-        if (!strcmp(export_file, "-"))
-        {
-            /* Use stdout */
-            fd = fileno (stdout);
-        }
-        else
-        {
-            fd = open (export_file, O_CREAT | O_EXCL | O_WRONLY, 0);
-            if (fd < 0)
-            {
-                g_printerr (_("Could not create export file \"%s\": %s\n"), export_file, strerror (errno));
-                return 1;
-            }
-        }
-
-        if (!xfconf_query_export_channel (channel, fd, &error))
-        {
-            if (fd != fileno (stdout))
-                close (fd);
-            g_printerr (_("Could not create export file \"%s\": %s\n"), export_file, error->message);
-            g_error_free (error);
-            return 1;
-        }
-        if (fd != fileno (stdout))
-            close (fd);
-    }
-
-    if (import_file)
-    {
-        if (!strcmp(import_file, "-"))
-        {
-            /* Use stdin */
-            fd = fileno (stdin);
-        }
-        else
-        {
-            fd = open (import_file, O_RDONLY, 0);
-            if (fd < 0)
-            {
-                g_printerr (_("Could not open import file \"%s\": %s\n"), import_file, strerror (errno));
-                return 1;
-            }
-        }
-
-        if (!xfconf_query_import_channel (channel, fd, &error))
-        {
-            if (fd != fileno (stdin))
-                close (fd);
-            g_printerr (_("Could not parse import file \"%s\": %s\n"), import_file, error->message);
-            g_error_free (error);
-            return 1;
-        }
-        if (fd != fileno (stdin))
-            close (fd);
-    }
-
     return 0;
 }



More information about the Xfce4-commits mailing list