[gthumb] set the appearance properties on the actions and not on the widgets
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] set the appearance properties on the actions and not on the widgets
- Date: Tue, 25 Oct 2011 14:56:25 +0000 (UTC)
commit 6f3435566d4c0d8ffbbef4824b15407b00093ddf
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Oct 22 18:14:44 2011 +0200
set the appearance properties on the actions and not on the widgets
extensions/23hq/callbacks.c | 16 ++++------
extensions/change_date/callbacks.c | 2 -
extensions/edit_metadata/callbacks.c | 17 +++++------
extensions/facebook/callbacks.c | 14 ++++-----
extensions/flicker/callbacks.c | 16 ++++------
extensions/image_print/callbacks.c | 12 ++++----
extensions/image_rotation/callbacks.c | 17 ++++++-----
extensions/photobucket/callbacks.c | 14 ++++-----
extensions/picasaweb/callbacks.c | 16 ++++------
extensions/search/callbacks.c | 1 -
gthumb/gth-browser-actions-entries.h | 31 ++++++++++++++++++--
gthumb/gth-browser.c | 17 ++++-------
gthumb/gth-window-actions-entries.h | 1 -
gthumb/gtk-utils.c | 51 +++++++++++++++++++++++++++++++++
gthumb/gtk-utils.h | 33 +++++++++++++++++----
15 files changed, 168 insertions(+), 90 deletions(-)
---
diff --git a/extensions/23hq/callbacks.c b/extensions/23hq/callbacks.c
index de5f836..0b7f185 100644
--- a/extensions/23hq/callbacks.c
+++ b/extensions/23hq/callbacks.c
@@ -56,16 +56,18 @@ static const char *ui_info =
"</ui>";
-static GtkActionEntry action_entries[] = {
+static GthActionEntryExt action_entries[] = {
/*
{ "File_Import_23", "site-twentythree",
N_("_23..."), NULL,
N_("Download photos from 23"),
+ GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE,
G_CALLBACK (gth_browser_activate_action_import_23) },
*/
{ "File_Export_23", "site-twentythree",
N_("_23..."), NULL,
N_("Upload photos to 23"),
+ GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE,
G_CALLBACK (gth_browser_activate_action_export_23) },
};
@@ -95,10 +97,10 @@ tt__gth_browser_construct_cb (GthBrowser *browser)
data->action_group = gtk_action_group_new ("23HQ Actions");
gtk_action_group_set_translation_domain (data->action_group, NULL);
- gtk_action_group_add_actions (data->action_group,
- action_entries,
- G_N_ELEMENTS (action_entries),
- browser);
+ _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);
merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), ui_info, -1, &error);
@@ -107,9 +109,5 @@ tt__gth_browser_construct_cb (GthBrowser *browser)
g_clear_error (&error);
}
- /*gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/MenuBar/File/Import/Web_Services/File_Import_23")), TRUE);*/
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/MenuBar/File/Export/Web_Services/File_Export_23")), TRUE);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ExportPopup/Web_Services/File_Export_23")), TRUE);
-
g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
diff --git a/extensions/change_date/callbacks.c b/extensions/change_date/callbacks.c
index d28a28a..9c2bcf7 100644
--- a/extensions/change_date/callbacks.c
+++ b/extensions/change_date/callbacks.c
@@ -81,8 +81,6 @@ cd__gth_browser_construct_cb (GthBrowser *browser)
g_clear_error (&error);
}
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ListToolsPopup/Tools/ChangeDate")), TRUE);
-
g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
diff --git a/extensions/edit_metadata/callbacks.c b/extensions/edit_metadata/callbacks.c
index fbf8d69..1d7d22b 100644
--- a/extensions/edit_metadata/callbacks.c
+++ b/extensions/edit_metadata/callbacks.c
@@ -104,22 +104,25 @@ static const char *viewer_ui_info =
"</ui>";
-static GtkActionEntry edit_metadata_action_entries[] = {
+static GthActionEntryExt edit_metadata_action_entries[] = {
{ "Edit_QuickTag", "tag", N_("T_ags") },
{ "Edit_Metadata", GTK_STOCK_EDIT,
N_("Comment"), "<control>M",
N_("Edit the comment and other information of the selected files"),
+ GTH_ACTION_FLAG_IS_IMPORTANT,
G_CALLBACK (gth_browser_activate_action_edit_metadata) },
{ "Edit_QuickTagOther", NULL,
N_("Other..."), NULL,
N_("Choose another tag"),
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_edit_tag_files) },
{ "Tool_DeleteMetadata", NULL,
N_("Delete Metadata"), NULL,
N_("Delete the comment and the embedded metadata of the selected files"),
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_tool_delete_metadata) }
};
@@ -166,10 +169,10 @@ edit_metadata__gth_browser_construct_cb (GthBrowser *browser)
data->actions = gtk_action_group_new ("Edit Metadata Actions");
gtk_action_group_set_translation_domain (data->actions, NULL);
- gtk_action_group_add_actions (data->actions,
- edit_metadata_action_entries,
- G_N_ELEMENTS (edit_metadata_action_entries),
- browser);
+ _gtk_action_group_add_actions_with_flags (data->actions,
+ edit_metadata_action_entries,
+ G_N_ELEMENTS (edit_metadata_action_entries),
+ 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)) {
@@ -182,8 +185,6 @@ edit_metadata__gth_browser_construct_cb (GthBrowser *browser)
g_error_free (error);
}
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/Fullscreen_ToolBar/Edit_Actions/Edit_Metadata")), TRUE);
-
data->monitor_events = g_signal_connect (gth_main_get_default_monitor (),
"tags-changed",
G_CALLBACK (monitor_tags_changed_cb),
@@ -215,7 +216,6 @@ edit_metadata__gth_browser_set_current_page_cb (GthBrowser *browser)
g_warning ("ui building failed: %s", error->message);
g_clear_error (&error);
}
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ToolBar/Edit_Actions/Edit_Metadata")), TRUE);
break;
case GTH_BROWSER_PAGE_VIEWER:
@@ -230,7 +230,6 @@ edit_metadata__gth_browser_set_current_page_cb (GthBrowser *browser)
g_warning ("ui building failed: %s", error->message);
g_clear_error (&error);
}
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ViewerToolBar/Edit_Actions/Edit_Metadata")), TRUE);
break;
default:
diff --git a/extensions/facebook/callbacks.c b/extensions/facebook/callbacks.c
index 4a009dc..bed6103 100644
--- a/extensions/facebook/callbacks.c
+++ b/extensions/facebook/callbacks.c
@@ -49,10 +49,11 @@ static const char *ui_info =
"</ui>";
-static GtkActionEntry action_entries[] = {
+static GthActionEntryExt action_entries[] = {
{ "File_Export_Facebook", "site-facebook",
N_("Face_book..."), NULL,
N_("Upload photos to Facebook"),
+ GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE,
G_CALLBACK (gth_browser_activate_action_export_facebook) },
};
@@ -82,10 +83,10 @@ fb__gth_browser_construct_cb (GthBrowser *browser)
data->action_group = gtk_action_group_new ("Facebook Actions");
gtk_action_group_set_translation_domain (data->action_group, NULL);
- gtk_action_group_add_actions (data->action_group,
- action_entries,
- G_N_ELEMENTS (action_entries),
- browser);
+ _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);
merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), ui_info, -1, &error);
@@ -94,8 +95,5 @@ fb__gth_browser_construct_cb (GthBrowser *browser)
g_clear_error (&error);
}
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/MenuBar/File/Export/Web_Services/File_Export_Facebook")), TRUE);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ExportPopup/Web_Services/File_Export_Facebook")), TRUE);
-
g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
diff --git a/extensions/flicker/callbacks.c b/extensions/flicker/callbacks.c
index 5418aa3..9c7420c 100644
--- a/extensions/flicker/callbacks.c
+++ b/extensions/flicker/callbacks.c
@@ -54,14 +54,16 @@ static const char *ui_info =
"</ui>";
-static GtkActionEntry action_entries[] = {
+static GthActionEntryExt action_entries[] = {
{ "File_Import_Flicker", "site-flickr",
N_("_Flickr..."), NULL,
N_("Download photos from Flickr"),
+ GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE,
G_CALLBACK (gth_browser_activate_action_import_flicker) },
{ "File_Export_Flicker", "site-flickr",
N_("_Flickr..."), NULL,
N_("Upload photos to Flickr"),
+ GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE,
G_CALLBACK (gth_browser_activate_action_export_flicker) },
};
@@ -91,10 +93,10 @@ fl__gth_browser_construct_cb (GthBrowser *browser)
data->action_group = gtk_action_group_new ("Flicker Actions");
gtk_action_group_set_translation_domain (data->action_group, NULL);
- gtk_action_group_add_actions (data->action_group,
- action_entries,
- G_N_ELEMENTS (action_entries),
- browser);
+ _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);
merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), ui_info, -1, &error);
@@ -103,9 +105,5 @@ fl__gth_browser_construct_cb (GthBrowser *browser)
g_clear_error (&error);
}
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/MenuBar/File/Import/Web_Services/File_Import_Flicker")), TRUE);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/MenuBar/File/Export/Web_Services/File_Export_Flicker")), TRUE);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ExportPopup/Web_Services/File_Export_Flicker")), TRUE);
-
g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
diff --git a/extensions/image_print/callbacks.c b/extensions/image_print/callbacks.c
index 7310e96..4b9749b 100644
--- a/extensions/image_print/callbacks.c
+++ b/extensions/image_print/callbacks.c
@@ -48,10 +48,11 @@ static const char *fixed_ui_info =
"</ui>";
-static GtkActionEntry action_entries[] = {
+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) },
};
@@ -81,10 +82,10 @@ ip__gth_browser_construct_cb (GthBrowser *browser)
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 (data->action_group,
- action_entries,
- G_N_ELEMENTS (action_entries),
- browser);
+ _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);
@@ -92,7 +93,6 @@ ip__gth_browser_construct_cb (GthBrowser *browser)
g_warning ("building ui failed: %s", error->message);
g_error_free (error);
}
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ToolBar/Export_Actions/File_Print")), TRUE);
g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
diff --git a/extensions/image_rotation/callbacks.c b/extensions/image_rotation/callbacks.c
index 81fa992..1c19f90 100644
--- a/extensions/image_rotation/callbacks.c
+++ b/extensions/image_rotation/callbacks.c
@@ -44,25 +44,29 @@ static const char *fixed_ui_info =
"</ui>";
-static GtkActionEntry action_entries[] = {
+static GthActionEntryExt action_entries[] = {
{ "Tool_RotateRight", "object-rotate-right",
N_("Rotate Right"), "<control><alt>R",
N_("Rotate the selected images 90Â to the right"),
+ GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE,
G_CALLBACK (gth_browser_activate_action_tool_rotate_right) },
{ "Tool_RotateLeft", "object-rotate-left",
N_("Rotate Left"), "<control><alt>L",
N_("Rotate the selected images 90Â to the left"),
+ GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE,
G_CALLBACK (gth_browser_activate_action_tool_rotate_left) },
{ "Tool_ApplyOrientation", NULL,
N_("Rotate Physically"), NULL,
N_("Rotate the selected images according to the embedded orientation"),
+ 0,
G_CALLBACK (gth_browser_activate_action_tool_apply_orientation) },
{ "Tool_ResetOrientation", NULL,
N_("Reset the EXIF Orientation"), NULL,
N_("Reset the embedded orientation without rotating the images"),
+ 0,
G_CALLBACK (gth_browser_activate_action_tool_reset_orientation) }
};
@@ -90,10 +94,10 @@ ir__gth_browser_construct_cb (GthBrowser *browser)
data = g_new0 (BrowserData, 1);
data->action_group = gtk_action_group_new ("Image Rotation Actions");
gtk_action_group_set_translation_domain (data->action_group, NULL);
- gtk_action_group_add_actions (data->action_group,
- action_entries,
- G_N_ELEMENTS (action_entries),
- browser);
+ _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);
if (! gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), fixed_ui_info, -1, &error)) {
@@ -101,9 +105,6 @@ ir__gth_browser_construct_cb (GthBrowser *browser)
g_clear_error (&error);
}
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ListToolsPopup/Tools/RotateRight")), TRUE);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ListToolsPopup/Tools/RotateLeft")), TRUE);
-
g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
diff --git a/extensions/photobucket/callbacks.c b/extensions/photobucket/callbacks.c
index 03ef480..1e65c5c 100644
--- a/extensions/photobucket/callbacks.c
+++ b/extensions/photobucket/callbacks.c
@@ -49,10 +49,11 @@ static const char *ui_info =
"</ui>";
-static GtkActionEntry action_entries[] = {
+static GthActionEntryExt action_entries[] = {
{ "File_Export_PhotoBucket", "site-photobucket",
N_("Photobucket..."), NULL,
N_("Upload photos to Photobucket"),
+ GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE,
G_CALLBACK (gth_browser_activate_action_export_photobucket) },
};
@@ -82,10 +83,10 @@ pb__gth_browser_construct_cb (GthBrowser *browser)
data->action_group = gtk_action_group_new ("PhotoBucket Actions");
gtk_action_group_set_translation_domain (data->action_group, NULL);
- gtk_action_group_add_actions (data->action_group,
- action_entries,
- G_N_ELEMENTS (action_entries),
- browser);
+ _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);
merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), ui_info, -1, &error);
@@ -94,8 +95,5 @@ pb__gth_browser_construct_cb (GthBrowser *browser)
g_clear_error (&error);
}
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/MenuBar/File/Export/Web_Services/File_Export_PhotoBucket")), TRUE);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ExportPopup/Web_Services/File_Export_PhotoBucket")), TRUE);
-
g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
diff --git a/extensions/picasaweb/callbacks.c b/extensions/picasaweb/callbacks.c
index 74a5d19..fcb03d0 100644
--- a/extensions/picasaweb/callbacks.c
+++ b/extensions/picasaweb/callbacks.c
@@ -54,14 +54,16 @@ static const char *ui_info =
"</ui>";
-static GtkActionEntry action_entries[] = {
+static GthActionEntryExt action_entries[] = {
{ "File_Import_PicasaWeb", "site-picasaweb",
N_("_Picasa Web Album..."), NULL,
N_("Download photos from Picasa Web Album"),
+ GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE,
G_CALLBACK (gth_browser_activate_action_import_picasaweb) },
{ "File_Export_PicasaWeb", "site-picasaweb",
N_("_Picasa Web Album..."), NULL,
N_("Upload photos to Picasa Web Album"),
+ GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE,
G_CALLBACK (gth_browser_activate_action_export_picasaweb) },
};
@@ -91,10 +93,10 @@ pw__gth_browser_construct_cb (GthBrowser *browser)
data->action_group = gtk_action_group_new ("Picasa Web Actions");
gtk_action_group_set_translation_domain (data->action_group, NULL);
- gtk_action_group_add_actions (data->action_group,
- action_entries,
- G_N_ELEMENTS (action_entries),
- browser);
+ _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);
merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), ui_info, -1, &error);
@@ -103,9 +105,5 @@ pw__gth_browser_construct_cb (GthBrowser *browser)
g_clear_error (&error);
}
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/MenuBar/File/Import/Web_Services/File_Import_PicasaWeb")), TRUE);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/MenuBar/File/Export/Web_Services/File_Export_PicasaWeb")), TRUE);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ExportPopup/Web_Services/File_Export_PicasaWeb")), TRUE);
-
g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
diff --git a/extensions/search/callbacks.c b/extensions/search/callbacks.c
index 4ef0880..31c1152 100644
--- a/extensions/search/callbacks.c
+++ b/extensions/search/callbacks.c
@@ -99,7 +99,6 @@ search__gth_browser_construct_cb (GthBrowser *browser)
g_warning ("building menus failed: %s", error->message);
g_error_free (error);
}
- /*gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ToolBar/SourceCommands/Edit_Find")), TRUE);*/
g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
diff --git a/gthumb/gth-browser-actions-entries.h b/gthumb/gth-browser-actions-entries.h
index a2a0141..40189c4 100644
--- a/gthumb/gth-browser-actions-entries.h
+++ b/gthumb/gth-browser-actions-entries.h
@@ -25,8 +25,9 @@
#include <config.h>
#include <glib/gi18n.h>
#include "gth-stock.h"
+#include "gtk-utils.h"
-static GtkActionEntry gth_browser_action_entries[] = {
+static GthActionEntryExt gth_browser_action_entries[] = {
{ "FileMenu", NULL, N_("_File") },
{ "EditMenu", NULL, N_("_Edit") },
{ "ViewMenu", NULL, N_("_View") },
@@ -39,134 +40,159 @@ static GtkActionEntry gth_browser_action_entries[] = {
{ "File_NewWindow", "window-new",
N_("New _Window"), "<control>N",
N_("Open another window"),
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_file_new_window) },
{ "File_Open", GTK_STOCK_OPEN,
NULL, NULL,
NULL,
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_file_open) },
{ "File_Save", GTK_STOCK_SAVE,
NULL, "<control>S",
NULL,
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_file_save) },
{ "File_SaveAs", GTK_STOCK_SAVE_AS,
NULL, NULL,
NULL,
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_file_save_as) },
{ "File_Revert", GTK_STOCK_REVERT_TO_SAVED,
NULL, "F4",
NULL,
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_file_revert) },
{ "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_Preferences", GTK_STOCK_PREFERENCES,
NULL, NULL,
N_("Edit various preferences"),
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_edit_preferences) },
{ "Edit_SelectAll", GTK_STOCK_SELECT_ALL,
NULL, NULL,
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, "Escape",
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) },
{ "View_Prev", GTK_STOCK_GO_UP,
N_("Previous"), NULL,
N_("View previous image"),
+ GTH_ACTION_FLAG_IS_IMPORTANT,
G_CALLBACK (gth_browser_activate_action_view_prev) },
{ "View_Next", GTK_STOCK_GO_DOWN,
N_("Next"), NULL,
N_("View next image"),
+ GTH_ACTION_FLAG_IS_IMPORTANT,
G_CALLBACK (gth_browser_activate_action_view_next) },
{ "View_Fullscreen", GTK_STOCK_FULLSCREEN,
NULL, "F11",
N_("Switch to fullscreen"),
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_view_fullscreen) },
{ "View_Leave_Fullscreen", GTK_STOCK_LEAVE_FULLSCREEN,
NULL, NULL,
N_("Leave Fullscreen"),
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_view_fullscreen) },
{ "Go_Back", GTK_STOCK_GO_BACK,
NULL, "<alt>Left",
N_("Go to the previous visited location"),
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_go_back) },
{ "Go_Forward", GTK_STOCK_GO_FORWARD,
NULL, "<alt>Right",
N_("Go to the next visited location"),
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_go_forward) },
{ "Go_Up", GTK_STOCK_GO_UP,
NULL, "<alt>Up",
N_("Go up one level"),
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_go_up) },
{ "Go_Home", NULL,
NULL, "<alt>Home",
NULL,
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_go_home) },
{ "Go_Clear_History", GTK_STOCK_CLEAR,
N_("_Delete History"), NULL,
N_("Delete the list of visited locations"),
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_go_clear_history) },
{ "View_BrowserMode", GTH_STOCK_BROWSER_MODE,
N_("Browser"), "Escape",
N_("View the folders"),
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_browser_mode) },
{ "Help_About", GTK_STOCK_ABOUT,
NULL, NULL,
N_("Show information about gthumb"),
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_help_about) },
{ "Help_Help", GTK_STOCK_HELP,
N_("Contents"), "F1",
N_("Display the gthumb Manual"),
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_help_help) },
{ "Help_Shortcuts", NULL,
N_("_Keyboard Shortcuts"), NULL,
" ",
+ GTH_ACTION_FLAG_NONE,
G_CALLBACK (gth_browser_activate_action_help_shortcuts) },
};
-static guint gth_browser_action_entries_size = G_N_ELEMENTS (gth_browser_action_entries);
static GtkToggleActionEntry gth_browser_action_toggle_entries[] = {
@@ -216,6 +242,5 @@ static GtkToggleActionEntry gth_browser_action_toggle_entries[] = {
G_CALLBACK (gth_browser_activate_action_viewer_tools),
FALSE },
};
-static guint gth_browser_action_toggle_entries_size = G_N_ELEMENTS (gth_browser_action_toggle_entries);
#endif /* GTH_BROWSER_ACTION_ENTRIES_H */
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 8bf77d3..781bfe9 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -4153,15 +4153,15 @@ _gth_browser_construct (GthBrowser *browser)
gtk_action_group_set_translation_domain (browser->priv->actions, NULL);
gtk_action_group_add_actions (browser->priv->actions,
gth_window_action_entries,
- gth_window_action_entries_size,
- browser);
- gtk_action_group_add_actions (browser->priv->actions,
- gth_browser_action_entries,
- gth_browser_action_entries_size,
+ G_N_ELEMENTS (gth_window_action_entries),
browser);
+ _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,
- gth_browser_action_toggle_entries_size,
+ G_N_ELEMENTS (gth_browser_action_toggle_entries),
browser);
browser->priv->ui = gtk_ui_manager_new ();
@@ -4190,11 +4190,6 @@ _gth_browser_construct (GthBrowser *browser)
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (browser->priv->viewer_toolbar), TRUE);
gth_window_attach_toolbar (GTH_WINDOW (browser), GTH_BROWSER_PAGE_VIEWER, browser->priv->viewer_toolbar);
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (browser->priv->ui, "/ViewerToolBar/View_Prev")), TRUE);
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (browser->priv->ui, "/ViewerToolBar/View_Next")), TRUE);
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (browser->priv->ui, "/Fullscreen_ToolBar/View_Prev")), TRUE);
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (browser->priv->ui, "/Fullscreen_ToolBar/View_Next")), TRUE);
-
/* content */
viewer_thumbnails_orientation = eel_gconf_get_enum (PREF_UI_VIEWER_THUMBNAILS_ORIENT, GTK_TYPE_ORIENTATION, GTK_ORIENTATION_HORIZONTAL);
diff --git a/gthumb/gth-window-actions-entries.h b/gthumb/gth-window-actions-entries.h
index 1ee3d30..32a8033 100644
--- a/gthumb/gth-window-actions-entries.h
+++ b/gthumb/gth-window-actions-entries.h
@@ -37,6 +37,5 @@ static GtkActionEntry gth_window_action_entries[] = {
NULL,
G_CALLBACK (gth_window_activate_action_file_quit_application) }
};
-static guint gth_window_action_entries_size = G_N_ELEMENTS (gth_window_action_entries);
#endif /* GTH_WINDOW_ACTION_ENTRIES_H */
diff --git a/gthumb/gtk-utils.c b/gthumb/gtk-utils.c
index 7268056..4f50e66 100644
--- a/gthumb/gtk-utils.c
+++ b/gthumb/gtk-utils.c
@@ -28,6 +28,57 @@
#define REQUEST_ENTRY_WIDTH_IN_CHARS 40
+void
+_gtk_action_group_add_actions_with_flags (GtkActionGroup *action_group,
+ const GthActionEntryExt *entries,
+ guint n_entries,
+ gpointer user_data)
+{
+ guint i;
+
+ g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
+
+ for (i = 0; i < n_entries; i++) {
+ GtkAction *action;
+ const char *label;
+ const char *tooltip;
+
+ label = gtk_action_group_translate_string (action_group, entries[i].label);
+ tooltip = gtk_action_group_translate_string (action_group, entries[i].tooltip);
+
+ action = gtk_action_new (entries[i].name,
+ label,
+ tooltip,
+ NULL);
+
+ if (entries[i].stock_id) {
+ g_object_set (action, "stock-id", entries[i].stock_id, NULL);
+ if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), entries[i].stock_id))
+ g_object_set (action, "icon-name", entries[i].stock_id, NULL);
+ }
+
+ if (entries[i].callback) {
+ GClosure *closure;
+
+ closure = g_cclosure_new (entries[i].callback, user_data, NULL);
+ g_signal_connect_closure (action, "activate", closure, FALSE);
+ }
+
+ gtk_action_group_add_action_with_accel (action_group,
+ action,
+ entries[i].accelerator);
+
+ if (entries[i].flags & GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE)
+ gtk_action_set_always_show_image (action, TRUE);
+
+ if (entries[i].flags & GTH_ACTION_FLAG_IS_IMPORTANT)
+ gtk_action_set_is_important (action, TRUE);
+
+ g_object_unref (action);
+ }
+}
+
+
GtkWidget *
_gtk_button_new_from_stock_with_text (const char *stock_id,
const char *text)
diff --git a/gthumb/gtk-utils.h b/gthumb/gtk-utils.h
index dc85bce..73041ea 100644
--- a/gthumb/gtk-utils.h
+++ b/gthumb/gtk-utils.h
@@ -28,15 +28,36 @@
G_BEGIN_DECLS
+typedef enum {
+ GTH_ACTION_FLAG_NONE = 0,
+ GTH_ACTION_FLAG_ALWAYS_SHOW_IMAGE = 1 << 0,
+ GTH_ACTION_FLAG_IS_IMPORTANT = 1 << 1
+} GthActionFlags;
+
+typedef struct {
+ const char *name;
+ const char *stock_id;
+ const char *label;
+ const char *accelerator;
+ const char *tooltip;
+ GthActionFlags flags;
+ GCallback callback;
+} GthActionEntryExt;
+
+void _gtk_action_group_add_actions_with_flags (GtkActionGroup *action_group,
+ const GthActionEntryExt
+ *entries,
+ guint n_entries,
+ gpointer user_data);
GtkWidget * _gtk_button_new_from_stock_with_text (const char *stock_id,
const char *text);
GtkWidget * _gtk_message_dialog_new (GtkWindow *parent,
- GtkDialogFlags flags,
- const char *stock_id,
- const char *message,
- const char *secondary_message,
- const char *first_button_text,
- ...);
+ GtkDialogFlags flags,
+ const char *stock_id,
+ const char *message,
+ const char *secondary_message,
+ const char *first_button_text,
+ ...);
GtkWidget * _gtk_message_dialog_with_checkbutton_new (GtkWindow *parent,
GtkDialogFlags flags,
const char *stock_id,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]