[gnome-disk-utility] return non-zero exit code if volume/drive to show does not exist



commit 240d0a23dcc6c31fa470ebb36ddf1505f581687a
Author: David Zeuthen <davidz redhat com>
Date:   Tue Mar 31 16:32:20 2009 -0400

    return non-zero exit code if volume/drive to show does not exist
---
 src/palimpsest/gdu-main.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/palimpsest/gdu-main.c b/src/palimpsest/gdu-main.c
index 28b888c..22ae7f8 100644
--- a/src/palimpsest/gdu-main.c
+++ b/src/palimpsest/gdu-main.c
@@ -127,12 +127,15 @@ static GOptionEntry entries[] = {
 int
 main (int argc, char **argv)
 {
+        gint ret;
         GduShell *shell;
         UniqueApp *unique_app;
         UniqueMessageData *msg_data;
         UniqueResponse response;
         GError *error;
 
+        ret = 1;
+
         error = NULL;
         if (!gtk_init_with_args (&argc, &argv, "", entries, GETTEXT_PACKAGE, &error)) {
                 g_error ("%s", error->message);
@@ -176,14 +179,19 @@ main (int argc, char **argv)
         gtk_widget_show_all (gdu_shell_get_toplevel (shell));
         gdu_shell_update (shell);
 
-        if (volume_to_show)
-                show_volume (shell, volume_to_show);
-        else if (drive_to_show)
-                show_drive (shell, drive_to_show);
+        if (volume_to_show) {
+                if (!show_volume (shell, volume_to_show))
+                        goto out;
+        }  else if (drive_to_show) {
+                if (!show_drive (shell, drive_to_show))
+                        goto out;
+        }
 
         gtk_main ();
 
+        ret = 0;
+
  out:
         g_object_unref (shell);
-        return 0;
+        return ret;
 }



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