gthumb r2252 - in trunk: . src
- From: mjc svn gnome org
- To: svn-commits-list gnome org
- Subject: gthumb r2252 - in trunk: . src
- Date: Mon, 4 Feb 2008 20:27:03 +0000 (GMT)
Author: mjc
Date: Mon Feb 4 20:27:02 2008
New Revision: 2252
URL: http://svn.gnome.org/viewvc/gthumb?rev=2252&view=rev
Log:
2008-02-04 Michael J. Chudobiak <mjc svn gnome org>
* src/dlg-scripts.c: (generate_script_menu):
* src/gth-viewer-actions-callbacks.c:
(gth_viewer_activate_action_scripts):
* src/gth-viewer-actions-callbacks.h:
* src/gth-viewer-actions-entries.h:
* src/gth-viewer.c: (viewer_update_sensitivity),
(gth_viewer_construct), (gth_viewer_update_script_menu):
* src/gth-viewer.h:
Added Scripts menu to viewer mode. Fixed console warnings relating to
script initialization. Fixed warnings related to ImageTransformMenu
and ImageAutoMenu. Enhanced version of patch by Manuel Braga
<mul braga gmail com>.
Modified:
trunk/ChangeLog
trunk/src/dlg-scripts.c
trunk/src/gth-viewer-actions-callbacks.c
trunk/src/gth-viewer-actions-callbacks.h
trunk/src/gth-viewer-actions-entries.h
trunk/src/gth-viewer.c
trunk/src/gth-viewer.h
Modified: trunk/src/dlg-scripts.c
==============================================================================
--- trunk/src/dlg-scripts.c (original)
+++ trunk/src/dlg-scripts.c Mon Feb 4 20:27:02 2008
@@ -1250,7 +1250,7 @@
GthWindow *window)
{
static int number_of_scripts = 0;
- static guint merge_id = 0;
+ guint merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (ui), "script-merge-id"));
/* Remove the previously-defined menu items and their associated actions.
* Only one of the checks *should* be necessary. */
@@ -1270,6 +1270,9 @@
/* Identify this batch of menu additions (for later removal, if required) */
merge_id = gtk_ui_manager_new_merge_id (ui);
+ g_object_set_data (G_OBJECT (ui),
+ "script-merge-id",
+ GUINT_TO_POINTER (merge_id));
unsigned int i;
number_of_scripts = eel_gconf_get_integer (PREF_HOTKEY_PREFIX "number_of_scripts", 10);
Modified: trunk/src/gth-viewer-actions-callbacks.c
==============================================================================
--- trunk/src/gth-viewer-actions-callbacks.c (original)
+++ trunk/src/gth-viewer-actions-callbacks.c Mon Feb 4 20:27:02 2008
@@ -135,6 +135,13 @@
gth_viewer_set_single_window (viewer, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
}
+void
+gth_viewer_activate_action_scripts (GtkAction *action,
+ GthViewer *viewer) {
+ dlg_scripts (GTH_WINDOW (viewer), (DoneFunc) gth_viewer_update_script_menu, viewer);
+}
+
+
void
gth_viewer_activate_action_upload_flickr (GtkAction *action,
GthBrowser *viewer)
Modified: trunk/src/gth-viewer-actions-callbacks.h
==============================================================================
--- trunk/src/gth-viewer-actions-callbacks.h (original)
+++ trunk/src/gth-viewer-actions-callbacks.h Mon Feb 4 20:27:02 2008
@@ -36,6 +36,7 @@
DEFINE_ACTION(gth_viewer_activate_action_view_show_info)
DEFINE_ACTION(gth_viewer_activate_action_go_refresh)
DEFINE_ACTION(gth_viewer_activate_action_single_window)
+DEFINE_ACTION(gth_viewer_activate_action_scripts)
DEFINE_ACTION(gth_viewer_activate_action_upload_flickr)
#endif /* GTH_VIEWER_ACTIONS_CALLBACK_H */
Modified: trunk/src/gth-viewer-actions-entries.h
==============================================================================
--- trunk/src/gth-viewer-actions-entries.h (original)
+++ trunk/src/gth-viewer-actions-entries.h Mon Feb 4 20:27:02 2008
@@ -38,8 +38,6 @@
{ "ViewShowHideMenu", NULL, N_("Show/_Hide") },
{ "ViewZoomMenu", NULL, N_("_Zoom") },
{ "ImageMenu", NULL, N_("_Image") },
- { "ImageTransformMenu", NULL, N_("_Transform") },
- { "ImageAutoMenu", NULL, N_("Auto") },
{ "ToolsMenu", NULL, N_("_Tools") },
{ "ToolsWallpaperMenu", NULL, N_("Set Image as _Wallpaper") },
{ "ScriptMenu", NULL, N_("_Scripts") },
@@ -65,6 +63,11 @@
N_("_Reload"), "<control>R",
N_("Reload the current location"),
G_CALLBACK (gth_viewer_activate_action_go_refresh) },
+
+ { "External_Scripts", GTK_STOCK_EDIT,
+ N_("_Edit Scripts"), NULL,
+ N_("Edit external scripts"),
+ G_CALLBACK (gth_viewer_activate_action_scripts) },
{ "Upload_Flickr", NULL,
N_("To _Flickr"), NULL,
Modified: trunk/src/gth-viewer.c
==============================================================================
--- trunk/src/gth-viewer.c (original)
+++ trunk/src/gth-viewer.c Mon Feb 4 20:27:02 2008
@@ -215,6 +215,8 @@
gboolean image_is_void;
gboolean image_is_ani;
gboolean playing;
+ int i, number_of_scripts;
+ char *script_name;
image_is_void = image_viewer_is_void (IMAGE_VIEWER (priv->viewer));
image_is_ani = image_viewer_is_animation (IMAGE_VIEWER (priv->viewer));
@@ -250,16 +252,13 @@
set_action_sensitive (viewer, "View_PlayAnimation", image_is_ani);
set_action_sensitive (viewer, "View_StepAnimation", image_is_ani && ! playing);
- set_action_sensitive (viewer, "Script_0", !image_is_void);
- set_action_sensitive (viewer, "Script_1", !image_is_void);
- set_action_sensitive (viewer, "Script_2", !image_is_void);
- set_action_sensitive (viewer, "Script_3", !image_is_void);
- set_action_sensitive (viewer, "Script_4", !image_is_void);
- set_action_sensitive (viewer, "Script_5", !image_is_void);
- set_action_sensitive (viewer, "Script_6", !image_is_void);
- set_action_sensitive (viewer, "Script_7", !image_is_void);
- set_action_sensitive (viewer, "Script_8", !image_is_void);
- set_action_sensitive (viewer, "Script_9", !image_is_void);
+ /* Scripts menu */
+ number_of_scripts = eel_gconf_get_integer (PREF_HOTKEY_PREFIX "number_of_scripts", 10);
+ for (i = 0; i < number_of_scripts; i++) {
+ script_name = g_strdup_printf ("Script_%d", i);
+ set_action_sensitive (viewer, script_name, !image_is_void);
+ g_free (script_name);
+ }
set_action_sensitive (viewer, "Upload_Flickr", !image_is_void);
@@ -1481,6 +1480,9 @@
g_message ("building menus failed: %s", error->message);
g_error_free (error);
}
+
+ generate_script_menu (ui, priv->actions, GTH_WINDOW (viewer));
+
menubar = gtk_ui_manager_get_widget (ui, "/MenuBar");
gtk_widget_show (menubar);
@@ -2303,3 +2305,10 @@
return (GtkWidget*) SingleViewer;
}
+
+void
+gth_viewer_update_script_menu (GthViewer *viewer)
+{
+ generate_script_menu (viewer->priv->ui, viewer->priv->actions, GTH_WINDOW (viewer));
+}
+
Modified: trunk/src/gth-viewer.h
==============================================================================
--- trunk/src/gth-viewer.h (original)
+++ trunk/src/gth-viewer.h Mon Feb 4 20:27:02 2008
@@ -60,5 +60,7 @@
gboolean value);
GtkWidget * gth_viewer_get_current_viewer (void);
+void gth_viewer_update_script_menu (GthViewer *viewer);
+
#endif /* GTH_VIEWER_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]