diff main.c @ 46:aa5d3752091d

Make the update viewer command configurable Make the update viewer command configurable at copile time through the UPDATE_VIEWER_COMMAND macro. Make the update viewer command configurable at run time through the -c/--command command line option. Treat the update viewer command as a shell command and parse it via g_shell_parse_argv(), this allows for running the update viewer via xdg-su, gnomesu, pkexec etc. Disable install action in the notification and on the status icon in case no update viewer command has been provided.
author Guido Berhoerster <gber@opensuse.org>
date Thu, 18 Jun 2015 14:10:57 +0200
parents f549b75c3c22
children 7de92a24e86c
line wrap: on
line diff
--- a/main.c	Thu Jun 18 13:35:55 2015 +0200
+++ b/main.c	Thu Jun 18 14:10:57 2015 +0200
@@ -32,11 +32,15 @@
 	UniqueApp	*app = NULL;
 	int		exitval = 0;
 	gboolean	version = FALSE;
+	gchar		*update_viewer_command = NULL;
 	gint		startup_delay = 300;
 	gint		check_interval = 86400;
 	GOptionContext	*context;
 	GError		*error = NULL;
 	const GOptionEntry options[] = {
+		{ "command", 'c', 0, G_OPTION_ARG_STRING,
+		    &update_viewer_command, N_("Command for starting the "
+		    "software update viewer"), "command" },
 		{ "delay", 'd', 0, G_OPTION_ARG_INT, &startup_delay,
 		    N_("Set the delay in seconds before the first check for "
 		    "updates"), "delay" },
@@ -98,7 +102,8 @@
 
 	notify_init(PACKAGE);
 
-	icon = pkui_icon_new(startup_delay, check_interval);
+	icon = pkui_icon_new(startup_delay, check_interval,
+	    update_viewer_command);
 
 	gtk_main();
 
@@ -108,6 +113,7 @@
 		g_object_unref(app);
 	if (notify_is_initted())
 		notify_uninit ();
+	g_free(update_viewer_command);
 
 	return (exitval);
 }