[easytag/wip/application-window: 12/18] Move select and unselect actions to main window
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/application-window: 12/18] Move select and unselect actions to main window
- Date: Sat, 8 Feb 2014 23:39:06 +0000 (UTC)
commit 5c92bbf03dbd2539b1179077485058b3fcadbfad
Author: David King <amigadave amigadave com>
Date: Sun Jan 5 21:49:55 2014 +0000
Move select and unselect actions to main window
src/application_window.c | 66 ++++++++++++++++++++++++++++++++++++++++++++
src/application_window.h | 2 +
src/bar.c | 4 +-
src/browser.c | 3 +-
src/easytag.c | 68 ----------------------------------------------
src/easytag.h | 2 -
6 files changed, 72 insertions(+), 73 deletions(-)
---
diff --git a/src/application_window.c b/src/application_window.c
index 9d855d5..b2f850e 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -2304,3 +2304,69 @@ et_application_window_tag_area_display_controls (EtApplicationWindow *self,
break;
}
}
+
+/*
+ * Action when selecting all files
+ */
+void
+et_application_window_select_all (GtkAction *action, gpointer user_data)
+{
+ GtkWidget *focused;
+
+ /* Use the currently-focused widget and "select all" as appropriate.
+ * https://bugzilla.gnome.org/show_bug.cgi?id=697515 */
+ focused = gtk_window_get_focus (GTK_WINDOW (user_data));
+
+ if (GTK_IS_EDITABLE (focused))
+ {
+ gtk_editable_select_region (GTK_EDITABLE (focused), 0, -1);
+ }
+ else if (focused == PictureEntryView)
+ {
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (focused));
+ gtk_tree_selection_select_all (selection);
+ }
+ else /* Assume that other widgets should select all in the file view. */
+ {
+ /* Save the current displayed data */
+ ET_Save_File_Data_From_UI (ETCore->ETFileDisplayed);
+
+ Browser_List_Select_All_Files ();
+ Update_Command_Buttons_Sensivity ();
+ }
+}
+
+/*
+ * Action when unselecting all
+ */
+void
+et_application_window_unselect_all (GtkAction *action, gpointer user_data)
+{
+ GtkWidget *focused;
+
+ focused = gtk_window_get_focus (GTK_WINDOW (user_data));
+
+ if (GTK_IS_EDITABLE (focused))
+ {
+ GtkEditable *editable;
+ gint pos;
+
+ editable = GTK_EDITABLE (focused);
+ pos = gtk_editable_get_position (editable);
+ gtk_editable_select_region (editable, 0, 0);
+ gtk_editable_set_position (editable, pos);
+ }
+ else if (focused == PictureEntryView)
+ {
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (focused));
+ gtk_tree_selection_unselect_all (selection);
+ }
+ else /* Assume that other widgets should select all in the file view. */
+ {
+ /* Save the current displayed data */
+ ET_Save_File_Data_From_UI (ETCore->ETFileDisplayed);
+
+ Browser_List_Unselect_All_Files ();
+ ETCore->ETFileDisplayed = NULL;
+ }
+}
diff --git a/src/application_window.h b/src/application_window.h
index 31b28ae..cbdcb89 100644
--- a/src/application_window.h
+++ b/src/application_window.h
@@ -66,6 +66,8 @@ GtkWidget * et_application_window_get_scan_dialog (EtApplicationWindow *self);
void et_application_window_show_scan_dialog (GtkAction *action, gpointer user_data);
void et_application_window_scan_selected_files (GtkAction *action, gpointer user_data);
void et_on_action_select_scan_mode (GtkRadioAction *action, GtkRadioAction *current, gpointer user_data);
+void et_application_window_select_all (GtkAction *action, gpointer user_data);
+void et_application_window_unselect_all (GtkAction *action, gpointer user_data);
void et_application_window_hide_log_area (EtApplicationWindow *self);
void et_application_window_show_log_area (EtApplicationWindow *self);
diff --git a/src/bar.c b/src/bar.c
index 9b0455d..c5c95d8 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -207,10 +207,10 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
"<Primary><Shift>O", _("Run a command on the selected files"),
G_CALLBACK (Browser_Open_Run_Program_List_Window) },
{ AM_SELECT_ALL, GTK_STOCK_SELECT_ALL, NULL, "<Primary>A",
- _("Select all"), G_CALLBACK (et_on_action_select_all) },
+ _("Select all"), G_CALLBACK (et_application_window_select_all) },
{ AM_UNSELECT_ALL, "easytag-unselect-all", _("Unselect All"),
"<Primary><Shift>A", _("Clear the current selection"),
- G_CALLBACK (et_on_action_unselect_all) },
+ G_CALLBACK (et_application_window_unselect_all) },
{ AM_INVERT_SELECTION, "easytag-invert-selection",
_("Invert File Selection"), "<Primary>I",
_("Invert file selection"),
diff --git a/src/browser.c b/src/browser.c
index 5a4d6c9..6a26163 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -38,6 +38,7 @@
#include <stdio.h>
#include <errno.h>
+#include "application_window.h"
#include "gtk2_compat.h"
#include "easytag.h"
#include "browser.h"
@@ -560,7 +561,7 @@ Browser_List_Button_Press (GtkTreeView *treeView, GdkEventButton *event)
}else if (event->type==GDK_3BUTTON_PRESS && event->button==1)
{
/* Triple left mouse click, select all files of the list. */
- et_on_action_select_all ();
+ et_application_window_select_all (NULL, MainWindow);
}
return FALSE;
}
diff --git a/src/easytag.c b/src/easytag.c
index 66576b9..7a287f6 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -435,74 +435,6 @@ int main (int argc, char *argv[])
return status;
}
-
-
-/*
- * Action when selecting all files
- */
-void
-et_on_action_select_all (void)
-{
- GtkWidget *focused;
-
- /* Use the currently-focused widget and "select all" as appropriate.
- * https://bugzilla.gnome.org/show_bug.cgi?id=697515 */
- focused = gtk_window_get_focus (GTK_WINDOW (MainWindow));
- if (GTK_IS_EDITABLE (focused))
- {
- gtk_editable_select_region (GTK_EDITABLE (focused), 0, -1);
- }
- else if (focused == PictureEntryView)
- {
- GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (focused));
- gtk_tree_selection_select_all (selection);
- }
- else /* Assume that other widgets should select all in the file view. */
- {
- /* Save the current displayed data */
- ET_Save_File_Data_From_UI (ETCore->ETFileDisplayed);
-
- Browser_List_Select_All_Files ();
- Update_Command_Buttons_Sensivity ();
- }
-}
-
-
-/*
- * Action when unselecting all
- */
-void
-et_on_action_unselect_all (void)
-{
- GtkWidget *focused;
-
- focused = gtk_window_get_focus (GTK_WINDOW (MainWindow));
- if (GTK_IS_EDITABLE (focused))
- {
- GtkEditable *editable;
- gint pos;
-
- editable = GTK_EDITABLE (focused);
- pos = gtk_editable_get_position (editable);
- gtk_editable_select_region (editable, 0, 0);
- gtk_editable_set_position (editable, pos);
- }
- else if (focused == PictureEntryView)
- {
- GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (focused));
- gtk_tree_selection_unselect_all (selection);
- }
- else /* Assume that other widgets should select all in the file view. */
- {
- /* Save the current displayed data */
- ET_Save_File_Data_From_UI (ETCore->ETFileDisplayed);
-
- Browser_List_Unselect_All_Files ();
- ETCore->ETFileDisplayed = NULL;
- }
-}
-
-
/*
* Action when inverting files selection
*/
diff --git a/src/easytag.h b/src/easytag.h
index 7322871..be384b5 100644
--- a/src/easytag.h
+++ b/src/easytag.h
@@ -102,8 +102,6 @@ gboolean ReadingDirectory;
* Prototypes *
**************/
void Disable_Command_Buttons (void);
-void et_on_action_select_all (void);
-void et_on_action_unselect_all (void);
void Action_Invert_Files_Selection (void);
void Action_Select_Prev_File (void);
void Action_Select_Next_File (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]