[Xfce4-commits] <xfce4-settings:nick/settings-manager> Cleanup main.

Nick Schermer noreply at xfce.org
Wed Jan 25 21:40:01 CET 2012


Updating branch refs/heads/nick/settings-manager
         to 7e92b148ae8a31d9d1c90a2e8bacb588d0d949d7 (commit)
       from 75481a5d3092b6b8a8caa84a0eb57759192294e8 (commit)

commit 7e92b148ae8a31d9d1c90a2e8bacb588d0d949d7
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Jan 25 21:37:40 2012 +0100

    Cleanup main.

 xfce4-settings-manager/Makefile.am                 |    2 -
 xfce4-settings-manager/main.c                      |   77 ++++++++------------
 .../xfce-settings-manager-dialog.c                 |    1 -
 3 files changed, 32 insertions(+), 48 deletions(-)

diff --git a/xfce4-settings-manager/Makefile.am b/xfce4-settings-manager/Makefile.am
index 84acfee..2fee266 100644
--- a/xfce4-settings-manager/Makefile.am
+++ b/xfce4-settings-manager/Makefile.am
@@ -20,7 +20,6 @@ xfce4_settings_manager_CFLAGS = \
 	$(GTK_CFLAGS) \
 	$(LIBXFCE4UTIL_CFLAGS) \
 	$(LIBXFCE4UI_CFLAGS) \
-	$(XFCONF_CFLAGS) \
 	$(GARCON_CFLAGS) \
 	$(EXO_CFLAGS) \
 	$(PLATFORM_CFLAGS)
@@ -33,7 +32,6 @@ xfce4_settings_manager_LDADD = \
 	$(GTK_LIBS) \
 	$(LIBXFCE4UTIL_LIBS) \
 	$(LIBXFCE4UI_LIBS) \
-	$(XFCONF_LIBS) \
 	$(EXO_LIBS) \
 	$(GARCON_LIBS)
 
diff --git a/xfce4-settings-manager/main.c b/xfce4-settings-manager/main.c
index 9ebab31..3a65879 100644
--- a/xfce4-settings-manager/main.c
+++ b/xfce4-settings-manager/main.c
@@ -26,7 +26,6 @@
 #endif
 
 #include <gtk/gtk.h>
-#include <xfconf/xfconf.h>
 #include <libxfce4util/libxfce4util.h>
 #include <garcon/garcon.h>
 
@@ -35,67 +34,60 @@
 static gboolean opt_version = FALSE;
 static gchar   *opt_dialog = NULL;
 
-static GOptionEntry option_entries[] = {
-    { "version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_version,
-      N_("Version information"), NULL },
-    { "dialog", 'd', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &opt_dialog,
-      N_("Settings dialog to show"), NULL },
+static GOptionEntry option_entries[] =
+{
+    { "version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_version, N_("Version information"), NULL },
+    { "dialog", 'd', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &opt_dialog, N_("Settings dialog to show"), NULL },
     { NULL }
 };
 
+
+
 int
 main(int argc,
      char **argv)
 {
     GtkWidget *dialog;
-    GError *error = NULL;
+    GError    *error = NULL;
 
     xfce_textdomain(GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
 
-    if(!gtk_init_with_args(&argc, &argv, "", option_entries, GETTEXT_PACKAGE, &error)) {
-        if(G_LIKELY(error)) {
-            g_print("%s: %s.\n", G_LOG_DOMAIN, error->message);
-            g_print(_("Type '%s --help' for usage."), G_LOG_DOMAIN);
-            g_print("\n");
+    if (!gtk_init_with_args (&argc, &argv, NULL, option_entries, GETTEXT_PACKAGE, &error))
+    {
+        if (G_LIKELY (error != NULL))
+        {
+            g_print ("%s: %s.\n", G_LOG_DOMAIN, error->message);
+            g_print (_("Type '%s --help' for usage."), G_LOG_DOMAIN);
+            g_print ("\n");
 
-            g_error_free(error);
-        } else {
-            g_error("Unable to open display.");
+            g_error_free (error);
+        }
+        else
+        {
+            g_error ("Unable to open display.");
         }
         return EXIT_FAILURE;
     }
 
-    if(G_UNLIKELY(opt_version)) {
-        g_print("%s %s (Xfce %s)\n\n", G_LOG_DOMAIN, PACKAGE_VERSION, xfce_version_string());
-        g_print("%s\n", "Copyright (c) 2008-2011");
-        g_print("\t%s\n\n", _("The Xfce development team. All rights reserved."));
-        g_print(_("Please report bugs to <%s>."), PACKAGE_BUGREPORT);
-        g_print("\n");
+    if (G_UNLIKELY (opt_version))
+    {
+        g_print ("%s %s (Xfce %s)\n\n", G_LOG_DOMAIN, PACKAGE_VERSION, xfce_version_string());
+        g_print ("%s\n", "Copyright (c) 2008-2011");
+        g_print ("\t%s\n\n", _("The Xfce development team. All rights reserved."));
+        g_print (_("Please report bugs to <%s>."), PACKAGE_BUGREPORT);
+        g_print ("\n");
         return EXIT_SUCCESS;
     }
 
-    if(G_UNLIKELY(!xfconf_init (&error))) {
-        if(G_LIKELY(error != NULL)) {
-            g_error("%s: Failed to initialize xfconf: %s.\n", G_LOG_DOMAIN,
-                    error->message);
-            g_error_free(error);
-        } else {
-            g_error("Failed to initialize xfconf.");
-        }
-        return EXIT_FAILURE;
-    }
-
     garcon_set_environment ("XFCE");
 
-    dialog = xfce_settings_manager_dialog_new();
-    gtk_widget_show(dialog);
+    dialog = xfce_settings_manager_dialog_new ();
+    gtk_window_present (GTK_WINDOW (dialog));
 
-    if(opt_dialog != NULL) {
-        if (!xfce_settings_manager_dialog_show_dialog(XFCE_SETTINGS_MANAGER_DIALOG(dialog),
-                                                 opt_dialog))
-        {
-            g_message ("Dialog \"%s\" not found.", opt_dialog);
-        }
+    if (opt_dialog != NULL
+        && !xfce_settings_manager_dialog_show_dialog (XFCE_SETTINGS_MANAGER_DIALOG(dialog), opt_dialog))
+    {
+        g_message ("Dialog \"%s\" not found.", opt_dialog);
     }
 
     /* To prevent the settings dialog to be saved in the session */
@@ -103,10 +95,5 @@ main(int argc,
 
     gtk_main();
 
-    if(GTK_IS_WIDGET(dialog))
-        gtk_widget_destroy(dialog);
-
-    xfconf_shutdown();
-
     return EXIT_SUCCESS;
 }
diff --git a/xfce4-settings-manager/xfce-settings-manager-dialog.c b/xfce4-settings-manager/xfce-settings-manager-dialog.c
index 5f6a8d6..42d1e5d 100644
--- a/xfce4-settings-manager/xfce-settings-manager-dialog.c
+++ b/xfce4-settings-manager/xfce-settings-manager-dialog.c
@@ -34,7 +34,6 @@
 
 #include <libxfce4util/libxfce4util.h>
 #include <libxfce4ui/libxfce4ui.h>
-#include <xfconf/xfconf.h>
 #include <garcon/garcon.h>
 #include <exo/exo.h>
 


More information about the Xfce4-commits mailing list