From 8fe642fe95df0985c71713c74f7c450e0b21aa1a Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sun, 19 Oct 2014 02:15:38 +0200 Subject: [PATCH] Create a selection menu --- po/POTFILES.in | 1 + src/ag-app.c | 1 + src/ag-window.c | 22 ++++++++++++++++++++++ src/resources/gtk/menus.ui | 13 +++++++++++++ 4 files changed, 37 insertions(+) diff --git a/po/POTFILES.in b/po/POTFILES.in index 6bd6a19..fbe5eda 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -6,6 +6,7 @@ src/ag-chart.c src/ag-db.c src/ag-display-theme.c src/ag-window.c +src/ag-header-bar.c src/astrognome.c [type: gettext/glade]src/resources/gtk/menus.ui [type: gettext/glade]src/resources/ui/ag-window.ui diff --git a/src/ag-app.c b/src/ag-app.c index c465cb4..22db865 100644 --- a/src/ag-app.c +++ b/src/ag-app.c @@ -361,6 +361,7 @@ const gchar *action_accels[] = { "win.change-tab::points", "F7", NULL, "win.change-tab::edit", "F4", NULL, "win.back", "Left", "Back", NULL, + "win.select-all", "A", NULL, NULL }; diff --git a/src/ag-window.c b/src/ag-window.c index ffcef1f..29f2b26 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -1645,6 +1645,26 @@ ag_window_connection_action(GSimpleAction *action, } } +static void +ag_window_select_all_action(GSimpleAction *action, + GVariant *parameter, + gpointer user_data) +{ + GET_PRIV(AG_WINDOW(user_data)); + + ag_icon_view_select_all(priv->chart_list); +} + + static void +ag_window_select_none_action(GSimpleAction *action, + GVariant *parameter, + gpointer user_data) +{ + GET_PRIV(AG_WINDOW(user_data)); + + ag_icon_view_unselect_all(priv->chart_list); +} + static GActionEntry win_entries[] = { { "close", ag_window_close_action, NULL, NULL, NULL }, { "save", ag_window_save_action, NULL, NULL, NULL }, @@ -1658,6 +1678,8 @@ static GActionEntry win_entries[] = { { "refresh", ag_window_refresh_action, NULL, NULL, NULL }, { "delete", ag_window_delete_action, NULL, NULL, NULL }, { "connection", ag_window_connection_action, "s", "'aspects'", NULL }, + { "select-all", ag_window_select_all_action, NULL, NULL, NULL }, + { "select-none", ag_window_select_none_action, NULL, NULL, NULL }, }; static void diff --git a/src/resources/gtk/menus.ui b/src/resources/gtk/menus.ui index 967cfed..8035267 100644 --- a/src/resources/gtk/menus.ui +++ b/src/resources/gtk/menus.ui @@ -39,4 +39,17 @@ + +
+ + Select All + win.select-all + <Primary>a + + + Select None + win.select-none + +
+