[easytag/wip/application-window: 30/32] Move file selection actions to EtApplicationWindow
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/application-window: 30/32] Move file selection actions to EtApplicationWindow
- Date: Sat, 8 Mar 2014 17:01:51 +0000 (UTC)
commit c76dbc8c22d8fded46a233bd4b6a0a42f200a669
Author: David King <amigadave amigadave com>
Date: Sun Jan 5 22:08:21 2014 +0000
Move file selection actions to EtApplicationWindow
src/application_window.c | 129 ++++++++++++++++++++++++++++++++++++++++++++++
src/application_window.h | 4 ++
src/bar.c | 14 ++++--
src/easytag.c | 128 ---------------------------------------------
src/easytag.h | 4 --
5 files changed, 143 insertions(+), 136 deletions(-)
---
diff --git a/src/application_window.c b/src/application_window.c
index 197f1ec..d555ce5 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -2381,3 +2381,132 @@ et_application_window_unselect_all (GtkAction *action, gpointer user_data)
ETCore->ETFileDisplayed = NULL;
}
}
+
+/*
+ * Action when First button is selected
+ */
+void
+et_application_window_select_first_file (GtkAction *action, gpointer user_data)
+{
+ GList *etfilelist;
+
+ if (!ETCore->ETFileDisplayedList)
+ return;
+
+ /* Save the current displayed data */
+ ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
+
+ /* Go to the first item of the list */
+ etfilelist = ET_Displayed_File_List_First();
+ if (etfilelist)
+ {
+ Browser_List_Unselect_All_Files(); // To avoid the last line still selected
+ Browser_List_Select_File_By_Etfile((ET_File *)etfilelist->data,TRUE);
+ ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
+ }
+
+ Update_Command_Buttons_Sensivity();
+ et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog
(ET_APPLICATION_WINDOW (user_data))));
+
+ if (SET_FOCUS_TO_FIRST_TAG_FIELD)
+ gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
+}
+
+
+/*
+ * Action when Prev button is selected
+ */
+void
+et_application_window_select_prev_file (GtkAction *action, gpointer user_data)
+{
+ GList *etfilelist;
+
+ if (!ETCore->ETFileDisplayedList || !ETCore->ETFileDisplayedList->prev)
+ return;
+
+ /* Save the current displayed data */
+ ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
+
+ /* Go to the prev item of the list */
+ etfilelist = ET_Displayed_File_List_Previous();
+ if (etfilelist)
+ {
+ Browser_List_Unselect_All_Files();
+ Browser_List_Select_File_By_Etfile((ET_File *)etfilelist->data,TRUE);
+ ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
+ }
+
+// if (!ETFileList->prev)
+// gdk_beep(); // Warm the user
+
+ Update_Command_Buttons_Sensivity();
+ et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog
(ET_APPLICATION_WINDOW (user_data))));
+
+ if (SET_FOCUS_TO_FIRST_TAG_FIELD)
+ gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
+}
+
+
+/*
+ * Action when Next button is selected
+ */
+void
+et_application_window_select_next_file (GtkAction *acton, gpointer user_data)
+{
+ GList *etfilelist;
+
+ if (!ETCore->ETFileDisplayedList || !ETCore->ETFileDisplayedList->next)
+ return;
+
+ /* Save the current displayed data */
+ ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
+
+ /* Go to the next item of the list */
+ etfilelist = ET_Displayed_File_List_Next();
+ if (etfilelist)
+ {
+ Browser_List_Unselect_All_Files();
+ Browser_List_Select_File_By_Etfile((ET_File *)etfilelist->data,TRUE);
+ ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
+ }
+
+// if (!ETFileList->next)
+// gdk_beep(); // Warm the user
+
+ Update_Command_Buttons_Sensivity();
+ et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog
(ET_APPLICATION_WINDOW (user_data))));
+
+ if (SET_FOCUS_TO_FIRST_TAG_FIELD)
+ gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
+}
+
+
+/*
+ * Action when Last button is selected
+ */
+void
+et_application_window_select_last_file (GtkAction *action, gpointer user_data)
+{
+ GList *etfilelist;
+
+ if (!ETCore->ETFileDisplayedList || !ETCore->ETFileDisplayedList->next)
+ return;
+
+ /* Save the current displayed data */
+ ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
+
+ /* Go to the last item of the list */
+ etfilelist = ET_Displayed_File_List_Last();
+ if (etfilelist)
+ {
+ Browser_List_Unselect_All_Files();
+ Browser_List_Select_File_By_Etfile((ET_File *)etfilelist->data,TRUE);
+ ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
+ }
+
+ Update_Command_Buttons_Sensivity();
+ et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog
(ET_APPLICATION_WINDOW (user_data))));
+
+ if (SET_FOCUS_TO_FIRST_TAG_FIELD)
+ gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
+}
diff --git a/src/application_window.h b/src/application_window.h
index cbdcb89..d4976dd 100644
--- a/src/application_window.h
+++ b/src/application_window.h
@@ -68,6 +68,10 @@ void et_application_window_scan_selected_files (GtkAction *action, gpointer user
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_select_prev_file (GtkAction *action, gpointer user_data);
+void et_application_window_select_next_file (GtkAction *action, gpointer user_data);
+void et_application_window_select_first_file (GtkAction *action, gpointer user_data);
+void et_application_window_select_last_file (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 a340cd5..67e8246 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -217,11 +217,17 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
G_CALLBACK (Action_Invert_Files_Selection) },
{ AM_DELETE_FILE, GTK_STOCK_DELETE, _("Delete Files"), NULL,
_("Delete files"), G_CALLBACK(Action_Delete_Selected_Files) },
{ AM_FIRST, GTK_STOCK_GOTO_FIRST, _("_First File"), "<Primary>Home",
- _("First file"), G_CALLBACK (Action_Select_First_File) },
- { AM_PREV, GTK_STOCK_GO_BACK, _("_Previous File"), "Page_Up",
_("Previous file"), G_CALLBACK(Action_Select_Prev_File) },
- { AM_NEXT, GTK_STOCK_GO_FORWARD, _("_Next File"), "Page_Down",
_("Next file"), G_CALLBACK(Action_Select_Next_File) },
+ _("First file"),
+ G_CALLBACK (et_application_window_select_first_file) },
+ { AM_PREV, GTK_STOCK_GO_BACK, _("_Previous File"), "Page_Up",
+ _("Previous file"),
+ G_CALLBACK (et_application_window_select_prev_file) },
+ { AM_NEXT, GTK_STOCK_GO_FORWARD, _("_Next File"), "Page_Down",
+ _("Next file"),
+ G_CALLBACK (et_application_window_select_next_file) },
{ AM_LAST, GTK_STOCK_GOTO_LAST, _("_Last File"), "<Primary>End",
- _("Last file"), G_CALLBACK (Action_Select_Last_File) },
+ _("Last file"),
+ G_CALLBACK (et_application_window_select_last_file) },
{ AM_SCAN_FILES, GTK_STOCK_APPLY, _("S_can Files"), NULL,
_("Scan selected files"),
G_CALLBACK (et_application_window_scan_selected_files) },
diff --git a/src/easytag.c b/src/easytag.c
index 89e6162..c4e6cab 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -447,134 +447,6 @@ void Action_Invert_Files_Selection (void)
Update_Command_Buttons_Sensivity();
}
-
-
-/*
- * Action when First button is selected
- */
-void Action_Select_First_File (void)
-{
- GList *etfilelist;
-
- if (!ETCore->ETFileDisplayedList)
- return;
-
- /* Save the current displayed data */
- ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
-
- /* Go to the first item of the list */
- etfilelist = ET_Displayed_File_List_First();
- if (etfilelist)
- {
- Browser_List_Unselect_All_Files(); // To avoid the last line still selected
- Browser_List_Select_File_By_Etfile((ET_File *)etfilelist->data,TRUE);
- ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
- }
-
- Update_Command_Buttons_Sensivity();
- et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog
(ET_APPLICATION_WINDOW (MainWindow))));
-
- if (SET_FOCUS_TO_FIRST_TAG_FIELD)
- gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
-}
-
-
-/*
- * Action when Prev button is selected
- */
-void Action_Select_Prev_File (void)
-{
- GList *etfilelist;
-
- if (!ETCore->ETFileDisplayedList || !ETCore->ETFileDisplayedList->prev)
- return;
-
- /* Save the current displayed data */
- ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
-
- /* Go to the prev item of the list */
- etfilelist = ET_Displayed_File_List_Previous();
- if (etfilelist)
- {
- Browser_List_Unselect_All_Files();
- Browser_List_Select_File_By_Etfile((ET_File *)etfilelist->data,TRUE);
- ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
- }
-
-// if (!ETFileList->prev)
-// gdk_beep(); // Warm the user
-
- Update_Command_Buttons_Sensivity();
- et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog
(ET_APPLICATION_WINDOW (MainWindow))));
-
- if (SET_FOCUS_TO_FIRST_TAG_FIELD)
- gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
-}
-
-
-/*
- * Action when Next button is selected
- */
-void Action_Select_Next_File (void)
-{
- GList *etfilelist;
-
- if (!ETCore->ETFileDisplayedList || !ETCore->ETFileDisplayedList->next)
- return;
-
- /* Save the current displayed data */
- ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
-
- /* Go to the next item of the list */
- etfilelist = ET_Displayed_File_List_Next();
- if (etfilelist)
- {
- Browser_List_Unselect_All_Files();
- Browser_List_Select_File_By_Etfile((ET_File *)etfilelist->data,TRUE);
- ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
- }
-
-// if (!ETFileList->next)
-// gdk_beep(); // Warm the user
-
- Update_Command_Buttons_Sensivity();
- et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog
(ET_APPLICATION_WINDOW (MainWindow))));
-
- if (SET_FOCUS_TO_FIRST_TAG_FIELD)
- gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
-}
-
-
-/*
- * Action when Last button is selected
- */
-void Action_Select_Last_File (void)
-{
- GList *etfilelist;
-
- if (!ETCore->ETFileDisplayedList || !ETCore->ETFileDisplayedList->next)
- return;
-
- /* Save the current displayed data */
- ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
-
- /* Go to the last item of the list */
- etfilelist = ET_Displayed_File_List_Last();
- if (etfilelist)
- {
- Browser_List_Unselect_All_Files();
- Browser_List_Select_File_By_Etfile((ET_File *)etfilelist->data,TRUE);
- ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
- }
-
- Update_Command_Buttons_Sensivity();
- et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog
(ET_APPLICATION_WINDOW (MainWindow))));
-
- if (SET_FOCUS_TO_FIRST_TAG_FIELD)
- gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
-}
-
-
/*
* Select a file in the "main list" using the ETFile adress of each item.
*/
diff --git a/src/easytag.h b/src/easytag.h
index be384b5..f13befb 100644
--- a/src/easytag.h
+++ b/src/easytag.h
@@ -103,10 +103,6 @@ gboolean ReadingDirectory;
**************/
void Disable_Command_Buttons (void);
void Action_Invert_Files_Selection (void);
-void Action_Select_Prev_File (void);
-void Action_Select_Next_File (void);
-void Action_Select_First_File (void);
-void Action_Select_Last_File (void);
void Action_Select_Nth_File_By_Position (gulong num_item);
void Action_Select_Nth_File_By_Etfile (ET_File *ETFile);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]