[gthumb] moved the remainging menubar actions to the gears menu or popup menus
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] moved the remainging menubar actions to the gears menu or popup menus
- Date: Sat, 9 Nov 2013 20:06:15 +0000 (UTC)
commit f96cbaa7d7475cfdb50571b86ca3c5221bd2c865
Author: Paolo Bacchilega <paobac src gnome org>
Date: Fri Oct 25 00:00:16 2013 +0200
moved the remainging menubar actions to the gears menu or popup menus
data/org.gnome.gthumb.gschema.xml.in | 3 -
extensions/bookmarks/data/ui/bookmarks-menu.ui | 1 -
extensions/catalogs/actions.c | 48 ++-
extensions/catalogs/actions.h | 20 +-
extensions/catalogs/callbacks.c | 509 +++--------------------
extensions/catalogs/callbacks.h | 2 -
extensions/catalogs/main.c | 2 -
extensions/desktop_background/callbacks.c | 4 +-
extensions/file_manager/callbacks.c | 18 +-
extensions/image_print/actions.c | 10 +-
extensions/image_print/actions.h | 6 +-
extensions/image_print/callbacks.c | 96 +----
extensions/image_print/main.c | 2 +-
extensions/image_viewer/Makefile.am | 2 +
extensions/image_viewer/actions.c | 125 ++++++
extensions/image_viewer/actions.h | 37 ++
extensions/image_viewer/gth-image-viewer-page.c | 225 +++--------
extensions/selections/actions.c | 58 ++--
extensions/selections/actions.h | 30 +-
extensions/selections/callbacks.c | 146 ++-----
gthumb/Makefile.am | 1 -
gthumb/gth-browser-actions-callbacks.c | 250 ++++-------
gthumb/gth-browser-actions-callbacks.h | 25 +-
gthumb/gth-browser-actions-entries.h | 97 +----
gthumb/gth-browser-ui.h | 153 -------
gthumb/gth-browser.c | 271 +------------
gthumb/gth-browser.h | 3 +-
gthumb/gth-embedded-dialog.c | 6 -
gthumb/gth-preferences.h | 1 -
gthumb/resources/file-list-menu.ui | 3 +
gthumb/resources/file-menu.ui | 8 +
gthumb/resources/gears-menu.ui | 29 +-
32 files changed, 593 insertions(+), 1598 deletions(-)
---
diff --git a/data/org.gnome.gthumb.gschema.xml.in b/data/org.gnome.gthumb.gschema.xml.in
index 61a1dd9..5f38cad 100644
--- a/data/org.gnome.gthumb.gschema.xml.in
+++ b/data/org.gnome.gthumb.gschema.xml.in
@@ -104,9 +104,6 @@
<key name="statusbar-visible" type="b">
<default>true</default>
</key>
- <key name="filterbar-visible" type="b">
- <default>true</default>
- </key>
<key name="sidebar-visible" type="b">
<default>true</default>
</key>
diff --git a/extensions/bookmarks/data/ui/bookmarks-menu.ui b/extensions/bookmarks/data/ui/bookmarks-menu.ui
index adcb55a..81319d7 100644
--- a/extensions/bookmarks/data/ui/bookmarks-menu.ui
+++ b/extensions/bookmarks/data/ui/bookmarks-menu.ui
@@ -6,7 +6,6 @@
<item>
<attribute name="label" translatable="yes">_Add Bookmark</attribute>
<attribute name="action">win.bookmarks-add</attribute>
- <attribute name="accel"><![CDATA[<Ctrl>d]]></attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Edit Bookmarks…</attribute>
diff --git a/extensions/catalogs/actions.c b/extensions/catalogs/actions.c
index 446243d..737a472 100644
--- a/extensions/catalogs/actions.c
+++ b/extensions/catalogs/actions.c
@@ -29,9 +29,11 @@
void
-gth_browser_activate_action_edit_add_to_catalog (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_add_to_catalog (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GthBrowser *browser = GTH_BROWSER (user_data);
GList *items;
GList *file_list = NULL;
GList *files;
@@ -48,9 +50,11 @@ gth_browser_activate_action_edit_add_to_catalog (GtkAction *action,
void
-gth_browser_activate_action_edit_remove_from_catalog (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_remove_from_catalog (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GthBrowser *browser = GTH_BROWSER (user_data);
GList *items;
GList *file_data_list;
@@ -168,9 +172,11 @@ catalog_new_dialog_response_cb (GtkWidget *dialog,
void
-gth_browser_activate_action_catalog_new (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_create_catalog (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GthBrowser *browser = GTH_BROWSER (user_data);
GtkWidget *dialog;
dialog = gth_request_dialog_new (GTK_WINDOW (browser),
@@ -280,9 +286,11 @@ new_library_dialog_response_cb (GtkWidget *dialog,
void
-gth_browser_activate_action_catalog_new_library (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_create_library (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GthBrowser *browser = GTH_BROWSER (user_data);
GtkWidget *dialog;
dialog = gth_request_dialog_new (GTK_WINDOW (browser),
@@ -347,9 +355,11 @@ remove_catalog_response_cb (GtkDialog *dialog,
void
-gth_browser_activate_action_catalog_remove (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_remove_catalog (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GthBrowser *browser = GTH_BROWSER (user_data);
GthFileData *file_data;
GSettings *settings;
@@ -384,9 +394,11 @@ gth_browser_activate_action_catalog_remove (GtkAction *action,
void
-gth_browser_activate_action_catalog_rename (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_rename_catalog (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GthBrowser *browser = GTH_BROWSER (user_data);
GthFileData *file_data;
file_data = gth_browser_get_folder_popup_file_data (browser);
@@ -397,9 +409,11 @@ gth_browser_activate_action_catalog_rename (GtkAction *action,
void
-gth_browser_activate_action_catalog_properties (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_catalog_properties (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GthBrowser *browser = GTH_BROWSER (user_data);
GthFileData *file_data;
file_data = gth_browser_get_folder_popup_file_data (browser);
@@ -410,9 +424,11 @@ gth_browser_activate_action_catalog_properties (GtkAction *action,
void
-gth_browser_activate_action_go_to_container (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_go_to_container_from_catalog (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GthBrowser *browser = GTH_BROWSER (user_data);
GList *items;
GList *file_list = NULL;
diff --git a/extensions/catalogs/actions.h b/extensions/catalogs/actions.h
index 86611bc..920be85 100644
--- a/extensions/catalogs/actions.h
+++ b/extensions/catalogs/actions.h
@@ -22,18 +22,16 @@
#ifndef ACTIONS_H
#define ACTIONS_H
-#include <gtk/gtk.h>
+#include <gthumb.h>
-#define DEFINE_ACTION(x) void x (GtkAction *action, gpointer data);
-
-DEFINE_ACTION(gth_browser_activate_action_edit_add_to_catalog)
-DEFINE_ACTION(gth_browser_activate_action_edit_remove_from_catalog)
-DEFINE_ACTION(gth_browser_activate_action_catalog_new)
-DEFINE_ACTION(gth_browser_activate_action_catalog_new_library)
-DEFINE_ACTION(gth_browser_activate_action_catalog_remove)
-DEFINE_ACTION(gth_browser_activate_action_catalog_rename)
-DEFINE_ACTION(gth_browser_activate_action_catalog_properties)
-DEFINE_ACTION(gth_browser_activate_action_go_to_container)
+DEF_ACTION_CALLBACK (gth_browser_activate_add_to_catalog)
+DEF_ACTION_CALLBACK (gth_browser_activate_remove_from_catalog)
+DEF_ACTION_CALLBACK (gth_browser_activate_create_catalog)
+DEF_ACTION_CALLBACK (gth_browser_activate_create_library)
+DEF_ACTION_CALLBACK (gth_browser_activate_remove_catalog)
+DEF_ACTION_CALLBACK (gth_browser_activate_rename_catalog)
+DEF_ACTION_CALLBACK (gth_browser_activate_catalog_properties)
+DEF_ACTION_CALLBACK (gth_browser_activate_go_to_container_from_catalog)
void gth_browser_add_to_catalog (GthBrowser *browser,
GFile *catalog);
diff --git a/extensions/catalogs/callbacks.c b/extensions/catalogs/callbacks.c
index d4cba05..6768d88 100644
--- a/extensions/catalogs/callbacks.c
+++ b/extensions/catalogs/callbacks.c
@@ -37,121 +37,40 @@
#define UPDATE_RENAMED_FILES_DELAY 500
-static const char *fixed_ui_info =
-"<ui>"
-" <popup name='FileListPopup'>"
-" <placeholder name='Folder_Actions2'>"
-" <menuitem action='Edit_AddToCatalog'/>"
-" <menu action='Edit_QuickAddToCatalog'>"
-" <separator name='CatalogListSeparator'/>"
-" <menuitem action='Edit_QuickAddToCatalogOther'/>"
-" </menu>"
-" </placeholder>"
-" </popup>"
-" <popup name='FilePopup'>"
-" <placeholder name='Folder_Actions2'>"
-" <menuitem action='Edit_AddToCatalog'/>"
-" <menu action='Edit_QuickAddToCatalog'>"
-" <separator name='CatalogListSeparator'/>"
-" <menuitem action='Edit_QuickAddToCatalogOther'/>"
-" </menu>"
-" </placeholder>"
-" </popup>"
-"</ui>";
-
-
-static const char *vfs_ui_info =
-"<ui>"
-" <popup name='FileListPopup'>"
-" <placeholder name='Open_Actions'>"
-" <menuitem action='Go_FileContainer'/>"
-" </placeholder>"
-" <placeholder name='Folder_Actions2'>"
-" <menuitem action='Edit_RemoveFromCatalog'/>"
-" </placeholder>"
-" </popup>"
-" <popup name='FilePopup'>"
-" <placeholder name='Open_Actions'>"
-" <menuitem action='Go_FileContainer'/>"
-" </placeholder>"
-" <placeholder name='Folder_Actions2'>"
-" <menuitem action='Edit_RemoveFromCatalog'/>"
-" </placeholder>"
-" </popup>"
-"</ui>";
-
-
-
-static const gchar *folder_popup_ui_info =
-"<ui>"
-" <popup name='FolderListPopup'>"
-" <placeholder name='SourceCommands'>"
-" <menuitem action='Catalog_New'/>"
-" <menuitem action='Catalog_New_Library'/>"
-" <separator/>"
-" <menuitem action='Catalog_Remove'/>"
-" <menuitem action='Catalog_Rename'/>"
-" <separator/>"
-" <menuitem action='Catalog_Properties'/>"
-" </placeholder>"
-" </popup>"
-"</ui>";
-
-
-static GtkActionEntry catalog_action_entries[] = {
- { "Edit_QuickAddToCatalog", GTK_STOCK_ADD, N_("_Add to Catalog") },
-
- { "Go_FileContainer", GTK_STOCK_JUMP_TO,
- N_("Open _Folder"), "<alt>End",
- N_("Go to the folder that contains the selected file"),
- G_CALLBACK (gth_browser_activate_action_go_to_container) },
-
- { "Edit_QuickAddToCatalogOther", NULL,
- N_("Other..."), NULL,
- N_("Choose another catalog"),
- G_CALLBACK (gth_browser_activate_action_edit_add_to_catalog) },
-
- { "Edit_AddToCatalog", GTK_STOCK_ADD,
- N_("_Add to Catalog..."), NULL,
- N_("Add selected images to a catalog"),
- G_CALLBACK (gth_browser_activate_action_edit_add_to_catalog) },
-
- { "Edit_RemoveFromCatalog", GTK_STOCK_REMOVE,
- N_("Remo_ve from Catalog"), NULL,
- N_("Remove selected images from the catalog"),
- G_CALLBACK (gth_browser_activate_action_edit_remove_from_catalog) },
-
- { "Catalog_New", NULL,
- N_("Create _Catalog"), NULL,
- NULL,
- G_CALLBACK (gth_browser_activate_action_catalog_new) },
-
- { "Catalog_New_Library", NULL,
- N_("Create _Library"), NULL,
- NULL,
- G_CALLBACK (gth_browser_activate_action_catalog_new_library) },
-
- { "Catalog_Remove", GTK_STOCK_REMOVE,
- NULL, NULL,
- NULL,
- G_CALLBACK (gth_browser_activate_action_catalog_remove) },
-
- { "Catalog_Rename", NULL,
- N_("Rena_me"), NULL,
- NULL,
- G_CALLBACK (gth_browser_activate_action_catalog_rename) },
-
- { "Catalog_Properties", GTK_STOCK_PROPERTIES,
- NULL, NULL,
- NULL,
- G_CALLBACK (gth_browser_activate_action_catalog_properties) }
+static const GActionEntry actions[] = {
+ { "add-to-catalog", gth_browser_activate_add_to_catalog },
+ { "go-to-container-from-catalog", gth_browser_activate_go_to_container_from_catalog },
+ { "remove-from-catalog", gth_browser_activate_remove_from_catalog },
+ { "create-catalog", gth_browser_activate_create_catalog },
+ { "create-library", gth_browser_activate_create_library },
+ { "remove-catalog", gth_browser_activate_remove_catalog },
+ { "rename-catalog", gth_browser_activate_rename_catalog },
+ { "catalog-properties", gth_browser_activate_catalog_properties },
+};
+
+
+static const GthMenuEntry fixed_menu_entries[] = {
+ { N_("Add to Catalog…"), "win.add-to-catalog" },
+};
+
+
+static const GthMenuEntry file_list_popup_entries[] = {
+ { N_("Open Folder"), "win.go-to-container-from-catalog", "<Alt>end" },
+ { N_("Remove from Catalog"), "win.remove-from-catalog" },
+};
+
+
+static const GthMenuEntry folder_popup_entries[] = {
+ { N_("Create Catalog"), "win.create-catalog" },
+ { N_("Create Library"), "win.create-library" },
+ { N_("Remove"), "win.remove-catalog" },
+ { N_("Rename"), "win.rename-catalog" },
+ { N_("Properties"), "win.catalog-properties" }
};
-static guint catalog_action_entries_size = G_N_ELEMENTS (catalog_action_entries);
typedef struct {
GthBrowser *browser;
- GtkActionGroup *actions;
guint folder_popup_merge_id;
guint vfs_merge_id;
gboolean catalog_menu_loaded;
@@ -211,33 +130,27 @@ void
catalogs__gth_browser_construct_cb (GthBrowser *browser)
{
BrowserData *data;
- GError *error = NULL;
g_return_if_fail (GTH_IS_BROWSER (browser));
data = g_new0 (BrowserData, 1);
+ g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify)
browser_data_free);
+
data->browser = browser;
data->n_top_catalogs = 0;
- data->actions = gtk_action_group_new ("Catalog Actions");
- gtk_action_group_set_translation_domain (data->actions, NULL);
- gtk_action_group_add_actions (data->actions,
- catalog_action_entries,
- catalog_action_entries_size,
- browser);
- gtk_ui_manager_insert_action_group (gth_browser_get_ui_manager (browser), data->actions, 0);
-
- if (! gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), fixed_ui_info, -1,
&error)) {
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- }
+ g_action_map_add_action_entries (G_ACTION_MAP (browser),
+ actions,
+ G_N_ELEMENTS (actions),
+ browser);
+ gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser,
GTH_BROWSER_MENU_MANAGER_FILE_LIST_OTHER_ACTIONS),
+ fixed_menu_entries,
+ G_N_ELEMENTS (fixed_menu_entries));
data->monitor_events = g_signal_connect (gth_main_get_default_monitor (),
"folder-changed",
G_CALLBACK (monitor_folder_changed_cb),
data);
-
- g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify)
browser_data_free);
}
@@ -245,26 +158,16 @@ void
catalogs__gth_browser_update_sensitivity_cb (GthBrowser *browser)
{
BrowserData *data;
- GtkAction *action;
int n_selected;
- gboolean sensitive;
data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
g_return_if_fail (data != NULL);
n_selected = gth_file_selection_get_n_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view
(browser)));
- action = gtk_action_group_get_action (data->actions, "Edit_AddToCatalog");
- sensitive = n_selected > 0;
- g_object_set (action, "sensitive", sensitive, NULL);
-
- action = gtk_action_group_get_action (data->actions, "Edit_RemoveFromCatalog");
- sensitive = (n_selected > 0) && GTH_IS_FILE_SOURCE_CATALOGS (gth_browser_get_location_source
(browser));
- g_object_set (action, "sensitive", sensitive, NULL);
-
- action = gtk_action_group_get_action (data->actions, "Go_FileContainer");
- sensitive = (n_selected == 1);
- g_object_set (action, "sensitive", sensitive, NULL);
+ gth_window_enable_action (GTH_WINDOW (browser), "add-to-catalog", n_selected > 0);
+ gth_window_enable_action (GTH_WINDOW (browser), "remove-from-catalog", (n_selected > 0) &&
GTH_IS_FILE_SOURCE_CATALOGS (gth_browser_get_location_source (browser)));
+ gth_window_enable_action (GTH_WINDOW (browser), "go-to-container-from-catalog", n_selected == 1);
}
@@ -306,285 +209,6 @@ catalogs__gth_catalog_load_from_data_cb (const void *buffer)
}
-/* -- update_catalog_menu -- */
-
-
-typedef struct _CatalogListData CatalogListData;
-
-
-struct _CatalogListData {
- CatalogListData *parent;
- BrowserData *data;
- GthFileSource *file_source;
- GFile *root;
- GtkWidget *list_menu;
- GtkWidget *file_menu;
- GList *children;
- GList *current_child;
-};
-
-
-static void
-catalog_list_data_free (CatalogListData *list_data)
-{
- g_list_free (list_data->children);
- g_object_unref (list_data->root);
- g_object_unref (list_data->file_source);
- g_free (list_data);
-}
-
-
-static void catalog_list_load_current_child (CatalogListData *list_data);
-
-
-static void
-catalog_list_load_next_child (CatalogListData *list_data)
-{
- if (list_data == NULL)
- return;
- list_data->current_child = list_data->current_child->next;
- catalog_list_load_current_child (list_data);
-}
-
-
-static void load_catalog_list (CatalogListData *list_data);
-
-
-static void
-catalog_list_load_current_child (CatalogListData *list_data)
-{
- if (list_data->current_child == NULL) {
- catalog_list_load_next_child (list_data->parent);
- catalog_list_data_free (list_data);
- return;
- }
-
- load_catalog_list ((CatalogListData *) list_data->current_child->data);
-}
-
-
-static int
-sort_catalogs (gconstpointer a,
- gconstpointer b)
-{
- GthFileData *file_data_a = (GthFileData *) a;
- GthFileData *file_data_b = (GthFileData *) b;
-
- if (g_file_info_get_attribute_boolean (file_data_a->info, "gthumb::no-child") !=
g_file_info_get_attribute_boolean (file_data_b->info, "gthumb::no-child")) {
- /* put the libraries before the catalogs */
- return g_file_info_get_attribute_boolean (file_data_a->info, "gthumb::no-child") ? 1 : -1;
- }
- else if (g_file_info_get_sort_order (file_data_a->info) == g_file_info_get_sort_order
(file_data_b->info))
- return g_utf8_collate (g_file_info_get_display_name (file_data_a->info),
- g_file_info_get_display_name (file_data_b->info));
- else if (g_file_info_get_sort_order (file_data_a->info) < g_file_info_get_sort_order
(file_data_b->info))
- return -1;
- else
- return 1;
-}
-
-
-static void
-catalog_item_activate_cb (GtkMenuItem *menuitem,
- gpointer user_data)
-{
- GthBrowser *browser = user_data;
- char *uri;
- GFile *file;
-
- if (gtk_menu_item_get_submenu (menuitem) != NULL)
- return;
-
- uri = g_object_get_data (G_OBJECT (menuitem), "uri");
- file = g_file_new_for_uri (uri);
- gth_browser_add_to_catalog (browser, file);
-
- g_object_unref (file);
-}
-
-
-static GtkWidget *
-insert_menu_item (CatalogListData *list_data,
- GtkWidget *menu,
- GthFileData *file_data,
- int pos)
-{
- GtkWidget *item;
- GtkWidget *image;
-
- item = gtk_image_menu_item_new_with_label (g_file_info_get_display_name (file_data->info));
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
-
- image = gtk_image_new_from_gicon (g_file_info_get_icon (file_data->info), GTK_ICON_SIZE_MENU);
- gtk_widget_show (image);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- gtk_widget_show (item);
- gtk_menu_shell_insert (GTK_MENU_SHELL (menu), item, pos);
- g_object_set_data_full (G_OBJECT (item), "uri", g_file_get_uri (file_data->file), g_free);
- g_signal_connect (item, "activate", G_CALLBACK (catalog_item_activate_cb), list_data->data->browser);
-
- return item;
-}
-
-
-static void
-update_commands_visibility (BrowserData *data)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (data->actions, "Edit_QuickAddToCatalog");
- gtk_action_set_visible (action, (data->n_top_catalogs > 0));
-
- action = gtk_action_group_get_action (data->actions, "Edit_AddToCatalog");
- gtk_action_set_visible (action, (data->n_top_catalogs == 0));
-}
-
-
-
-static void
-catalog_list_ready (GthFileSource *file_source,
- GList *files,
- GError *error,
- gpointer user_data)
-{
- CatalogListData *list_data = user_data;
- GList *ordered;
- int pos;
- GList *scan;
- GFile *root;
-
- ordered = g_list_sort (gth_file_data_list_dup (files), sort_catalogs);
- pos = 0;
- for (scan = ordered; scan; scan = scan->next) {
- GthFileData *file_data = scan->data;
- GtkWidget *list_item;
- GtkWidget *file_item;
-
- if (g_file_info_get_is_hidden (file_data->info))
- continue;
-
- list_item = insert_menu_item (list_data, list_data->list_menu, file_data, pos);
- file_item = insert_menu_item (list_data, list_data->file_menu, file_data, pos);
-
- if (! g_file_info_get_attribute_boolean (file_data->info, "gthumb::no-child")) {
- CatalogListData *child;
-
- child = g_new0 (CatalogListData, 1);
- child->parent = list_data;
- child->data = list_data->data;
- child->file_source = g_object_ref (list_data->file_source);
- child->root = g_file_dup (file_data->file);
- child->list_menu = gtk_menu_new ();
- child->file_menu = gtk_menu_new ();
- list_data->children = g_list_prepend (list_data->children, child);
-
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (list_item), child->list_menu);
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (file_item), child->file_menu);
- }
-
- pos++;
- }
-
- root = g_file_new_for_uri ("catalog:///");
- if (g_file_equal (list_data->root, root)) {
- list_data->data->n_top_catalogs = g_list_length (ordered);
- update_commands_visibility (list_data->data);
- }
- else if (ordered == NULL) {
- GtkWidget *item;
-
- item = gtk_menu_item_new_with_label (_("(Empty)"));
- gtk_widget_show (item);
- gtk_widget_set_sensitive (item, FALSE);
- gtk_menu_shell_insert (GTK_MENU_SHELL (list_data->list_menu), item, pos);
-
- item = gtk_menu_item_new_with_label (_("(Empty)"));
- gtk_widget_show (item);
- gtk_widget_set_sensitive (item, FALSE);
- gtk_menu_shell_insert (GTK_MENU_SHELL (list_data->file_menu), item, pos);
- }
-
- g_object_unref (root);
- _g_object_list_unref (ordered);
-
- list_data->children = g_list_reverse (list_data->children);
- list_data->current_child = list_data->children;
- catalog_list_load_current_child (list_data);
-}
-
-
-static void
-load_catalog_list (CatalogListData *list_data)
-{
- gth_file_source_list (list_data->file_source,
- list_data->root,
- GFILE_STANDARD_ATTRIBUTES,
- catalog_list_ready,
- list_data);
-}
-
-
-static void
-update_catalog_menu (BrowserData *data)
-{
- CatalogListData *list_data;
- GtkWidget *list_menu;
- GtkWidget *file_menu;
- GtkWidget *separator;
-
- list_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (gtk_ui_manager_get_widget
(gth_browser_get_ui_manager (data->browser), "/FileListPopup/Folder_Actions2/Edit_QuickAddToCatalog")));
- separator = gtk_ui_manager_get_widget (gth_browser_get_ui_manager (data->browser),
"/FileListPopup/Folder_Actions2/Edit_QuickAddToCatalog/CatalogListSeparator");
- _gtk_container_remove_children (GTK_CONTAINER (list_menu), NULL, separator);
-
- file_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (gtk_ui_manager_get_widget
(gth_browser_get_ui_manager (data->browser), "/FilePopup/Folder_Actions2/Edit_QuickAddToCatalog")));
- separator = gtk_ui_manager_get_widget (gth_browser_get_ui_manager (data->browser),
"/FilePopup/Folder_Actions2/Edit_QuickAddToCatalog/CatalogListSeparator");
- _gtk_container_remove_children (GTK_CONTAINER (file_menu), NULL, separator);
-
- list_data = g_new0 (CatalogListData, 1);
- list_data->data = data;
- list_data->file_source = g_object_new (GTH_TYPE_FILE_SOURCE_CATALOGS, NULL);
- list_data->root = g_file_new_for_uri ("catalog:///");
- list_data->list_menu = list_menu;
- list_data->file_menu = file_menu;
-
- load_catalog_list (list_data);
-}
-
-
-void
-catalogs__gth_browser_file_list_popup_before_cb (GthBrowser *browser)
-{
- BrowserData *data;
-
- data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
- g_return_if_fail (data != NULL);
-
- if (! data->catalog_menu_loaded) {
- data->catalog_menu_loaded = TRUE;
- update_catalog_menu (data);
- }
- else
- update_commands_visibility (data);
-}
-
-
-void
-catalogs__gth_browser_file_popup_before_cb (GthBrowser *browser)
-{
- BrowserData *data;
-
- data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
- g_return_if_fail (data != NULL);
-
- if (! data->catalog_menu_loaded) {
- data->catalog_menu_loaded = TRUE;
- update_catalog_menu (data);
- }
- else
- update_commands_visibility (data);
-}
-
-
void
catalogs__gth_browser_folder_tree_popup_before_cb (GthBrowser *browser,
GthFileSource *file_source,
@@ -596,38 +220,29 @@ catalogs__gth_browser_folder_tree_popup_before_cb (GthBrowser *browser,
g_return_if_fail (data != NULL);
if (GTH_IS_FILE_SOURCE_CATALOGS (file_source)) {
- GtkAction *action;
- gboolean sensitive;
+ gboolean sensitive;
- if (data->folder_popup_merge_id == 0) {
- GError *error = NULL;
+ if (data->folder_popup_merge_id == 0)
+ data->folder_popup_merge_id =
+ gth_menu_manager_append_entries (gth_browser_get_menu_manager
(browser, GTH_BROWSER_MENU_MANAGER_FOLDER),
+ folder_popup_entries,
+ G_N_ELEMENTS (folder_popup_entries));
- data->folder_popup_merge_id = gtk_ui_manager_add_ui_from_string
(gth_browser_get_ui_manager (browser), folder_popup_ui_info, -1, &error);
- if (data->folder_popup_merge_id == 0) {
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- }
- }
- action = gtk_action_group_get_action (data->actions, "Catalog_Remove");
sensitive = (folder != NULL) && g_file_info_get_attribute_boolean (folder->info,
G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE);
- g_object_set (action, "sensitive", sensitive, NULL);
+ gth_window_enable_action (GTH_WINDOW (browser), "remove-catalog", sensitive);
- action = gtk_action_group_get_action (data->actions, "Catalog_Rename");
sensitive = ((folder != NULL)
&& (_g_content_type_is_a (g_file_info_get_content_type (folder->info),
"gthumb/library") || _g_content_type_is_a (g_file_info_get_content_type (folder->info), "gthumb/catalog"))
&& g_file_info_get_attribute_boolean (folder->info,
G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME));
- g_object_set (action, "sensitive", sensitive, NULL);
+ gth_window_enable_action (GTH_WINDOW (browser), "rename-catalog", sensitive);
- action = gtk_action_group_get_action (data->actions, "Catalog_Properties");
sensitive = (folder != NULL) && (! _g_content_type_is_a (g_file_info_get_content_type
(folder->info), "gthumb/library"));
- g_object_set (action, "sensitive", sensitive, NULL);
+ gth_window_enable_action (GTH_WINDOW (browser), "catalog-properties", sensitive);
}
else {
- if (data->folder_popup_merge_id != 0) {
- gtk_ui_manager_remove_ui (gth_browser_get_ui_manager (browser),
data->folder_popup_merge_id);
- data->folder_popup_merge_id = 0;
- }
+ gth_menu_manager_remove_entries (gth_browser_get_menu_manager (browser,
GTH_BROWSER_MENU_MANAGER_FOLDER), data->folder_popup_merge_id);
+ data->folder_popup_merge_id = 0;
}
}
@@ -661,21 +276,15 @@ catalogs__gth_browser_load_location_after_cb (GthBrowser *browser,
data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
if (GTH_IS_FILE_SOURCE_CATALOGS (gth_browser_get_location_source (browser))) {
- if (data->vfs_merge_id == 0) {
- GError *error = NULL;
-
- data->vfs_merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager
(browser), vfs_ui_info, -1, &error);
- if (data->vfs_merge_id == 0) {
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- }
- }
+ if (data->vfs_merge_id == 0)
+ data->vfs_merge_id =
+ gth_menu_manager_append_entries (gth_browser_get_menu_manager
(browser, GTH_BROWSER_MENU_MANAGER_FILE_LIST_OTHER_ACTIONS),
+ file_list_popup_entries,
+ G_N_ELEMENTS
(file_list_popup_entries));
}
else {
- if (data->vfs_merge_id != 0) {
- gtk_ui_manager_remove_ui (gth_browser_get_ui_manager (browser), data->vfs_merge_id);
- data->vfs_merge_id = 0;
- }
+ gth_menu_manager_remove_entries (gth_browser_get_menu_manager (browser,
GTH_BROWSER_MENU_MANAGER_FILE_LIST_OTHER_ACTIONS), data->vfs_merge_id);
+ data->vfs_merge_id = 0;
}
}
diff --git a/extensions/catalogs/callbacks.h b/extensions/catalogs/callbacks.h
index 6cb7f34..622e7db 100644
--- a/extensions/catalogs/callbacks.h
+++ b/extensions/catalogs/callbacks.h
@@ -28,8 +28,6 @@
void catalogs__initialize_cb (void);
void catalogs__gth_browser_construct_cb (GthBrowser *browser);
void catalogs__gth_browser_update_sensitivity_cb (GthBrowser *browser);
-void catalogs__gth_browser_file_list_popup_before_cb (GthBrowser *browser);
-void catalogs__gth_browser_file_popup_before_cb (GthBrowser *browser);
void catalogs__gth_browser_folder_tree_popup_before_cb (GthBrowser *browser,
GthFileSource *file_source,
GFile *folder);
diff --git a/extensions/catalogs/main.c b/extensions/catalogs/main.c
index cdc6663..96c225c 100644
--- a/extensions/catalogs/main.c
+++ b/extensions/catalogs/main.c
@@ -114,8 +114,6 @@ gthumb_extension_activate (void)
gth_hook_add_callback ("initialize", 10, G_CALLBACK (catalogs__initialize_cb), NULL);
gth_hook_add_callback ("gth-browser-construct", 10, G_CALLBACK (catalogs__gth_browser_construct_cb),
NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK
(catalogs__gth_browser_update_sensitivity_cb), NULL);
- gth_hook_add_callback ("gth-browser-file-list-popup-before", 10, G_CALLBACK
(catalogs__gth_browser_file_list_popup_before_cb), NULL);
- gth_hook_add_callback ("gth-browser-file-popup-before", 10, G_CALLBACK
(catalogs__gth_browser_file_popup_before_cb), NULL);
gth_hook_add_callback ("gth-browser-folder-tree-popup-before", 10, G_CALLBACK
(catalogs__gth_browser_folder_tree_popup_before_cb), NULL);
gth_hook_add_callback ("gth-browser-load-location-after", 10, G_CALLBACK
(catalogs__gth_browser_load_location_after_cb), NULL);
gth_hook_add_callback ("gth-browser-update-extra-widget", 10, G_CALLBACK
(catalogs__gth_browser_update_extra_widget_cb), NULL);
diff --git a/extensions/desktop_background/callbacks.c b/extensions/desktop_background/callbacks.c
index 8141cd4..a102909 100644
--- a/extensions/desktop_background/callbacks.c
+++ b/extensions/desktop_background/callbacks.c
@@ -43,13 +43,13 @@ db__gth_browser_construct_cb (GthBrowser *browser)
browser);
gth_menu_manager_append_entry (gth_browser_get_menu_manager (browser,
GTH_BROWSER_MENU_MANAGER_FILE_SCREEN_ACTIONS),
GTH_MENU_MANAGER_NEW_MERGE_ID,
- _("Set as Desktop Background"),
+ _("Desktop Background"),
"win.set-desktop-background",
NULL,
NULL);
gth_menu_manager_append_entry (gth_browser_get_menu_manager (browser,
GTH_BROWSER_MENU_MANAGER_FILE_LIST_SCREEN_ACTIONS),
GTH_MENU_MANAGER_NEW_MERGE_ID,
- _("Set as Desktop Background"),
+ _("Desktop Background"),
"win.set-desktop-background",
NULL,
NULL);
diff --git a/extensions/file_manager/callbacks.c b/extensions/file_manager/callbacks.c
index e8eb20c..bbd86bc 100644
--- a/extensions/file_manager/callbacks.c
+++ b/extensions/file_manager/callbacks.c
@@ -71,14 +71,17 @@ static const GthMenuEntry fixed_menu_entries_edit[] = {
static const GthMenuEntry fixed_menu_entries_file[] = {
- { N_("Copy to..."), "win.copy-to-folder" },
- { N_("Move to..."), "win.move-to-folder" },
+ { N_("Copy to…"), "win.copy-to-folder" },
+ { N_("Move to…"), "win.move-to-folder" },
{ N_("Rename"), "win.rename", "F2" },
+};
+
+
+static const GthMenuEntry fixed_menu_entries_delete[] = {
{ N_("Move to Trash"), "win.trash" },
{ N_("Delete"), "win.delete" },
};
-
static const GthMenuEntry folder_context_open_entries[] = {
{ N_("Open with the File Manager"), "win.folder-context-open-with-fm" }
};
@@ -98,8 +101,8 @@ static const GthMenuEntry folder_context_edit_entries[] = {
static const GthMenuEntry folder_context_folder_entries[] = {
{ N_("Rename"), "win.folder-context-rename" },
- { N_("Copy to..."), "win.folder-context-copy-to" },
- { N_("Move to..."), "win.folder-context-move-to" },
+ { N_("Copy to…"), "win.folder-context-copy-to" },
+ { N_("Move to…"), "win.folder-context-move-to" },
{ N_("Move to Trash"), "win.folder-context-trash" },
{ N_("Delete"), "win.folder-context-delete" }
};
@@ -111,7 +114,7 @@ static const GthMenuEntry create_folder_entries[] = {
static const GthMenuEntry vfs_entries[] = {
- { N_("Duplicate"), "win.duplicate", "<Control><Shift>d" }
+ { N_("Duplicate"), "win.duplicate", "<Control>d" }
};
@@ -488,6 +491,9 @@ fm__gth_browser_construct_cb (GthBrowser *browser)
gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser,
GTH_BROWSER_MENU_MANAGER_FILE_LIST_FILE_ACTIONS),
fixed_menu_entries_file,
G_N_ELEMENTS (fixed_menu_entries_file));
+ gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser,
GTH_BROWSER_MENU_MANAGER_FILE_LIST_DELETE_ACTIONS),
+ fixed_menu_entries_delete,
+ G_N_ELEMENTS (fixed_menu_entries_delete));
data->open_with_menu = g_menu_new ();
diff --git a/extensions/image_print/actions.c b/extensions/image_print/actions.c
index 3b206dd..2803964 100644
--- a/extensions/image_print/actions.c
+++ b/extensions/image_print/actions.c
@@ -28,11 +28,13 @@
void
-gth_browser_activate_action_file_print (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_print (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- GList *items;
- GList *file_list;
+ GthBrowser *browser = GTH_BROWSER (user_data);
+ GList *items;
+ GList *file_list;
items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view
(browser)));
file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items);
diff --git a/extensions/image_print/actions.h b/extensions/image_print/actions.h
index df717c0..1a6dc11 100644
--- a/extensions/image_print/actions.h
+++ b/extensions/image_print/actions.h
@@ -22,10 +22,8 @@
#ifndef ACTIONS_H
#define ACTIONS_H
-#include <gtk/gtk.h>
+#include <gthumb.h>
-#define DEFINE_ACTION(x) void x (GtkAction *action, gpointer data);
-
-DEFINE_ACTION(gth_browser_activate_action_file_print)
+DEF_ACTION_CALLBACK (gth_browser_activate_print)
#endif /* ACTIONS_H */
diff --git a/extensions/image_print/callbacks.c b/extensions/image_print/callbacks.c
index 7bcd40f..63d31e2 100644
--- a/extensions/image_print/callbacks.c
+++ b/extensions/image_print/callbacks.c
@@ -28,96 +28,40 @@
#include "actions.h"
-#define BROWSER_DATA_KEY "image-print-browser-data"
-
-
-static const char *fixed_ui_info =
-"<ui>"
-" <popup name='FileListPopup'>"
-" <placeholder name='Open_Actions'>"
-" <menuitem action='File_Print'/>"
-" </placeholder>"
-" </popup>"
-
-" <popup name='FilePopup'>"
-" <placeholder name='Open_Actions'>"
-" <menuitem action='File_Print'/>"
-" </placeholder>"
-" </popup>"
-"</ui>";
-
-
-static GthActionEntryExt action_entries[] = {
- { "File_Print", GTK_STOCK_PRINT,
- NULL, "<control>P",
- N_("Print the selected images"),
- GTH_ACTION_FLAG_IS_IMPORTANT,
- G_CALLBACK (gth_browser_activate_action_file_print) },
+static const GActionEntry actions[] = {
+ { "print", gth_browser_activate_print }
};
-typedef struct {
- GtkActionGroup *action_group;
- guint fixed_merge_id;
-} BrowserData;
-
-
-static void
-browser_data_free (BrowserData *data)
-{
- g_free (data);
-}
-
-
void
ip__gth_browser_construct_cb (GthBrowser *browser)
{
- BrowserData *data;
- GError *error = NULL;
-
g_return_if_fail (GTH_IS_BROWSER (browser));
- data = g_new0 (BrowserData, 1);
-
- data->action_group = gtk_action_group_new ("Image Print Actions");
- gtk_action_group_set_translation_domain (data->action_group, NULL);
- _gtk_action_group_add_actions_with_flags (data->action_group,
- action_entries,
- G_N_ELEMENTS (action_entries),
- browser);
- gtk_ui_manager_insert_action_group (gth_browser_get_ui_manager (browser), data->action_group, 0);
-
- data->fixed_merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser),
fixed_ui_info, -1, &error);
- if (data->fixed_merge_id == 0) {
- g_warning ("building ui failed: %s", error->message);
- g_error_free (error);
- }
-
- g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify)
browser_data_free);
-}
-
-
-static void
-set_action_sensitive (BrowserData *data,
- const char *action_name,
- gboolean sensitive)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (data->action_group, action_name);
- g_object_set (action, "sensitive", sensitive, NULL);
+ g_action_map_add_action_entries (G_ACTION_MAP (browser),
+ actions,
+ G_N_ELEMENTS (actions),
+ browser);
+ gth_menu_manager_append_entry (gth_browser_get_menu_manager (browser,
GTH_BROWSER_MENU_MANAGER_FILE_OPEN_ACTIONS),
+ GTH_MENU_MANAGER_NEW_MERGE_ID,
+ _("Print"),
+ "win.print",
+ "<control>P",
+ NULL);
+ gth_menu_manager_append_entry (gth_browser_get_menu_manager (browser,
GTH_BROWSER_MENU_MANAGER_FILE_LIST_OPEN_ACTIONS),
+ GTH_MENU_MANAGER_NEW_MERGE_ID,
+ _("Print"),
+ "win.print",
+ "<control>P",
+ NULL);
}
void
ip__gth_browser_update_sensitivity_cb (GthBrowser *browser)
{
- BrowserData *data;
- int n_selected;
-
- data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
- g_return_if_fail (data != NULL);
+ int n_selected;
n_selected = gth_file_selection_get_n_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view
(browser)));
- set_action_sensitive (data, "File_Print", n_selected > 0);
+ g_object_set (g_action_map_lookup_action (G_ACTION_MAP (browser), "print"), "enabled", n_selected >
0, NULL);
}
diff --git a/extensions/image_print/main.c b/extensions/image_print/main.c
index 9fc9057..ef8b5f0 100644
--- a/extensions/image_print/main.c
+++ b/extensions/image_print/main.c
@@ -30,7 +30,7 @@
G_MODULE_EXPORT void
gthumb_extension_activate (void)
{
- gth_hook_add_callback ("gth-browser-construct", 10, G_CALLBACK (ip__gth_browser_construct_cb), NULL);
+ gth_hook_add_callback ("gth-browser-construct", 9, G_CALLBACK (ip__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK
(ip__gth_browser_update_sensitivity_cb), NULL);
gth_hook_add_callback ("dlg-preferences-construct", 40, G_CALLBACK
(ip__dlg_preferences_construct_cb), NULL);
gth_hook_add_callback ("dlg-preferences-apply", 10, G_CALLBACK (ip__dlg_preferences_apply_cb), NULL);
diff --git a/extensions/image_viewer/Makefile.am b/extensions/image_viewer/Makefile.am
index ae7bc8a..239988d 100644
--- a/extensions/image_viewer/Makefile.am
+++ b/extensions/image_viewer/Makefile.am
@@ -4,6 +4,8 @@ extensiondir = $(pkglibdir)/extensions
extension_LTLIBRARIES = libimage_viewer.la
libimage_viewer_la_SOURCES = \
+ actions.c \
+ actions.h \
gth-image-histogram.c \
gth-image-histogram.h \
gth-image-viewer-page.c \
diff --git a/extensions/image_viewer/actions.c b/extensions/image_viewer/actions.c
new file mode 100644
index 0000000..4ca2f37
--- /dev/null
+++ b/extensions/image_viewer/actions.c
@@ -0,0 +1,125 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include <config.h>
+#include <gthumb.h>
+#include "gth-image-viewer-page.h"
+
+
+void
+gth_browser_activate_image_zoom_in (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GthBrowser *browser = user_data;
+ GthImageViewerPage *self = GTH_IMAGE_VIEWER_PAGE (gth_browser_get_viewer_page (browser));
+
+ gth_image_viewer_zoom_in (GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (self)));
+}
+
+
+void
+gth_browser_activate_image_zoom_out (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GthBrowser *browser = user_data;
+ GthImageViewerPage *self = GTH_IMAGE_VIEWER_PAGE (gth_browser_get_viewer_page (browser));
+
+ gth_image_viewer_zoom_out (GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (self)));
+}
+
+
+void
+gth_browser_activate_image_zoom_100 (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GthBrowser *browser = user_data;
+ GthImageViewerPage *self = GTH_IMAGE_VIEWER_PAGE (gth_browser_get_viewer_page (browser));
+
+ gth_image_viewer_set_zoom (GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (self)), 1.0);
+}
+
+
+void
+gth_browser_activate_image_zoom_fit (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GthBrowser *browser = user_data;
+ GthImageViewerPage *self = GTH_IMAGE_VIEWER_PAGE (gth_browser_get_viewer_page (browser));
+
+ gth_image_viewer_set_fit_mode (GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (self)),
GTH_FIT_SIZE);
+}
+
+
+void
+gth_browser_activate_image_zoom_fit_width (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GthBrowser *browser = user_data;
+ GthImageViewerPage *self = GTH_IMAGE_VIEWER_PAGE (gth_browser_get_viewer_page (browser));
+
+ gth_image_viewer_set_fit_mode (GTH_IMAGE_VIEWER (gth_image_viewer_page_get_image_viewer (self)),
GTH_FIT_WIDTH);
+}
+
+
+void
+gth_browser_activate_image_undo (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GthBrowser *browser = user_data;
+ gth_image_viewer_page_undo (GTH_IMAGE_VIEWER_PAGE (gth_browser_get_viewer_page (browser)));
+}
+
+
+void
+gth_browser_activate_image_redo (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GthBrowser *browser = user_data;
+ gth_image_viewer_page_redo (GTH_IMAGE_VIEWER_PAGE (gth_browser_get_viewer_page (browser)));
+}
+
+
+void
+gth_browser_activate_copy_image (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GthBrowser *browser = user_data;
+ gth_image_viewer_page_copy_image (GTH_IMAGE_VIEWER_PAGE (gth_browser_get_viewer_page (browser)));
+}
+
+
+void
+gth_browser_activate_paste_image (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GthBrowser *browser = user_data;
+ gth_image_viewer_page_paste_image (GTH_IMAGE_VIEWER_PAGE (gth_browser_get_viewer_page (browser)));
+}
diff --git a/extensions/image_viewer/actions.h b/extensions/image_viewer/actions.h
new file mode 100644
index 0000000..5ff4498
--- /dev/null
+++ b/extensions/image_viewer/actions.h
@@ -0,0 +1,37 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ACTIONS_H
+#define ACTIONS_H
+
+#include <gthumb.h>
+
+DEF_ACTION_CALLBACK (gth_browser_activate_image_zoom_in)
+DEF_ACTION_CALLBACK (gth_browser_activate_image_zoom_out)
+DEF_ACTION_CALLBACK (gth_browser_activate_image_zoom_100)
+DEF_ACTION_CALLBACK (gth_browser_activate_image_zoom_fit)
+DEF_ACTION_CALLBACK (gth_browser_activate_image_zoom_fit_width)
+DEF_ACTION_CALLBACK (gth_browser_activate_image_undo)
+DEF_ACTION_CALLBACK (gth_browser_activate_image_redo)
+DEF_ACTION_CALLBACK (gth_browser_activate_copy_image)
+DEF_ACTION_CALLBACK (gth_browser_activate_paste_image)
+
+#endif /* ACTIONS_H */
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index ca57eb6..66c52a5 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -23,6 +23,7 @@
#include <math.h>
#include <gdk/gdkkeysyms.h>
#include <gthumb.h>
+#include "actions.h"
#include "gth-image-viewer-page.h"
#include "preferences.h"
@@ -41,14 +42,41 @@ G_DEFINE_TYPE_WITH_CODE (GthImageViewerPage,
gth_viewer_page_interface_init))
+static const GActionEntry actions[] = {
+ { "image-zoom-in", gth_browser_activate_image_zoom_in },
+ { "image-zoom-out", gth_browser_activate_image_zoom_out },
+ { "image-zoom-100", gth_browser_activate_image_zoom_100 },
+ { "image-zoom-fit", gth_browser_activate_image_zoom_fit },
+ { "image-zoom-fit-width", gth_browser_activate_image_zoom_fit_width },
+ { "image-undo", gth_browser_activate_image_undo },
+ { "image-redo", gth_browser_activate_image_redo },
+ { "copy-image", gth_browser_activate_copy_image },
+ { "paste-image", gth_browser_activate_paste_image },
+};
+
+
+static const GthAccelerator accelerators[] = {
+ { "image-zoom-in", "<control>plus" },
+ { "image-zoom-out", "<control>minus" },
+ { "image-zoom-100", "<control>0" },
+ { "image-undo", "<control>z" },
+ { "image-redo", "<shift><control>z" },
+};
+
+
+static const GthMenuEntry file_popup_entries[] = {
+ { N_("Copy Image"), "win.copy-image", "<control>c" },
+ { N_("Paste Image"), "win.paste-image", "<control>v" },
+};
+
+
struct _GthImageViewerPagePrivate {
GthBrowser *browser;
GSettings *settings;
GtkWidget *image_navigator;
GtkWidget *viewer;
GthImagePreloader *preloader;
- GtkActionGroup *actions;
- guint browser_merge_id;
+ guint file_popup_merge_id;
GthImageHistory *history;
GthFileData *file_data;
gboolean image_changed;
@@ -60,153 +88,6 @@ struct _GthImageViewerPagePrivate {
};
-static const char *image_viewer_ui_info =
-"<ui>"
-" <menubar name='MenuBar'>"
-" <menu name='Edit' action='EditMenu'>"
-" <placeholder name='File_Actions_1'>"
-" <menuitem action='ImageViewer_Edit_Undo'/>"
-" <menuitem action='ImageViewer_Edit_Redo'/>"
-" <separator />"
-" <menuitem action='ImageViewer_Edit_Copy_Image'/>"
-" <menuitem action='ImageViewer_Edit_Paste_Image'/>"
-" </placeholder>"
-" </menu>"
-" </menubar>"
-"</ui>";
-
-
-static void
-image_viewer_activate_action_edit_undo (GtkAction *action,
- GthImageViewerPage *self)
-{
- gth_image_viewer_page_undo (self);
-}
-
-
-static void
-image_viewer_activate_action_edit_redo (GtkAction *action,
- GthImageViewerPage *self)
-{
- gth_image_viewer_page_redo (self);
-}
-
-
-static void
-image_viewer_activate_action_edit_copy_image (GtkAction *action,
- GthImageViewerPage *self)
-{
- gth_image_viewer_page_copy_image (self);
-}
-
-
-static void
-image_viewer_activate_action_edit_paste_image (GtkAction *action,
- GthImageViewerPage *self)
-{
- gth_image_viewer_page_paste_image (self);
-}
-
-
-static GtkActionEntry image_viewer_action_entries[] = {
- { "ImageViewer_Edit_Undo", GTK_STOCK_UNDO,
- NULL, "<control>z",
- NULL,
- G_CALLBACK (image_viewer_activate_action_edit_undo) },
-
- { "ImageViewer_Edit_Redo", GTK_STOCK_REDO,
- NULL, "<shift><control>z",
- NULL,
- G_CALLBACK (image_viewer_activate_action_edit_redo) },
-
- { "ImageViewer_Edit_Copy_Image", GTK_STOCK_COPY,
- N_("Copy Image"), "<control>c",
- N_("Copy the image to the clipboard"),
- G_CALLBACK (image_viewer_activate_action_edit_copy_image) },
-
- { "ImageViewer_Edit_Paste_Image", GTK_STOCK_PASTE,
- N_("Paste Image"), "<control>p",
- N_("Paste the image from the clipboard"),
- G_CALLBACK (image_viewer_activate_action_edit_paste_image) },
-};
-
-
-static void
-gth_browser_activate_image_zoom_in (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- GthBrowser *browser = user_data;
- GthImageViewerPage *self = (GthImageViewerPage *) gth_browser_get_viewer_page (browser);
-
- gth_image_viewer_zoom_in (GTH_IMAGE_VIEWER (self->priv->viewer));
-}
-
-
-static void
-gth_browser_activate_image_zoom_out (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- GthBrowser *browser = user_data;
- GthImageViewerPage *self = (GthImageViewerPage *) gth_browser_get_viewer_page (browser);
-
- gth_image_viewer_zoom_out (GTH_IMAGE_VIEWER (self->priv->viewer));
-}
-
-
-static void
-gth_browser_activate_image_zoom_100 (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- GthBrowser *browser = user_data;
- GthImageViewerPage *self = (GthImageViewerPage *) gth_browser_get_viewer_page (browser);
-
- gth_image_viewer_set_zoom (GTH_IMAGE_VIEWER (self->priv->viewer), 1.0);
-}
-
-
-static void
-gth_browser_activate_image_zoom_fit (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- GthBrowser *browser = user_data;
- GthImageViewerPage *self = (GthImageViewerPage *) gth_browser_get_viewer_page (browser);
-
- gth_image_viewer_set_fit_mode (GTH_IMAGE_VIEWER (self->priv->viewer), GTH_FIT_SIZE);
-}
-
-
-static void
-gth_browser_activate_image_zoom_fit_width (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- GthBrowser *browser = user_data;
- GthImageViewerPage *self = (GthImageViewerPage *) gth_browser_get_viewer_page (browser);
-
- gth_image_viewer_set_fit_mode (GTH_IMAGE_VIEWER (self->priv->viewer), GTH_FIT_WIDTH);
-}
-
-
-static const GActionEntry actions[] = {
- { "image-zoom-in", gth_browser_activate_image_zoom_in },
- { "image-zoom-out", gth_browser_activate_image_zoom_out },
- { "image-zoom-100", gth_browser_activate_image_zoom_100 },
- { "image-zoom-fit", gth_browser_activate_image_zoom_fit },
- { "image-zoom-fit-width", gth_browser_activate_image_zoom_fit_width }
-};
-
-
-static const GthAccelerator accelerators[] = {
- { "image-zoom-in", "<control>plus" },
- { "image-zoom-out", "<control>minus" },
- { "image-zoom-100", "<control>0" },
-};
-
-
static void
gth_image_viewer_page_file_loaded (GthImageViewerPage *self,
gboolean success)
@@ -442,20 +323,6 @@ viewer_key_press_cb (GtkWidget *widget,
static void
-_set_action_sensitive (GthImageViewerPage *self,
- const char *action_name,
- gboolean sensitive)
-{
- GtkAction *action;
-
- if (self->priv->actions == NULL)
- return;
- action = gtk_action_group_get_action (self->priv->actions, action_name);
- g_object_set (action, "sensitive", sensitive, NULL);
-}
-
-
-static void
clipboard_targets_received_cb (GtkClipboard *clipboard,
GdkAtom *atoms,
int n_atoms,
@@ -469,7 +336,7 @@ clipboard_targets_received_cb (GtkClipboard *clipboard,
if (atoms[i] == gdk_atom_intern_static_string ("image/png"))
self->priv->can_paste = TRUE;
- _set_action_sensitive (self, "ImageViewer_Edit_Paste_Image", self->priv->can_paste);
+ gth_window_enable_action (GTH_WINDOW (self->priv->browser), "paste-image", self->priv->can_paste);
g_object_unref (self);
}
@@ -480,7 +347,7 @@ _gth_image_viewer_page_update_paste_command_sensitivity (GthImageViewerPage *sel
GtkClipboard *clipboard)
{
self->priv->can_paste = FALSE;
- _set_action_sensitive (self, "ImageViewer_Edit_Paste_Image", FALSE);
+ gth_window_enable_action (GTH_WINDOW (self->priv->browser), "paste-image", self->priv->can_paste);
if (clipboard == NULL)
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (self->priv->viewer),
GDK_SELECTION_CLIPBOARD);
@@ -909,14 +776,24 @@ gth_image_viewer_page_real_deactivate (GthViewerPage *base)
static void
gth_image_viewer_page_real_show (GthViewerPage *base)
{
- gth_viewer_page_focus (GTH_VIEWER_PAGE (base));
+ GthImageViewerPage *self = (GthImageViewerPage*) base;
+
+ if (self->priv->file_popup_merge_id == 0)
+ self->priv->file_popup_merge_id =
+ gth_menu_manager_append_entries (gth_browser_get_menu_manager
(self->priv->browser, GTH_BROWSER_MENU_MANAGER_FILE_EDIT_ACTIONS),
+ file_popup_entries,
+ G_N_ELEMENTS (file_popup_entries));
+ gth_viewer_page_focus (GTH_VIEWER_PAGE (self));
}
static void
gth_image_viewer_page_real_hide (GthViewerPage *base)
{
- /* void */
+ GthImageViewerPage *self = (GthImageViewerPage*) base;
+
+ gth_menu_manager_remove_entries (gth_browser_get_menu_manager (self->priv->browser,
GTH_BROWSER_MENU_MANAGER_FILE_EDIT_ACTIONS), self->priv->file_popup_merge_id);
+ self->priv->file_popup_merge_id = 0;
}
@@ -1161,19 +1038,19 @@ gth_image_viewer_page_real_update_sensitivity (GthViewerPage *base)
self = (GthImageViewerPage*) base;
- _set_action_sensitive (self, "ImageViewer_Edit_Undo", gth_image_history_can_undo
(self->priv->history));
- _set_action_sensitive (self, "ImageViewer_Edit_Redo", gth_image_history_can_redo
(self->priv->history));
+ gth_window_enable_action (GTH_WINDOW (self->priv->browser), "image-undo", gth_image_history_can_undo
(self->priv->history));
+ gth_window_enable_action (GTH_WINDOW (self->priv->browser), "image-redo", gth_image_history_can_redo
(self->priv->history));
zoom_enabled = gth_image_viewer_get_zoom_enabled (GTH_IMAGE_VIEWER (self->priv->viewer));
zoom = gth_image_viewer_get_zoom (GTH_IMAGE_VIEWER (self->priv->viewer));
- _set_action_sensitive (self, "ImageViewer_View_Zoom100", zoom_enabled && ! FLOAT_EQUAL (zoom, 1.0));
- _set_action_sensitive (self, "ImageViewer_View_ZoomOut", zoom_enabled && (zoom > 0.05));
- _set_action_sensitive (self, "ImageViewer_View_ZoomIn", zoom_enabled && (zoom < 100.0));
+ gth_window_enable_action (GTH_WINDOW (self->priv->browser), "image-zoom-100", zoom_enabled && !
FLOAT_EQUAL (zoom, 1.0));
+ gth_window_enable_action (GTH_WINDOW (self->priv->browser), "image-zoom-out", zoom_enabled && (zoom >
0.05));
+ gth_window_enable_action (GTH_WINDOW (self->priv->browser), "image-zoom-in", zoom_enabled && (zoom <
100.0));
fit_mode = gth_image_viewer_get_fit_mode (GTH_IMAGE_VIEWER (self->priv->viewer));
- _set_action_sensitive (self, "ImageViewer_View_ZoomFit", zoom_enabled && (fit_mode != GTH_FIT_SIZE));
- _set_action_sensitive (self, "ImageViewer_View_ZoomFitWidth", zoom_enabled && (fit_mode !=
GTH_FIT_WIDTH));
+ gth_window_enable_action (GTH_WINDOW (self->priv->browser), "image-zoom-fit", zoom_enabled &&
(fit_mode != GTH_FIT_SIZE));
+ gth_window_enable_action (GTH_WINDOW (self->priv->browser), "image-zoom-fit-width", zoom_enabled &&
(fit_mode != GTH_FIT_WIDTH));
_gth_image_viewer_page_update_paste_command_sensitivity (self, NULL);
}
diff --git a/extensions/selections/actions.c b/extensions/selections/actions.c
index 2829e3e..d3ff0ab 100644
--- a/extensions/selections/actions.c
+++ b/extensions/selections/actions.c
@@ -26,8 +26,8 @@
void
-gth_browser_activate_action_show_selection (GthBrowser *browser,
- int n_selection)
+gth_browser_activate_show_selection (GthBrowser *browser,
+ int n_selection)
{
char *uri;
GFile *location;
@@ -50,32 +50,35 @@ gth_browser_activate_action_show_selection (GthBrowser *browser,
void
-gth_browser_activate_action_go_selection_1 (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_go_to_selection_1 (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- gth_browser_activate_action_show_selection (browser, 1);
+ gth_browser_activate_show_selection (GTH_BROWSER (user_data), 1);
}
void
-gth_browser_activate_action_go_selection_2 (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_go_to_selection_2 (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- gth_browser_activate_action_show_selection (browser, 2);
+ gth_browser_activate_show_selection (GTH_BROWSER (user_data), 2);
}
void
-gth_browser_activate_action_go_selection_3 (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_go_to_selection_3 (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- gth_browser_activate_action_show_selection (browser, 3);
+ gth_browser_activate_show_selection (GTH_BROWSER (user_data), 3);
}
void
-gth_browser_activate_action_add_to_selection (GthBrowser *browser,
- int n_selection)
+gth_browser_activate_add_to_selection (GthBrowser *browser,
+ int n_selection)
{
char *uri;
GFile *folder;
@@ -99,31 +102,34 @@ gth_browser_activate_action_add_to_selection (GthBrowser *browser,
void
-gth_browser_activate_action_add_to_selection_1 (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_add_to_selection_1 (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- gth_browser_activate_action_add_to_selection (browser, 1);
+ gth_browser_activate_add_to_selection (GTH_BROWSER (user_data), 1);
}
void
-gth_browser_activate_action_add_to_selection_2 (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_add_to_selection_2 (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- gth_browser_activate_action_add_to_selection (browser, 2);
+ gth_browser_activate_add_to_selection (GTH_BROWSER (user_data), 2);
}
void
-gth_browser_activate_action_add_to_selection_3 (GtkAction *action,
- GthBrowser *browser)
+gth_browser_activate_add_to_selection_3 (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- gth_browser_activate_action_add_to_selection (browser, 3);
+ gth_browser_activate_add_to_selection (GTH_BROWSER (user_data), 3);
}
void
-gth_browser_activate_action_remove_from_selection (GthBrowser *browser,
- int n_selection)
+gth_browser_activate_remove_from_selection (GthBrowser *browser,
+ int n_selection)
{
char *uri;
GFile *folder;
@@ -147,8 +153,8 @@ gth_browser_activate_action_remove_from_selection (GthBrowser *browser,
void
-gth_browser_activate_action_selection_go_to_container (GthBrowser *browser,
- int n_selection)
+gth_browser_activate_go_to_file_container_from_selection (GthBrowser *browser,
+ int n_selection)
{
GList *items;
GList *file_list = NULL;
diff --git a/extensions/selections/actions.h b/extensions/selections/actions.h
index 1b4a4fd..0270d88 100644
--- a/extensions/selections/actions.h
+++ b/extensions/selections/actions.h
@@ -22,23 +22,21 @@
#ifndef ACTIONS_H
#define ACTIONS_H
-#include <gtk/gtk.h>
+#include <gthumb.h>
-#define DEFINE_ACTION(x) void x (GtkAction *action, gpointer data);
+void gth_browser_activate_show_selection (GthBrowser *browser,
+ int n_selection);
+void gth_browser_activate_add_to_selection (GthBrowser *browser,
+ int n_selection);
+void gth_browser_activate_remove_from_selection (GthBrowser *browser,
+ int n_selection);
-void gth_browser_activate_action_show_selection (GthBrowser *browser,
- int n_selection);
-void gth_browser_activate_action_add_to_selection (GthBrowser *browser,
- int n_selection);
-void gth_browser_activate_action_remove_from_selection (GthBrowser *browser,
- int n_selection);
-
-DEFINE_ACTION(gth_browser_activate_action_go_selection_1)
-DEFINE_ACTION(gth_browser_activate_action_go_selection_2)
-DEFINE_ACTION(gth_browser_activate_action_go_selection_3)
-DEFINE_ACTION(gth_browser_activate_action_add_to_selection_1)
-DEFINE_ACTION(gth_browser_activate_action_add_to_selection_2)
-DEFINE_ACTION(gth_browser_activate_action_add_to_selection_3)
-DEFINE_ACTION(gth_browser_activate_action_selection_go_to_container)
+DEF_ACTION_CALLBACK (gth_browser_activate_go_to_selection_1)
+DEF_ACTION_CALLBACK (gth_browser_activate_go_to_selection_2)
+DEF_ACTION_CALLBACK (gth_browser_activate_go_to_selection_3)
+DEF_ACTION_CALLBACK (gth_browser_activate_add_to_selection_1)
+DEF_ACTION_CALLBACK (gth_browser_activate_add_to_selection_2)
+DEF_ACTION_CALLBACK (gth_browser_activate_add_to_selection_3)
+DEF_ACTION_CALLBACK (gth_browser_activate_go_to_file_container_from_selection)
#endif /* ACTIONS_H */
diff --git a/extensions/selections/callbacks.c b/extensions/selections/callbacks.c
index 0468827..74932b9 100644
--- a/extensions/selections/callbacks.c
+++ b/extensions/selections/callbacks.c
@@ -33,94 +33,31 @@
#define N_SELECTIONS 3
-static const char *fixed_ui_info =
-"<ui>"
-" <popup name='FileListPopup'>"
-" <placeholder name='Folder_Actions2'>"
-" <menu action='Edit_AddToSelection'>"
-" <menuitem action='Edit_AddToSelection_1'/>"
-" <menuitem action='Edit_AddToSelection_2'/>"
-" <menuitem action='Edit_AddToSelection_3'/>"
-" </menu>"
-" </placeholder>"
-" </popup>"
-" <popup name='FilePopup'>"
-" <placeholder name='Folder_Actions2'>"
-" <menu action='Edit_AddToSelection'>"
-" <menuitem action='Edit_AddToSelection_1'/>"
-" <menuitem action='Edit_AddToSelection_2'/>"
-" <menuitem action='Edit_AddToSelection_3'/>"
-" </menu>"
-" </placeholder>"
-" </popup>"
-" <accelerator action=\"Go_Selection_1\" />"
-" <accelerator action=\"Go_Selection_2\" />"
-" <accelerator action=\"Go_Selection_3\" />"
-"</ui>";
-
-
-static const char *vfs_ui_info =
-"<ui>"
-" <popup name='FileListPopup'>"
-" <placeholder name='Open_Actions'>"
-" <menuitem action='Go_FileContainer'/>"
-" </placeholder>"
-" </popup>"
-" <popup name='FilePopup'>"
-" <placeholder name='Open_Actions'>"
-" <menuitem action='Go_FileContainer'/>"
-" </placeholder>"
-" </popup>"
-"</ui>";
-
-
-static GthActionEntryExt selections_action_entries[] = {
- { "Edit_AddToSelection", GTK_STOCK_ADD, N_("Add to _Selection") },
-
- { "Go_FileContainer", GTK_STOCK_JUMP_TO,
- N_("Open _Folder"), "<alt>End",
- N_("Go to the folder that contains the selected file"),
- GTH_ACTION_FLAG_NONE,
- G_CALLBACK (gth_browser_activate_action_selection_go_to_container) },
-
- { "Edit_AddToSelection_1", "selection1",
- N_("Selection 1"), NULL,
- NULL,
- GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE,
- G_CALLBACK (gth_browser_activate_action_add_to_selection_1) },
- { "Edit_AddToSelection_2", "selection2",
- N_("Selection 2"), NULL,
- NULL,
- GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE,
- G_CALLBACK (gth_browser_activate_action_add_to_selection_2) },
- { "Edit_AddToSelection_3", "selection3",
- N_("Selection 3"), NULL,
- NULL,
- GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE,
- G_CALLBACK (gth_browser_activate_action_add_to_selection_3) },
- { "Go_Selection_1", NULL,
- NULL, "<control>1",
- NULL,
- GTH_ACTION_FLAG_NONE,
- G_CALLBACK (gth_browser_activate_action_go_selection_1) },
- { "Go_Selection_2", NULL,
- NULL, "<control>2",
- NULL,
- GTH_ACTION_FLAG_NONE,
- G_CALLBACK (gth_browser_activate_action_go_selection_2) },
- { "Go_Selection_3", NULL,
- NULL, "<control>3",
- NULL,
- GTH_ACTION_FLAG_NONE,
- G_CALLBACK (gth_browser_activate_action_go_selection_3) }
+static const GActionEntry actions[] = {
+ { "add-to-selection-1", gth_browser_activate_add_to_selection_1 },
+ { "add-to-selection-2", gth_browser_activate_add_to_selection_2 },
+ { "add-to-selection-3", gth_browser_activate_add_to_selection_3 },
+ { "go-to-selection-1", gth_browser_activate_go_to_selection_1 },
+ { "go-to-selection-2", gth_browser_activate_go_to_selection_2 },
+ { "go-to-selection-3", gth_browser_activate_go_to_selection_3 },
+ { "go-to-file-container", gth_browser_activate_go_to_file_container_from_selection },
+};
+
+
+static const GthAccelerator accelerators[] = {
+ { "go-to-selection-1", "<control>1" },
+ { "go-to-selection-2", "<control>2" },
+ { "go-to-selection-3", "<control>3" },
+};
+
+static const GthMenuEntry file_list_popup_entries[] = {
+ { N_("Open Folder"), "win.go-to-container-from-selection", "<Alt>end" },
};
-static guint selections_action_entries_size = G_N_ELEMENTS (selections_action_entries);
typedef struct {
GthBrowser *browser;
- GtkActionGroup *actions;
guint vfs_merge_id;
GtkWidget *selection_buttons[N_SELECTIONS];
gulong folder_changed_id;
@@ -148,7 +85,7 @@ selection_clicked_cb (GtkWidget *button,
g_return_if_fail (n_selection >= 0 && n_selection <= N_SELECTIONS - 1);
- gth_browser_activate_action_show_selection (data->browser, n_selection + 1);
+ gth_browser_activate_show_selection (data->browser, n_selection + 1);
}
@@ -229,7 +166,6 @@ void
selections__gth_browser_construct_cb (GthBrowser *browser)
{
BrowserData *data;
- GError *error = NULL;
GtkWidget *filter_bar;
GtkWidget *filter_bar_extra_area;
GtkWidget *selection_buttons;
@@ -241,18 +177,10 @@ selections__gth_browser_construct_cb (GthBrowser *browser)
data->browser = browser;
- data->actions = gtk_action_group_new ("Selections Actions");
- gtk_action_group_set_translation_domain (data->actions, NULL);
- _gtk_action_group_add_actions_with_flags (data->actions,
- selections_action_entries,
- selections_action_entries_size,
- browser);
- gtk_ui_manager_insert_action_group (gth_browser_get_ui_manager (browser), data->actions, 0);
-
- if (! gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), fixed_ui_info, -1,
&error)) {
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- }
+ g_action_map_add_action_entries (G_ACTION_MAP (browser),
+ actions,
+ G_N_ELEMENTS (actions),
+ browser);
filter_bar = gth_browser_get_filterbar (browser);
filter_bar_extra_area = gth_filterbar_get_extra_area (GTH_FILTERBAR (filter_bar));
@@ -313,9 +241,9 @@ selections__gth_browser_file_list_key_press_cb (GthBrowser *browser,
case GDK_KEY_3:
/* Alt+Shift+n => remove from selection n */
if ((event->state & modifiers) == (GDK_SHIFT_MASK|GDK_MOD1_MASK))
- gth_browser_activate_action_remove_from_selection (browser, keyval -
GDK_KEY_1 + 1);
+ gth_browser_activate_remove_from_selection (browser, keyval - GDK_KEY_1 + 1);
else /* Alt+n => add to selection n */
- gth_browser_activate_action_add_to_selection (browser, keyval - GDK_KEY_1 +
1);
+ gth_browser_activate_add_to_selection (browser, keyval - GDK_KEY_1 + 1);
result = GINT_TO_POINTER (1);
break;
}
@@ -330,7 +258,7 @@ selections__gth_browser_file_list_key_press_cb (GthBrowser *browser,
case GDK_KEY_2:
case GDK_KEY_3:
/* Control+n => go to selection n */
- gth_browser_activate_action_show_selection (browser, keyval - GDK_KEY_1 + 1);
+ gth_browser_activate_show_selection (browser, keyval - GDK_KEY_1 + 1);
result = GINT_TO_POINTER (1);
break;
}
@@ -353,21 +281,15 @@ selections__gth_browser_load_location_after_cb (GthBrowser *browser,
data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
if (GTH_IS_FILE_SOURCE_SELECTIONS (gth_browser_get_location_source (browser))) {
- if (data->vfs_merge_id == 0) {
- GError *error = NULL;
-
- data->vfs_merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager
(browser), vfs_ui_info, -1, &error);
- if (data->vfs_merge_id == 0) {
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- }
- }
+ if (data->vfs_merge_id == 0)
+ data->vfs_merge_id =
+ gth_menu_manager_append_entries (gth_browser_get_menu_manager
(browser, GTH_BROWSER_MENU_MANAGER_FILE_LIST_OPEN_ACTIONS),
+ file_list_popup_entries,
+ G_N_ELEMENTS
(file_list_popup_entries));
}
else {
- if (data->vfs_merge_id != 0) {
- gtk_ui_manager_remove_ui (gth_browser_get_ui_manager (browser), data->vfs_merge_id);
- data->vfs_merge_id = 0;
- }
+ gth_menu_manager_remove_entries (gth_browser_get_menu_manager (browser,
GTH_BROWSER_MENU_MANAGER_FILE_LIST_OPEN_ACTIONS), data->vfs_merge_id);
+ data->vfs_merge_id = 0;
}
}
diff --git a/gthumb/Makefile.am b/gthumb/Makefile.am
index 4051fb6..4a8705a 100644
--- a/gthumb/Makefile.am
+++ b/gthumb/Makefile.am
@@ -133,7 +133,6 @@ PRIVATE_HEADER_FILES = \
dlg-preferences-extensions.h \
gth-browser-actions-callbacks.h \
gth-browser-actions-entries.h \
- gth-browser-ui.h \
gth-metadata-provider-file.h \
dlg-personalize-filters.h \
dlg-preferences.h \
diff --git a/gthumb/gth-browser-actions-callbacks.c b/gthumb/gth-browser-actions-callbacks.c
index 427fa1a..cb84a25 100644
--- a/gthumb/gth-browser-actions-callbacks.c
+++ b/gthumb/gth-browser-actions-callbacks.c
@@ -39,167 +39,6 @@
void
-gth_browser_activate_action_view_filter (GtkAction *action,
- GthBrowser *browser)
-{
- dlg_personalize_filters (browser);
-}
-
-
-void
-gth_browser_activate_action_view_filterbar (GtkAction *action,
- GthBrowser *browser)
-{
- gth_browser_show_filterbar (browser, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
-}
-
-
-void
-gth_browser_activate_action_view_fullscreen (GtkAction *action,
- GthBrowser *browser)
-{
- gth_browser_fullscreen (browser);
-}
-
-
-void
-gth_browser_activate_action_view_sort_by (GtkAction *action,
- GthBrowser *browser)
-{
- dlg_sort_order (browser);
-}
-
-
-void
-gth_browser_activate_action_view_thumbnails (GtkAction *action,
- GthBrowser *browser)
-{
- gth_browser_enable_thumbnails (browser, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
-}
-
-
-void
-gth_browser_activate_action_view_show_hidden_files (GtkAction *action,
- GthBrowser *browser)
-{
- GSettings *settings;
-
- settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
- g_settings_set_boolean (settings, PREF_BROWSER_SHOW_HIDDEN_FILES, gtk_toggle_action_get_active
(GTK_TOGGLE_ACTION (action)));
-
- g_object_unref (settings);
-}
-
-
-void
-gth_browser_activate_action_view_statusbar (GtkAction *action,
- GthBrowser *browser)
-{
- GSettings *settings;
-
- settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
- g_settings_set_boolean (settings, PREF_BROWSER_STATUSBAR_VISIBLE, gtk_toggle_action_get_active
(GTK_TOGGLE_ACTION (action)));
-
- g_object_unref (settings);
-}
-
-
-void
-gth_browser_activate_action_view_sidebar (GtkAction *action,
- GthBrowser *browser)
-{
- GSettings *settings;
-
- settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
- g_settings_set_boolean (settings, PREF_BROWSER_SIDEBAR_VISIBLE, gtk_toggle_action_get_active
(GTK_TOGGLE_ACTION (action)));
-
- g_object_unref (settings);
-}
-
-
-void
-gth_browser_activate_action_view_thumbnail_list (GtkAction *action,
- GthBrowser *browser)
-{
- GSettings *settings;
-
- settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
- g_settings_set_boolean (settings, PREF_BROWSER_THUMBNAIL_LIST_VISIBLE, gtk_toggle_action_get_active
(GTK_TOGGLE_ACTION (action)));
-
- g_object_unref (settings);
-}
-
-
-void
-gth_browser_activate_action_view_stop (GtkAction *action,
- GthBrowser *browser)
-{
- gth_browser_stop (browser);
-}
-
-
-void
-gth_browser_activate_action_view_reload (GtkAction *action,
- GthBrowser *browser)
-{
- gth_browser_reload (browser);
-}
-
-
-void
-gth_browser_activate_action_folder_open (GtkAction *action,
- GthBrowser *browser)
-{
- GthFileData *file_data;
-
- file_data = gth_browser_get_folder_popup_file_data (browser);
- if (file_data == NULL)
- return;
-
- gth_browser_load_location (browser, file_data->file);
-
- g_object_unref (file_data);
-}
-
-
-void
-gth_browser_activate_action_folder_open_in_new_window (GtkAction *action,
- GthBrowser *browser)
-{
- GthFileData *file_data;
- GtkWidget *new_browser;
-
- file_data = gth_browser_get_folder_popup_file_data (browser);
- if (file_data == NULL)
- return;
-
- new_browser = gth_browser_new (file_data->file, NULL);
- gtk_window_present (GTK_WINDOW (new_browser));
-
- g_object_unref (file_data);
-}
-
-
-void
-gth_browser_activate_action_view_shrink_wrap (GtkAction *action,
- GthBrowser *browser)
-{
- gth_browser_set_shrink_wrap_viewer (GTH_BROWSER (browser), gtk_toggle_action_get_active
(GTK_TOGGLE_ACTION (action)));
-}
-
-
-void
-gth_browser_activate_action_edit_select_all (GtkAction *action,
- GthBrowser *browser)
-{
- gth_file_selection_select_all (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
-}
-
-
-/* -- GAction callbacks -- */
-
-
-void
toggle_action_activated (GSimpleAction *action,
GVariant *parameter,
gpointer data)
@@ -601,3 +440,92 @@ gth_browser_activate_open_folder_in_new_window (GSimpleAction *action,
g_object_unref (file_data);
}
+
+
+void
+gth_browser_activate_shrink_wrap (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ g_simple_action_set_state (action, state);
+ gth_browser_set_shrink_wrap_viewer (GTH_BROWSER (user_data), g_variant_get_boolean (state));
+}
+
+
+void
+gth_browser_activate_show_hidden_files (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ GSettings *settings;
+
+ g_simple_action_set_state (action, state);
+
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ g_settings_set_boolean (settings, PREF_BROWSER_SHOW_HIDDEN_FILES, g_variant_get_boolean (state));
+ g_object_unref (settings);
+}
+
+
+void
+gth_browser_activate_show_thumbnails (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ g_simple_action_set_state (action, state);
+ gth_browser_enable_thumbnails (GTH_BROWSER (user_data), g_variant_get_boolean (state));
+}
+
+
+void
+gth_browser_activate_sort_by (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ dlg_sort_order (GTH_BROWSER (user_data));
+}
+
+
+void
+gth_browser_activate_show_statusbar (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ GSettings *settings;
+
+ g_simple_action_set_state (action, state);
+
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ g_settings_set_boolean (settings, PREF_BROWSER_STATUSBAR_VISIBLE, g_variant_get_boolean (state));
+ g_object_unref (settings);
+}
+
+
+void
+gth_browser_activate_show_sidebar (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ GSettings *settings;
+
+ g_simple_action_set_state (action, state);
+
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ g_settings_set_boolean (settings, PREF_BROWSER_SIDEBAR_VISIBLE, g_variant_get_boolean (state));
+ g_object_unref (settings);
+}
+
+
+void
+gth_browser_activate_show_thumbnail_list (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ GSettings *settings;
+
+ g_simple_action_set_state (action, state);
+
+ settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+ g_settings_set_boolean (settings, PREF_BROWSER_THUMBNAIL_LIST_VISIBLE, g_variant_get_boolean (state));
+ g_object_unref (settings);
+}
diff --git a/gthumb/gth-browser-actions-callbacks.h b/gthumb/gth-browser-actions-callbacks.h
index 835137f..db0fd88 100644
--- a/gthumb/gth-browser-actions-callbacks.h
+++ b/gthumb/gth-browser-actions-callbacks.h
@@ -23,23 +23,7 @@
#define GTH_BROWSER_ACTIONS_CALLBACKS_H
#include <gtk/gtk.h>
-
-#define DEFINE_ACTION(x) void x (GtkAction *action, gpointer data);
-
-DEFINE_ACTION(gth_browser_activate_action_edit_select_all)
-DEFINE_ACTION(gth_browser_activate_action_folder_open)
-DEFINE_ACTION(gth_browser_activate_action_folder_open_in_new_window)
-DEFINE_ACTION(gth_browser_activate_action_view_sort_by)
-DEFINE_ACTION(gth_browser_activate_action_view_filter)
-DEFINE_ACTION(gth_browser_activate_action_view_filterbar)
-DEFINE_ACTION(gth_browser_activate_action_view_thumbnails)
-DEFINE_ACTION(gth_browser_activate_action_view_show_hidden_files)
-DEFINE_ACTION(gth_browser_activate_action_view_statusbar)
-DEFINE_ACTION(gth_browser_activate_action_view_sidebar)
-DEFINE_ACTION(gth_browser_activate_action_view_thumbnail_list)
-DEFINE_ACTION(gth_browser_activate_action_view_stop)
-DEFINE_ACTION(gth_browser_activate_action_view_reload)
-DEFINE_ACTION(gth_browser_activate_action_view_shrink_wrap)
+#include "glib-utils.h"
DEF_ACTION_CALLBACK (toggle_action_activated)
DEF_ACTION_CALLBACK (gth_application_activate_new_window)
@@ -68,5 +52,12 @@ DEF_ACTION_CALLBACK (gth_browser_activate_viewer_edit_file)
DEF_ACTION_CALLBACK (gth_browser_activate_viewer_properties)
DEF_ACTION_CALLBACK (gth_browser_activate_unfullscreen)
DEF_ACTION_CALLBACK (gth_browser_activate_open_folder_in_new_window)
+DEF_ACTION_CALLBACK (gth_browser_activate_shrink_wrap)
+DEF_ACTION_CALLBACK (gth_browser_activate_show_hidden_files)
+DEF_ACTION_CALLBACK (gth_browser_activate_show_thumbnails)
+DEF_ACTION_CALLBACK (gth_browser_activate_sort_by)
+DEF_ACTION_CALLBACK (gth_browser_activate_show_statusbar)
+DEF_ACTION_CALLBACK (gth_browser_activate_show_sidebar)
+DEF_ACTION_CALLBACK (gth_browser_activate_show_thumbnail_list)
#endif /* GTH_BROWSER_ACTIONS_CALLBACK_H */
diff --git a/gthumb/gth-browser-actions-entries.h b/gthumb/gth-browser-actions-entries.h
index 11a9290..1fc6656 100644
--- a/gthumb/gth-browser-actions-entries.h
+++ b/gthumb/gth-browser-actions-entries.h
@@ -27,6 +27,7 @@
#include "gth-stock.h"
#include "gtk-utils.h"
+
static const GActionEntry gth_browser_actions[] = {
{ "browser-mode", gth_browser_activate_browser_mode },
{ "browser-edit-file", gth_browser_activate_browser_edit_file },
@@ -48,6 +49,15 @@ static const GActionEntry gth_browser_actions[] = {
{ "viewer-properties", toggle_action_activated, NULL, "false", gth_browser_activate_viewer_properties
},
{ "unfullscreen", gth_browser_activate_unfullscreen },
{ "open-folder-in-new-window", gth_browser_activate_open_folder_in_new_window },
+ { "shrink-wrap", toggle_action_activated, NULL, "false", gth_browser_activate_shrink_wrap },
+
+ { "show-hidden-files", toggle_action_activated, NULL, "false", gth_browser_activate_show_hidden_files
},
+ { "show-thumbnails", toggle_action_activated, NULL, "false", gth_browser_activate_show_thumbnails },
+ { "sort-by", gth_browser_activate_sort_by },
+
+ { "show-statusbar", toggle_action_activated, NULL, "false", gth_browser_activate_show_statusbar },
+ { "show-sidebar", toggle_action_activated, NULL, "false", gth_browser_activate_show_sidebar },
+ { "show-thumbnail-list", toggle_action_activated, NULL, "false",
gth_browser_activate_show_thumbnail_list },
};
@@ -58,91 +68,4 @@ static const GthAccelerator gth_browser_accelerators[] = {
};
-static GthActionEntryExt gth_browser_action_entries[] = {
- { "EditMenu", NULL, N_("_Edit") },
- { "ViewMenu", NULL, N_("_View") },
- { "OpenWithMenu", NULL, N_("Open _With") },
-
- { "Folder_Open", GTK_STOCK_OPEN,
- N_("Open"), "",
- NULL,
- GTH_ACTION_FLAG_NONE,
- G_CALLBACK (gth_browser_activate_action_folder_open) },
-
- { "Folder_OpenInNewWindow", NULL,
- N_("Open in New Window"), "",
- NULL,
- GTH_ACTION_FLAG_NONE,
- G_CALLBACK (gth_browser_activate_action_folder_open_in_new_window) },
-
- { "Edit_SelectAll", GTK_STOCK_SELECT_ALL,
- NULL, "<control>A",
- NULL,
- GTH_ACTION_FLAG_NONE,
- G_CALLBACK (gth_browser_activate_action_edit_select_all) },
-
- { "View_Sort_By", NULL,
- N_("_Sort By..."), NULL,
- NULL,
- GTH_ACTION_FLAG_NONE,
- G_CALLBACK (gth_browser_activate_action_view_sort_by) },
-
- { "View_Filters", NULL,
- N_("_Filter..."), NULL,
- NULL,
- GTH_ACTION_FLAG_NONE,
- G_CALLBACK (gth_browser_activate_action_view_filter) },
-
- { "View_Stop", GTK_STOCK_STOP,
- NULL, NULL,
- N_("Stop loading the current location"),
- GTH_ACTION_FLAG_NONE,
- G_CALLBACK (gth_browser_activate_action_view_stop) },
-
- { "View_Reload", GTK_STOCK_REFRESH,
- NULL, "<control>R",
- N_("Reload the current location"),
- GTH_ACTION_FLAG_NONE,
- G_CALLBACK (gth_browser_activate_action_view_reload) },
-};
-
-
-static GtkToggleActionEntry gth_browser_action_toggle_entries[] = {
- { "View_Statusbar", NULL,
- N_("_Statusbar"), NULL,
- N_("View or hide the statusbar of this window"),
- G_CALLBACK (gth_browser_activate_action_view_statusbar),
- TRUE },
- { "View_Filterbar", NULL,
- N_("_Filterbar"), NULL,
- N_("View or hide the filterbar of this window"),
- G_CALLBACK (gth_browser_activate_action_view_filterbar),
- TRUE },
- { "View_Sidebar", NULL,
- N_("_Sidebar"), "F9",
- N_("View or hide the sidebar of this window"),
- G_CALLBACK (gth_browser_activate_action_view_sidebar),
- TRUE },
- { "View_Thumbnail_List", NULL,
- N_("_Thumbnail Pane"), "F8",
- N_("View or hide the thumbnail pane in viewer mode"),
- G_CALLBACK (gth_browser_activate_action_view_thumbnail_list),
- TRUE },
- { "View_Thumbnails", NULL,
- N_("_Thumbnails"), "<control>T",
- N_("View thumbnails"),
- G_CALLBACK (gth_browser_activate_action_view_thumbnails),
- TRUE },
- { "View_ShowHiddenFiles", NULL,
- N_("_Hidden Files"), "<control>H",
- N_("Show hidden files and folders"),
- G_CALLBACK (gth_browser_activate_action_view_show_hidden_files),
- FALSE },
- { "View_ShrinkWrap", NULL,
- N_("_Fit Window to Image"), "<control>e",
- N_("Resize the window to the size of the image"),
- G_CALLBACK (gth_browser_activate_action_view_shrink_wrap),
- FALSE },
-};
-
#endif /* GTH_BROWSER_ACTION_ENTRIES_H */
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 0fd36c9..bc8a4aa 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -30,7 +30,6 @@
#include "gth-browser.h"
#include "gth-browser-actions-callbacks.h"
#include "gth-browser-actions-entries.h"
-#include "gth-browser-ui.h"
#include "gth-duplicable.h"
#include "gth-embedded-dialog.h"
#include "gth-enum-types.h"
@@ -98,8 +97,6 @@ typedef struct {
struct _GthBrowserPrivate {
/* UI staff */
- GtkUIManager *ui;
- GtkActionGroup *actions;
GtkWidget *infobar;
GtkWidget *statusbar;
GtkWidget *browser_right_container;
@@ -132,9 +129,6 @@ struct _GthBrowserPrivate {
GHashTable *named_dialogs;
- guint browser_ui_merge_id;
- guint viewer_ui_merge_id;
-
/* Browser data */
guint help_message_cid;
@@ -300,44 +294,6 @@ monitor_event_data_unref (MonitorEventData *monitor_data)
/* -- gth_browser -- */
-static void
-_gth_browser_set_action_sensitive (GthBrowser *browser,
- const char *action_name,
- gboolean sensitive)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (browser->priv->actions, action_name);
- g_object_set (action, "sensitive", sensitive, NULL);
-}
-
-
-static void
-_gth_browser_set_action_active (GthBrowser *browser,
- const char *action_name,
- gboolean active)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (browser->priv->actions, action_name);
- g_object_set (action, "active", active, NULL);
-}
-
-
-static gboolean
-_gth_browser_get_action_active (GthBrowser *browser,
- const char *action_name)
-{
- GtkAction *action;
- gboolean active;
-
- action = gtk_action_group_get_action (browser->priv->actions, action_name);
- g_object_get (action, "active", &active, NULL);
-
- return active;
-}
-
-
void
gth_browser_update_title (GthBrowser *browser)
{
@@ -406,11 +362,9 @@ gth_browser_update_sensitivity (GthBrowser *browser)
modified = gth_browser_get_file_modified (browser);
n_selected = gth_file_selection_get_n_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view
(browser)));
- _gth_browser_set_action_sensitive (browser, "View_Stop", browser->priv->fullscreen ||
(browser->priv->activity_ref > 0));
- _gth_browser_set_action_sensitive (browser, "View_Thumbnail_List", gth_window_get_current_page
(GTH_WINDOW (browser)) == GTH_BROWSER_PAGE_VIEWER);
- _gth_browser_set_action_sensitive (browser, "View_Sidebar", gth_window_get_current_page (GTH_WINDOW
(browser)) == GTH_BROWSER_PAGE_BROWSER);
- _gth_browser_set_action_sensitive (browser, "View_Reload", gth_window_get_current_page (GTH_WINDOW
(browser)) == GTH_BROWSER_PAGE_BROWSER);
-
+ gth_window_enable_action (GTH_WINDOW (browser), "show-thumbnail-list", gth_window_get_current_page
(GTH_WINDOW (browser)) == GTH_BROWSER_PAGE_VIEWER);
+ gth_window_enable_action (GTH_WINDOW (browser), "show-sidebar", gth_window_get_current_page
(GTH_WINDOW (browser)) == GTH_BROWSER_PAGE_BROWSER);
+ /* gth_window_enable_action (GTH_WINDOW (browser), "view-reload", gth_window_get_current_page
(GTH_WINDOW (browser)) == GTH_BROWSER_PAGE_BROWSER);*/ /* FIXME add view-reload */
gth_window_enable_action (GTH_WINDOW (browser), "save", viewer_can_save && modified);
gth_window_enable_action (GTH_WINDOW (browser), "save-as", viewer_can_save);
gth_window_enable_action (GTH_WINDOW (browser), "revert-to-saved", viewer_can_save && modified);
@@ -1931,7 +1885,6 @@ _gth_browser_deactivate_viewer_page (GthBrowser *browser)
if (browser->priv->fullscreen)
gth_viewer_page_show_pointer (GTH_VIEWER_PAGE (browser->priv->viewer_page), TRUE);
gth_viewer_page_deactivate (browser->priv->viewer_page);
- gtk_ui_manager_ensure_update (browser->priv->ui);
gth_browser_set_viewer_widget (browser, NULL);
g_object_unref (browser->priv->viewer_page);
browser->priv->viewer_page = NULL;
@@ -2155,61 +2108,6 @@ _gth_browser_close (GthWindow *window)
}
-static void
-_gth_browser_update_viewer_ui (GthBrowser *browser,
- int page)
-{
- if (page == GTH_BROWSER_PAGE_VIEWER) {
- GError *error = NULL;
-
- if (browser->priv->viewer_ui_merge_id != 0)
- return;
- browser->priv->viewer_ui_merge_id = gtk_ui_manager_add_ui_from_string (browser->priv->ui,
viewer_ui_info, -1, &error);
- if (browser->priv->viewer_ui_merge_id == 0) {
- g_warning ("ui building failed: %s", error->message);
- g_clear_error (&error);
- }
- gtk_ui_manager_ensure_update (gth_browser_get_ui_manager (browser));
- }
- else if (browser->priv->viewer_ui_merge_id != 0) {
- gtk_ui_manager_remove_ui (browser->priv->ui, browser->priv->viewer_ui_merge_id);
- browser->priv->viewer_ui_merge_id = 0;
- gtk_ui_manager_ensure_update (gth_browser_get_ui_manager (browser));
- }
-
- if (browser->priv->viewer_page != NULL) {
- if (page == GTH_BROWSER_PAGE_VIEWER)
- gth_viewer_page_show (browser->priv->viewer_page);
- else
- gth_viewer_page_hide (browser->priv->viewer_page);
- }
-}
-
-
-static void
-_gth_browser_update_browser_ui (GthBrowser *browser,
- int page)
-{
- if (page == GTH_BROWSER_PAGE_BROWSER) {
- GError *error = NULL;
-
- if (browser->priv->browser_ui_merge_id != 0)
- return;
- browser->priv->browser_ui_merge_id = gtk_ui_manager_add_ui_from_string (browser->priv->ui,
browser_ui_info, -1, &error);
- if (browser->priv->browser_ui_merge_id == 0) {
- g_warning ("ui building failed: %s", error->message);
- g_clear_error (&error);
- }
- gtk_ui_manager_ensure_update (gth_browser_get_ui_manager (browser));
- }
- else if (browser->priv->browser_ui_merge_id != 0) {
- gtk_ui_manager_remove_ui (browser->priv->ui, browser->priv->browser_ui_merge_id);
- browser->priv->browser_ui_merge_id = 0;
- gtk_ui_manager_ensure_update (gth_browser_get_ui_manager (browser));
- }
-}
-
-
/* --- _gth_browser_set_current_page --- */
@@ -2252,8 +2150,6 @@ _gth_browser_real_set_current_page (GthWindow *window,
/* update the ui commands */
- _gth_browser_update_viewer_ui (browser, page);
- _gth_browser_update_browser_ui (browser, page);
_gth_browser_hide_infobar (browser);
_gth_browser_update_header_section_visibility (browser,
GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION, page == GTH_BROWSER_PAGE_BROWSER);
@@ -2431,65 +2327,6 @@ gth_browser_class_init (GthBrowserClass *klass)
static void
-menu_item_select_cb (GtkMenuItem *proxy,
- GthBrowser *browser)
-{
- GtkAction *action;
- char *message;
-
- action = g_object_get_data (G_OBJECT (proxy), "gtk-action");
- g_return_if_fail (action != NULL);
-
- g_object_get (G_OBJECT (action), "tooltip", &message, NULL);
- if (message != NULL) {
- gtk_statusbar_push (GTK_STATUSBAR (browser->priv->statusbar),
- browser->priv->help_message_cid,
- message);
- g_free (message);
- }
-}
-
-
-static void
-menu_item_deselect_cb (GtkMenuItem *proxy,
- GthBrowser *browser)
-{
- gtk_statusbar_pop (GTK_STATUSBAR (browser->priv->statusbar),
- browser->priv->help_message_cid);
-}
-
-
-static void
-disconnect_proxy_cb (GtkUIManager *manager,
- GtkAction *action,
- GtkWidget *proxy,
- GthBrowser *browser)
-{
- if (GTK_IS_MENU_ITEM (proxy)) {
- g_signal_handlers_disconnect_by_func
- (proxy, G_CALLBACK (menu_item_select_cb), browser);
- g_signal_handlers_disconnect_by_func
- (proxy, G_CALLBACK (menu_item_deselect_cb), browser);
- }
-}
-
-
-static void
-connect_proxy_cb (GtkUIManager *manager,
- GtkAction *action,
- GtkWidget *proxy,
- GthBrowser *browser)
-{
- if (GTK_IS_MENU_ITEM (proxy)) {
- g_signal_connect (proxy, "select",
- G_CALLBACK (menu_item_select_cb), browser);
- g_signal_connect (proxy, "deselect",
- G_CALLBACK (menu_item_deselect_cb), browser);
- }
-}
-
-
-static void
folder_tree_drag_data_received (GtkWidget *tree_view,
GdkDragContext *context,
int x,
@@ -2646,7 +2483,6 @@ folder_tree_folder_popup_cb (GthFolderTree *folder_tree,
else
file_source = NULL;
gth_hook_invoke ("gth-browser-folder-tree-popup-before", browser, file_source, file_data);
- gtk_ui_manager_ensure_update (browser->priv->ui);
gtk_menu_popup (GTK_MENU (browser->priv->folder_popup),
NULL,
@@ -2751,14 +2587,6 @@ filterbar_personalize_cb (GthFilterbar *filterbar,
static void
-filterbar_close_button_clicked_cb (GthFilterbar *filterbar,
- GthBrowser *browser)
-{
- gth_browser_show_filterbar (browser, FALSE);
-}
-
-
-static void
_gth_browser_change_file_list_order (GthBrowser *browser,
int *new_order)
{
@@ -3281,7 +3109,6 @@ gth_file_list_popup_menu (GthBrowser *browser,
int button, event_time;
gth_hook_invoke ("gth-browser-file-list-popup-before", browser);
- gtk_ui_manager_ensure_update (browser->priv->ui);
if (event != NULL) {
button = event->button;
@@ -3641,7 +3468,7 @@ pref_ui_viewer_thumbnails_orient_changed (GSettings *settings,
gth_window_attach_content (GTH_WINDOW (browser), GTH_BROWSER_PAGE_VIEWER,
browser->priv->viewer_thumbnails_pane);
- if (_gth_browser_get_action_active (browser, "View_Thumbnail_List"))
+ if (gth_window_get_action_state (GTH_WINDOW (browser), "show-thumbnail-list"))
gtk_widget_show (browser->priv->thumbnail_list);
gtk_widget_show (browser->priv->viewer_sidebar_pane);
gtk_widget_show (browser->priv->viewer_thumbnails_pane);
@@ -3654,7 +3481,7 @@ _gth_browser_set_statusbar_visibility (GthBrowser *browser,
{
g_return_if_fail (browser != NULL);
- _gth_browser_set_action_active (browser, "View_Statusbar", visible);
+ gth_window_change_action_state (GTH_WINDOW (browser), "show-statusbar", visible);
if (visible)
gtk_widget_show (browser->priv->statusbar);
else
@@ -3678,7 +3505,7 @@ _gth_browser_set_sidebar_visibility (GthBrowser *browser,
{
g_return_if_fail (browser != NULL);
- _gth_browser_set_action_active (browser, "View_Sidebar", visible);
+ gth_window_change_action_state (GTH_WINDOW (browser), "show-sidebar", visible);
if (visible) {
gtk_widget_show (browser->priv->browser_sidebar);
gtk_paned_set_position (GTK_PANED (browser->priv->browser_left_container),
@@ -3742,7 +3569,7 @@ _gth_browser_set_thumbnail_list_visibility (GthBrowser *browser,
{
g_return_if_fail (browser != NULL);
- _gth_browser_set_action_active (browser, "View_Thumbnail_List", visible);
+ gth_window_change_action_state (GTH_WINDOW (browser), "show-thumbnail-list", visible);
if (visible) {
gtk_widget_show (browser->priv->thumbnail_list);
_gth_browser_make_file_visible (browser, browser->priv->current_file);
@@ -3774,7 +3601,7 @@ pref_show_hidden_files_changed (GSettings *settings,
if (show_hidden_files == browser->priv->show_hidden_files)
return;
- _gth_browser_set_action_active (browser, "View_ShowHiddenFiles", show_hidden_files);
+ gth_window_change_action_state (GTH_WINDOW (browser), "show-hidden-files", show_hidden_files);
browser->priv->show_hidden_files = show_hidden_files;
gth_folder_tree_reset_loaded (GTH_FOLDER_TREE (browser->priv->folder_tree));
gth_browser_reload (browser);
@@ -3848,10 +3675,8 @@ gth_browser_init (GthBrowser *browser)
{
int window_width;
int window_height;
- GError *error = NULL;
GtkWidget *vbox;
GtkWidget *scrolled_window;
- GtkWidget *menubar;
char *general_filter;
char *sort_type;
char *caption;
@@ -3868,8 +3693,6 @@ gth_browser_init (GthBrowser *browser)
browser->priv->image_preloader = gth_image_preloader_new ();
browser->priv->progress_dialog = NULL;
browser->priv->named_dialogs = g_hash_table_new (g_str_hash, g_str_equal);
- browser->priv->browser_ui_merge_id = 0;
- browser->priv->viewer_ui_merge_id = 0;
browser->priv->location = NULL;
browser->priv->current_file = NULL;
browser->priv->location_source = NULL;
@@ -3973,35 +3796,6 @@ gth_browser_init (GthBrowser *browser)
gth_browser_accelerators,
G_N_ELEMENTS (gth_browser_accelerators));
- browser->priv->actions = gtk_action_group_new ("Actions");
- gtk_action_group_set_translation_domain (browser->priv->actions, NULL);
- _gtk_action_group_add_actions_with_flags (browser->priv->actions,
- gth_browser_action_entries,
- G_N_ELEMENTS (gth_browser_action_entries),
- browser);
- gtk_action_group_add_toggle_actions (browser->priv->actions,
- gth_browser_action_toggle_entries,
- G_N_ELEMENTS (gth_browser_action_toggle_entries),
- browser);
-
- browser->priv->ui = gtk_ui_manager_new ();
- g_signal_connect (browser->priv->ui,
- "connect_proxy",
- G_CALLBACK (connect_proxy_cb),
- browser);
- g_signal_connect (browser->priv->ui,
- "disconnect_proxy",
- G_CALLBACK (disconnect_proxy_cb),
- browser);
-
- gtk_ui_manager_insert_action_group (browser->priv->ui, browser->priv->actions, 0);
- gtk_window_add_accel_group (GTK_WINDOW (browser), gtk_ui_manager_get_accel_group (browser->priv->ui));
-
- if (! gtk_ui_manager_add_ui_from_string (browser->priv->ui, fixed_ui_info, -1, &error)) {
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- }
-
/* -- image page -- */
/* content */
@@ -4054,7 +3848,6 @@ gth_browser_init (GthBrowser *browser)
/* menus */
- menubar = gtk_ui_manager_get_widget (browser->priv->ui, "/MenuBar");
#ifdef USE_MACOSMENU
{
GtkWidget *widget;
@@ -4080,7 +3873,6 @@ gth_browser_init (GthBrowser *browser)
}
}
#endif
- gth_window_attach (GTH_WINDOW (browser), menubar, GTH_WINDOW_MENUBAR);
/* headerbar */
@@ -4423,10 +4215,9 @@ gth_browser_init (GthBrowser *browser)
general_filter = g_settings_get_string (browser->priv->browser_settings, PREF_BROWSER_GENERAL_FILTER);
browser->priv->filterbar = gth_filterbar_new (general_filter);
+ gtk_widget_show (browser->priv->filterbar);
gth_filterbar_load_filter (GTH_FILTERBAR (browser->priv->filterbar), "active_filter.xml");
g_free (general_filter);
-
- gth_browser_show_filterbar (browser, g_settings_get_boolean (browser->priv->browser_settings,
PREF_BROWSER_FILTERBAR_VISIBLE));
gtk_box_pack_end (GTK_BOX (vbox), browser->priv->filterbar, FALSE, FALSE, 0);
g_signal_connect (browser->priv->filterbar,
@@ -4437,10 +4228,6 @@ gth_browser_init (GthBrowser *browser)
"personalize",
G_CALLBACK (filterbar_personalize_cb),
browser);
- g_signal_connect (browser->priv->filterbar,
- "close_button_clicked",
- G_CALLBACK (filterbar_close_button_clicked_cb),
- browser);
/* monitor signals */
@@ -4513,6 +4300,7 @@ gth_browser_init (GthBrowser *browser)
gth_browser_add_menu_manager_for_menu (browser,
GTH_BROWSER_MENU_MANAGER_FILE_LIST_OPEN_ACTIONS, G_MENU (gtk_builder_get_object (builder, "open-actions")));
gth_browser_add_menu_manager_for_menu (browser,
GTH_BROWSER_MENU_MANAGER_FILE_LIST_EDIT_ACTIONS, G_MENU (gtk_builder_get_object (builder, "edit-actions")));
gth_browser_add_menu_manager_for_menu (browser,
GTH_BROWSER_MENU_MANAGER_FILE_LIST_FILE_ACTIONS, G_MENU (gtk_builder_get_object (builder, "file-actions")));
+ gth_browser_add_menu_manager_for_menu (browser,
GTH_BROWSER_MENU_MANAGER_FILE_LIST_DELETE_ACTIONS, G_MENU (gtk_builder_get_object (builder,
"delete-actions")));
gth_browser_add_menu_manager_for_menu (browser,
GTH_BROWSER_MENU_MANAGER_FILE_LIST_FOLDER_ACTIONS, G_MENU (gtk_builder_get_object (builder,
"folder-actions")));
gth_browser_add_menu_manager_for_menu (browser,
GTH_BROWSER_MENU_MANAGER_FILE_LIST_OTHER_ACTIONS, G_MENU (gtk_builder_get_object (builder, "other-actions")));
@@ -4546,10 +4334,10 @@ gth_browser_init (GthBrowser *browser)
_gth_browser_set_sidebar_visibility (browser, g_settings_get_boolean
(browser->priv->browser_settings, PREF_BROWSER_SIDEBAR_VISIBLE));
browser->priv->show_hidden_files = g_settings_get_boolean (browser->priv->browser_settings,
PREF_BROWSER_SHOW_HIDDEN_FILES);
- _gth_browser_set_action_active (browser, "View_ShowHiddenFiles", browser->priv->show_hidden_files);
+ gth_window_change_action_state (GTH_WINDOW (browser), "show-hidden-files",
browser->priv->show_hidden_files);
browser->priv->shrink_wrap_viewer = g_settings_get_boolean (browser->priv->browser_settings,
PREF_BROWSER_SHRINK_WRAP_VIEWER);
- _gth_browser_set_action_active (browser, "View_ShrinkWrap", browser->priv->shrink_wrap_viewer);
+ gth_window_change_action_state (GTH_WINDOW (browser), "shrink-wrap",
browser->priv->shrink_wrap_viewer);
if (g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_PROPERTIES_VISIBLE))
gth_browser_show_file_properties (browser);
@@ -4817,20 +4605,6 @@ gth_browser_get_dialog (GthBrowser *browser,
}
-GtkUIManager *
-gth_browser_get_ui_manager (GthBrowser *browser)
-{
- return browser->priv->ui;
-}
-
-
-GtkActionGroup *
-gth_browser_get_actions (GthBrowser *browser)
-{
- return browser->priv->actions;
-}
-
-
GthIconCache *
gth_browser_get_menu_icon_cache (GthBrowser *browser)
{
@@ -5593,7 +5367,6 @@ _gth_browser_set_current_viewer_page (GthBrowser *browser,
gth_viewer_page_activate (browser->priv->viewer_page, browser);
if (browser->priv->fullscreen)
gth_viewer_page_show_pointer (GTH_VIEWER_PAGE (browser->priv->viewer_page), FALSE);
- gtk_ui_manager_ensure_update (browser->priv->ui);
g_signal_connect (browser->priv->viewer_page,
"file-loaded",
@@ -6274,24 +6047,11 @@ gth_browser_enable_thumbnails (GthBrowser *browser,
gboolean show)
{
gth_file_list_enable_thumbs (GTH_FILE_LIST (browser->priv->file_list), show);
- _gth_browser_set_action_active (browser, "View_Thumbnails", show);
+ gth_window_change_action_state (GTH_WINDOW (browser), "show-thumbnails", show);
g_settings_set_boolean (browser->priv->browser_settings, PREF_BROWSER_SHOW_THUMBNAILS, show);
}
-void
-gth_browser_show_filterbar (GthBrowser *browser,
- gboolean show)
-{
- if (show)
- gtk_widget_show (browser->priv->filterbar);
- else
- gtk_widget_hide (browser->priv->filterbar);
- _gth_browser_set_action_active (browser, "View_Filterbar", show);
- g_settings_set_boolean (browser->priv->browser_settings, PREF_BROWSER_FILTERBAR_VISIBLE, show);
-}
-
-
gpointer
gth_browser_get_image_preloader (GthBrowser *browser)
{
@@ -6346,8 +6106,6 @@ _gth_browser_create_fullscreen_toolbar (GthBrowser *browser)
browser->priv->fullscreen_toolbar = gtk_window_new (GTK_WINDOW_POPUP);
gtk_container_set_border_width (GTK_CONTAINER (browser->priv->fullscreen_toolbar), 0);
- gtk_container_add (GTK_CONTAINER (browser->priv->fullscreen_toolbar),
- gtk_ui_manager_get_widget (browser->priv->ui, "/Fullscreen_ToolBar"));
gth_browser_register_fullscreen_control (browser, browser->priv->fullscreen_toolbar);
}
@@ -6477,7 +6235,7 @@ gth_browser_fullscreen (GthBrowser *browser)
browser->priv->before_fullscreen.page = gth_window_get_current_page (GTH_WINDOW (browser));
browser->priv->before_fullscreen.viewer_properties = gth_window_get_action_state (GTH_WINDOW
(browser), "viewer-properties");
browser->priv->before_fullscreen.viewer_tools = gth_window_get_action_state (GTH_WINDOW (browser),
"viewer-edit-file");
- browser->priv->before_fullscreen.thumbnail_list = _gth_browser_get_action_active (browser,
"View_Thumbnail_List");
+ browser->priv->before_fullscreen.thumbnail_list = gth_window_get_action_state (GTH_WINDOW (browser),
"show-thumbnail-list");
browser->priv->before_fullscreen.browser_properties = gth_window_get_action_state (GTH_WINDOW
(browser), "browser-properties");
gth_browser_hide_sidebar (browser);
@@ -6578,7 +6336,6 @@ gth_browser_file_menu_popup (GthBrowser *browser,
}
gth_hook_invoke ("gth-browser-file-popup-before", browser);
- gtk_ui_manager_ensure_update (browser->priv->ui);
gtk_menu_popup (GTK_MENU (browser->priv->file_popup),
NULL,
NULL,
diff --git a/gthumb/gth-browser.h b/gthumb/gth-browser.h
index f02ff46..3039c24 100644
--- a/gthumb/gth-browser.h
+++ b/gthumb/gth-browser.h
@@ -47,6 +47,7 @@ G_BEGIN_DECLS
#define GTH_BROWSER_MENU_MANAGER_FILE_LIST_OPEN_ACTIONS "file-list.open-actions"
#define GTH_BROWSER_MENU_MANAGER_FILE_LIST_EDIT_ACTIONS "file-list.edit-actions"
#define GTH_BROWSER_MENU_MANAGER_FILE_LIST_FILE_ACTIONS "file-list.file-actions"
+#define GTH_BROWSER_MENU_MANAGER_FILE_LIST_DELETE_ACTIONS "file-list.delete-actions"
#define GTH_BROWSER_MENU_MANAGER_FILE_LIST_FOLDER_ACTIONS "file-list.folder-actions"
#define GTH_BROWSER_MENU_MANAGER_FILE_LIST_OTHER_ACTIONS "file-list.other-actions"
#define GTH_BROWSER_MENU_MANAGER_FOLDER "folder"
@@ -141,8 +142,6 @@ void gth_browser_set_dialog (GthBrowser *browser,
GtkWidget *dialog);
GtkWidget * gth_browser_get_dialog (GthBrowser *browser,
const char *dialog_name);
-GtkUIManager * gth_browser_get_ui_manager (GthBrowser *browser);
-GtkActionGroup * gth_browser_get_actions (GthBrowser *browser);
GthIconCache * gth_browser_get_menu_icon_cache (GthBrowser *browser);
GtkWidget * gth_browser_get_infobar (GthBrowser *browser);
GtkWidget * gth_browser_get_statusbar (GthBrowser *browser);
diff --git a/gthumb/gth-embedded-dialog.c b/gthumb/gth-embedded-dialog.c
index 840fcd8..4bc2be2 100644
--- a/gthumb/gth-embedded-dialog.c
+++ b/gthumb/gth-embedded-dialog.c
@@ -148,9 +148,6 @@ gth_embedded_dialog_set_primary_text (GthEmbeddedDialog *self,
gtk_widget_hide (self->priv->location_chooser);
gtk_widget_show (self->priv->info_box);
- gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
GTK_STYLE_CLASS_TOOLBAR);
- gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)), GTK_STYLE_CLASS_INFO);
if (text == NULL) {
gtk_widget_hide (self->priv->primary_text_label);
@@ -195,9 +192,6 @@ gth_embedded_dialog_set_from_file (GthEmbeddedDialog *self,
{
gtk_widget_hide (self->priv->info_box);
gtk_widget_show (self->priv->location_chooser);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
GTK_STYLE_CLASS_TOOLBAR);
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
- gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
GTK_STYLE_CLASS_INFO);
gth_location_chooser_set_current (GTH_LOCATION_CHOOSER (self->priv->location_chooser), file);
}
diff --git a/gthumb/gth-preferences.h b/gthumb/gth-preferences.h
index add8016..c3e79c2 100644
--- a/gthumb/gth-preferences.h
+++ b/gthumb/gth-preferences.h
@@ -69,7 +69,6 @@ G_BEGIN_DECLS
#define PREF_BROWSER_WINDOW_HEIGHT "window-height"
#define PREF_BROWSER_WINDOW_MAXIMIZED "maximized"
#define PREF_BROWSER_STATUSBAR_VISIBLE "statusbar-visible"
-#define PREF_BROWSER_FILTERBAR_VISIBLE "filterbar-visible"
#define PREF_BROWSER_SIDEBAR_VISIBLE "sidebar-visible"
#define PREF_BROWSER_PROPERTIES_VISIBLE "properties-visible"
#define PREF_BROWSER_PROPERTIES_ON_THE_RIGHT "properties-on-the-right"
diff --git a/gthumb/resources/file-list-menu.ui b/gthumb/resources/file-list-menu.ui
index 7530bbb..f48fea8 100644
--- a/gthumb/resources/file-list-menu.ui
+++ b/gthumb/resources/file-list-menu.ui
@@ -6,6 +6,7 @@
<item>
<attribute name="label" translatable="yes">Fullscreen</attribute>
<attribute name="action">win.fullscreen</attribute>
+ <attribute name="accel">F11</attribute>
</item>
</section>
<section id="open-actions">
@@ -14,6 +15,8 @@
</section>
<section id="file-actions">
</section>
+ <section id="delete-actions">
+ </section>
<section id="folder-actions">
</section>
<section id="other-actions">
diff --git a/gthumb/resources/file-menu.ui b/gthumb/resources/file-menu.ui
index 7530bbb..d784c45 100644
--- a/gthumb/resources/file-menu.ui
+++ b/gthumb/resources/file-menu.ui
@@ -6,10 +6,18 @@
<item>
<attribute name="label" translatable="yes">Fullscreen</attribute>
<attribute name="action">win.fullscreen</attribute>
+ <attribute name="accel">F11</attribute>
</item>
</section>
<section id="open-actions">
</section>
+ <section id="view-actions">
+ <item>
+ <attribute name="label" translatable="yes">_Fit Window to Image</attribute>
+ <attribute name="action">win.shrink-wrap</attribute>
+ <attribute name="accel"><![CDATA[<Ctrl>e]]></attribute>
+ </item>
+ </section>
<section id="edit-actions">
</section>
<section id="file-actions">
diff --git a/gthumb/resources/gears-menu.ui b/gthumb/resources/gears-menu.ui
index bc9eb75..f964d2b 100644
--- a/gthumb/resources/gears-menu.ui
+++ b/gthumb/resources/gears-menu.ui
@@ -4,44 +4,59 @@
<menu id="menu">
<section>
<item>
- <attribute name="label" translatable="yes">New _Window</attribute>
+ <attribute name="label" translatable="yes">New Window</attribute>
<attribute name="action">app.new-window</attribute>
<attribute name="accel"><![CDATA[<Ctrl>n]]></attribute>
</item>
<item>
- <attribute name="label" translatable="yes">Open _Location…</attribute>
+ <attribute name="label" translatable="yes">Open Location…</attribute>
<attribute name="action">win.open-location</attribute>
<attribute name="accel"><![CDATA[<Ctrl>l]]></attribute>
</item>
</section>
<section>
<item>
- <attribute name="label" translatable="yes">_Save</attribute>
+ <attribute name="label" translatable="yes">Save</attribute>
<attribute name="action">win.save</attribute>
<attribute name="accel"><![CDATA[<Ctrl>s]]></attribute>
</item>
<item>
- <attribute name="label" translatable="yes">Save _As</attribute>
+ <attribute name="label" translatable="yes">Save As</attribute>
<attribute name="action">win.save-as</attribute>
</item>
<item>
- <attribute name="label" translatable="yes">_Revert</attribute>
+ <attribute name="label" translatable="yes">Revert</attribute>
<attribute name="action">win.revert-to-saved</attribute>
<attribute name="accel">F4</attribute>
</item>
</section>
+ <section id="view-actions">
+ <item>
+ <attribute name="label" translatable="yes">Hidden Files</attribute>
+ <attribute name="action">win.show-hidden-files</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Thumbnails</attribute>
+ <attribute name="action">win.show-thumbnails</attribute>
+ <attribute name="accel"><![CDATA[<Control>t]]></attribute>
+ </item>
+ </section>
<section id="folder-actions">
+ <item>
+ <attribute name="label" translatable="yes">Sort By…</attribute>
+ <attribute name="action">win.sort-by</attribute>
+ </item>
</section>
<section id="other-actions">
</section>
<section>
<item>
- <attribute name="label" translatable="yes">Close _All Windows</attribute>
+ <attribute name="label" translatable="yes">Close All Windows</attribute>
<attribute name="action">app.quit</attribute>
<attribute name="accel"><![CDATA[<Ctrl>q]]></attribute>
</item>
<item>
- <attribute name="label" translatable="yes">_Close</attribute>
+ <attribute name="label" translatable="yes">Close</attribute>
<attribute name="action">win.close</attribute>
<attribute name="accel"><![CDATA[<Ctrl>w]]></attribute>
</item>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]