[Xfce4-commits] [apps/gigolo] 11/35: Tentative migration from handrolled GigoloSingleInstance to GtkApplication
noreply at xfce.org
noreply at xfce.org
Mon Oct 31 18:18:45 CET 2016
This is an automated email from the git hooks/post-receive script.
landry pushed a commit to branch master
in repository apps/gigolo.
commit 6f421a3cb376026c12b128a399062aa65b330996
Author: Landry Breuil <landry at xfce.org>
Date: Fri Jun 17 22:49:04 2016 +0200
Tentative migration from handrolled GigoloSingleInstance to GtkApplication
Warning, this only builds, but doesn't actually work!
To be revisited soon...
---
src/main.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/main.c b/src/main.c
index 3a3b705..4b23c9b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -96,11 +96,18 @@ static void print_supported_schemes(void)
}
}
+static void activate (GApplication *app, gpointer user_data)
+{
+ GtkWidget *widget;
+
+ widget = gtk_application_window_new (GTK_APPLICATION (app));
+ gtk_widget_show (widget);
+}
gint main(gint argc, gchar** argv)
{
GigoloSettings *settings;
- GigoloSingleInstance *gis = NULL;
+ GtkApplication *gis = NULL;
gchar *accel_filename;
GOptionContext *context;
GtkWidget *window;
@@ -144,13 +151,8 @@ gint main(gint argc, gchar** argv)
if (! new_instance)
{
- gis = gigolo_single_instance_new();
- if (gigolo_single_instance_is_running(gis))
- {
- gigolo_single_instance_present(gis);
- g_object_unref(gis);
- exit(0);
- }
+ gis = gtk_application_new("org.xfce.gigolo", G_APPLICATION_FLAGS_NONE);
+ g_signal_connect (gis, "activate", G_CALLBACK (activate), NULL);
}
verbose("Gigolo %s (GTK+ %u.%u.%u, GLib %u.%u.%u)",
@@ -166,7 +168,7 @@ gint main(gint argc, gchar** argv)
window = gigolo_window_new(settings);
if (gis != NULL)
- gigolo_single_instance_set_parent(gis, GTK_WINDOW(window));
+ gtk_application_add_window(gis, GTK_WINDOW(window));
if (gigolo_settings_get_boolean(settings, "start-in-systray") &&
gigolo_settings_get_boolean(settings, "show-in-systray"))
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list