gthumb r2223 - in trunk: . data/glade src



Author: mjc
Date: Sat Jan 26 17:54:51 2008
New Revision: 2223
URL: http://svn.gnome.org/viewvc/gthumb?rev=2223&view=rev

Log:
2008-01-26  Michael J. Chudobiak  <mjc svn gnome org>

        * data/glade/gthumb_tools.glade:
        * src/dlg-scripts.c: (gconf_get_script), (add_scripts),
        (create_script_model), (add_columns), (destroy_cb), (save_cb),
        (add_script_cb), (remove_script_cb), (dlg_scripts),
        (generate_script_menu):
        * src/dlg-scripts.h:
        * src/gth-browser.c: (window_update_sensitivity),
        (update_scripts_cb), (gth_browser_construct),
        (gth_browser_update_script_menu):
        Allow arbitrary number of user-defined scripts, instead of just 10.
        Tweaked version of Natan Yellin's <aantny gmail com> ghop patch.
        http://code.google.com/p/google-highly-open-participation-gnome/issues/detail?id=104



Modified:
   trunk/ChangeLog
   trunk/data/glade/gthumb_tools.glade
   trunk/src/dlg-scripts.c
   trunk/src/dlg-scripts.h
   trunk/src/gth-browser.c

Modified: trunk/data/glade/gthumb_tools.glade
==============================================================================
--- trunk/data/glade/gthumb_tools.glade	(original)
+++ trunk/data/glade/gthumb_tools.glade	Sat Jan 26 17:54:51 2008
@@ -188,7 +188,7 @@
 		      <property name="right_attach">1</property>
 		      <property name="top_attach">0</property>
 		      <property name="bottom_attach">1</property>
-		      <property name="x_options">fill</property>
+		      <property name="x_options"></property>
 		      <property name="y_options"></property>
 		    </packing>
 		  </child>
@@ -216,7 +216,7 @@
 		      <property name="right_attach">1</property>
 		      <property name="top_attach">2</property>
 		      <property name="bottom_attach">3</property>
-		      <property name="x_options">fill</property>
+		      <property name="x_options"></property>
 		      <property name="y_options"></property>
 		    </packing>
 		  </child>
@@ -251,8 +251,8 @@
 		      <property name="right_attach">2</property>
 		      <property name="top_attach">2</property>
 		      <property name="bottom_attach">3</property>
-		      <property name="x_options">fill</property>
-		      <property name="y_options">fill</property>
+		      <property name="x_options"></property>
+		      <property name="y_options"></property>
 		    </packing>
 		  </child>
 
@@ -271,7 +271,7 @@
 			  <property name="max_length">0</property>
 			  <property name="text" translatable="yes"></property>
 			  <property name="has_frame">True</property>
-			  <property name="invisible_char">*</property>
+			  <property name="invisible_char">â</property>
 			  <property name="activates_default">True</property>
 			</widget>
 			<packing>
@@ -286,7 +286,7 @@
 		      <property name="right_attach">2</property>
 		      <property name="top_attach">0</property>
 		      <property name="bottom_attach">1</property>
-		      <property name="y_options">fill</property>
+		      <property name="y_options"></property>
 		    </packing>
 		  </child>
 
@@ -316,7 +316,7 @@
 		      <property name="right_attach">2</property>
 		      <property name="top_attach">1</property>
 		      <property name="bottom_attach">2</property>
-		      <property name="x_options">fill</property>
+		      <property name="x_options"></property>
 		      <property name="y_options"></property>
 		    </packing>
 		  </child>
@@ -344,7 +344,7 @@
 		      <property name="right_attach">1</property>
 		      <property name="top_attach">3</property>
 		      <property name="bottom_attach">4</property>
-		      <property name="x_options">fill</property>
+		      <property name="x_options"></property>
 		      <property name="y_options"></property>
 		    </packing>
 		  </child>
@@ -366,7 +366,7 @@
 		      <property name="right_attach">2</property>
 		      <property name="top_attach">4</property>
 		      <property name="bottom_attach">5</property>
-		      <property name="x_options">fill</property>
+		      <property name="x_options"></property>
 		      <property name="y_options"></property>
 		    </packing>
 		  </child>
@@ -396,8 +396,8 @@
 		      <property name="right_attach">2</property>
 		      <property name="top_attach">3</property>
 		      <property name="bottom_attach">4</property>
-		      <property name="x_options">fill</property>
-		      <property name="y_options">fill</property>
+		      <property name="x_options"></property>
+		      <property name="y_options"></property>
 		    </packing>
 		  </child>
 
@@ -424,7 +424,7 @@
 		      <property name="right_attach">1</property>
 		      <property name="top_attach">5</property>
 		      <property name="bottom_attach">6</property>
-		      <property name="x_options">fill</property>
+		      <property name="x_options"></property>
 		      <property name="y_options"></property>
 		    </packing>
 		  </child>
@@ -456,8 +456,8 @@
 		      <property name="right_attach">2</property>
 		      <property name="top_attach">5</property>
 		      <property name="bottom_attach">6</property>
-		      <property name="x_options">fill</property>
-		      <property name="y_options">fill</property>
+		      <property name="x_options"></property>
+		      <property name="y_options"></property>
 		    </packing>
 		  </child>
 		</widget>
@@ -901,6 +901,8 @@
 		      <property name="width_request">200</property>
 		      <property name="height_request">200</property>
 		      <property name="visible">True</property>
+		      <property name="stock">gtk-missing-image</property>
+		      <property name="icon_size">4</property>
 		      <property name="xalign">0.5</property>
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
@@ -1123,7 +1125,7 @@
 	      <property name="right_attach">1</property>
 	      <property name="top_attach">0</property>
 	      <property name="bottom_attach">1</property>
-	      <property name="x_options">fill</property>
+	      <property name="x_options"></property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
@@ -1145,7 +1147,7 @@
 	      <property name="right_attach">2</property>
 	      <property name="top_attach">1</property>
 	      <property name="bottom_attach">2</property>
-	      <property name="x_options">fill</property>
+	      <property name="x_options"></property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
@@ -1165,8 +1167,8 @@
 	      <property name="right_attach">2</property>
 	      <property name="top_attach">0</property>
 	      <property name="bottom_attach">1</property>
-	      <property name="x_options">fill</property>
-	      <property name="y_options">fill</property>
+	      <property name="x_options"></property>
+	      <property name="y_options"></property>
 	    </packing>
 	  </child>
 	</widget>
@@ -1294,7 +1296,7 @@
 		  <property name="right_attach">1</property>
 		  <property name="top_attach">0</property>
 		  <property name="bottom_attach">1</property>
-		  <property name="x_options">fill</property>
+		  <property name="x_options"></property>
 		  <property name="y_options"></property>
 		</packing>
 	      </child>
@@ -1322,7 +1324,7 @@
 		  <property name="right_attach">1</property>
 		  <property name="top_attach">1</property>
 		  <property name="bottom_attach">2</property>
-		  <property name="x_options">fill</property>
+		  <property name="x_options"></property>
 		  <property name="y_options"></property>
 		</packing>
 	      </child>
@@ -1336,7 +1338,7 @@
 		  <property name="max_length">0</property>
 		  <property name="text" translatable="yes"></property>
 		  <property name="has_frame">True</property>
-		  <property name="invisible_char">*</property>
+		  <property name="invisible_char">â</property>
 		  <property name="activates_default">False</property>
 		</widget>
 		<packing>
@@ -1357,7 +1359,7 @@
 		  <property name="max_length">0</property>
 		  <property name="text" translatable="yes"></property>
 		  <property name="has_frame">True</property>
-		  <property name="invisible_char">*</property>
+		  <property name="invisible_char">â</property>
 		  <property name="activates_default">False</property>
 		</widget>
 		<packing>
@@ -2901,7 +2903,7 @@
 		      <child>
 			<widget class="GtkLabel" id="label112">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">_Scale</property>
+			  <property name="label" translatable="yes" context="yes">_Scale</property>
 			  <property name="use_underline">True</property>
 			  <property name="use_markup">False</property>
 			  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -2953,7 +2955,7 @@
 	      <child>
 		<widget class="GtkLabel" id="label106">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">&lt;b&gt;New dimensions&lt;/b&gt;</property>
+		  <property name="label" translatable="yes" context="yes">&lt;b&gt;New dimensions&lt;/b&gt;</property>
 		  <property name="use_underline">False</property>
 		  <property name="use_markup">True</property>
 		  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -2984,7 +2986,7 @@
 		  <child>
 		    <widget class="GtkLabel" id="label105">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">    </property>
+		      <property name="label" translatable="yes" context="yes">    </property>
 		      <property name="use_underline">False</property>
 		      <property name="use_markup">False</property>
 		      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -3024,7 +3026,7 @@
 			  <child>
 			    <widget class="GtkLabel" id="label103">
 			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_Width:</property>
+			      <property name="label" translatable="yes" context="yes">_Width:</property>
 			      <property name="use_underline">True</property>
 			      <property name="use_markup">False</property>
 			      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -3045,7 +3047,7 @@
 			      <property name="right_attach">1</property>
 			      <property name="top_attach">0</property>
 			      <property name="bottom_attach">1</property>
-			      <property name="x_options">fill</property>
+			      <property name="x_options"></property>
 			      <property name="y_options"></property>
 			    </packing>
 			  </child>
@@ -3053,7 +3055,7 @@
 			  <child>
 			    <widget class="GtkLabel" id="label104">
 			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_Height:</property>
+			      <property name="label" translatable="yes" context="yes">_Height:</property>
 			      <property name="use_underline">True</property>
 			      <property name="use_markup">False</property>
 			      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -3074,7 +3076,7 @@
 			      <property name="right_attach">1</property>
 			      <property name="top_attach">1</property>
 			      <property name="bottom_attach">2</property>
-			      <property name="x_options">fill</property>
+			      <property name="x_options"></property>
 			      <property name="y_options"></property>
 			    </packing>
 			  </child>
@@ -3083,37 +3085,14 @@
 			    <widget class="GtkOptionMenu" id="ss_unit_optionmenu">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
-			      <property name="history">0</property>
-
-			      <child>
-				<widget class="GtkMenu" id="menu2">
-
-				  <child>
-				    <widget class="GtkMenuItem" id="menuitem1">
-				      <property name="visible">True</property>
-				      <property name="label" translatable="yes">pixels</property>
-				      <property name="use_underline">True</property>
-				      <signal name="activate" handler="on_pixels1_activate" last_modification_time="Tue, 22 Oct 2002 14:24:32 GMT"/>
-				    </widget>
-				  </child>
-
-				  <child>
-				    <widget class="GtkMenuItem" id="menuitem2">
-				      <property name="visible">True</property>
-				      <property name="label" translatable="yes">%</property>
-				      <property name="use_underline">True</property>
-				      <signal name="activate" handler="on_%1_activate" last_modification_time="Tue, 22 Oct 2002 14:24:32 GMT"/>
-				    </widget>
-				  </child>
-				</widget>
-			      </child>
+			      <property name="history">-1</property>
 			    </widget>
 			    <packing>
 			      <property name="left_attach">2</property>
 			      <property name="right_attach">3</property>
 			      <property name="top_attach">1</property>
 			      <property name="bottom_attach">2</property>
-			      <property name="x_options">fill</property>
+			      <property name="x_options"></property>
 			      <property name="y_options"></property>
 			    </packing>
 			  </child>
@@ -3135,7 +3114,7 @@
 			      <property name="right_attach">2</property>
 			      <property name="top_attach">0</property>
 			      <property name="bottom_attach">1</property>
-			      <property name="x_options">fill</property>
+			      <property name="x_options"></property>
 			      <property name="y_options"></property>
 			    </packing>
 			  </child>
@@ -3157,7 +3136,7 @@
 			      <property name="right_attach">2</property>
 			      <property name="top_attach">1</property>
 			      <property name="bottom_attach">2</property>
-			      <property name="x_options">fill</property>
+			      <property name="x_options"></property>
 			      <property name="y_options"></property>
 			    </packing>
 			  </child>
@@ -3173,7 +3152,7 @@
 			<widget class="GtkCheckButton" id="ss_keep_ratio_checkbutton">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">_Keep aspect ratio</property>
+			  <property name="label" translatable="yes" context="yes">_Keep aspect ratio</property>
 			  <property name="use_underline">True</property>
 			  <property name="relief">GTK_RELIEF_NORMAL</property>
 			  <property name="focus_on_click">True</property>
@@ -3218,7 +3197,7 @@
 	      <child>
 		<widget class="GtkLabel" id="label118">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">&lt;b&gt;Image type&lt;/b&gt;</property>
+		  <property name="label" translatable="yes" context="yes">&lt;b&gt;Image type&lt;/b&gt;</property>
 		  <property name="use_underline">False</property>
 		  <property name="use_markup">True</property>
 		  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -3249,7 +3228,7 @@
 		  <child>
 		    <widget class="GtkLabel" id="label117">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">    </property>
+		      <property name="label" translatable="yes" context="yes">    </property>
 		      <property name="use_underline">False</property>
 		      <property name="use_markup">False</property>
 		      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -3284,7 +3263,7 @@
 			<widget class="GtkRadioButton" id="ss_jpeg_radiobutton">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">_JPEG</property>
+			  <property name="label" translatable="yes" context="yes">_JPEG</property>
 			  <property name="use_underline">True</property>
 			  <property name="relief">GTK_RELIEF_NORMAL</property>
 			  <property name="focus_on_click">True</property>
@@ -3305,7 +3284,7 @@
 			<widget class="GtkRadioButton" id="ss_png_radiobutton">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">_PNG</property>
+			  <property name="label" translatable="yes" context="yes">_PNG</property>
 			  <property name="use_underline">True</property>
 			  <property name="relief">GTK_RELIEF_NORMAL</property>
 			  <property name="focus_on_click">True</property>
@@ -3327,7 +3306,7 @@
 			<widget class="GtkRadioButton" id="ss_tga_radiobutton">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">T_GA</property>
+			  <property name="label" translatable="yes" context="yes">T_GA</property>
 			  <property name="use_underline">True</property>
 			  <property name="relief">GTK_RELIEF_NORMAL</property>
 			  <property name="focus_on_click">True</property>
@@ -3349,7 +3328,7 @@
 			<widget class="GtkRadioButton" id="ss_tiff_radiobutton">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">_TIFF</property>
+			  <property name="label" translatable="yes" context="yes">_TIFF</property>
 			  <property name="use_underline">True</property>
 			  <property name="relief">GTK_RELIEF_NORMAL</property>
 			  <property name="focus_on_click">True</property>
@@ -3397,7 +3376,7 @@
 	      <child>
 		<widget class="GtkLabel" id="label115">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">&lt;b&gt;Saving&lt;/b&gt;</property>
+		  <property name="label" translatable="yes" context="yes">&lt;b&gt;Saving&lt;/b&gt;</property>
 		  <property name="use_underline">False</property>
 		  <property name="use_markup">True</property>
 		  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -3428,7 +3407,7 @@
 		  <child>
 		    <widget class="GtkLabel" id="label114">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">    </property>
+		      <property name="label" translatable="yes" context="yes">    </property>
 		      <property name="use_underline">False</property>
 		      <property name="use_markup">False</property>
 		      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -3462,7 +3441,7 @@
 		      <child>
 			<widget class="GtkFileChooserButton" id="ss_dest_filechooserbutton">
 			  <property name="visible">True</property>
-			  <property name="title" translatable="yes">Choose destination folder</property>
+			  <property name="title" translatable="yes" context="yes">Choose destination folder</property>
 			  <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
 			  <property name="local_only">False</property>
 			  <property name="show_hidden">False</property>
@@ -3474,14 +3453,14 @@
 			  <property name="right_attach">2</property>
 			  <property name="top_attach">0</property>
 			  <property name="bottom_attach">1</property>
-			  <property name="y_options">fill</property>
+			  <property name="y_options"></property>
 			</packing>
 		      </child>
 
 		      <child>
 			<widget class="GtkLabel" id="label113">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">_Destination:</property>
+			  <property name="label" translatable="yes" context="yes">_Destination:</property>
 			  <property name="use_underline">True</property>
 			  <property name="use_markup">False</property>
 			  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -3501,7 +3480,7 @@
 			  <property name="right_attach">1</property>
 			  <property name="top_attach">0</property>
 			  <property name="bottom_attach">1</property>
-			  <property name="x_options">fill</property>
+			  <property name="x_options"></property>
 			  <property name="y_options"></property>
 			</packing>
 		      </child>
@@ -3509,7 +3488,7 @@
 		      <child>
 			<widget class="GtkLabel" id="label116">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">Overwrite mode:</property>
+			  <property name="label" translatable="yes" context="yes">Overwrite mode:</property>
 			  <property name="use_underline">False</property>
 			  <property name="use_markup">False</property>
 			  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -3529,7 +3508,7 @@
 			  <property name="right_attach">1</property>
 			  <property name="top_attach">1</property>
 			  <property name="bottom_attach">2</property>
-			  <property name="x_options">fill</property>
+			  <property name="x_options"></property>
 			  <property name="y_options"></property>
 			</packing>
 		      </child>
@@ -3538,7 +3517,7 @@
 			<widget class="GtkCheckButton" id="ss_remove_orig_checkbutton">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">R_emove original</property>
+			  <property name="label" translatable="yes" context="yes">R_emove original</property>
 			  <property name="use_underline">True</property>
 			  <property name="relief">GTK_RELIEF_NORMAL</property>
 			  <property name="focus_on_click">True</property>
@@ -3551,7 +3530,7 @@
 			  <property name="right_attach">2</property>
 			  <property name="top_attach">2</property>
 			  <property name="bottom_attach">3</property>
-			  <property name="x_options">fill</property>
+			  <property name="x_options"></property>
 			  <property name="y_options"></property>
 			</packing>
 		      </child>
@@ -3565,7 +3544,7 @@
 			  <child>
 			    <widget class="GtkComboBox" id="ss_om_combobox">
 			      <property name="visible">True</property>
-			      <property name="items" translatable="yes">Skip
+			      <property name="items" translatable="yes" context="yes">Skip
 Rename
 Ask
 Overwrite</property>
@@ -3584,8 +3563,8 @@
 			  <property name="right_attach">2</property>
 			  <property name="top_attach">1</property>
 			  <property name="bottom_attach">2</property>
-			  <property name="x_options">fill</property>
-			  <property name="y_options">fill</property>
+			  <property name="x_options"></property>
+			  <property name="y_options"></property>
 			</packing>
 		      </child>
 		    </widget>
@@ -3757,7 +3736,7 @@
 
 <widget class="GtkDialog" id="reset_exif_dialog">
   <property name="border_width">6</property>
-  <property name="title" translatable="yes">Reset Exif Orientation Tags</property>
+  <property name="title" translatable="yes" context="yes">Reset Exif Orientation Tags</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
   <property name="window_position">GTK_WIN_POS_NONE</property>
   <property name="modal">False</property>
@@ -3865,7 +3844,7 @@
 	      <child>
 		<widget class="GtkLabel" id="label120">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">Click OK to reset the Exif orientation tag for the selected images to Top-Left.</property>
+		  <property name="label" translatable="yes" context="yes">Click OK to reset the Exif orientation tag for the selected images to Top-Left.</property>
 		  <property name="use_underline">False</property>
 		  <property name="use_markup">True</property>
 		  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -3959,6 +3938,8 @@
       <child>
 	<widget class="GtkImage" id="progress_thumbnail">
 	  <property name="visible">True</property>
+	  <property name="stock">gtk-missing-image</property>
+	  <property name="icon_size">4</property>
 	  <property name="xalign">0.5</property>
 	  <property name="yalign">0.5</property>
 	  <property name="xpad">0</property>
@@ -4028,12 +4009,13 @@
   </child>
 </widget>
 
-<widget class="GtkDialog" id="scripts_dialog">
+<widget class="GtkDialog" id="prompt_dialog">
   <property name="border_width">6</property>
-  <property name="title" translatable="yes">Define External Scripts</property>
+  <property name="title" translatable="yes" context="yes">User-Defined Script Parameter</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
   <property name="window_position">GTK_WIN_POS_NONE</property>
   <property name="modal">False</property>
+  <property name="default_width">600</property>
   <property name="resizable">True</property>
   <property name="destroy_with_parent">False</property>
   <property name="decorated">True</property>
@@ -4046,50 +4028,23 @@
   <property name="has_separator">False</property>
 
   <child internal-child="vbox">
-    <widget class="GtkVBox" id="vbox_all">
+    <widget class="GtkVBox" id="vbox73">
       <property name="visible">True</property>
       <property name="homogeneous">False</property>
       <property name="spacing">12</property>
 
       <child internal-child="action_area">
-	<widget class="GtkHButtonBox" id="hbuttonbox3">
+	<widget class="GtkHButtonBox" id="hbuttonbox4">
 	  <property name="visible">True</property>
 	  <property name="layout_style">GTK_BUTTONBOX_END</property>
 
 	  <child>
-	    <widget class="GtkButton" id="script_help_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-help</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <property name="response_id">-11</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="script_cancel_button">
+	    <widget class="GtkButton" id="prompt_ok_button">
 	      <property name="visible">True</property>
 	      <property name="can_default">True</property>
 	      <property name="has_default">True</property>
 	      <property name="can_focus">True</property>
-	      <property name="has_focus">True</property>
-	      <property name="label">gtk-cancel</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <property name="response_id">-6</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="script_save_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-save</property>
+	      <property name="label">gtk-ok</property>
 	      <property name="use_stock">True</property>
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
@@ -4106,9 +4061,9 @@
       </child>
 
       <child>
-	<widget class="GtkLabel" id="label126">
+	<widget class="GtkLabel" id="label128">
 	  <property name="visible">True</property>
-	  <property name="label" translatable="yes">The number keys on the numeric keypad can be associated with external scripts:</property>
+	  <property name="label" translatable="yes" context="yes">Your script requires this user-defined parameter:</property>
 	  <property name="use_underline">False</property>
 	  <property name="use_markup">False</property>
 	  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -4125,20 +4080,59 @@
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">False</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
 	</packing>
       </child>
 
       <child>
-	<widget class="GtkVBox" id="vbox_tree">
-	  <property name="border_width">5</property>
+	<widget class="GtkHBox" id="hbox84">
 	  <property name="visible">True</property>
 	  <property name="homogeneous">False</property>
-	  <property name="spacing">6</property>
+	  <property name="spacing">0</property>
 
 	  <child>
-	    <placeholder/>
+	    <widget class="GtkLabel" id="prompt_label">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes" context="yes">prompt</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0.5</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">6</property>
+	      <property name="ypad">6</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkEntry" id="prompt_entry">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="editable">True</property>
+	      <property name="visibility">True</property>
+	      <property name="max_length">0</property>
+	      <property name="text" translatable="yes"></property>
+	      <property name="has_frame">True</property>
+	      <property name="invisible_char">â</property>
+	      <property name="activates_default">True</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
 	  </child>
 	</widget>
 	<packing>
@@ -4147,57 +4141,16 @@
 	  <property name="fill">True</property>
 	</packing>
       </child>
-
-      <child>
-	<widget class="GtkLabel" id="label129">
-	  <property name="visible">True</property>
-	  <property name="label" translatable="yes">Click inside the name or script fields to edit them.
-&lt;small&gt;&lt;i&gt;&lt;b&gt;
-Special characters:&lt;/b&gt;
-%F = all selected filenames on one line, space delimited
-%f = a single filename, including path
-%b = a single filename, excluding path
-%n = a single filename, including path, with no extension
-%m = a single filename, excluding path, with no extension
-%e = a single extension (starting with a period)
-%p = the parent folder of the single file&lt;/i&gt;
-&lt;i&gt;[text] = a user prompt, refreshed for each iteration&lt;/i&gt;
-&lt;i&gt;[TEXT] = a user prompt, used for all iterations&lt;/i&gt;
-&lt;i&gt;{..code..} = a strftime date format code&lt;/i&gt;
-&lt;i&gt;{TEXT} = a user prompt used for all iterations matching previous date&lt;/i&gt;
-Scripts with the %F code will be executed just once, regardless of the number of files selected. All other scripts will be executed once per selected file.
-The default scripts are explained in the Help file.&lt;/small&gt;</property>
-	  <property name="use_underline">False</property>
-	  <property name="use_markup">True</property>
-	  <property name="justify">GTK_JUSTIFY_LEFT</property>
-	  <property name="wrap">True</property>
-	  <property name="selectable">False</property>
-	  <property name="xalign">0</property>
-	  <property name="yalign">0.5</property>
-	  <property name="xpad">0</property>
-	  <property name="ypad">0</property>
-	  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-	  <property name="width_chars">-1</property>
-	  <property name="single_line_mode">False</property>
-	  <property name="angle">0</property>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">False</property>
-	</packing>
-      </child>
     </widget>
   </child>
 </widget>
 
-<widget class="GtkDialog" id="prompt_dialog">
+<widget class="GtkDialog" id="scripts_dialog">
   <property name="border_width">6</property>
-  <property name="title" translatable="yes">User-Defined Script Parameter</property>
+  <property name="title" translatable="yes" context="yes">Define External Scripts</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
   <property name="window_position">GTK_WIN_POS_NONE</property>
   <property name="modal">False</property>
-  <property name="default_width">600</property>
   <property name="resizable">True</property>
   <property name="destroy_with_parent">False</property>
   <property name="decorated">True</property>
@@ -4210,23 +4163,50 @@
   <property name="has_separator">False</property>
 
   <child internal-child="vbox">
-    <widget class="GtkVBox" id="vbox73">
+    <widget class="GtkVBox" id="vbox_all">
       <property name="visible">True</property>
       <property name="homogeneous">False</property>
       <property name="spacing">12</property>
 
       <child internal-child="action_area">
-	<widget class="GtkHButtonBox" id="hbuttonbox4">
+	<widget class="GtkHButtonBox" id="hbuttonbox3">
 	  <property name="visible">True</property>
 	  <property name="layout_style">GTK_BUTTONBOX_END</property>
 
 	  <child>
-	    <widget class="GtkButton" id="prompt_ok_button">
+	    <widget class="GtkButton" id="script_help_button">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-help</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-11</property>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="script_cancel_button">
 	      <property name="visible">True</property>
 	      <property name="can_default">True</property>
 	      <property name="has_default">True</property>
 	      <property name="can_focus">True</property>
-	      <property name="label">gtk-ok</property>
+	      <property name="has_focus">True</property>
+	      <property name="label">gtk-cancel</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-6</property>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="script_save_button">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-save</property>
 	      <property name="use_stock">True</property>
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
@@ -4236,16 +4216,17 @@
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
-	  <property name="expand">True</property>
+	  <property name="expand">False</property>
 	  <property name="fill">True</property>
 	  <property name="pack_type">GTK_PACK_END</property>
 	</packing>
       </child>
 
       <child>
-	<widget class="GtkLabel" id="label128">
+	<widget class="GtkLabel" id="label126">
 	  <property name="visible">True</property>
-	  <property name="label" translatable="yes">Your script requires this user-defined parameter:</property>
+	  <property name="label" translatable="yes" context="yes">The number keys on the numeric keypad can be associated with scripts 0-9.
+All scripts can be launched from the Scripts menu.</property>
 	  <property name="use_underline">False</property>
 	  <property name="use_markup">False</property>
 	  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -4262,34 +4243,131 @@
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
+	  <property name="expand">False</property>
+	  <property name="fill">False</property>
 	</packing>
       </child>
 
       <child>
-	<widget class="GtkHBox" id="hbox84">
+	<widget class="GtkHBox" id="scripts_hbox">
 	  <property name="visible">True</property>
 	  <property name="homogeneous">False</property>
 	  <property name="spacing">0</property>
 
 	  <child>
-	    <widget class="GtkLabel" id="prompt_label">
+	    <widget class="GtkVBox" id="vbox_manage_scripts">
+	      <property name="border_width">5</property>
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">prompt</property>
-	      <property name="use_underline">False</property>
-	      <property name="use_markup">False</property>
-	      <property name="justify">GTK_JUSTIFY_LEFT</property>
-	      <property name="wrap">False</property>
-	      <property name="selectable">False</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">6</property>
-	      <property name="ypad">6</property>
-	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-	      <property name="width_chars">-1</property>
-	      <property name="single_line_mode">False</property>
-	      <property name="angle">0</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">6</property>
+
+	      <child>
+		<widget class="GtkButton" id="script_add_button">
+		  <property name="visible">True</property>
+		  <property name="tooltip" translatable="yes" context="yes">Add New Script</property>
+		  <property name="can_focus">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+
+		  <child>
+		    <widget class="GtkAlignment" id="alignment15">
+		      <property name="visible">True</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xscale">0</property>
+		      <property name="yscale">0</property>
+		      <property name="top_padding">0</property>
+		      <property name="bottom_padding">0</property>
+		      <property name="left_padding">0</property>
+		      <property name="right_padding">0</property>
+
+		      <child>
+			<widget class="GtkHBox" id="hbox85">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">2</property>
+
+			  <child>
+			    <widget class="GtkImage" id="image50">
+			      <property name="visible">True</property>
+			      <property name="stock">gtk-add</property>
+			      <property name="icon_size">4</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkButton" id="script_remove_button">
+		  <property name="visible">True</property>
+		  <property name="tooltip" translatable="yes" context="yes">Remove Script</property>
+		  <property name="can_focus">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+
+		  <child>
+		    <widget class="GtkAlignment" id="alignment16">
+		      <property name="visible">True</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xscale">0</property>
+		      <property name="yscale">0</property>
+		      <property name="top_padding">0</property>
+		      <property name="bottom_padding">0</property>
+		      <property name="left_padding">0</property>
+		      <property name="right_padding">0</property>
+
+		      <child>
+			<widget class="GtkHBox" id="hbox86">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">2</property>
+
+			  <child>
+			    <widget class="GtkImage" id="image51">
+			      <property name="visible">True</property>
+			      <property name="stock">gtk-remove</property>
+			      <property name="icon_size">4</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
 	    </widget>
 	    <packing>
 	      <property name="padding">0</property>
@@ -4299,16 +4377,19 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkEntry" id="prompt_entry">
+	    <widget class="GtkVBox" id="vbox_tree">
+	      <property name="border_width">5</property>
 	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="editable">True</property>
-	      <property name="visibility">True</property>
-	      <property name="max_length">0</property>
-	      <property name="text" translatable="yes"></property>
-	      <property name="has_frame">True</property>
-	      <property name="invisible_char">â</property>
-	      <property name="activates_default">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">6</property>
+
+	      <child>
+		<placeholder/>
+	      </child>
+
+	      <child>
+		<placeholder/>
+	      </child>
 	    </widget>
 	    <packing>
 	      <property name="padding">0</property>
@@ -4323,6 +4404,46 @@
 	  <property name="fill">True</property>
 	</packing>
       </child>
+
+      <child>
+	<widget class="GtkLabel" id="label129">
+	  <property name="visible">True</property>
+	  <property name="label" translatable="yes" context="yes">Click inside the name or script fields to edit them.
+&lt;small&gt;&lt;i&gt;&lt;b&gt;
+Special characters:&lt;/b&gt;
+%F = all selected filenames on one line, space delimited
+%f = a single filename, including path
+%b = a single filename, excluding path
+%n = a single filename, including path, with no extension
+%m = a single filename, excluding path, with no extension
+%e = a single extension (starting with a period)
+%p = the parent folder of the single file&lt;/i&gt;
+&lt;i&gt;[text] = a user prompt, refreshed for each iteration&lt;/i&gt;
+&lt;i&gt;[TEXT] = a user prompt, used for all iterations&lt;/i&gt;
+&lt;i&gt;{..code..} = a strftime date format code&lt;/i&gt;
+&lt;i&gt;{TEXT} = a user prompt used for all iterations matching previous date&lt;/i&gt;
+Scripts with the %F code will be executed just once, regardless of the number of files selected. All other scripts will be executed once per selected file.
+The default scripts are explained in the Help file.&lt;/small&gt;</property>
+	  <property name="use_underline">False</property>
+	  <property name="use_markup">True</property>
+	  <property name="justify">GTK_JUSTIFY_LEFT</property>
+	  <property name="wrap">True</property>
+	  <property name="selectable">False</property>
+	  <property name="xalign">0</property>
+	  <property name="yalign">0.5</property>
+	  <property name="xpad">0</property>
+	  <property name="ypad">0</property>
+	  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	  <property name="width_chars">-1</property>
+	  <property name="single_line_mode">False</property>
+	  <property name="angle">0</property>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">False</property>
+	</packing>
+      </child>
     </widget>
   </child>
 </widget>

Modified: trunk/src/dlg-scripts.c
==============================================================================
--- trunk/src/dlg-scripts.c	(original)
+++ trunk/src/dlg-scripts.c	Sat Jan 26 17:54:51 2008
@@ -47,7 +47,6 @@
 
 #define SCRIPT_GLADE_FILE "gthumb_tools.glade"
 #define DEF_THUMB_SIZE 128
-#define MAX_SCRIPTS 10
 
 typedef struct {
         GthWindow    *window;
@@ -75,6 +74,7 @@
         gchar *script_text;
 } ScriptStruct;
 
+
 typedef struct {
 	/* Name of the script */
 	char *name;
@@ -101,10 +101,8 @@
         NUMBER_OF_COLUMNS
 };
 
-
 static GArray *script_array = NULL;
 
-
 /* called when the main dialog is closed. */
 static void
 progress_cancel_cb (GtkWidget    *widget,
@@ -732,7 +730,6 @@
 
 void
 gconf_get_script (unsigned int number, char **name, char **command) {
-
 	char *user_name, *current_command, *default_name, *default_command;
 	char *script_name, *script_command;
 	char *dummy_name = g_strdup_printf (_("Script %d"), number);
@@ -744,7 +741,6 @@
 		default_name = dummy_name;
 		default_command = "";
 	}
-
 	/* First check if the user has specified a name for the script (gthumb >= 2.11) */
 	user_name = eel_gconf_get_string (gconf_script_name_path (number), "");
 
@@ -766,14 +762,12 @@
 		script_name = g_strdup (user_name);
 		script_command = g_strdup ((char*) current_command);
 	}
-
 	g_free (user_name);
 	g_free (current_command);
 	g_free (dummy_name);
 
 	if (name) *name = script_name;
 	if (command) *command = script_command;
-
 }
 
 
@@ -829,14 +823,13 @@
 {
         ScriptStruct new_entry;
 	int i;
-
+	int number_of_scripts;
         g_return_if_fail (script_array != NULL);
-
-	for (i = 0 ; i < MAX_SCRIPTS ; i++) {
+	number_of_scripts = eel_gconf_get_integer (PREF_HOTKEY_PREFIX "number_of_scripts", 10);
+	for (i = 0 ; i < number_of_scripts; i++) {
 		setup_script_struct (&new_entry, i);
 		g_array_append_vals (script_array, &new_entry, 1);
 	}
-
 }
 
 
@@ -868,7 +861,6 @@
                                     g_array_index (script_array, ScriptStruct, i).script_text,
                                     -1);
         }
-
         return GTK_TREE_MODEL (model);
 }
 
@@ -968,7 +960,7 @@
         g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COLUMN_SCRIPT_NUMBER));
 
         gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
-                        -1, _("Hot key"), renderer,
+                        -1, _("Number"), renderer,
                         "text", COLUMN_SCRIPT_NUMBER,
                         NULL);
 
@@ -1011,8 +1003,17 @@
 destroy_cb (GtkWidget  *widget,
             DialogData *data)
 {
+	int i;
 	g_object_unref (data->gui);
         g_free (data);
+
+	for (i = 0; i < script_array->len; i++) {
+	    	g_free (g_array_index (script_array, ScriptStruct, i).script_text);
+    		g_free (g_array_index (script_array, ScriptStruct, i).short_name);
+	}
+
+	g_array_free (script_array, TRUE);
+	script_array = NULL;
 }
 
 
@@ -1030,9 +1031,12 @@
 save_cb (GtkWidget  *widget,
          DialogData *data)
 {
+	eel_gconf_set_integer (PREF_HOTKEY_PREFIX "number_of_scripts", script_array->len);
+	
 	unsigned int i;
 	char *pref_key_path = NULL, *pref_key_name = NULL;
-	for (i = 0 ; i < MAX_SCRIPTS ; i++) {
+	
+	for (i = 0; i < script_array->len; i++) {
 		pref_key_path = gconf_script_path (i);
 		pref_key_name = gconf_script_name_path (i);
         	eel_gconf_set_string (pref_key_path, g_array_index (script_array, ScriptStruct, i).script_text);
@@ -1046,6 +1050,75 @@
 
 }
 
+/* called when a new script is added. */
+static void
+add_script_cb (GtkWidget  *widget,
+               GtkWidget *treeview)
+{
+	GtkListStore *model;
+	GtkTreeIter iter;
+	ScriptStruct new_entry;
+	int len;
+	
+	len = script_array->len;
+	new_entry.number = len;
+	new_entry.script_text = g_strdup ("");
+	new_entry.short_name = g_strdup ("New Script");
+	g_array_append_vals (script_array, &new_entry, 1);
+	
+	model = (GtkListStore*)gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
+	gtk_list_store_append (model, &iter);
+	gtk_list_store_set (model, &iter,
+                                    COLUMN_SCRIPT_NUMBER,
+                                    g_array_index (script_array, ScriptStruct, len).number,
+                                    COLUMN_SHORT_NAME,
+                                    g_array_index (script_array, ScriptStruct, len).short_name,
+                                    COLUMN_SCRIPT_TEXT,
+                                    g_array_index (script_array, ScriptStruct, len).script_text,
+                                    -1);
+    
+}
+
+/* called when a script is removed. */
+static void
+remove_script_cb (GtkWidget *widget,
+                  GtkWidget *treeview)
+{
+	GtkListStore     *model;
+	GtkTreeSelection *selection;
+	GtkTreeIter       iter;
+	int               script_number;
+	gboolean          cont;
+	
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
+	
+	/* If no rows are selected then return. */
+	if (!gtk_tree_selection_get_selected (selection,
+	                                      NULL,
+                                          &iter))
+                                          return;
+    
+	model = (GtkListStore*)gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
+    
+	gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+        		    COLUMN_SCRIPT_NUMBER,
+                            &script_number,
+                            -1);
+	g_free (g_array_index (script_array, ScriptStruct, script_number).script_text);
+	g_free (g_array_index (script_array, ScriptStruct, script_number).short_name);
+	g_array_remove_index (script_array, script_number);
+
+	cont = gtk_list_store_remove (model, &iter);
+	while (cont) {
+		gtk_list_store_set (model,
+    	                            &iter,
+    	                            COLUMN_SCRIPT_NUMBER,
+    	                            script_number,
+    	                            -1);
+		cont = gtk_tree_model_iter_next (GTK_TREE_MODEL(model), &iter);
+		script_number++;
+	}
+}
 
 void
 dlg_scripts (GthWindow *window, DoneFunc done_func, gpointer done_data)
@@ -1054,6 +1127,8 @@
         GtkWidget    *script_help_button;
         GtkWidget    *script_cancel_button;
         GtkWidget    *script_save_button;
+        GtkWidget    *script_add_button;
+        GtkWidget    *script_remove_button;
  	GtkWidget    *vbox_tree;
         GtkWidget    *sw;
         GtkWidget    *treeview;
@@ -1080,6 +1155,8 @@
         script_help_button = glade_xml_get_widget (data->gui, "script_help_button");
         script_cancel_button = glade_xml_get_widget (data->gui, "script_cancel_button");
         script_save_button = glade_xml_get_widget (data->gui, "script_save_button");
+        script_add_button = glade_xml_get_widget (data->gui, "script_add_button");
+        script_remove_button = glade_xml_get_widget (data->gui, "script_remove_button");
 	vbox_tree = glade_xml_get_widget (data->gui, "vbox_tree");
 
         sw = gtk_scrolled_window_new (NULL, NULL);
@@ -1101,8 +1178,8 @@
 
         add_columns (GTK_TREE_VIEW (treeview), script_model);
 
-        g_object_unref (script_model);
-
+		g_object_unref (script_model);
+		
         gtk_container_add (GTK_CONTAINER (sw), treeview);
 
 
@@ -1125,6 +1202,16 @@
                           "clicked",
                           G_CALLBACK (save_cb),
                           data);
+                          
+        g_signal_connect (G_OBJECT (script_add_button),
+                          "clicked",
+                          G_CALLBACK (add_script_cb),
+                          treeview);
+        
+        g_signal_connect (G_OBJECT (script_remove_button),
+                          "clicked",
+                          G_CALLBACK (remove_script_cb),
+                          treeview);
 
 
         gth_get_screen_size (GTK_WINDOW (window), &width, &height);
@@ -1192,32 +1279,33 @@
 guint
 generate_script_menu (GtkUIManager   *ui,
 		      GtkActionGroup *action_group,
-		      GthWindow      *window,
-		      guint	      merge_id)
+		      GthWindow      *window)
 {
-	/* Remove the previously-defined menu items and their associated actions */
-        if (merge_id != 0) {
-		int i;	
+	static int   number_of_scripts = 0;
+	static guint merge_id = 0;
+
+	/* Remove the previously-defined menu items and their associated actions.
+	 * Only one of the checks *should* be necessary. */
+	if (merge_id != 0 && number_of_scripts != 0) {
+		int i;
 		char *action_name;
 
-		for (i = 0; i < MAX_SCRIPTS; i++) {
+		for (i = 0 ; i < number_of_scripts; i++) {
 			action_name = g_strdup_printf ("Script_%d", i);
 			gtk_action_group_remove_action (action_group, 
-				gtk_action_group_get_action (action_group, action_name));
+			gtk_action_group_get_action (action_group, action_name));
 			g_free (action_name);
-		}
+			}
 
-	        gtk_ui_manager_remove_ui (ui, merge_id);
+		gtk_ui_manager_remove_ui (ui, merge_id);
 	}
 
 	/* Identify this batch of menu additions (for later removal, if required) */
 	merge_id = gtk_ui_manager_new_merge_id (ui);                
 
 	unsigned int i;
-
-	for (i = 0 ; i < MAX_SCRIPTS ; i++) {
+	number_of_scripts = eel_gconf_get_integer (PREF_HOTKEY_PREFIX "number_of_scripts", 10);
+	
+	for (i = 0 ; i < number_of_scripts; i++)
 		add_menu_item_and_action (ui, action_group, window, merge_id, i);
-	}
-
-	return merge_id;
 }

Modified: trunk/src/dlg-scripts.h
==============================================================================
--- trunk/src/dlg-scripts.h	(original)
+++ trunk/src/dlg-scripts.h	Sat Jan 26 17:54:51 2008
@@ -41,7 +41,6 @@
 					 gpointer	  done_data);
 guint	generate_script_menu	 	(GtkUIManager    *ui,
 				    	 GtkActionGroup  *actions,
-				     	 GthWindow       *window,
-				    	 guint	    	  merge_id);
+				     	 GthWindow       *window);
 
 #endif /* DLG_SCRIPTS_H */

Modified: trunk/src/gth-browser.c
==============================================================================
--- trunk/src/gth-browser.c	(original)
+++ trunk/src/gth-browser.c	Sat Jan 26 17:54:51 2008
@@ -101,7 +101,6 @@
 	guint               toolbar_merge_id;
 	guint               bookmarks_merge_id;
 	guint               history_merge_id;
-	guint		    scripts_merge_id;
 
 	GtkToolItem        *rotate_tool_item;
 	GtkToolItem        *sep_rotate_tool_item;
@@ -873,6 +872,9 @@
 	gboolean    file_list_contains_images;
 	gboolean    image_is_image;
 	int         image_pos;
+	int         i;
+	int         number_of_scripts;
+	char *      script_name;
 
 	n_selected = gth_file_view_get_n_selected (priv->file_list->view);
 	sel_not_null = n_selected > 0;
@@ -1006,16 +1008,12 @@
 	set_action_sensitive (browser, "Wallpaper_Stretched", ! image_is_void);
 
 	/* Scripts menu */
-	set_action_sensitive (browser, "Script_0", sel_not_null);
-	set_action_sensitive (browser, "Script_1", sel_not_null);
-	set_action_sensitive (browser, "Script_2", sel_not_null);
-	set_action_sensitive (browser, "Script_3", sel_not_null);
-	set_action_sensitive (browser, "Script_4", sel_not_null);
-	set_action_sensitive (browser, "Script_5", sel_not_null);
-	set_action_sensitive (browser, "Script_6", sel_not_null);
-	set_action_sensitive (browser, "Script_7", sel_not_null);
-	set_action_sensitive (browser, "Script_8", sel_not_null);
-	set_action_sensitive (browser, "Script_9", sel_not_null);
+	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 (browser, script_name, sel_not_null);
+		g_free (script_name);
+	}
 
 	/* Upload menu. */
 	
@@ -6413,12 +6411,7 @@
 
 static void
 update_scripts_cb (GtkActionGroup *actions, GthBrowser *browser) {
-
-        browser->priv->scripts_merge_id = generate_script_menu (browser->priv->ui,
-                                                       		actions,
-                                                       		GTH_WINDOW (browser),
-                                                       		browser->priv->scripts_merge_id);
-
+        generate_script_menu (browser->priv->ui, actions, GTH_WINDOW (browser));
 }
 
 
@@ -6504,10 +6497,7 @@
 		g_error_free (error);
 	}
 
-	priv->scripts_merge_id = generate_script_menu (ui, 
-						       priv->actions, 
-						       GTH_WINDOW (browser),
-						       priv->scripts_merge_id);
+	generate_script_menu (ui, priv->actions, GTH_WINDOW (browser));
 
 	gth_window_attach (GTH_WINDOW (browser), gtk_ui_manager_get_widget (ui, "/MenuBar"), GTH_WINDOW_MENUBAR);
 
@@ -8908,8 +8898,5 @@
 void
 gth_browser_update_script_menu (GthBrowser *browser)
 {
-	browser->priv->scripts_merge_id = generate_script_menu (browser->priv->ui, 
-								browser->priv->actions,
-								GTH_WINDOW (browser),
-								browser->priv->scripts_merge_id);
+	generate_script_menu (browser->priv->ui, browser->priv->actions, GTH_WINDOW (browser));
 }



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