From 397bb63e2384709a0a9e39e0c81ce5cc5ab3f352 Mon Sep 17 00:00:00 2001 From: Ben Burrill Date: Mon, 28 May 2018 13:18:39 -0700 Subject: [PATCH] Improvements to --start-hidden (bug 14343) * Prints an explanatory warning message when both the window and the status icon can't be shown (because --start-hidden is used and "Hide into the notification area" is disabled) rather than just exiting. * Fixes a bug where when the task manager is already running, --start-hidden would erroneously activate it. * Use return instead of exit. I adopted exit from the gnome docs, but I think return makes more sense here. --- src/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 664e784..945cb3a 100644 --- a/src/main.c +++ b/src/main.c @@ -199,7 +199,7 @@ int main (int argc, char *argv[]) if (!g_option_context_parse (opt_context, &argc, &argv, &error)) { g_print ("Unable to parse arguments: %s\n", error->message); - exit (1); + return 1; } app = g_application_new ("xfce.taskmanager", 0); @@ -213,7 +213,8 @@ int main (int argc, char *argv[]) if (g_application_get_is_remote (G_APPLICATION (app))) { - g_application_activate (G_APPLICATION (app)); + if (!start_hidden) + g_application_activate (G_APPLICATION (app)); g_object_unref (app); return 0; } @@ -250,6 +251,8 @@ int main (int argc, char *argv[]) if (gtk_widget_get_visible (window) || gtk_status_icon_get_visible (status_icon)) gtk_main (); + else + g_warning ("Nothing to do: activate hiding to the notification area when using --start-hidden"); if (timeout > 0) g_source_remove (timeout);