summaryrefslogtreecommitdiff
path: root/libslab/app-shell.c
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2016-10-01 02:40:11 -0400
committermonsta <[email protected]>2016-10-19 13:28:59 +0300
commit80d37475904c9e58b8a291bcd6d49867dbf23506 (patch)
treefca1d0da4c73ee24a8156f9e03f99596dac24088 /libslab/app-shell.c
parent2ef871dfb77e9ecf9b269561c81cee8c2169d197 (diff)
downloadmate-control-center-80d37475904c9e58b8a291bcd6d49867dbf23506.tar.bz2
mate-control-center-80d37475904c9e58b8a291bcd6d49867dbf23506.tar.xz
GTK3: port libunique->GtkApplication
All GTK3 builds for now, this can go 3-way to permit gtk3/libunique builds if there is any reason for a distro to have issues with using GtkApplication, or for a point/buildfix release
Diffstat (limited to 'libslab/app-shell.c')
-rw-r--r--libslab/app-shell.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/libslab/app-shell.c b/libslab/app-shell.c
index 9e84e1c5..41fb3419 100644
--- a/libslab/app-shell.c
+++ b/libslab/app-shell.c
@@ -195,6 +195,9 @@ launch_selected_app (AppShellData * app_data)
static gboolean
main_keypress_callback (GtkWidget * widget, GdkEventKey * event, AppShellData * app_data)
{
+#if GTK_CHECK_VERSION(3,0,0)
+ GApplication *app;
+#endif
if (event->keyval == GDK_KEY_Return)
{
SlabSection *section = SLAB_SECTION (app_data->filter_section);
@@ -216,7 +219,14 @@ main_keypress_callback (GtkWidget * widget, GdkEventKey * event, AppShellData *
((event->keyval == GDK_KEY_q || event->keyval == GDK_KEY_Q) && (event->state & GDK_CONTROL_MASK)))
{
if (app_data->exit_on_close)
+#if GTK_CHECK_VERSION(3,0,0)
+ {
+ app=g_application_get_default();
+ g_application_quit(app);
+ }
+#else
gtk_main_quit ();
+#endif
else
hide_shell (app_data);
return TRUE;
@@ -227,9 +237,18 @@ main_keypress_callback (GtkWidget * widget, GdkEventKey * event, AppShellData *
static gboolean
main_delete_callback (GtkWidget * widget, GdkEvent * event, AppShellData * app_data)
{
+#if GTK_CHECK_VERSION(3,0,0)
+ GApplication *app;
+#endif
if (app_data->exit_on_close)
{
- gtk_main_quit ();
+ /*avoid "gtk_main_quit: assertion 'main_loops != NULL' failed" critical here */
+#if GTK_CHECK_VERSION(3,0,0)
+ app=g_application_get_default();
+ g_application_quit(app);
+#else
+ gtk_main_quit();
+#endif
return FALSE;
}
@@ -1385,6 +1404,9 @@ tile_activated_cb (Tile * tile, TileEvent * event, gpointer user_data)
static void
handle_launcher_single_clicked (Tile * launcher, gpointer data)
{
+#if GTK_CHECK_VERSION(3,0,0)
+ GApplication *app;
+#endif
AppShellData *app_data = (AppShellData *) data;
tile_trigger_action (launcher, launcher->actions[APPLICATION_TILE_ACTION_START]);
@@ -1392,7 +1414,14 @@ handle_launcher_single_clicked (Tile * launcher, gpointer data)
if (g_settings_get_boolean (app_data->settings, EXIT_SHELL_ON_ACTION_START))
{
if (app_data->exit_on_close)
- gtk_main_quit ();
+#if GTK_CHECK_VERSION(3,0,0)
+ {
+ app=g_application_get_default();
+ g_application_quit(app);
+ }
+#else
+ gtk_main_quit();
+#endif
else
hide_shell (app_data);
}
@@ -1402,6 +1431,9 @@ static void
handle_menu_action_performed (Tile * launcher, TileEvent * event, TileAction * action,
gpointer data)
{
+#if GTK_CHECK_VERSION(3,0,0)
+ GApplication *app;
+#endif
AppShellData *app_data = (AppShellData *) data;
gchar *temp;
@@ -1433,7 +1465,14 @@ handle_menu_action_performed (Tile * launcher, TileEvent * event, TileAction * a
if (g_settings_get_boolean (app_data->settings, temp))
{
if (app_data->exit_on_close)
- gtk_main_quit ();
+#if GTK_CHECK_VERSION(3,0,0)
+ {
+ app=g_application_get_default();
+ g_application_quit(app);
+ }
+#else
+ gtk_main_quit();
+#endif
else
hide_shell (app_data);
}