[Xfce4-commits] [apps/xfce4-taskmanager] 05/05: Add --start-hidden command-line option (bug 14343)
noreply at xfce.org
noreply at xfce.org
Mon May 28 21:16:51 CEST 2018
This is an automated email from the git hooks/post-receive script.
l a n d r y p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-taskmanager.
commit 5fdfe369a62eb8027ffd50962c3dc0a01b25c92a
Author: Ben Burrill <bburrill98 at gmail.com>
Date: Mon May 28 21:16:05 2018 +0200
Add --start-hidden command-line option (bug 14343)
When --start-hidden is used, the primary interface is not shown. If the
"Hide into the notification area" option is enabled, the notification
icon will shown. Otherwise, the task manager will immediately quit
(running completely in the background would be pointless).
---
src/main.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/main.c b/src/main.c
index 3960f6d..664e784 100644
--- a/src/main.c
+++ b/src/main.c
@@ -27,6 +27,12 @@ static GtkWidget *window;
static GtkStatusIcon *status_icon;
static XtmTaskManager *task_manager;
static gboolean timeout = FALSE;
+static gboolean start_hidden = FALSE;
+
+static GOptionEntry main_entries[] = {
+ { "start-hidden", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &start_hidden, "Don't open a task manager window" },
+ { NULL }
+};
static void
status_icon_activated (void)
@@ -175,6 +181,7 @@ int main (int argc, char *argv[])
#if GLIB_CHECK_VERSION(2, 28, 0)
GApplication *app;
GError *error = NULL;
+ GOptionContext *opt_context;
#endif
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
@@ -186,6 +193,15 @@ int main (int argc, char *argv[])
g_set_application_name (_("Task Manager"));
#if GLIB_CHECK_VERSION(2, 28, 0)
+ opt_context = g_option_context_new ("");
+ g_option_context_add_main_entries (opt_context, main_entries, NULL);
+ g_option_context_add_group (opt_context, gtk_get_option_group (TRUE));
+ if (!g_option_context_parse (opt_context, &argc, &argv, &error))
+ {
+ g_print ("Unable to parse arguments: %s\n", error->message);
+ exit (1);
+ }
+
app = g_application_new ("xfce.taskmanager", 0);
g_application_register (G_APPLICATION (app), NULL, &error);
if (error != NULL)
@@ -211,7 +227,10 @@ int main (int argc, char *argv[])
g_signal_connect (status_icon, "popup-menu", G_CALLBACK (status_icon_popup_menu), NULL);
window = xtm_process_window_new ();
- gtk_widget_show (window);
+
+ if (!start_hidden)
+ gtk_widget_show (window);
+
#if GLIB_CHECK_VERSION(2, 28, 0)
g_signal_connect_swapped (app, "activate", G_CALLBACK (xtm_process_window_show), window);
#endif
@@ -229,7 +248,8 @@ int main (int argc, char *argv[])
g_signal_connect (window, "destroy", G_CALLBACK (destroy_window), NULL);
g_signal_connect (window, "delete-event", G_CALLBACK (delete_window), NULL);
- gtk_main ();
+ if (gtk_widget_get_visible (window) || gtk_status_icon_get_visible (status_icon))
+ gtk_main ();
if (timeout > 0)
g_source_remove (timeout);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list