[easytag/wip/application-window: 47/72] Use GAction for edit menu items



commit d5d2f2e564a5ad08268f1155553d0718713c1e87
Author: David King <amigadave amigadave com>
Date:   Sun Jul 13 13:03:39 2014 +0100

    Use GAction for edit menu items

 data/menus.ui            |   13 ++-
 data/toolbar.ui          |   21 ++
 src/application_window.c |  453 +++++++++++++++++++++++++++-------------------
 src/application_window.h |    5 -
 src/bar.c                |   18 --
 src/bar.h                |    7 -
 src/browser.c            |    3 +-
 src/easytag.c            |   47 -----
 src/easytag.h            |    2 -
 src/ui_manager.h         |   18 --
 10 files changed, 303 insertions(+), 284 deletions(-)
---
diff --git a/data/menus.ui b/data/menus.ui
index 4e1f36e..94f3c19 100644
--- a/data/menus.ui
+++ b/data/menus.ui
@@ -57,30 +57,41 @@
             <attribute name="label" translatable="yes">_Edit</attribute>
             <section>
                 <item>
-                    <attribute name="label" translatable="yes">_Find</attribute>
+                    <attribute name="accel">&lt;Primary&gt;f</attribute>
+                    <attribute name="action">win.find</attribute>
+                    <attribute name="label" translatable="yes">_Find…</attribute>
                 </item>
                 <item>
+                    <attribute name="accel">&lt;Primary&gt;a</attribute>
+                    <attribute name="action">win.select-all</attribute>
                     <attribute name="label" translatable="yes">Select All</attribute>
                 </item>
                 <item>
+                    <attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;a</attribute>
+                    <attribute name="action">win.unselect-all</attribute>
                     <attribute name="label" translatable="yes">Unselect All</attribute>
                 </item>
             </section>
             <section>
                 <item>
+                    <attribute name="action">win.undo-last-changes</attribute>
                     <attribute name="label" translatable="yes">Undo Last Changes</attribute>
                 </item>
                 <item>
+                    <attribute name="action">win.redo-last-changes</attribute>
                     <attribute name="label" translatable="yes">Redo Last Changes</attribute>
                 </item>
             </section>
             <section>
                 <item>
+                    <attribute name="accel">&lt;Primary&gt;e</attribute>
+                    <attribute name="action">win.remove-tags</attribute>
                     <attribute name="label" translatable="yes">_Remove Tags</attribute>
                 </item>
             </section>
             <section>
                 <item>
+                    <attribute name="action">win.preferences</attribute>
                     <attribute name="label" translatable="yes">_Preferences</attribute>
                 </item>
             </section>
diff --git a/data/toolbar.ui b/data/toolbar.ui
index 0d6e136..e011f2f 100644
--- a/data/toolbar.ui
+++ b/data/toolbar.ui
@@ -41,6 +41,27 @@
             <object class="GtkSeparatorToolItem" id="separator1"/>
         </child>
         <child>
+            <object class="GtkToolButton" id="remove_tags_button">
+                <property name="action-name">win.remove-tags</property>
+                <property name="icon-name">edit-clear</property>
+                <property name="label" translatable="yes">_Remove Tags</property>
+                <property name="tooltip-text" translatable="yes">Remove tags</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkSeparatorToolItem" id="separator2"/>
+        </child>
+        <child>
+            <object class="GtkToolButton" id="find_button">
+                <property name="action-name">win.find</property>
+                <property name="icon-name">edit-find</property>
+                <property name="label" translatable="yes">_Find…</property>
+                <property name="tooltip-text" translatable="yes">Search filenames and tags</property>
+                <property name="visible">True</property>
+            </object>
+        </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 769a362..1b443eb 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -1717,6 +1717,243 @@ et_application_window_show_cddb_dialog (EtApplicationWindow *self)
 }
 
 static void
+on_find (GSimpleAction *action,
+         GVariant *variant,
+         gpointer user_data)
+{
+    EtApplicationWindow *self;
+    EtApplicationWindowPrivate *priv;
+
+    self = ET_APPLICATION_WINDOW (user_data);
+    priv = et_application_window_get_instance_private (self);
+
+    if (priv->search_dialog)
+    {
+        gtk_widget_show (priv->search_dialog);
+    }
+    else
+    {
+        priv->search_dialog = GTK_WIDGET (et_search_dialog_new ());
+        gtk_widget_show_all (priv->search_dialog);
+    }
+}
+
+static void
+on_select_all (GSimpleAction *action,
+               GVariant *variant,
+               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. */
+    {
+        EtApplicationWindowPrivate *priv;
+        EtApplicationWindow *self = ET_APPLICATION_WINDOW (user_data);
+
+        priv = et_application_window_get_instance_private (self);
+
+        /* Save the current displayed data */
+        ET_Save_File_Data_From_UI (ETCore->ETFileDisplayed);
+
+        et_browser_select_all (ET_BROWSER (priv->browser));
+        et_application_window_update_actions (self);
+    }
+}
+
+static void
+on_unselect_all (GSimpleAction *action,
+                 GVariant *variant,
+                 gpointer user_data)
+{
+    EtApplicationWindow *self;
+    EtApplicationWindowPrivate *priv;
+    GtkWidget *focused;
+
+    self = ET_APPLICATION_WINDOW (user_data);
+    priv = et_application_window_get_instance_private (self);
+
+    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 unselect all in the file view. */
+    {
+        /* Save the current displayed data */
+        ET_Save_File_Data_From_UI (ETCore->ETFileDisplayed);
+
+        et_browser_unselect_all (ET_BROWSER (priv->browser));
+
+        ETCore->ETFileDisplayed = NULL;
+    }
+}
+
+static void
+on_undo_last_changes (GSimpleAction *action,
+                      GVariant *variant,
+                      gpointer user_data)
+{
+    EtApplicationWindow *self;
+    ET_File *ETFile;
+
+    self = ET_APPLICATION_WINDOW (user_data);
+
+    g_return_if_fail (ETCore->ETFileList != NULL);
+
+    /* Save the current displayed data */
+    ET_Save_File_Data_From_UI (ETCore->ETFileDisplayed);
+
+    ETFile = ET_Undo_History_File_Data ();
+
+    if (ETFile)
+    {
+        ET_Display_File_Data_To_UI (ETFile);
+        et_application_window_browser_select_file_by_et_file (self, ETFile,
+                                                              TRUE);
+        et_application_window_browser_refresh_file_in_list (self, ETFile);
+    }
+
+    et_application_window_update_actions (self);
+}
+
+static void
+on_redo_last_changes (GSimpleAction *action,
+                      GVariant *variant,
+                      gpointer user_data)
+{
+    EtApplicationWindow *self;
+    ET_File *ETFile;
+
+    self = ET_APPLICATION_WINDOW (user_data);
+
+    g_return_if_fail (ETCore->ETFileDisplayedList != NULL);
+
+    /* Save the current displayed data */
+    ET_Save_File_Data_From_UI (ETCore->ETFileDisplayed);
+
+    ETFile = ET_Redo_History_File_Data ();
+
+    if (ETFile)
+    {
+        ET_Display_File_Data_To_UI (ETFile);
+        et_application_window_browser_select_file_by_et_file (self, ETFile,
+                                                              TRUE);
+        et_application_window_browser_refresh_file_in_list (self, ETFile);
+    }
+
+    et_application_window_update_actions (self);
+}
+
+static void
+on_remove_tags (GSimpleAction *action,
+                GVariant *variant,
+                gpointer user_data)
+{
+    EtApplicationWindow *self;
+    EtApplicationWindowPrivate *priv;
+    GList *selfilelist = NULL;
+    GList *l;
+    ET_File *etfile;
+    File_Tag *FileTag;
+    gint progress_bar_index;
+    gint selectcount;
+    double fraction;
+    GtkTreeSelection *selection;
+
+    g_return_if_fail (ETCore->ETFileDisplayedList != NULL);
+
+    self = ET_APPLICATION_WINDOW (user_data);
+    priv = et_application_window_get_instance_private (self);
+
+    /* Save the current displayed data */
+    ET_Save_File_Data_From_UI (ETCore->ETFileDisplayed);
+
+    /* Initialize status bar */
+    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (ProgressBar), 0.0);
+    selection = et_application_window_browser_get_selection (self);
+    selectcount = gtk_tree_selection_count_selected_rows (selection);
+    progress_bar_index = 0;
+
+    selfilelist = gtk_tree_selection_get_selected_rows (selection, NULL);
+
+    for (l = selfilelist; l != NULL; l = g_list_next (l))
+    {
+        etfile = et_browser_get_et_file_from_path (ET_BROWSER (priv->browser),
+                                                   l->data);
+        FileTag = ET_File_Tag_Item_New ();
+        ET_Manage_Changes_Of_File_Data (etfile, NULL, FileTag);
+
+        fraction = (++progress_bar_index) / (double) selectcount;
+        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (ProgressBar),
+                                       fraction);
+        /* Needed to refresh status bar */
+        while (gtk_events_pending ())
+        {
+            gtk_main_iteration ();
+        }
+    }
+
+    g_list_free_full (selfilelist, (GDestroyNotify)gtk_tree_path_free);
+
+    /* Refresh the whole list (faster than file by file) to show changes. */
+    et_application_window_browser_refresh_list (self);
+
+    /* Display the current file */
+    ET_Display_File_Data_To_UI (ETCore->ETFileDisplayed);
+    et_application_window_update_actions (self);
+
+    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (ProgressBar), 0.0);
+    Statusbar_Message (_("All tags have been removed"),TRUE);
+}
+
+static void
+on_preferences (GSimpleAction *action,
+                GVariant *variant,
+                gpointer user_data)
+{
+    EtApplicationWindow *self;
+    EtApplicationWindowPrivate *priv;
+
+    self = ET_APPLICATION_WINDOW (user_data);
+    priv = et_application_window_get_instance_private (self);
+
+    if (priv->preferences_dialog)
+    {
+        gtk_widget_show (priv->preferences_dialog);
+    }
+    else
+    {
+        priv->preferences_dialog = GTK_WIDGET (et_preferences_dialog_new ());
+        gtk_widget_show_all (priv->preferences_dialog);
+    }
+}
+
+static void
 on_set_default_path (GSimpleAction *action,
                      GVariant *variant,
                      gpointer user_data)
@@ -2071,6 +2308,14 @@ on_go_last (GSimpleAction *action,
 
 static const GActionEntry actions[] =
 {
+    /* Edit menu. */
+    { "find", on_find },
+    { "select-all", on_select_all },
+    { "unselect-all", on_unselect_all },
+    { "undo-last-changes", on_undo_last_changes },
+    { "redo-last-changes", on_redo_last_changes },
+    { "remove-tags", on_remove_tags },
+    { "preferences", on_preferences },
     /* Browser menu. */
     { "set-default-path", on_set_default_path },
     { "rename-directory", on_rename_directory },
@@ -2313,26 +2558,6 @@ et_application_window_get_search_dialog (EtApplicationWindow *self)
     return priv->search_dialog;
 }
 
-void
-et_application_window_show_search_dialog (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);
-
-    if (priv->search_dialog)
-    {
-        gtk_widget_show (priv->search_dialog);
-    }
-    else
-    {
-        priv->search_dialog = GTK_WIDGET (et_search_dialog_new ());
-        gtk_widget_show_all (priv->search_dialog);
-    }
-}
-
 GtkWidget *
 et_application_window_get_preferences_dialog (EtApplicationWindow *self)
 {
@@ -2346,26 +2571,6 @@ et_application_window_get_preferences_dialog (EtApplicationWindow *self)
 }
 
 void
-et_application_window_show_preferences_dialog (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);
-
-    if (priv->preferences_dialog)
-    {
-        gtk_widget_show (priv->preferences_dialog);
-    }
-    else
-    {
-        priv->preferences_dialog = GTK_WIDGET (et_preferences_dialog_new ());
-        gtk_widget_show_all (priv->preferences_dialog);
-    }
-}
-
-void
 et_application_window_show_preferences_dialog_scanner (G_GNUC_UNUSED GtkAction *action,
                                                        gpointer user_data)
 {
@@ -2783,13 +2988,13 @@ et_application_window_disable_command_actions (EtApplicationWindow *self)
     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);
+    set_action_state (self, "remove-tags", 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);
+    set_action_state (self, "undo-last-changes", FALSE);
+    set_action_state (self, "redo-last-changes", FALSE);
 
     /* "Scanner" menu commands */
     ui_widget_set_sensitive (MENU_SCANNER_PATH, AM_SCANNER_FILL_TAG,
@@ -2869,14 +3074,14 @@ et_application_window_update_actions (EtApplicationWindow *self)
         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);
+        set_action_state (self, "remove-tags", 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);
-        ui_widget_set_sensitive (MENU_EDIT, AM_SEARCH_FILE, FALSE);
+        set_action_state (self, "undo-last-changes", FALSE);
+        set_action_state (self, "redo-last-changes", FALSE);
+        set_action_state (self, "find", FALSE);
         set_action_state (self, "show-load-filenames", FALSE);
         set_action_state (self, "show-playlist", FALSE);
         ui_widget_set_sensitive (MENU_FILE, AM_RUN_AUDIO_PLAYER, FALSE);
@@ -2946,8 +3151,8 @@ et_application_window_update_actions (EtApplicationWindow *self)
         ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_DESCENDING_FILE_BITRATE,TRUE);
         ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_ASCENDING_FILE_SAMPLERATE,TRUE);
         ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_DESCENDING_FILE_SAMPLERATE,TRUE);
-        ui_widget_set_sensitive (MENU_EDIT, AM_REMOVE, TRUE);
-        ui_widget_set_sensitive (MENU_EDIT, AM_SEARCH_FILE, TRUE);
+        set_action_state (self, "remove-tags", TRUE);
+        set_action_state (self, "find", TRUE);
         set_action_state (self, "show-load-filenames", TRUE);
         set_action_state (self, "show-playlist", TRUE);
         ui_widget_set_sensitive (MENU_FILE, AM_RUN_AUDIO_PLAYER, TRUE);
@@ -3002,16 +3207,24 @@ et_application_window_update_actions (EtApplicationWindow *self)
         ui_widget_set_sensitive(MENU_FILE, AM_SAVE_FORCED, TRUE);
 
         /* Enable undo command if there are data into main undo list (history list) */
-        if (ET_History_File_List_Has_Undo_Data())
-            ui_widget_set_sensitive (MENU_EDIT, AM_UNDO_HISTORY, TRUE);
+        if (ET_History_File_List_Has_Undo_Data ())
+        {
+            set_action_state (self, "undo-last-changes", TRUE);
+        }
         else
-            ui_widget_set_sensitive (MENU_EDIT, AM_UNDO_HISTORY, FALSE);
+        {
+            set_action_state (self, "undo-last-changes", FALSE);
+        }
 
         /* Enable redo commands if there are data into main redo list (history list) */
-        if (ET_History_File_List_Has_Redo_Data())
-            ui_widget_set_sensitive (MENU_EDIT, AM_REDO_HISTORY, TRUE);
+        if (ET_History_File_List_Has_Redo_Data ())
+        {
+            set_action_state (self, "redo-last-changes", TRUE);
+        }
         else
-            ui_widget_set_sensitive (MENU_EDIT, AM_REDO_HISTORY, FALSE);
+        {
+            set_action_state (self, "redo-last-changes", FALSE);
+        }
 
         artist_radio = gtk_ui_manager_get_widget (UIManager,
                                                   "/ToolBar/ArtistViewMode");
@@ -3271,42 +3484,6 @@ et_application_window_tag_area_display_controls (EtApplicationWindow *self,
     }
 }
 
-/*
- * 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. */
-    {
-        EtApplicationWindowPrivate *priv;
-        EtApplicationWindow *self = ET_APPLICATION_WINDOW (user_data);
-
-        priv = et_application_window_get_instance_private (self);
-
-        /* Save the current displayed data */
-        ET_Save_File_Data_From_UI (ETCore->ETFileDisplayed);
-
-        et_browser_select_all (ET_BROWSER (priv->browser));
-        et_application_window_update_actions (self);
-    }
-}
-
 void
 et_application_window_browser_entry_set_text (EtApplicationWindow *self,
                                               const gchar *text)
@@ -3490,37 +3667,6 @@ et_application_window_browser_refresh_sort (EtApplicationWindow *self)
 }
 
 /*
- * 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 unselect all in the file view. */
-    {
-        et_application_window_browser_unselect_all (ET_APPLICATION_WINDOW (user_data));
-    }
-}
-
-/*
  * Action when inverting files selection
  */
 void
@@ -3539,69 +3685,6 @@ et_application_window_invert_selection (GtkAction *action, gpointer user_data)
 }
 
 /*
- * Action when Remove button is pressed
- */
-void
-et_application_window_remove_selected_tags (GtkAction *action,
-                                            gpointer user_data)
-{
-    EtApplicationWindow *self;
-    EtApplicationWindowPrivate *priv;
-    GList *selfilelist = NULL;
-    GList *l;
-    ET_File *etfile;
-    File_Tag *FileTag;
-    gint progress_bar_index;
-    gint selectcount;
-    double fraction;
-    GtkTreeSelection *selection;
-
-    g_return_if_fail (ETCore->ETFileDisplayedList != NULL);
-
-    self = ET_APPLICATION_WINDOW (user_data);
-    priv = et_application_window_get_instance_private (self);
-
-    /* Save the current displayed data */
-    ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
-
-    /* Initialize status bar */
-    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar), 0.0);
-    selection = et_application_window_browser_get_selection (self);
-    selectcount = gtk_tree_selection_count_selected_rows (selection);
-    progress_bar_index = 0;
-
-    selfilelist = gtk_tree_selection_get_selected_rows (selection, NULL);
-
-    for (l = selfilelist; l != NULL; l = g_list_next (l))
-    {
-        etfile = et_browser_get_et_file_from_path (ET_BROWSER (priv->browser),
-                                                   l->data);
-        FileTag = ET_File_Tag_Item_New();
-        ET_Manage_Changes_Of_File_Data(etfile,NULL,FileTag);
-
-        fraction = (++progress_bar_index) / (double) selectcount;
-        gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar), fraction);
-        /* Needed to refresh status bar */
-        while (gtk_events_pending())
-            gtk_main_iteration();
-    }
-
-    g_list_free_full (selfilelist, (GDestroyNotify)gtk_tree_path_free);
-
-    /* Refresh the whole list (faster than file by file) to show changes. */
-    et_application_window_browser_refresh_list (self);
-
-    /* Display the current file */
-    ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
-    et_application_window_update_actions (self);
-
-    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar), 0.0);
-    Statusbar_Message(_("All tags have been removed"),TRUE);
-}
-
-
-
-/*
  * Action when Undo button is pressed.
  * Action_Undo_Selected_Files: Undo the last changes for the selected files.
  * Action_Undo_From_History_List: Undo the changes of the last modified file of the list.
diff --git a/src/application_window.h b/src/application_window.h
index 8093f02..f740f86 100644
--- a/src/application_window.h
+++ b/src/application_window.h
@@ -55,9 +55,7 @@ void et_application_window_tag_area_display_controls (EtApplicationWindow *self,
 GtkWidget * et_application_window_get_log_area (EtApplicationWindow *self);
 GtkWidget * et_application_window_get_load_files_dialog (EtApplicationWindow *self);
 GtkWidget * et_application_window_get_search_dialog (EtApplicationWindow *self);
-void et_application_window_show_search_dialog (GtkAction *action, gpointer user_data);
 GtkWidget * et_application_window_get_preferences_dialog (EtApplicationWindow *self);
-void et_application_window_show_preferences_dialog (GtkAction *action, gpointer user_data);
 void et_application_window_show_preferences_dialog_scanner (GtkAction *action, gpointer user_data);
 GtkWidget * et_application_window_get_cddb_dialog (EtApplicationWindow *self);
 void et_application_window_search_cddb_for_selection (GtkAction *action, gpointer user_data);
@@ -80,7 +78,6 @@ void et_application_window_show_scan_dialog (GtkAction *action, gpointer user_da
 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_on_action_select_browser_mode (GtkRadioAction *action, GtkRadioAction *current, gpointer user_data);
-void et_application_window_select_all (GtkAction *action, gpointer user_data);
 void et_application_window_browser_entry_set_text (EtApplicationWindow *self, const gchar *text);
 void et_application_window_browser_label_set_text (EtApplicationWindow *self, const gchar *text);
 ET_File * et_application_window_browser_get_et_file_from_path (EtApplicationWindow *self, GtkTreePath *path);
@@ -96,10 +93,8 @@ void et_application_window_browser_unselect_all (EtApplicationWindow *self);
 void et_application_window_browser_refresh_list (EtApplicationWindow *self);
 void et_application_window_browser_refresh_file_in_list (EtApplicationWindow *self, ET_File *file);
 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_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);
 void et_application_window_redo_selected_files (GtkAction *action, gpointer user_data);
 void et_application_window_hide_log_area (EtApplicationWindow *self);
diff --git a/src/bar.c b/src/bar.c
index 9f59985..15ba53f 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -213,11 +213,6 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
         { AM_OPEN_FILE_WITH, GTK_STOCK_OPEN, _("Open Files With…"),
           "<Primary><Shift>O", _("Run a command on the selected files"),
           G_CALLBACK (et_application_window_show_open_files_with_dialog) },
-        { AM_SELECT_ALL, GTK_STOCK_SELECT_ALL, NULL, "<Primary>A",
-          _("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_application_window_unselect_all) },
         { AM_INVERT_SELECTION, "easytag-invert-selection",
           _("Invert File Selection"), "<Primary>I", _("Invert file selection"),
           G_CALLBACK (et_application_window_invert_selection) },
@@ -227,9 +222,6 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
         { AM_SCAN_FILES, GTK_STOCK_APPLY, _("S_can Files"), NULL,
           _("Scan selected files"),
           G_CALLBACK (et_application_window_scan_selected_files) },
-        { AM_REMOVE, GTK_STOCK_CLEAR, _("_Remove Tags"), "<Primary>E",
-          _("Remove tags"),
-          G_CALLBACK (et_application_window_remove_selected_tags) },
         { AM_UNDO, GTK_STOCK_UNDO, _("_Undo Last Files Changes"), "<Primary>Z",
           _("Undo last files changes"),
           G_CALLBACK (et_application_window_undo_selected_files) },
@@ -242,8 +234,6 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
         { AM_SAVE_FORCED, GTK_STOCK_SAVE, _("_Force Save Files"),
           "<Primary><Shift>S", _("Force saving files"),
           G_CALLBACK (Action_Force_Saving_Selected_Files) },
-        { AM_UNDO_HISTORY,       GTK_STOCK_UNDO,             _("Undo Last Changes"),          NULL,          
      _("Undo last changes"),         G_CALLBACK(Action_Undo_From_History_List) },
-        { AM_REDO_HISTORY,       GTK_STOCK_REDO,             _("Redo Last Changes"),          NULL,          
      _("Redo last changes"),         G_CALLBACK(Action_Redo_From_History_List) },
         { AM_QUIT, GTK_STOCK_QUIT, _("_Quit"), "<Primary>Q", _("Quit"),
           G_CALLBACK (Quit_MainWindow) },
 
@@ -259,18 +249,10 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
 
         { MENU_SCANNER, NULL, _("S_canner Mode"), NULL, NULL, NULL },
 
-        { AM_SEARCH_FILE, GTK_STOCK_FIND, _("_Find…"), "<Primary>F",
-          _("Search filenames and tags"),
-          G_CALLBACK (et_application_window_show_search_dialog) },
         { AM_RUN_AUDIO_PLAYER, GTK_STOCK_MEDIA_PLAY, _("Run Audio Player"),
           "<Primary>M", _("Run audio player"),
           G_CALLBACK (et_application_window_run_player_for_selection) },
 
-        { MENU_EDIT, NULL, _("_Edit"), NULL, NULL, NULL },
-        { AM_OPEN_OPTIONS_WINDOW, GTK_STOCK_PREFERENCES, _("_Preferences"),
-          NULL, _("Preferences"),
-          G_CALLBACK (et_application_window_show_preferences_dialog) },
-
         { MENU_VIEW, NULL, _("_View"), NULL, NULL, NULL },
 
 
diff --git a/src/bar.h b/src/bar.h
index 91dea89..4ea890b 100644
--- a/src/bar.h
+++ b/src/bar.h
@@ -34,7 +34,6 @@ GtkWidget *CheckMenuItemBrowseSubdirMainMenu;
 GtkWidget *CheckMenuItemBrowseHiddenDirMainMenu;
 
 #define MENU_FILE       "FileMenu"
-#define MENU_EDIT "EditMenu"
 #define MENU_VIEW "ViewMenu"
 #define MENU_SCANNER    "ScannerMenu"
 
@@ -51,15 +50,10 @@ GtkWidget *CheckMenuItemBrowseHiddenDirMainMenu;
 #define POPUP_LOG               "LogPopup"
 
 #define AM_SCAN_FILES "ScanFiles"
-#define AM_REMOVE                   "RemoveTag"
 #define AM_UNDO                     "UndoFile"
 #define AM_REDO                     "RedoFile"
-#define AM_UNDO_HISTORY             "Undo"
-#define AM_REDO_HISTORY             "Redo"
 #define AM_SAVE                     "SaveFile"
 #define AM_SAVE_FORCED              "SaveFileForced"
-#define AM_SELECT_ALL "SelAll"
-#define AM_UNSELECT_ALL "UnselAll"
 #define AM_INVERT_SELECTION         "SelInv"
 #define AM_DELETE_FILE              "DeleteFile"
 #define AM_BROWSER_HIDDEN_DIR       "BrowseHiddenDir"
@@ -74,7 +68,6 @@ GtkWidget *CheckMenuItemBrowseHiddenDirMainMenu;
 #define AM_SCANNER_RENAME_FILE      "RenameFile"
 #define AM_SCANNER_PROCESS_FIELDS   "ProcessFields"
 #define AM_SCANNER_SHOW "ShowScanner"
-#define AM_SEARCH_FILE              "SearchFile"
 #define AM_CDDB_SEARCH_FILE         "CDDBSearchFile"
 #define AM_RUN_AUDIO_PLAYER         "RunAudio"
 #define AM_QUIT                     "Quit"
diff --git a/src/browser.c b/src/browser.c
index f40d1b5..08c411b 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -769,7 +769,8 @@ Browser_List_Button_Press (EtBrowser *self,
     }else if (event->type==GDK_3BUTTON_PRESS && event->button==1)
     {
         /* Triple left mouse click, select all files of the list. */
-        et_application_window_select_all (NULL, MainWindow);
+        g_action_group_activate_action (G_ACTION_GROUP (MainWindow),
+                                        "select-all", NULL);
     }
     return FALSE;
 }
diff --git a/src/easytag.c b/src/easytag.c
index 28b2acb..de02e19 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -447,53 +447,6 @@ void Action_Select_Nth_File_By_Etfile (ET_File *ETFile)
     et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog 
(ET_APPLICATION_WINDOW (MainWindow))));
 }
 
-void Action_Undo_From_History_List (void)
-{
-    ET_File *ETFile;
-
-    g_return_if_fail (ETCore->ETFileList != NULL);
-
-    /* Save the current displayed data */
-    ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
-
-    ETFile = ET_Undo_History_File_Data();
-    if (ETFile)
-    {
-        ET_Display_File_Data_To_UI(ETFile);
-        et_application_window_browser_select_file_by_et_file (ET_APPLICATION_WINDOW (MainWindow),
-                                                              ETFile, TRUE);
-        et_application_window_browser_refresh_file_in_list (ET_APPLICATION_WINDOW (MainWindow),
-                                                            ETFile);
-    }
-
-    et_application_window_update_actions (ET_APPLICATION_WINDOW (MainWindow));
-}
-
-
-
-void Action_Redo_From_History_List (void)
-{
-    ET_File *ETFile;
-
-    g_return_if_fail (ETCore->ETFileDisplayedList != NULL);
-
-    /* Save the current displayed data */
-    ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
-
-    ETFile = ET_Redo_History_File_Data();
-    if (ETFile)
-    {
-        ET_Display_File_Data_To_UI(ETFile);
-        et_application_window_browser_select_file_by_et_file (ET_APPLICATION_WINDOW (MainWindow),
-                                                              ETFile, TRUE);
-        et_application_window_browser_refresh_file_in_list (ET_APPLICATION_WINDOW (MainWindow),
-                                                            ETFile);
-    }
-
-    et_application_window_update_actions (ET_APPLICATION_WINDOW (MainWindow));
-}
-
-
 /*
  * Action when Save button is pressed
  */
diff --git a/src/easytag.h b/src/easytag.h
index 3216324..9fb3d5a 100644
--- a/src/easytag.h
+++ b/src/easytag.h
@@ -110,8 +110,6 @@ void Action_Undo_All_Files              (void);
 void Action_Redo_All_Files              (void);
 void Action_Save_Selected_Files         (void);
 void Action_Force_Saving_Selected_Files (void);
-void Action_Undo_From_History_List      (void);
-void Action_Redo_From_History_List      (void);
 gint et_delete_file (ET_File *ETFile, gboolean multiple_files, GError **error);
 gint Save_All_Files_With_Answer         (gboolean force_saving_files);
 
diff --git a/src/ui_manager.h b/src/ui_manager.h
index 366d879..747166d 100644
--- a/src/ui_manager.h
+++ b/src/ui_manager.h
@@ -31,23 +31,6 @@ static const gchar *ui_xml =
 "      <menuitem action='Quit' />"
 "    </menu>"
 
-
-"    <menu action='EditMenu'>"
-"      <menuitem action='SearchFile' />"
-"      <menuitem action='SelAll' />"
-"      <menuitem action='UnselAll' />"
-"      <separator />"
-
-"      <menuitem action='Undo' />"
-"      <menuitem action='Redo' />"
-"      <separator />"
-
-"      <menuitem action='RemoveTag' />"
-"      <separator />"
-
-"      <menuitem action='Preferences' />"
-"    </menu>"
-
 "    <menu action='ViewMenu'>"
 "      <menuitem action='ShowScanner' />"
 "      <menu action='ScannerMenu'>"
@@ -149,7 +132,6 @@ static const gchar *ui_xml =
  */
 "  <toolbar name='ToolBar'>"
 "    <toolitem action='ShowScanner'/>"
-"    <toolitem action='RemoveTag'/>"
 "    <toolitem action='UndoFile'/>"
 "    <toolitem action='RedoFile'/>"
 "    <toolitem action='SaveFile'/>"


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