From 46a43461c1566ad645a62fa2fb1361b4ffe9c6fc Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 22 Nov 2022 18:09:29 +0000 Subject: [PATCH] Do not use new G_APPLICATION_DEFAULT_FLAGS enum value The merge request !5235 switched tests and examples from G_APPLICATION_FLAGS_NONE, which has been deprecated in GLib 2.74, to G_APPLICATION_DEFAULT_FLAGS. Sadly, it was done unconditionally, which means we'd have to bump the required version of GLib. To avoid that, let's just use the numeric value of the enum member. --- examples/drawing.c | 2 +- examples/grid-packing.c | 2 +- examples/hello-world.c | 2 +- examples/search-bar.c | 21 ++++++++++----------- examples/window-default.c | 2 +- tests/testinfobar.c | 5 ++--- tests/testlist4.c | 1 - tests/testmodelbutton.c | 3 +-- 8 files changed, 17 insertions(+), 21 deletions(-) diff --git a/examples/drawing.c b/examples/drawing.c index 01ef670df6..e8658223a6 100644 --- a/examples/drawing.c +++ b/examples/drawing.c @@ -182,7 +182,7 @@ main (int argc, GtkApplication *app; int status; - app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS); + app = gtk_application_new ("org.gtk.example", 0); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); diff --git a/examples/grid-packing.c b/examples/grid-packing.c index d651e16195..8fb12a88ad 100644 --- a/examples/grid-packing.c +++ b/examples/grid-packing.c @@ -66,7 +66,7 @@ main (int argc, GtkApplication *app; int status; - app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS); + app = gtk_application_new ("org.gtk.example", 0); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); diff --git a/examples/hello-world.c b/examples/hello-world.c index 13ef85f24c..dfee0e89b2 100644 --- a/examples/hello-world.c +++ b/examples/hello-world.c @@ -37,7 +37,7 @@ main (int argc, GtkApplication *app; int status; - app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS); + app = gtk_application_new ("org.gtk.example", 0); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); diff --git a/examples/search-bar.c b/examples/search-bar.c index 642ff27bb8..00990bf4f4 100644 --- a/examples/search-bar.c +++ b/examples/search-bar.c @@ -2,15 +2,15 @@ static gboolean window_key_press_event_cb (GtkWidget *window, - GdkEvent *event, - GtkSearchBar *search_bar) + GdkEvent *event, + GtkSearchBar *search_bar) { return gtk_search_bar_handle_event (search_bar, event); } static void activate_cb (GtkApplication *app, - gpointer user_data) + gpointer user_data) { GtkWidget *window; GtkWidget *search_bar; @@ -40,19 +40,18 @@ activate_cb (GtkApplication *app, gtk_search_bar_connect_entry (GTK_SEARCH_BAR (search_bar), GTK_ENTRY (entry)); g_signal_connect (window, "key-press-event", - G_CALLBACK (window_key_press_event_cb), search_bar); + G_CALLBACK (window_key_press_event_cb), + search_bar); } -gint -main (gint argc, - gchar *argv[]) +int +main (int argc, + char *argv[]) { GtkApplication *app; - app = gtk_application_new ("org.gtk.Example.GtkSearchBar", - G_APPLICATION_DEFAULT_FLAGS); - g_signal_connect (app, "activate", - G_CALLBACK (activate_cb), NULL); + app = gtk_application_new ("org.gtk.Example.GtkSearchBar", 0); + g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL); return g_application_run (G_APPLICATION (app), argc, argv); } diff --git a/examples/window-default.c b/examples/window-default.c index 4bc800a888..b11e61bfa8 100644 --- a/examples/window-default.c +++ b/examples/window-default.c @@ -19,7 +19,7 @@ main (int argc, GtkApplication *app; int status; - app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS); + app = gtk_application_new ("org.gtk.example", 0); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); diff --git a/tests/testinfobar.c b/tests/testinfobar.c index 812feae62a..3762bb1401 100644 --- a/tests/testinfobar.c +++ b/tests/testinfobar.c @@ -99,11 +99,10 @@ main (int argc, GtkApplication *application; int result; - application = gtk_application_new ("org.gtk.test.infobar", - G_APPLICATION_DEFAULT_FLAGS); + application = gtk_application_new ("org.gtk.test.infobar", 0); g_signal_connect (application, "activate", G_CALLBACK (on_activate), NULL); - result = g_application_run (G_APPLICATION (application), argc, argv); g_object_unref (application); + return result; } diff --git a/tests/testlist4.c b/tests/testlist4.c index 6c792445c9..a244e6fecc 100644 --- a/tests/testlist4.c +++ b/tests/testlist4.c @@ -202,7 +202,6 @@ test_app_new (void) test_app = g_object_new (test_app_get_type (), "application-id", "org.gtk.testlist4", - "flags", G_APPLICATION_DEFAULT_FLAGS, NULL); return test_app; diff --git a/tests/testmodelbutton.c b/tests/testmodelbutton.c index 846226538c..296ab1c525 100644 --- a/tests/testmodelbutton.c +++ b/tests/testmodelbutton.c @@ -97,8 +97,7 @@ int main (int argc, char *argv[]) { - GtkApplication *application = gtk_application_new ("org.gtk.test.modelbutton", - G_APPLICATION_DEFAULT_FLAGS); + GtkApplication *application = gtk_application_new ("org.gtk.test.modelbutton", 0); int result; g_signal_connect (application, "activate",