[easytag/wip/application-window: 30/95] Use GAction for go-file actions



commit 39d259c90905629f3f63ed724e7713c48cbc24f3
Author: David King <amigadave amigadave com>
Date:   Sun Jul 13 10:49:42 2014 +0100

    Use GAction for go-file actions

 data/menus.ui            |    4 +
 data/toolbar.ui          |   39 +++++
 src/application_window.c |  424 ++++++++++++++++++++++++----------------------
 src/application_window.h |    6 +-
 src/bar.c                |   13 --
 src/bar.h                |    5 -
 src/easytag.c            |   69 +-------
 src/easytag.h            |    1 -
 src/scan_dialog.c        |    2 +-
 src/ui_manager.h         |   13 --
 10 files changed, 270 insertions(+), 306 deletions(-)
---
diff --git a/data/menus.ui b/data/menus.ui
index 8efef36..c73d3ad 100644
--- a/data/menus.ui
+++ b/data/menus.ui
@@ -373,18 +373,22 @@
             </section>
             <section>
             <item>
+                <attribute name="accel">&lt;Primary&gt;Home</attribute>
                 <attribute name="action">win.go-first</attribute>
                 <attribute name="label" translatable="yes">First File</attribute>
             </item>
             <item>
+                <attribute name="accel">Page_Up</attribute>
                 <attribute name="action">win.go-previous</attribute>
                 <attribute name="label" translatable="yes">Previous File</attribute>
             </item>
             <item>
+                <attribute name="accel">Page_Down</attribute>
                 <attribute name="action">win.go-next</attribute>
                 <attribute name="label" translatable="yes">_Next File</attribute>
             </item>
             <item>
+                <attribute name="accel">&lt;Primary&gt;End</attribute>
                 <attribute name="action">win.go-last</attribute>
                 <attribute name="label" translatable="yes">_Last File</attribute>
             </item>
diff --git a/data/toolbar.ui b/data/toolbar.ui
index 1940d96..0d6e136 100644
--- a/data/toolbar.ui
+++ b/data/toolbar.ui
@@ -2,6 +2,45 @@
     <object class="GtkToolbar" id="main_toolbar">
         <property name="visible">True</property>
         <child>
+            <object class="GtkToolButton" id="first_button">
+                <property name="action-name">win.go-first</property>
+                <property name="icon-name">go-first</property>
+                <property name="label" translatable="yes">_First File</property>
+                <property name="tooltip-text" translatable="yes">First file</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkToolButton" id="previous_button">
+                <property name="action-name">win.go-previous</property>
+                <property name="icon-name">go-previous</property>
+                <property name="label" translatable="yes">_Previous File</property>
+                <property name="tooltip-text" translatable="yes">Previous file</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkToolButton" id="next_button">
+                <property name="action-name">win.go-next</property>
+                <property name="icon-name">go-next</property>
+                <property name="label" translatable="yes">_Next File</property>
+                <property name="tooltip-text" translatable="yes">Next file</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkToolButton" id="last_button">
+                <property name="action-name">win.go-last</property>
+                <property name="icon-name">go-last</property>
+                <property name="label" translatable="yes">_Last File</property>
+                <property name="tooltip-text" translatable="yes">Last file</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkSeparatorToolItem" id="separator1"/>
+        </child>
+        <child>
             <object class="GtkToolButton" id="cddb_button">
                 <property name="action-name">win.show-cddb</property>
                 <property name="icon-name">media-optical</property>
diff --git a/src/application_window.c b/src/application_window.c
index fbf9539..97fa567 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -1870,6 +1870,163 @@ on_go_default (GSimpleAction *action,
     et_browser_load_default_dir (ET_BROWSER (priv->browser));
 }
 
+static void
+on_go_first (GSimpleAction *action,
+             GVariant *variant,
+             gpointer user_data)
+{
+    EtApplicationWindowPrivate *priv;
+    EtApplicationWindow *self;
+    GList *etfilelist;
+
+    self = ET_APPLICATION_WINDOW (user_data);
+    priv = et_application_window_get_instance_private (self);
+
+    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)
+    {
+        /* To avoid the last line still selected. */
+        et_browser_unselect_all (ET_BROWSER (priv->browser));
+        et_application_window_browser_select_file_by_et_file (self,
+                                                              (ET_File *)etfilelist->data,
+                                                              TRUE);
+        ET_Display_File_Data_To_UI ((ET_File *)etfilelist->data);
+    }
+
+    et_application_window_update_actions (self);
+    et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog (self)));
+
+    if (!g_settings_get_boolean (MainSettings, "tag-preserve-focus"))
+    {
+        gtk_widget_grab_focus (GTK_WIDGET (TitleEntry));
+    }
+}
+
+static void
+on_go_previous (GSimpleAction *action,
+                GVariant *variant,
+                gpointer user_data)
+{
+    EtApplicationWindowPrivate *priv;
+    EtApplicationWindow *self;
+    GList *etfilelist;
+
+    self = ET_APPLICATION_WINDOW (user_data);
+    priv = et_application_window_get_instance_private (self);
+
+    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)
+    {
+        et_browser_unselect_all (ET_BROWSER (priv->browser));
+        et_application_window_browser_select_file_by_et_file (self,
+                                                              (ET_File *)etfilelist->data,
+                                                              TRUE);
+        ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
+    }
+
+    et_application_window_update_actions (self);
+    et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog (self)));
+
+    if (!g_settings_get_boolean (MainSettings, "tag-preserve-focus"))
+    {
+        gtk_widget_grab_focus (GTK_WIDGET (TitleEntry));
+    }
+}
+
+static void
+on_go_next (GSimpleAction *action,
+            GVariant *variant,
+            gpointer user_data)
+{
+    EtApplicationWindowPrivate *priv;
+    EtApplicationWindow *self;
+    GList *etfilelist;
+
+    self = ET_APPLICATION_WINDOW (user_data);
+    priv = et_application_window_get_instance_private (self);
+
+    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)
+    {
+        et_browser_unselect_all (ET_BROWSER (priv->browser));
+        et_application_window_browser_select_file_by_et_file (self,
+                                                              (ET_File *)etfilelist->data,
+                                                              TRUE);
+        ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
+    }
+
+    et_application_window_update_actions (self);
+    et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog (self)));
+
+    if (!g_settings_get_boolean (MainSettings, "tag-preserve-focus"))
+    {
+        gtk_widget_grab_focus (GTK_WIDGET (TitleEntry));
+    }
+}
+
+static void
+on_go_last (GSimpleAction *action,
+            GVariant *variant,
+            gpointer user_data)
+{
+    EtApplicationWindowPrivate *priv;
+    EtApplicationWindow *self;
+    GList *etfilelist;
+
+    self = ET_APPLICATION_WINDOW (user_data);
+    priv = et_application_window_get_instance_private (self);
+
+    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)
+    {
+        et_browser_unselect_all (ET_BROWSER (priv->browser));
+        et_application_window_browser_select_file_by_et_file (self,
+                                                              (ET_File *)etfilelist->data,
+                                                              TRUE);
+        ET_Display_File_Data_To_UI ((ET_File *)etfilelist->data);
+    }
+
+    et_application_window_update_actions (self);
+    et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog (self)));
+
+    if (!g_settings_get_boolean (MainSettings, "tag-preserve-focus"))
+    {
+        gtk_widget_grab_focus (GTK_WIDGET (TitleEntry));
+    }
+}
+
 static const GActionEntry actions[] =
 {
     /* Miscellaneous menu. */
@@ -1884,6 +2041,10 @@ static const GActionEntry actions[] =
     { "go-music", on_go_music },
     { "go-parent", on_go_parent },
     { "go-default", on_go_default },
+    { "go-first", on_go_first },
+    { "go-previous", on_go_previous },
+    { "go-next", on_go_next },
+    { "go-last", on_go_last },
 };
 
 static void
@@ -2376,19 +2537,6 @@ et_application_window_select_dir (EtApplicationWindow *self, const gchar *path)
 }
 
 void
-et_application_window_load_default_dir (G_GNUC_UNUSED GtkAction *action,
-                                        gpointer user_data)
-{
-    EtApplicationWindowPrivate *priv;
-    EtApplicationWindow *self = ET_APPLICATION_WINDOW (user_data);
-
-    priv = et_application_window_get_instance_private (self);
-
-    et_browser_load_default_dir (ET_BROWSER (priv->browser));
-}
-
-
-void
 et_application_window_set_current_path_default (G_GNUC_UNUSED GtkAction *action,
                                                 gpointer user_data)
 {
@@ -2627,6 +2775,49 @@ set_action_state (EtApplicationWindow *self,
     g_simple_action_set_enabled (action, enabled);
 }
 
+/* et_application_window_disable_command_actions:
+ * Disable buttons when saving files (do not disable Quit button).
+ */
+void
+et_application_window_disable_command_actions (EtApplicationWindow *self)
+{
+    GtkDialog *dialog;
+
+    dialog = GTK_DIALOG (et_application_window_get_scan_dialog (self));
+
+    /* Scanner Window */
+    if (dialog)
+    {
+        gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_APPLY, FALSE);
+    }
+
+    /* "File" menu commands */
+    ui_widget_set_sensitive(MENU_FILE,AM_OPEN_FILE_WITH,FALSE);
+    ui_widget_set_sensitive(MENU_FILE,AM_INVERT_SELECTION,FALSE);
+    ui_widget_set_sensitive(MENU_FILE,AM_DELETE_FILE,FALSE);
+    set_action_state (self, "go-first", FALSE);
+    set_action_state (self, "go-previous", FALSE);
+    set_action_state (self, "go-next", FALSE);
+    set_action_state (self, "go-last", FALSE);
+    ui_widget_set_sensitive (MENU_EDIT, AM_REMOVE, FALSE);
+    ui_widget_set_sensitive(MENU_FILE,AM_UNDO,FALSE);
+    ui_widget_set_sensitive(MENU_FILE,AM_REDO,FALSE);
+    ui_widget_set_sensitive(MENU_FILE,AM_SAVE,FALSE);
+    ui_widget_set_sensitive(MENU_FILE,AM_SAVE_FORCED,FALSE);
+    ui_widget_set_sensitive (MENU_EDIT, AM_UNDO_HISTORY, FALSE);
+    ui_widget_set_sensitive (MENU_EDIT, AM_REDO_HISTORY, FALSE);
+
+    /* "Scanner" menu commands */
+    ui_widget_set_sensitive (MENU_SCANNER_PATH, AM_SCANNER_FILL_TAG,
+                             FALSE);
+    ui_widget_set_sensitive (MENU_SCANNER_PATH,
+                             AM_SCANNER_RENAME_FILE, FALSE);
+    ui_widget_set_sensitive (MENU_SCANNER_PATH,
+                             AM_SCANNER_PROCESS_FIELDS, FALSE);
+
+}
+
+
 /* et_application_window_update_actions:
  * Set to sensitive/unsensitive the state of each button into
  * the commands area and menu items in function of state of the "main list".
@@ -2690,10 +2881,10 @@ et_application_window_update_actions (EtApplicationWindow *self)
         ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_DESCENDING_FILE_BITRATE,FALSE);
         ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_ASCENDING_FILE_SAMPLERATE,FALSE);
         ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_DESCENDING_FILE_SAMPLERATE,FALSE);
-        ui_widget_set_sensitive (MENU_GO, AM_PREV, FALSE);
-        ui_widget_set_sensitive (MENU_GO, AM_NEXT, FALSE);
-        ui_widget_set_sensitive (MENU_GO, AM_FIRST, FALSE);
-        ui_widget_set_sensitive (MENU_GO, AM_LAST, FALSE);
+        set_action_state (self, "go-previous", FALSE);
+        set_action_state (self, "go-next", FALSE);
+        set_action_state (self, "go-first", FALSE);
+        set_action_state (self, "go-last", FALSE);
         ui_widget_set_sensitive (MENU_EDIT, AM_REMOVE, FALSE);
         ui_widget_set_sensitive(MENU_FILE, AM_UNDO, FALSE);
         ui_widget_set_sensitive(MENU_FILE, AM_REDO, FALSE);
@@ -2855,21 +3046,24 @@ et_application_window_update_actions (EtApplicationWindow *self)
 
     if (!ETCore->ETFileDisplayedList->prev)    /* Is it the 1st item ? */
     {
-        ui_widget_set_sensitive (MENU_GO, AM_PREV, FALSE);
-        ui_widget_set_sensitive (MENU_GO, AM_FIRST, FALSE);
-    }else
+        set_action_state (self, "go-previous", FALSE);
+        set_action_state (self, "go-first", FALSE);
+    }
+    else
     {
-        ui_widget_set_sensitive (MENU_GO, AM_PREV, TRUE);
-        ui_widget_set_sensitive (MENU_GO, AM_FIRST, TRUE);
+        set_action_state (self, "go-previous", TRUE);
+        set_action_state (self, "go-first", TRUE);
     }
+
     if (!ETCore->ETFileDisplayedList->next)    /* Is it the last item ? */
     {
-        ui_widget_set_sensitive (MENU_GO, AM_NEXT, FALSE);
-        ui_widget_set_sensitive (MENU_GO, AM_LAST, FALSE);
-    }else
+        set_action_state (self, "go-next", FALSE);
+        set_action_state (self, "go-last", FALSE);
+    }
+    else
     {
-        ui_widget_set_sensitive (MENU_GO, AM_NEXT, TRUE);
-        ui_widget_set_sensitive (MENU_GO, AM_LAST, TRUE);
+        set_action_state (self, "go-next", TRUE);
+        set_action_state (self, "go-last", TRUE);
     }
 }
 
@@ -3361,180 +3555,6 @@ et_application_window_invert_selection (GtkAction *action, gpointer user_data)
 }
 
 /*
- * Action when First button is selected
- */
-void
-et_application_window_select_first_file (GtkAction *action, gpointer user_data)
-{
-    EtApplicationWindow *self;
-    GList *etfilelist;
-
-    if (!ETCore->ETFileDisplayedList)
-        return;
-
-    self = ET_APPLICATION_WINDOW (user_data);
-
-    /* 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)
-    {
-        EtApplicationWindowPrivate *priv;
-
-        priv = et_application_window_get_instance_private (self);
-
-        /* To avoid the last line still selected. */
-        et_browser_unselect_all (ET_BROWSER (priv->browser));
-        et_application_window_browser_select_file_by_et_file (self,
-                                                              (ET_File *)etfilelist->data,
-                                                              TRUE);
-        ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
-    }
-
-    et_application_window_update_actions (self);
-    et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog (self)));
-
-    if (!g_settings_get_boolean (MainSettings, "tag-preserve-focus"))
-    {
-        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)
-{
-    EtApplicationWindow *self;
-    GList *etfilelist;
-
-    if (!ETCore->ETFileDisplayedList || !ETCore->ETFileDisplayedList->prev)
-        return;
-
-    self = ET_APPLICATION_WINDOW (user_data);
-
-    /* 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)
-    {
-        EtApplicationWindowPrivate *priv;
-
-        priv = et_application_window_get_instance_private (self);
-
-        et_browser_unselect_all (ET_BROWSER (priv->browser));
-        et_application_window_browser_select_file_by_et_file (self,
-                                                              (ET_File *)etfilelist->data,
-                                                              TRUE);
-        ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
-    }
-
-//    if (!ETFileList->prev)
-//        gdk_beep(); // Warm the user
-
-    et_application_window_update_actions (self);
-    et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog (self)));
-
-    if (!g_settings_get_boolean (MainSettings, "tag-preserve-focus"))
-    {
-        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)
-{
-    EtApplicationWindow *self;
-    GList *etfilelist;
-
-    if (!ETCore->ETFileDisplayedList || !ETCore->ETFileDisplayedList->next)
-        return;
-
-    self = ET_APPLICATION_WINDOW (user_data);
-
-    /* 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)
-    {
-        EtApplicationWindowPrivate *priv;
-
-        priv = et_application_window_get_instance_private (self);
-
-        et_browser_unselect_all (ET_BROWSER (priv->browser));
-        et_application_window_browser_select_file_by_et_file (self,
-                                                              (ET_File *)etfilelist->data,
-                                                              TRUE);
-        ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
-    }
-
-//    if (!ETFileList->next)
-//        gdk_beep(); // Warm the user
-
-    et_application_window_update_actions (self);
-    et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog (self)));
-
-    if (!g_settings_get_boolean (MainSettings, "tag-preserve-focus"))
-    {
-        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)
-{
-    EtApplicationWindow *self;
-    GList *etfilelist;
-
-    if (!ETCore->ETFileDisplayedList || !ETCore->ETFileDisplayedList->next)
-        return;
-
-    self = ET_APPLICATION_WINDOW (user_data);
-
-    /* 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)
-    {
-        EtApplicationWindowPrivate *priv;
-
-        priv = et_application_window_get_instance_private (self);
-
-        et_browser_unselect_all (ET_BROWSER (priv->browser));
-        et_application_window_browser_select_file_by_et_file (self,
-                                                              (ET_File *)etfilelist->data,
-                                                              TRUE);
-        ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
-    }
-
-    et_application_window_update_actions (self);
-    et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog (self)));
-
-    if (!g_settings_get_boolean (MainSettings, "tag-preserve-focus"))
-    {
-        gtk_widget_grab_focus (GTK_WIDGET (TitleEntry));
-    }
-}
-
-/*
  * Action when Remove button is pressed
  */
 void
@@ -3793,7 +3813,7 @@ et_application_window_delete_selected_files (GtkAction *action,
     gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ProgressBar), progress_bar_text);
 
     /* Set to unsensitive all command buttons (except Quit button) */
-    Disable_Command_Buttons();
+    et_application_window_disable_command_actions (self);
     et_application_window_browser_set_sensitive (self, FALSE);
     et_application_window_tag_area_set_sensitive (self, FALSE);
     et_application_window_file_area_set_sensitive (self, FALSE);
diff --git a/src/application_window.h b/src/application_window.h
index 4d45337..e642104 100644
--- a/src/application_window.h
+++ b/src/application_window.h
@@ -49,6 +49,7 @@ GType et_application_window_get_type (void);
 EtApplicationWindow *et_application_window_new (GtkApplication *application);
 void et_application_window_tag_area_set_sensitive (EtApplicationWindow *self, gboolean sensitive);
 void et_application_window_file_area_set_sensitive (EtApplicationWindow *self, gboolean sensitive);
+void et_application_window_disable_command_actions (EtApplicationWindow *self);
 void et_application_window_update_actions (EtApplicationWindow *self);
 void et_application_window_tag_area_display_controls (EtApplicationWindow *self, ET_File *ETFile);
 GtkWidget * et_application_window_get_log_area (EtApplicationWindow *self);
@@ -72,7 +73,6 @@ void et_application_window_run_player_for_artist_list (GtkAction *action, gpoint
 void et_application_window_run_player_for_selection (GtkAction *action, gpointer user_data);
 void et_application_window_reload_directory (GtkAction *action, gpointer user_data);
 void et_application_window_select_dir (EtApplicationWindow *self, const gchar *path);
-void et_application_window_load_default_dir (GtkAction *action, gpointer user_data);
 void et_application_window_set_current_path_default (GtkAction *action, gpointer user_data);
 const gchar * et_application_window_get_current_path (EtApplicationWindow *self);
 void et_application_window_show_open_directory_with_dialog (GtkAction *action, gpointer user_data);
@@ -101,10 +101,6 @@ void et_application_window_browser_refresh_file_in_list (EtApplicationWindow *se
 void et_application_window_browser_refresh_sort (EtApplicationWindow *self);
 void et_application_window_unselect_all (GtkAction *action, gpointer user_data);
 void et_application_window_invert_selection (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_delete_selected_files (GtkAction *action, gpointer user_data);
 void et_application_window_remove_selected_tags (GtkAction *action, gpointer user_data);
 void et_application_window_undo_selected_files (GtkAction *action, gpointer user_data);
diff --git a/src/bar.c b/src/bar.c
index f832082..90cb6c2 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -224,18 +224,6 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
         { AM_DELETE_FILE, GTK_STOCK_DELETE, _("Delete Files"), NULL,
           _("Delete files"),
           G_CALLBACK (et_application_window_delete_selected_files) },
-        { AM_FIRST, GTK_STOCK_GOTO_FIRST, _("_First File"), "<Primary>Home",
-          _("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 (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) },
@@ -296,7 +284,6 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
           G_CALLBACK (et_application_window_show_preferences_dialog) },
 
         { MENU_VIEW, NULL, _("_View"), NULL, NULL, NULL },
-        { MENU_GO, NULL, _("_Go"), NULL, NULL, NULL },
 
 
         /*
diff --git a/src/bar.h b/src/bar.h
index 4f79ef2..fb6cdbd 100644
--- a/src/bar.h
+++ b/src/bar.h
@@ -36,7 +36,6 @@ GtkWidget *CheckMenuItemBrowseHiddenDirMainMenu;
 #define MENU_FILE       "FileMenu"
 #define MENU_EDIT "EditMenu"
 #define MENU_VIEW "ViewMenu"
-#define MENU_GO "GoMenu"
 #define MENU_BROWSER    "BrowserMenu"
 #define MENU_SCANNER    "ScannerMenu"
 
@@ -52,10 +51,6 @@ GtkWidget *CheckMenuItemBrowseHiddenDirMainMenu;
 #define POPUP_DIR_RUN_AUDIO     "DirPopupRunAudio"
 #define POPUP_LOG               "LogPopup"
 
-#define AM_PREV                     "PreviousFile"
-#define AM_NEXT                     "NextFile"
-#define AM_FIRST                    "FirstFile"
-#define AM_LAST                     "LastFile"
 #define AM_SCAN_FILES "ScanFiles"
 #define AM_REMOVE                   "RemoveTag"
 #define AM_UNDO                     "UndoFile"
diff --git a/src/easytag.c b/src/easytag.c
index a30730d..b09b08a 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -641,7 +641,7 @@ Save_List_Of_Files (GList *etfilelist, gboolean force_saving_files)
     gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ProgressBar), progress_bar_text);
 
     /* Set to unsensitive all command buttons (except Quit button) */
-    Disable_Command_Buttons();
+    et_application_window_disable_command_actions (window);
     et_application_window_browser_set_sensitive (window, FALSE);
     et_application_window_tag_area_set_sensitive (window, FALSE);
     et_application_window_file_area_set_sensitive (window, FALSE);
@@ -1597,69 +1597,6 @@ void Action_Main_Stop_Button_Pressed (void)
     g_object_set(uiaction, "sensitive", FALSE, NULL);
 }
 
-static void
-ui_widget_set_sensitive (const gchar *menu, const gchar *action, gboolean sensitive)
-{
-    GtkAction *uiaction;
-    gchar *path;
-
-    path = g_strconcat("/MenuBar/", menu,"/", action, NULL);
-
-    uiaction = gtk_ui_manager_get_action(UIManager, path);
-    if (uiaction)
-    {
-        gtk_action_set_sensitive (uiaction, sensitive);
-    }
-    else
-    {
-        g_warning ("Action not found for path '%s'", path);
-    }
-    g_free(path);
-}
-
-/*
- * Just to disable buttons when we are saving files (do not disable Quit button)
- */
-void
-Disable_Command_Buttons (void)
-{
-    GtkDialog *dialog;
-
-    dialog = GTK_DIALOG (et_application_window_get_scan_dialog (ET_APPLICATION_WINDOW (MainWindow)));
-
-    /* Scanner Window */
-    if (dialog)
-    {
-        gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_APPLY, FALSE);
-    }
-
-    /* "File" menu commands */
-    ui_widget_set_sensitive(MENU_FILE,AM_OPEN_FILE_WITH,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_GO, AM_FIRST, FALSE);
-    ui_widget_set_sensitive (MENU_GO, AM_PREV, FALSE);
-    ui_widget_set_sensitive (MENU_GO, AM_NEXT, FALSE);
-    ui_widget_set_sensitive (MENU_GO, AM_LAST, FALSE);
-    ui_widget_set_sensitive (MENU_EDIT, AM_REMOVE, FALSE);
-    ui_widget_set_sensitive(MENU_FILE,AM_UNDO,FALSE);
-    ui_widget_set_sensitive(MENU_FILE,AM_REDO,FALSE);
-    ui_widget_set_sensitive(MENU_FILE,AM_SAVE,FALSE);
-    ui_widget_set_sensitive(MENU_FILE,AM_SAVE_FORCED,FALSE);
-    ui_widget_set_sensitive (MENU_EDIT, AM_UNDO_HISTORY, FALSE);
-    ui_widget_set_sensitive (MENU_EDIT, AM_REDO_HISTORY, FALSE);
-
-    /* "Scanner" menu commands */
-    ui_widget_set_sensitive (MENU_SCANNER_PATH, AM_SCANNER_FILL_TAG,
-                             FALSE);
-    ui_widget_set_sensitive (MENU_SCANNER_PATH,
-                             AM_SCANNER_RENAME_FILE, FALSE);
-    ui_widget_set_sensitive (MENU_SCANNER_PATH,
-                             AM_SCANNER_PROCESS_FIELDS, FALSE);
-
-}
-
-
 /*
  * Load the default directory when the user interface is completely displayed
  * to avoid bad visualization effect at startup.
@@ -1687,8 +1624,8 @@ Init_Load_Default_Dir (void)
     else
     {
         Statusbar_Message(_("Select a directory to browse"),FALSE);
-        et_application_window_load_default_dir (NULL,
-                                               ET_APPLICATION_WINDOW (MainWindow));
+        g_action_group_activate_action (G_ACTION_GROUP (MainWindow),
+                                        "go-default", NULL);
     }
 
     /* Set sensitivity of buttons if the default directory is invalid. */
diff --git a/src/easytag.h b/src/easytag.h
index 2e379dd..3216324 100644
--- a/src/easytag.h
+++ b/src/easytag.h
@@ -101,7 +101,6 @@ gboolean ReadingDirectory;
 /**************
  * Prototypes *
  **************/
-void Disable_Command_Buttons (void);
 void Action_Invert_Files_Selection      (void);
 void Action_Select_Nth_File_By_Position (gulong num_item);
 void Action_Select_Nth_File_By_Etfile   (ET_File *ETFile);
diff --git a/src/scan_dialog.c b/src/scan_dialog.c
index 7ba6821..ed57eaa 100644
--- a/src/scan_dialog.c
+++ b/src/scan_dialog.c
@@ -3441,7 +3441,7 @@ et_scan_dialog_scan_selected_files (EtScanDialog *self)
     gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ProgressBar), progress_bar_text);
 
     /* Set to unsensitive all command buttons (except Quit button) */
-    Disable_Command_Buttons();
+    et_application_window_disable_command_actions (ET_APPLICATION_WINDOW (MainWindow));
 
     progress_bar_index = 0;
 
diff --git a/src/ui_manager.h b/src/ui_manager.h
index d6b3c6b..7232761 100644
--- a/src/ui_manager.h
+++ b/src/ui_manager.h
@@ -152,13 +152,6 @@ static const gchar *ui_xml =
 "      <menuitem action='BrowseSubdir' />"
 "    </menu>"
 
-"    <menu action='GoMenu'>"
-"      <menuitem action='FirstFile' />"
-"      <menuitem action='PreviousFile' />"
-"      <menuitem action='NextFile' />"
-"      <menuitem action='LastFile' />"
-"    </menu>"
-
 "  </menubar>"
 
 
@@ -166,12 +159,6 @@ static const gchar *ui_xml =
  * Tool bar
  */
 "  <toolbar name='ToolBar'>"
-"    <toolitem action='FirstFile'/>"
-"    <toolitem action='PreviousFile'/>"
-"    <toolitem action='NextFile'/>"
-"    <toolitem action='LastFile'/>"
-"    <separator />"
-
 "    <toolitem action='ShowScanner'/>"
 "    <toolitem action='RemoveTag'/>"
 "    <toolitem action='UndoFile'/>"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]