[recipes] Properly handle global actions
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Properly handle global actions
- Date: Sun, 12 Mar 2017 02:07:57 +0000 (UTC)
commit b89836dd5bbab01fc339b827178c396b0c810f56
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Mar 11 20:20:28 2017 -0500
Properly handle global actions
We don't want to trigger most actions when the window is
fullscreen, and we only want to trigger search when there
is a search button on the headerbar. Use the new window
APIs to realize this.
src/gr-app.c | 32 ++++++++++++++++++++++++++++----
1 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/src/gr-app.c b/src/gr-app.c
index 0ea5870..35aa895 100644
--- a/src/gr-app.c
+++ b/src/gr-app.c
@@ -96,7 +96,10 @@ chef_information_activated (GSimpleAction *action,
{
GtkWindow *win;
+ gr_app_activate (G_APPLICATION (app));
win = gtk_application_get_active_window (GTK_APPLICATION (app));
+ if (gr_window_is_fullscreen (GR_WINDOW (win)))
+ return;
gr_window_show_my_chef_information (GR_WINDOW (win));
}
@@ -107,7 +110,10 @@ about_activated (GSimpleAction *action,
{
GtkWindow *win;
+ gr_app_activate (G_APPLICATION (app));
win = gtk_application_get_active_window (GTK_APPLICATION (app));
+ if (gr_window_is_fullscreen (GR_WINDOW (win)))
+ return;
gr_window_show_about_dialog (GR_WINDOW (win));
}
@@ -118,7 +124,10 @@ report_issue_activated (GSimpleAction *action,
{
GtkWindow *win;
+ gr_app_activate (G_APPLICATION (app));
win = gtk_application_get_active_window (GTK_APPLICATION (app));
+ if (gr_window_is_fullscreen (GR_WINDOW (win)))
+ return;
gr_window_show_report_issue (GR_WINDOW (win));
}
@@ -129,7 +138,10 @@ news_activated (GSimpleAction *action,
{
GtkWindow *win;
+ gr_app_activate (G_APPLICATION (app));
win = gtk_application_get_active_window (GTK_APPLICATION (app));
+ if (gr_window_is_fullscreen (GR_WINDOW (win)))
+ return;
gr_window_show_news (GR_WINDOW (win));
}
@@ -140,7 +152,10 @@ quit_activated (GSimpleAction *action,
{
GtkWindow *win;
+ gr_app_activate (G_APPLICATION (app));
win = gtk_application_get_active_window (GTK_APPLICATION (app));
+ if (gr_window_is_fullscreen (GR_WINDOW (win)))
+ return;
gtk_window_close (win);
}
@@ -151,8 +166,10 @@ import_activated (GSimpleAction *action,
{
GtkWindow *win;
+ gr_app_activate (G_APPLICATION (app));
win = gtk_application_get_active_window (GTK_APPLICATION (app));
- gtk_window_present (win);
+ if (gr_window_is_fullscreen (GR_WINDOW (win)))
+ return;
gr_window_load_recipe (GR_WINDOW (win), NULL);
}
@@ -163,8 +180,10 @@ export_activated (GSimpleAction *action,
{
GtkWindow *win;
+ gr_app_activate (G_APPLICATION (app));
win = gtk_application_get_active_window (GTK_APPLICATION (app));
- gtk_window_present (win);
+ if (gr_window_is_fullscreen (GR_WINDOW (win)))
+ return;
gr_window_save_all (GR_WINDOW (win));
}
@@ -183,6 +202,8 @@ details_activated (GSimpleAction *action,
gr_app_activate (G_APPLICATION (app));
win = gtk_application_get_active_window (GTK_APPLICATION (app));
recipe = gr_recipe_store_get_recipe (gr_recipe_store_get (), id);
+ if (gr_window_is_fullscreen (GR_WINDOW (win)))
+ return;
gr_window_show_recipe (GR_WINDOW (win), recipe);
}
@@ -197,9 +218,12 @@ search_activated (GSimpleAction *action,
g_variant_get (parameter, "&s", &search);
- win = gtk_application_get_active_window (GTK_APPLICATION (app));
gr_app_activate (G_APPLICATION (app));
- gr_window_show_search (GR_WINDOW (win), search);
+ win = gtk_application_get_active_window (GTK_APPLICATION (app));
+ if (gr_window_is_fullscreen (GR_WINDOW (win)))
+ return;
+ if (gr_window_can_search (GR_WINDOW (win)))
+ gr_window_show_search (GR_WINDOW (win), search);
}
#define DEFAULT_LEVELS (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]