From 71b32db019b0539ddabb261098098d8c228d6455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20R=2E=20Garc=C3=ADa=20Blanco?= Date: Thu, 2 Apr 2015 16:48:47 +0200 Subject: app: Move New Window to app menu New Window action now opens a clean Dictionary window. See https://bugzilla.gnome.org/show_bug.cgi?id=334866 --- src/gdict-app-menus.ui | 12 +++++++----- src/gdict-app.c | 16 ++++++++++++++++ src/gdict-window.c | 39 --------------------------------------- 3 files changed, 23 insertions(+), 44 deletions(-) diff --git a/src/gdict-app-menus.ui b/src/gdict-app-menus.ui index 7ffcd9a..992fde1 100644 --- a/src/gdict-app-menus.ui +++ b/src/gdict-app-menus.ui @@ -1,5 +1,12 @@ +
+ + _New Window + app.new + <Primary>n + +
Preferences @@ -27,11 +34,6 @@ _File
- - _New - win.new - <Primary>n - _Save a Copy... win.save-as diff --git a/src/gdict-app.c b/src/gdict-app.c index d644d47..89f4659 100644 --- a/src/gdict-app.c +++ b/src/gdict-app.c @@ -77,6 +77,21 @@ static GOptionEntry gdict_app_goptions[] = { { NULL }, }; +static void +gdict_app_cmd_new (GSimpleAction *action, + GVariant *parameter, + gpointer user_data) +{ + GdictApp *app = user_data; + GtkWidget *window = gdict_window_new (GDICT_WINDOW_ACTION_CLEAR, + GTK_APPLICATION (app), + app->loader, + NULL, NULL, NULL, + NULL); + + gtk_widget_show (window); +} + static void gdict_app_cmd_preferences (GSimpleAction *action, GVariant *parameter, @@ -147,6 +162,7 @@ gdict_app_cmd_quit (GSimpleAction *action, static const GActionEntry app_entries[] = { + { "new", gdict_app_cmd_new, NULL, NULL, NULL }, { "preferences", gdict_app_cmd_preferences, NULL, NULL, NULL }, { "help", gdict_app_cmd_help, NULL, NULL, NULL }, { "about", gdict_app_cmd_about, NULL, NULL, NULL }, diff --git a/src/gdict-window.c b/src/gdict-window.c index d756e64..fb81726 100644 --- a/src/gdict-window.c +++ b/src/gdict-window.c @@ -866,44 +866,6 @@ gdict_window_load_state (GdictWindow *window) g_free (state_file); } -static void -gdict_window_cmd_file_new (GSimpleAction *action, - GVariant *parameter, - gpointer user_data) -{ - GdictWindow *window = user_data; - GtkApplication *application = gtk_window_get_application (GTK_WINDOW (window)); - GtkWidget *new_window; - gchar *word = NULL; - - gdict_window_store_state (window); - - word = gdict_defbox_get_selected_word (GDICT_DEFBOX (window->defbox)); - if (word) - { - new_window = gdict_window_new (GDICT_WINDOW_ACTION_LOOKUP, - application, - window->loader, - NULL, - NULL, - NULL, - word); - g_free (word); - } - else - new_window = gdict_window_new (GDICT_WINDOW_ACTION_CLEAR, - application, - window->loader, - NULL, - NULL, - NULL, - NULL); - - gtk_widget_show (new_window); - - g_signal_emit (window, gdict_window_signals[CREATED], 0, new_window); -} - static void gdict_window_cmd_save_as (GSimpleAction *action, GVariant *parameter, @@ -1274,7 +1236,6 @@ gdict_window_cmd_escape (GSimpleAction *action, static const GActionEntry entries[] = { /* File menu */ - { "new", gdict_window_cmd_file_new, NULL, NULL, NULL }, { "save-as", gdict_window_cmd_save_as, NULL, NULL, NULL }, { "preview", gdict_window_cmd_file_preview, NULL, NULL, NULL }, { "print", gdict_window_cmd_file_print, NULL, NULL, NULL }, -- cgit v1.2.1