[easytag/wip/application-window: 3/11] Use GAction for file sorting mode GSetting
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/application-window: 3/11] Use GAction for file sorting mode GSetting
- Date: Mon, 14 Jul 2014 22:11:20 +0000 (UTC)
commit b37e15ff8e4b3d4e6f7da63a7ee29a6019cd189d
Author: David King <amigadave amigadave com>
Date: Sun Jul 13 19:01:59 2014 +0100
Use GAction for file sorting mode GSetting
data/menus.ui | 80 ++++++++++++++++++++++++++++
src/application_window.c | 91 +++------------------------------
src/bar.c | 128 ++--------------------------------------------
src/bar.h | 50 +------------------
src/ui_manager.h | 76 ---------------------------
5 files changed, 92 insertions(+), 333 deletions(-)
---
diff --git a/data/menus.ui b/data/menus.ui
index 7911299..66b5ea4 100644
--- a/data/menus.ui
+++ b/data/menus.ui
@@ -152,106 +152,158 @@
<attribute name="label" translatable="yes">Sort List by Tag</attribute>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by track number</attribute>
+ <attribute name="target">ascending-track-number</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by track number</attribute>
+ <attribute name="target">descending-track-number</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by title</attribute>
+ <attribute name="target">ascending-title</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by title</attribute>
+ <attribute name="target">descending-title</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by artist</attribute>
+ <attribute name="target">ascending-artist</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by artist</attribute>
+ <attribute name="target">descending-artist</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by album artist</attribute>
+ <attribute name="target">ascending-album-artist</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by album artist</attribute>
+ <attribute name="target">descending-album-artist</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by album</attribute>
+ <attribute name="target">ascending-album</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by album</attribute>
+ <attribute name="target">descending-album</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by year</attribute>
+ <attribute name="target">ascending-year</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by year</attribute>
+ <attribute name="target">descending-year</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by genre</attribute>
+ <attribute name="target">ascending-genre</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by genre</attribute>
+ <attribute name="target">descending-genre</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by comment</attribute>
+ <attribute name="target">ascending-comment</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by comment</attribute>
+ <attribute name="target">descending-comment</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by composer</attribute>
+ <attribute name="target">ascending-composer</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by composer</attribute>
+ <attribute name="target">descending-composer</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by original artist</attribute>
+ <attribute name="target">ascending-orig-artist</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by original artist</attribute>
+ <attribute name="target">descending-orig-artist</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by copyright</attribute>
+ <attribute name="target">ascending-copyright</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by copyright</attribute>
+ <attribute name="target">descending-copyright</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by URL</attribute>
+ <attribute name="target">ascending-url</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by URL</attribute>
+ <attribute name="target">descending-url</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by encoder name</attribute>
+ <attribute name="target">ascending-encoded-by</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by encoder name</attribute>
+ <attribute name="target">descending-encoded-by</attribute>
</item>
</section>
</submenu>
@@ -259,58 +311,86 @@
<attribute name="label" translatable="yes">Sort List by Property</attribute>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by filename</attribute>
+ <attribute name="target">ascending-filename</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by filename</attribute>
+ <attribute name="target">descending-filename</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by creation date</attribute>
+ <attribute name="target">ascending-creation-date</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by creation date</attribute>
+ <attribute name="target">descending-creation-date</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by file type</attribute>
+ <attribute name="target">ascending-file-type</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by file type</attribute>
+ <attribute name="target">descending-file-type</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by file size</attribute>
+ <attribute name="target">ascending-file-size</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by file size</attribute>
+ <attribute name="target">descending-file-size</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by duration</attribute>
+ <attribute name="target">ascending-file-duration</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by duration</attribute>
+ <attribute name="target">descending-file-duration</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by bitrate</attribute>
+ <attribute name="target">ascending-file-bitrate</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by bitrate</attribute>
+ <attribute name="target">descending-file-bitrate</attribute>
</item>
</section>
<section>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Ascending by samplerate</attribute>
+ <attribute name="target">ascending-file-samplerate</attribute>
</item>
<item>
+ <attribute name="action">win.sort-mode</attribute>
<attribute name="label" translatable="yes">Descending by samplerate</attribute>
+ <attribute name="target">descending-file-samplerate</attribute>
</item>
</section>
</submenu>
diff --git a/src/application_window.c b/src/application_window.c
index 501e957..0e84ded 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -2822,7 +2822,8 @@ static const GActionEntry actions[] =
{ "scanner", on_action_toggle, NULL, "false", on_scanner_change },
/* { "scan-mode", on_action_radio, NULL, "false", on_scan_mode_change },
* Created from GSetting. */
- /* FIXME: Sorting submenus. */
+ /* { "sort-mode", on_action_radio, "s", "'ascending-filename'",
+ * on_sort_mode_change }, Created from GSetting */
{ "file-artist-view", on_action_radio, "s", "'file'",
on_file_artist_view_change },
{ "collapse-tree", on_collapse_tree },
@@ -2900,6 +2901,8 @@ et_application_window_init (EtApplicationWindow *self)
g_action_map_add_action (G_ACTION_MAP (self), action);
action = g_settings_create_action (MainSettings, "scan-mode");
g_action_map_add_action (G_ACTION_MAP (self), action);
+ action = g_settings_create_action (MainSettings, "sort-mode");
+ g_action_map_add_action (G_ACTION_MAP (self), action);
window = GTK_WINDOW (self);
@@ -2916,14 +2919,12 @@ et_application_window_init (EtApplicationWindow *self)
/* Menu bar and tool bar. */
{
- GtkWidget *menu_area;
GtkWidget *tool_area;
GtkBuilder *builder;
GError *error = NULL;
GtkWidget *toolbar;
- Create_UI (window, &menu_area, &tool_area);
- gtk_box_pack_start (GTK_BOX (main_vbox), menu_area, FALSE, FALSE, 0);
+ tool_area = create_main_toolbar (window);
gtk_box_pack_start (GTK_BOX (main_vbox), tool_area, FALSE, FALSE, 0);
builder = gtk_builder_new ();
@@ -3354,30 +3355,6 @@ et_application_window_file_area_set_sensitive (EtApplicationWindow *self,
}
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);
-}
-
-static void
set_action_state (EtApplicationWindow *self,
const gchar *action_name,
gboolean enabled)
@@ -3468,34 +3445,7 @@ et_application_window_update_actions (EtApplicationWindow *self)
set_action_state (self, "open-with", FALSE);
set_action_state (self, "invert-selection", FALSE);
set_action_state (self, "delete", FALSE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_ASCENDING_FILENAME, FALSE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_DESCENDING_FILENAME,FALSE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_ASCENDING_CREATION_DATE,FALSE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_DESCENDING_CREATION_DATE,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_ASCENDING_TRACK_NUMBER,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_DESCENDING_TRACK_NUMBER,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_ASCENDING_TITLE,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_DESCENDING_TITLE,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_ASCENDING_ARTIST,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_DESCENDING_ARTIST,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_ASCENDING_ALBUM,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_DESCENDING_ALBUM,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_ASCENDING_YEAR,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_DESCENDING_YEAR,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_ASCENDING_GENRE,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_DESCENDING_GENRE,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_ASCENDING_COMMENT,FALSE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH, AM_SORT_DESCENDING_COMMENT,FALSE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_ASCENDING_FILE_TYPE,FALSE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_DESCENDING_FILE_TYPE,FALSE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_ASCENDING_FILE_SIZE,FALSE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_DESCENDING_FILE_SIZE,FALSE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_ASCENDING_FILE_DURATION,FALSE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_DESCENDING_FILE_DURATION,FALSE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH, AM_SORT_ASCENDING_FILE_BITRATE,FALSE);
- 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);
+ /* FIXME: set_action_state (self, "sort-mode", FALSE); */
set_action_state (self, "go-previous", FALSE);
set_action_state (self, "go-next", FALSE);
set_action_state (self, "go-first", FALSE);
@@ -3543,34 +3493,7 @@ et_application_window_update_actions (EtApplicationWindow *self)
set_action_state (self, "open-with", TRUE);
set_action_state (self, "invert-selection", TRUE);
set_action_state (self, "delete", TRUE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_ASCENDING_FILENAME,TRUE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_DESCENDING_FILENAME,TRUE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_ASCENDING_CREATION_DATE,TRUE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_DESCENDING_CREATION_DATE,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_ASCENDING_TRACK_NUMBER,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_DESCENDING_TRACK_NUMBER,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_ASCENDING_TITLE,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_DESCENDING_TITLE,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_ASCENDING_ARTIST,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_DESCENDING_ARTIST,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_ASCENDING_ALBUM,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_DESCENDING_ALBUM,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_ASCENDING_YEAR,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_DESCENDING_YEAR,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_ASCENDING_GENRE,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_DESCENDING_GENRE,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_ASCENDING_COMMENT,TRUE);
- ui_widget_set_sensitive(MENU_SORT_TAG_PATH,AM_SORT_DESCENDING_COMMENT,TRUE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_ASCENDING_FILE_TYPE,TRUE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_DESCENDING_FILE_TYPE,TRUE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_ASCENDING_FILE_SIZE,TRUE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_DESCENDING_FILE_SIZE,TRUE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_ASCENDING_FILE_DURATION,TRUE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_DESCENDING_FILE_DURATION,TRUE);
- ui_widget_set_sensitive(MENU_SORT_PROP_PATH,AM_SORT_ASCENDING_FILE_BITRATE,TRUE);
- 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);
+ /* FIXME set_action_state (self, "sort-mode", TRUE); */
set_action_state (self, "remove-tags", TRUE);
set_action_state (self, "find", TRUE);
set_action_state (self, "show-load-filenames", TRUE);
diff --git a/src/bar.c b/src/bar.c
index 04d6b66..3b92255 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -69,68 +69,9 @@ static void on_menu_item_deselect (GtkMenuItem *item, gpointer user_data);
* Functions o
*************/
-/*
- * Dynamic reimplementation of switch macros
- */
-#define QCASE(string,callback) if (quark == g_quark_from_string((string))) { (callback)(); }
-#define QCASE_DATA(string,callback,data) if (quark == g_quark_from_string((string))) { (callback)((data)); }
-
-/*
- * Menu bar
- */
-static void
-Menu_Sort_Action (GtkAction *item, gpointer data)
+GtkWidget *
+create_main_toolbar (GtkWindow *window)
{
- const gchar *action = gtk_action_get_name(item);
- GQuark quark = g_quark_from_string(action);
-
- QCASE_DATA(AM_SORT_ASCENDING_FILENAME, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_FILENAME);
- QCASE_DATA(AM_SORT_DESCENDING_FILENAME, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_FILENAME);
- QCASE_DATA(AM_SORT_ASCENDING_CREATION_DATE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_CREATION_DATE);
- QCASE_DATA(AM_SORT_DESCENDING_CREATION_DATE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_CREATION_DATE);
- QCASE_DATA(AM_SORT_ASCENDING_TRACK_NUMBER, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_TRACK_NUMBER);
- QCASE_DATA(AM_SORT_DESCENDING_TRACK_NUMBER, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_TRACK_NUMBER);
- QCASE_DATA(AM_SORT_ASCENDING_TITLE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_TITLE);
- QCASE_DATA(AM_SORT_DESCENDING_TITLE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_TITLE);
- QCASE_DATA(AM_SORT_ASCENDING_ARTIST, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_ARTIST);
- QCASE_DATA(AM_SORT_DESCENDING_ARTIST, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_ARTIST);
- QCASE_DATA(AM_SORT_ASCENDING_ALBUM_ARTIST, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_ALBUM_ARTIST);
- QCASE_DATA(AM_SORT_DESCENDING_ALBUM_ARTIST, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_ALBUM_ARTIST);
- QCASE_DATA(AM_SORT_ASCENDING_ALBUM, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_ALBUM);
- QCASE_DATA(AM_SORT_DESCENDING_ALBUM, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_ALBUM);
- QCASE_DATA(AM_SORT_ASCENDING_YEAR, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_YEAR);
- QCASE_DATA(AM_SORT_DESCENDING_YEAR, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_YEAR);
- QCASE_DATA(AM_SORT_ASCENDING_GENRE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_GENRE);
- QCASE_DATA(AM_SORT_DESCENDING_GENRE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_GENRE);
- QCASE_DATA(AM_SORT_ASCENDING_COMMENT, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_COMMENT);
- QCASE_DATA(AM_SORT_DESCENDING_COMMENT, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_COMMENT);
- QCASE_DATA(AM_SORT_ASCENDING_COMPOSER, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_COMPOSER);
- QCASE_DATA(AM_SORT_DESCENDING_COMPOSER, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_COMPOSER);
- QCASE_DATA(AM_SORT_ASCENDING_ORIG_ARTIST, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_ORIG_ARTIST);
- QCASE_DATA(AM_SORT_DESCENDING_ORIG_ARTIST, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_ORIG_ARTIST);
- QCASE_DATA(AM_SORT_ASCENDING_COPYRIGHT, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_COPYRIGHT);
- QCASE_DATA(AM_SORT_DESCENDING_COPYRIGHT, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_COPYRIGHT);
- QCASE_DATA(AM_SORT_ASCENDING_URL, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_URL);
- QCASE_DATA(AM_SORT_DESCENDING_URL, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_URL);
- QCASE_DATA(AM_SORT_ASCENDING_ENCODED_BY, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_ENCODED_BY);
- QCASE_DATA(AM_SORT_DESCENDING_ENCODED_BY, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_ENCODED_BY);
- QCASE_DATA(AM_SORT_ASCENDING_FILE_TYPE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_FILE_TYPE);
- QCASE_DATA(AM_SORT_DESCENDING_FILE_TYPE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_FILE_TYPE);
- QCASE_DATA(AM_SORT_ASCENDING_FILE_SIZE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_FILE_SIZE);
- QCASE_DATA(AM_SORT_DESCENDING_FILE_SIZE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_FILE_SIZE);
- QCASE_DATA(AM_SORT_ASCENDING_FILE_DURATION, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_FILE_DURATION);
- QCASE_DATA(AM_SORT_DESCENDING_FILE_DURATION, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_FILE_DURATION);
- QCASE_DATA(AM_SORT_ASCENDING_FILE_BITRATE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_FILE_BITRATE);
- QCASE_DATA(AM_SORT_DESCENDING_FILE_BITRATE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_FILE_BITRATE);
- QCASE_DATA(AM_SORT_ASCENDING_FILE_SAMPLERATE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_ASCENDING_FILE_SAMPLERATE);
- QCASE_DATA(AM_SORT_DESCENDING_FILE_SAMPLERATE, ET_Sort_Displayed_File_List_And_Update_UI,
ET_SORT_MODE_DESCENDING_FILE_SAMPLERATE);
- et_application_window_browser_refresh_sort (ET_APPLICATION_WINDOW (data));
-}
-
-void
-Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
-{
- GtkWidget *menubar;
GtkWidget *toolbar;
/*
@@ -144,63 +85,6 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
*/
GtkActionEntry ActionEntries[] =
{
-
- /*
- * Main Menu Actions
- */
- { MENU_FILE_SORT_TAG, GTK_STOCK_SORT_ASCENDING, _("Sort List by Tag"),
- NULL, NULL, NULL },
- { MENU_FILE_SORT_PROP, GTK_STOCK_SORT_ASCENDING,
- _("Sort List by Property"), NULL, NULL, NULL },
- { AM_SORT_ASCENDING_FILENAME, GTK_STOCK_SORT_ASCENDING, _("Ascending by filename"),
NULL, _("Ascending by filename"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_FILENAME, GTK_STOCK_SORT_DESCENDING, _("Descending by filename"),
NULL, _("Descending by filename"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_CREATION_DATE, GTK_STOCK_SORT_ASCENDING, _("Ascending by creation date"),
NULL, _("Ascending by creation date"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_CREATION_DATE, GTK_STOCK_SORT_DESCENDING, _("Descending by creation date"),
NULL, _("Descending by creation date"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_TRACK_NUMBER, GTK_STOCK_SORT_ASCENDING, _("Ascending by track number"),
NULL, _("Ascending by track number"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_TRACK_NUMBER, GTK_STOCK_SORT_DESCENDING, _("Descending by track number"),
NULL, _("Descending by track number"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_TITLE, GTK_STOCK_SORT_ASCENDING, _("Ascending by title"),
NULL, _("Ascending by title"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_TITLE, GTK_STOCK_SORT_DESCENDING, _("Descending by title"),
NULL, _("Descending by title"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_ARTIST, GTK_STOCK_SORT_ASCENDING, _("Ascending by artist"),
NULL, _("Ascending by artist"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_ARTIST, GTK_STOCK_SORT_DESCENDING, _("Descending by artist"),
NULL, _("Descending by artist"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_ALBUM_ARTIST, GTK_STOCK_SORT_ASCENDING, _("Ascending by album artist"),
NULL, _("Ascending by album artist"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_ALBUM_ARTIST, GTK_STOCK_SORT_DESCENDING, _("Descending by album artist"),
NULL, _("Descending by album artist"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_ALBUM, GTK_STOCK_SORT_ASCENDING, _("Ascending by album"),
NULL, _("Ascending by album"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_ALBUM, GTK_STOCK_SORT_DESCENDING, _("Descending by album"),
NULL, _("Descending by album"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_YEAR, GTK_STOCK_SORT_ASCENDING, _("Ascending by year"),
NULL, _("Ascending by year"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_YEAR, GTK_STOCK_SORT_DESCENDING, _("Descending by year"),
NULL, _("Descending by year"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_GENRE, GTK_STOCK_SORT_ASCENDING, _("Ascending by genre"),
NULL, _("Ascending by genre"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_GENRE, GTK_STOCK_SORT_DESCENDING, _("Descending by genre"),
NULL, _("Descending by genre"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_COMMENT, GTK_STOCK_SORT_ASCENDING, _("Ascending by comment"),
NULL, _("Ascending by comment"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_COMMENT, GTK_STOCK_SORT_DESCENDING, _("Descending by comment"),
NULL, _("Descending by comment"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_COMPOSER, GTK_STOCK_SORT_ASCENDING, _("Ascending by composer"),
NULL, _("Ascending by composer"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_COMPOSER, GTK_STOCK_SORT_DESCENDING, _("Descending by composer"),
NULL, _("Descending by composer"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_ORIG_ARTIST, GTK_STOCK_SORT_ASCENDING, _("Ascending by original artist"),
NULL, _("Ascending by original artist"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_ORIG_ARTIST, GTK_STOCK_SORT_DESCENDING, _("Descending by original artist"),
NULL, _("Descending by original artist"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_COPYRIGHT, GTK_STOCK_SORT_ASCENDING, _("Ascending by copyright"),
NULL, _("Ascending by copyright"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_COPYRIGHT, GTK_STOCK_SORT_DESCENDING, _("Descending by copyright"),
NULL, _("Descending by copyright"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_URL, GTK_STOCK_SORT_ASCENDING, _("Ascending by URL"),
NULL, _("Ascending by URL"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_URL, GTK_STOCK_SORT_DESCENDING, _("Descending by URL"),
NULL, _("Descending by URL"), G_CALLBACK(Menu_Sort_Action) },
- /* Translators: the encoder name is supposed to be the name of a person
- * or organisation, but can sometimes be the name of an application. */
- { AM_SORT_ASCENDING_ENCODED_BY, GTK_STOCK_SORT_ASCENDING, _("Ascending by encoder name"),
NULL, _("Ascending by encoder name"), G_CALLBACK(Menu_Sort_Action) },
- /* Translators: the encoder name is supposed to be the name of a person
- * or organisation, but can sometimes be the name of an application. */
- { AM_SORT_DESCENDING_ENCODED_BY, GTK_STOCK_SORT_DESCENDING, _("Descending by encoder name"),
NULL, _("Descending by encoder name"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_FILE_TYPE, GTK_STOCK_SORT_ASCENDING, _("Ascending by file type"),
NULL, _("Ascending by file type"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_FILE_TYPE, GTK_STOCK_SORT_DESCENDING, _("Descending by file type"),
NULL, _("Descending by file type"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_FILE_SIZE, GTK_STOCK_SORT_ASCENDING, _("Ascending by file size"),
NULL, _("Ascending by file size"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_FILE_SIZE, GTK_STOCK_SORT_DESCENDING, _("Descending by file size"),
NULL, _("Descending by file size"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_FILE_DURATION, GTK_STOCK_SORT_ASCENDING, _("Ascending by duration"),
NULL, _("Ascending by duration"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_FILE_DURATION, GTK_STOCK_SORT_DESCENDING, _("Descending by duration"),
NULL, _("Descending by duration"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_FILE_BITRATE, GTK_STOCK_SORT_ASCENDING, _("Ascending by bitrate"),
NULL, _("Ascending by bitrate"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_FILE_BITRATE, GTK_STOCK_SORT_DESCENDING, _("Descending by bitrate"),
NULL, _("Descending by bitrate"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_ASCENDING_FILE_SAMPLERATE, GTK_STOCK_SORT_ASCENDING, _("Ascending by samplerate"),
NULL, _("Ascending by samplerate"), G_CALLBACK(Menu_Sort_Action) },
- { AM_SORT_DESCENDING_FILE_SAMPLERATE, GTK_STOCK_SORT_DESCENDING, _("Descending by samplerate"),
NULL, _("Descending by samplerate"), G_CALLBACK(Menu_Sort_Action) },
-
- { AM_SCAN_FILES, GTK_STOCK_APPLY, _("S_can Files"), NULL,
- _("Scan selected files"),
- G_CALLBACK (et_application_window_scan_selected_files) },
-
/*
* Following items are on toolbar but not on menu
*/
@@ -269,16 +153,12 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
gtk_window_add_accel_group (window,
gtk_ui_manager_get_accel_group (UIManager));
- menubar = gtk_ui_manager_get_widget(UIManager, "/MenuBar");
- gtk_widget_show_all(menubar);
-
toolbar = gtk_ui_manager_get_widget (UIManager, "/ToolBar");
- gtk_widget_show_all(toolbar);
+ gtk_widget_show_all (toolbar);
gtk_style_context_add_class (gtk_widget_get_style_context (toolbar),
GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
- *pptoolbar = toolbar;
- *ppmenubar = menubar;
+ return toolbar;
}
diff --git a/src/bar.h b/src/bar.h
index d1218fc..8cdadda 100644
--- a/src/bar.h
+++ b/src/bar.h
@@ -25,23 +25,16 @@
/***************
* Declaration *
***************/
-GtkWidget *MenuBar;
GtkWidget *ProgressBar;
GtkUIManager *UIManager;
GtkActionGroup *ActionGroup;
-#define MENU_FILE_SORT_TAG "SortTagMenu"
-#define MENU_FILE_SORT_PROP "SortPropMenu"
-#define MENU_SORT_TAG_PATH "ViewMenu/SortTagMenu"
-#define MENU_SORT_PROP_PATH "ViewMenu/SortPropMenu"
-
#define POPUP_FILE "FilePopup"
#define POPUP_DIR "DirPopup"
#define POPUP_SUBMENU_SCANNER "ScannerSubpopup"
#define POPUP_DIR_RUN_AUDIO "DirPopupRunAudio"
#define POPUP_LOG "LogPopup"
-#define AM_SCAN_FILES "ScanFiles"
#define AM_OPEN_OPTIONS_WINDOW "Preferences"
#define AM_CDDB_SEARCH_FILE "CDDBSearchFile"
@@ -54,47 +47,6 @@ GtkActionGroup *ActionGroup;
#define AM_STOP "Stop"
-#define AM_SORT_ASCENDING_FILENAME "SortFilenameAsc"
-#define AM_SORT_DESCENDING_FILENAME "SortFilenameDesc"
-#define AM_SORT_ASCENDING_CREATION_DATE "SortDateAsc"
-#define AM_SORT_DESCENDING_CREATION_DATE "SortDateDesc"
-#define AM_SORT_ASCENDING_TRACK_NUMBER "SortTrackNumAsc"
-#define AM_SORT_DESCENDING_TRACK_NUMBER "SortTrackNumDesc"
-#define AM_SORT_ASCENDING_TITLE "SortTitleAsc"
-#define AM_SORT_DESCENDING_TITLE "SortTitleDesc"
-#define AM_SORT_ASCENDING_ARTIST "SortArtistAsc"
-#define AM_SORT_DESCENDING_ARTIST "SortArtistDesc"
-#define AM_SORT_ASCENDING_ALBUM_ARTIST "SortAlbumArtistAsc"
-#define AM_SORT_DESCENDING_ALBUM_ARTIST "SortAlbumArtistDesc"
-#define AM_SORT_ASCENDING_ALBUM "SortAlbumAsc"
-#define AM_SORT_DESCENDING_ALBUM "SortAlbumDesc"
-#define AM_SORT_ASCENDING_YEAR "SortYearAsc"
-#define AM_SORT_DESCENDING_YEAR "SortYearDesc"
-#define AM_SORT_ASCENDING_GENRE "SortGenreAsc"
-#define AM_SORT_DESCENDING_GENRE "SortGenreDesc"
-#define AM_SORT_ASCENDING_COMMENT "SortCommentAsc"
-#define AM_SORT_DESCENDING_COMMENT "SortCommentDesc"
-#define AM_SORT_ASCENDING_COMPOSER "SortComposerAsc"
-#define AM_SORT_DESCENDING_COMPOSER "SortComposerDesc"
-#define AM_SORT_ASCENDING_ORIG_ARTIST "SortOrigArtistAsc"
-#define AM_SORT_DESCENDING_ORIG_ARTIST "SortOrigArtistDesc"
-#define AM_SORT_ASCENDING_COPYRIGHT "SortCopyrightAsc"
-#define AM_SORT_DESCENDING_COPYRIGHT "SortCopyrightDesc"
-#define AM_SORT_ASCENDING_URL "SortUrlAsc"
-#define AM_SORT_DESCENDING_URL "SortUrlDesc"
-#define AM_SORT_ASCENDING_ENCODED_BY "SortEncodedByAsc"
-#define AM_SORT_DESCENDING_ENCODED_BY "SortEncodedByDesc"
-#define AM_SORT_ASCENDING_FILE_TYPE "SortTypeAsc"
-#define AM_SORT_DESCENDING_FILE_TYPE "SortTypeDesc"
-#define AM_SORT_ASCENDING_FILE_SIZE "SortSizeAsc"
-#define AM_SORT_DESCENDING_FILE_SIZE "SortSizeDesc"
-#define AM_SORT_ASCENDING_FILE_DURATION "SortDurationAsc"
-#define AM_SORT_DESCENDING_FILE_DURATION "SortDurationDesc"
-#define AM_SORT_ASCENDING_FILE_BITRATE "SortBitrateAsc"
-#define AM_SORT_DESCENDING_FILE_BITRATE "SortBitrateDesc"
-#define AM_SORT_ASCENDING_FILE_SAMPLERATE "SortSamplerateAsc"
-#define AM_SORT_DESCENDING_FILE_SAMPLERATE "SortSamplerateDesc"
-
typedef struct _Action_Pair Action_Pair;
struct _Action_Pair {
const gchar *action;
@@ -105,7 +57,7 @@ struct _Action_Pair {
* Prototypes *
**************/
-void Create_UI (GtkWindow *window, GtkWidget **menubar, GtkWidget **toolbar);
+GtkWidget *create_main_toolbar (GtkWindow *window);
GtkWidget *Create_Status_Bar (void);
void Statusbar_Message (const gchar *message, gboolean with_timer);
GtkWidget *Create_Progress_Bar (void);
diff --git a/src/ui_manager.h b/src/ui_manager.h
index b5a6c26..4a63081 100644
--- a/src/ui_manager.h
+++ b/src/ui_manager.h
@@ -7,82 +7,6 @@ static const gchar *ui_xml =
"<ui>"
/*
- * Menu bar
- */
-" <menubar name='MenuBar'>"
-" <menu action='ViewMenu'>"
-" <menu action='SortTagMenu'>"
-" <menuitem action='SortTrackNumAsc' />"
-" <menuitem action='SortTrackNumDesc' />"
-" <separator />"
-" <menuitem action='SortTitleAsc' />"
-" <menuitem action='SortTitleDesc' />"
-" <separator />"
-" <menuitem action='SortArtistAsc' />"
-" <menuitem action='SortArtistDesc' />"
-" <separator />"
-" <menuitem action='SortAlbumArtistAsc' />"
-" <menuitem action='SortAlbumArtistDesc' />"
-" <separator />"
-" <menuitem action='SortAlbumAsc' />"
-" <menuitem action='SortAlbumDesc' />"
-" <separator />"
-" <menuitem action='SortYearAsc' />"
-" <menuitem action='SortYearDesc' />"
-" <separator />"
-" <menuitem action='SortYearAsc' />"
-" <menuitem action='SortYearDesc' />"
-" <separator />"
-" <menuitem action='SortGenreAsc' />"
-" <menuitem action='SortGenreDesc' />"
-" <separator />"
-" <menuitem action='SortCommentAsc' />"
-" <menuitem action='SortCommentDesc' />"
-" <separator />"
-" <menuitem action='SortComposerAsc' />"
-" <menuitem action='SortComposerDesc' />"
-" <separator />"
-" <menuitem action='SortOrigArtistAsc' />"
-" <menuitem action='SortOrigArtistDesc' />"
-" <separator />"
-" <menuitem action='SortCopyrightAsc' />"
-" <menuitem action='SortCopyrightDesc' />"
-" <separator />"
-" <menuitem action='SortUrlAsc' />"
-" <menuitem action='SortUrlDesc' />"
-" <separator />"
-" <menuitem action='SortEncodedByAsc' />"
-" <menuitem action='SortEncodedByDesc' />"
-" </menu>"
-
-" <menu action='SortPropMenu'>"
-" <menuitem action='SortFilenameAsc' />"
-" <menuitem action='SortFilenameDesc' />"
-" <separator />"
-" <menuitem action='SortDateAsc' />"
-" <menuitem action='SortDateDesc' />"
-" <separator />"
-" <menuitem action='SortTypeAsc' />"
-" <menuitem action='SortTypeDesc' />"
-" <separator />"
-" <menuitem action='SortSizeAsc' />"
-" <menuitem action='SortSizeDesc' />"
-" <separator />"
-" <menuitem action='SortDurationAsc' />"
-" <menuitem action='SortDurationDesc' />"
-" <separator />"
-" <menuitem action='SortBitrateAsc' />"
-" <menuitem action='SortBitrateDesc' />"
-" <separator />"
-" <menuitem action='SortSamplerateAsc' />"
-" <menuitem action='SortSamplerateDesc' />"
-" </menu>"
-" </menu>"
-
-" </menubar>"
-
-
-/*
* Tool bar
*/
" <toolbar name='ToolBar'>"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]