summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorLogan Rathbone <poprocks@gmail.com>2022-01-09 23:18:20 -0500
committerLogan Rathbone <poprocks@gmail.com>2022-01-10 02:06:40 -0500
commit73a1fd232d5c1a7aa2ccc0d429d141dd1250c296 (patch)
tree681d12b0429f21089404e09e0bb2d90d4ad97f53 /src/main.c
parent6da301644c82049dc7d0b4a701a481000379893f (diff)
downloadzenity-73a1fd232d5c1a7aa2ccc0d429d141dd1250c296.tar.gz
notification: Initial port to GNotification
Port from libnotify, which is deprecated. Some features are yet missing, but this is a start. This drops libnotify as a dependency; meson files updated accordingly.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c
index 86a816b..a4531fd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -43,7 +43,7 @@ command_line_cb (GtkApplication *app,
GApplicationCommandLine *command_line,
gpointer user_data)
{
- g_autofree ZenityArgs *args = user_data;
+ ZenityArgs *args = user_data;
ZenityParsingOptions *results;
results = zenity_option_parse (args->argc, args->argv);
@@ -83,11 +83,9 @@ command_line_cb (GtkApplication *app,
zenity_tree (results->data, results->tree_data);
break;
-#ifdef HAVE_LIBNOTIFY
case MODE_NOTIFICATION:
zenity_notification (results->data, results->notification_data);
break;
-#endif
case MODE_PROGRESS:
zenity_progress (results->data, results->progress_data);
@@ -129,12 +127,14 @@ command_line_cb (GtkApplication *app,
g_application_command_line_set_exit_status (command_line,
results->data->exit_code);
+
+ g_free (args);
}
int
main (int argc, char *argv[])
{
- g_autofree ZenityArgs *args = NULL;
+ ZenityArgs *args;
g_autoptr(GtkApplication) app = NULL;
int status;
@@ -146,15 +146,12 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE);
/* </i18n> */
- args = g_new (ZenityArgs, 1);
+ args = g_new0 (ZenityArgs, 1);
args->argc = argc;
args->argv = argv;
- app = gtk_application_new ("org.gnome.Zenity",
- G_APPLICATION_HANDLES_COMMAND_LINE);
-
- g_signal_connect (app, "command-line",
- G_CALLBACK(command_line_cb), args);
+ app = gtk_application_new (APP_ID, G_APPLICATION_HANDLES_COMMAND_LINE);
+ g_signal_connect (app, "command-line", G_CALLBACK(command_line_cb), args);
status = g_application_run (G_APPLICATION(app), 0, NULL);