[easytag] Make unselect all a generic action, bug 699958
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Make unselect all a generic action, bug 699958
- Date: Fri, 10 May 2013 18:49:13 +0000 (UTC)
commit 48c4f09e2b681c0d82fb79b16f1f26886626b9d1
Author: David King <amigadave amigadave com>
Date: Fri May 10 19:47:58 2013 +0100
Make unselect all a generic action, bug 699958
Move the unselect all item to the edit menu, and apply it to the
currently-focused widget.
src/bar.c | 4 +++-
src/bar.h | 2 +-
src/easytag.c | 40 +++++++++++++++++++++++++++++++---------
src/easytag.h | 2 +-
src/ui_manager.h | 2 +-
5 files changed, 37 insertions(+), 13 deletions(-)
---
diff --git a/src/bar.c b/src/bar.c
index 42f9227..06219e7 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -191,7 +191,9 @@ void Create_UI (GtkWidget **ppmenubar, GtkWidget **pptoolbar)
G_CALLBACK (Browser_Open_Run_Program_List_Window) },
{ AM_SELECT_ALL, GTK_STOCK_SELECT_ALL, NULL, "<Control>A",
_("Select all"), G_CALLBACK (et_on_action_select_all) },
- { AM_UNSELECT_ALL_FILES, "easytag-unselect-all", _("Unselect All Files"),
"<Shift><Control>A", _("Unselect all files"), G_CALLBACK(Action_Unselect_All_Files) },
+ { AM_UNSELECT_ALL, "easytag-unselect-all", _("Unselect All"),
+ "<Shift><Control>A", _("Clear the current selection"),
+ G_CALLBACK (et_on_action_unselect_all) },
{ AM_INVERT_SELECTION, "easytag-invert-selection",
_("Invert File Selection"), "<Control>I",
_("Invert file selection"),
diff --git a/src/bar.h b/src/bar.h
index 2347268..e767305 100644
--- a/src/bar.h
+++ b/src/bar.h
@@ -67,7 +67,7 @@ GtkWidget *CheckMenuItemBrowseHiddenDirMainMenu;
#define AM_SAVE "SaveFile"
#define AM_SAVE_FORCED "SaveFileForced"
#define AM_SELECT_ALL "SelAll"
-#define AM_UNSELECT_ALL_FILES "UnselAll"
+#define AM_UNSELECT_ALL "UnselAll"
#define AM_INVERT_SELECTION "SelInv"
#define AM_DELETE_FILE "DeleteFile"
#define AM_LOAD_HOME_DIR "GoToHome"
diff --git a/src/easytag.c b/src/easytag.c
index 02825a1..4e7d69a 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -1696,15 +1696,37 @@ et_on_action_select_all (void)
/*
- * Action when unselecting all files
+ * Action when unselecting all
*/
-void Action_Unselect_All_Files (void)
+void
+et_on_action_unselect_all (void)
{
- /* Save the current displayed data */
- ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
+ GtkWidget *focused;
+
+ focused = gtk_window_get_focus (GTK_WINDOW (MainWindow));
+ if (GTK_IS_EDITABLE (focused))
+ {
+ GtkEditable *editable;
+ gint pos;
- Browser_List_Unselect_All_Files();
- ETCore->ETFileDisplayed = NULL;
+ 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;
+ }
}
@@ -3906,7 +3928,7 @@ void Update_Command_Buttons_Sensivity (void)
/* Menu commands */
ui_widget_set_sensitive(MENU_FILE, AM_OPEN_FILE_WITH, FALSE);
ui_widget_set_sensitive (MENU_FILE, AM_SELECT_ALL, FALSE);
- ui_widget_set_sensitive(MENU_FILE, AM_UNSELECT_ALL_FILES, FALSE);
+ ui_widget_set_sensitive (MENU_FILE, AM_UNSELECT_ALL, FALSE);
ui_widget_set_sensitive(MENU_FILE, AM_INVERT_SELECTION, FALSE);
ui_widget_set_sensitive(MENU_FILE, AM_DELETE_FILE, FALSE);
ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_ASCENDING_FILENAME, FALSE);
@@ -3985,7 +4007,7 @@ void Update_Command_Buttons_Sensivity (void)
/* Commands into menu */
ui_widget_set_sensitive(MENU_FILE, AM_OPEN_FILE_WITH,TRUE);
ui_widget_set_sensitive (MENU_FILE, AM_SELECT_ALL, TRUE);
- ui_widget_set_sensitive(MENU_FILE, AM_UNSELECT_ALL_FILES,TRUE);
+ ui_widget_set_sensitive (MENU_FILE, AM_UNSELECT_ALL, TRUE);
ui_widget_set_sensitive(MENU_FILE, AM_INVERT_SELECTION,TRUE);
ui_widget_set_sensitive(MENU_FILE, AM_DELETE_FILE,TRUE);
ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_ASCENDING_FILENAME,TRUE);
@@ -4115,7 +4137,7 @@ Disable_Command_Buttons (void)
/* "File" menu commands */
ui_widget_set_sensitive(MENU_FILE,AM_OPEN_FILE_WITH,FALSE);
ui_widget_set_sensitive (MENU_FILE, AM_SELECT_ALL, FALSE);
- ui_widget_set_sensitive(MENU_FILE,AM_UNSELECT_ALL_FILES,FALSE);
+ ui_widget_set_sensitive (MENU_FILE, AM_UNSELECT_ALL, FALSE);
ui_widget_set_sensitive(MENU_FILE,AM_INVERT_SELECTION,FALSE);
ui_widget_set_sensitive(MENU_FILE,AM_DELETE_FILE,FALSE);
ui_widget_set_sensitive(MENU_FILE,AM_FIRST,FALSE);
diff --git a/src/easytag.h b/src/easytag.h
index 840dae7..ac51396 100644
--- a/src/easytag.h
+++ b/src/easytag.h
@@ -135,7 +135,7 @@ gboolean ReadingDirectory;
* Prototypes *
**************/
void et_on_action_select_all (void);
-void Action_Unselect_All_Files (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);
diff --git a/src/ui_manager.h b/src/ui_manager.h
index bccfdb4..8125de5 100644
--- a/src/ui_manager.h
+++ b/src/ui_manager.h
@@ -16,7 +16,6 @@ static const gchar *ui_xml =
" <menuitem action='RunAudio' />"
" <separator />"
-" <menuitem action='UnselAll' />"
" <menuitem action='SelInv' />"
" <separator />"
@@ -36,6 +35,7 @@ static const gchar *ui_xml =
" <menu action='EditMenu'>"
" <menuitem action='SearchFile' />"
" <menuitem action='SelAll' />"
+" <menuitem action='UnselAll' />"
" <separator />"
" <menuitem action='Undo' />"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]