summaryrefslogtreecommitdiff
path: root/src/capplet
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2026-03-20 20:55:49 -0400
committerVictor Kareh <[email protected]>2026-03-22 17:33:25 -0400
commit1903a4a635302f2c0a2b299e33d1c835799ae4bf (patch)
tree3e6fd97f3c7097d37276ca1f54ce0ce2f0038f8f /src/capplet
parent3f72f66032c6f9b80fc22e15a2fb33804d000bc6 (diff)
downloadmate-notification-daemon-add-version-option.tar.bz2
mate-notification-daemon-add-version-option.tar.xz
Add version flag to daemon and properties dialogadd-version-option
The mate-notification-properties binary had no command-line option parsing, making it hard to know the installed version. This adds the version flag to both mate-notification-properties and mate-notification-daemon. Fixes #228
Diffstat (limited to 'src/capplet')
-rw-r--r--src/capplet/mate-notification-properties.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/capplet/mate-notification-properties.c b/src/capplet/mate-notification-properties.c
index f81dd2c..f6266c5 100644
--- a/src/capplet/mate-notification-properties.c
+++ b/src/capplet/mate-notification-properties.c
@@ -562,6 +562,14 @@ static void notification_properties_dialog_finalize(NotificationAppletDialog* di
int main(int argc, char** argv)
{
NotificationAppletDialog *dialog;
+ static gboolean show_version = FALSE;
+ GOptionContext *option_context;
+ GError *error = NULL;
+
+ static GOptionEntry option_entries[] = {
+ { "version", 'v', 0, G_OPTION_ARG_NONE, &show_version, N_("Version of this application"), NULL },
+ { NULL }
+ };
#ifdef ENABLE_NLS
bindtextdomain(GETTEXT_PACKAGE, NOTIFICATION_LOCALEDIR);
@@ -569,7 +577,25 @@ int main(int argc, char** argv)
textdomain(GETTEXT_PACKAGE);
#endif /* ENABLE_NLS */
- gtk_init(&argc, &argv);
+ option_context = g_option_context_new (NULL);
+ g_option_context_add_main_entries (option_context, option_entries, GETTEXT_PACKAGE);
+ g_option_context_add_group (option_context, gtk_get_option_group (TRUE));
+
+ if (!g_option_context_parse (option_context, &argc, &argv, &error))
+ {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ g_option_context_free (option_context);
+ return 1;
+ }
+
+ g_option_context_free (option_context);
+
+ if (show_version)
+ {
+ g_print ("%s %s\n", PACKAGE, VERSION);
+ return 0;
+ }
notify_init("mate-notification-properties");