[gthumb] added ability to assign a keyboard shortcut to a script



commit 46feb78e19d8dbc7297fe6e1a906c31d73f2f3a3
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Thu Jul 1 11:43:33 2010 +0200

    added ability to assign a keyboard shortcut to a script

 extensions/list_tools/callbacks.c                  |   71 ++-
 extensions/list_tools/callbacks.h                  |    6 +-
 .../list_tools/data/ui/personalize-scripts.ui      |    3 +-
 extensions/list_tools/data/ui/script-editor.ui     |  745 +++++++++++---------
 extensions/list_tools/dlg-personalize-scripts.c    |   48 ++-
 extensions/list_tools/gth-script-editor-dialog.c   |  110 +++-
 extensions/list_tools/gth-script.c                 |   30 +-
 extensions/list_tools/gth-script.h                 |    1 +
 extensions/list_tools/main.c                       |    1 +
 gthumb/dom.c                                       |    6 +-
 10 files changed, 640 insertions(+), 381 deletions(-)
---
diff --git a/extensions/list_tools/callbacks.c b/extensions/list_tools/callbacks.c
index 766aa39..a137cef 100644
--- a/extensions/list_tools/callbacks.c
+++ b/extensions/list_tools/callbacks.c
@@ -84,6 +84,29 @@ browser_data_free (BrowserData *data)
 
 
 static void
+exec_script (GthBrowser *browser,
+	     GthScript  *script)
+{
+	GList *items;
+	GList *file_list;
+
+	items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
+	file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items);
+	if (file_list != NULL) {
+		GthTask *task;
+
+		task = gth_script_task_new (GTK_WINDOW (browser), script, file_list);
+		gth_browser_exec_task (browser, task, FALSE);
+
+		g_object_unref (task);
+	}
+
+	_g_object_list_unref (file_list);
+	_gtk_tree_path_list_free (items);
+}
+
+
+static void
 activate_script_menu_item (GtkMenuItem *menuitem,
 			   gpointer     user_data)
 {
@@ -91,24 +114,8 @@ activate_script_menu_item (GtkMenuItem *menuitem,
 	GthScript   *script;
 
 	script = gth_script_file_get_script (gth_script_file_get (), g_object_get_data (G_OBJECT (menuitem), "script_id"));
-	if (script != NULL) {
-		GList *items;
-		GList *file_list;
-
-		items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (data->browser)));
-		file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (data->browser)), items);
-		if (file_list != NULL) {
-			GthTask *task;
-
-			task = gth_script_task_new (GTK_WINDOW (data->browser), script, file_list);
-			gth_browser_exec_task (data->browser, task, FALSE);
-
-			g_object_unref (task);
-		}
-
-		_g_object_list_unref (file_list);
-		_gtk_tree_path_list_free (items);
-	}
+	if (script != NULL)
+		exec_script (data->browser, script);
 }
 
 
@@ -302,3 +309,31 @@ list_tools__gth_browser_update_sensitivity_cb (GthBrowser *browser)
 	_update_sensitivity (browser, "/ListToolsPopup");
 	/*_update_sensitivity (browser, "/FileListPopup/Open_Actions/ExecWith");*/
 }
+
+
+gpointer
+list_tools__gth_browser_file_list_key_press_cb (GthBrowser  *browser,
+						GdkEventKey *event)
+{
+	gpointer  result = NULL;
+	guint     keyval;
+	GList    *script_list;
+	GList    *scan;
+
+	keyval = gdk_keyval_to_lower (event->keyval);
+
+	script_list = gth_script_file_get_scripts (gth_script_file_get ());
+	for (scan = script_list; scan; scan = scan->next) {
+		GthScript *script = scan->data;
+
+		if (gth_script_get_shortcut (script) == keyval) {
+			exec_script (browser, script);
+			result = GINT_TO_POINTER (1);
+			break;
+		}
+	}
+
+	_g_object_list_unref (script_list);
+
+	return result;
+}
diff --git a/extensions/list_tools/callbacks.h b/extensions/list_tools/callbacks.h
index 765ca7a..af39b77 100644
--- a/extensions/list_tools/callbacks.h
+++ b/extensions/list_tools/callbacks.h
@@ -25,7 +25,9 @@
 
 #include <gthumb.h>
 
-void list_tools__gth_browser_construct_cb          (GthBrowser *browser);
-void list_tools__gth_browser_update_sensitivity_cb (GthBrowser *browser);
+void      list_tools__gth_browser_construct_cb           (GthBrowser  *browser);
+void      list_tools__gth_browser_update_sensitivity_cb  (GthBrowser  *browser);
+gpointer  list_tools__gth_browser_file_list_key_press_cb (GthBrowser  *browser,
+							  GdkEventKey *event);
 
 #endif /* CALLBACKS_H */
diff --git a/extensions/list_tools/data/ui/personalize-scripts.ui b/extensions/list_tools/data/ui/personalize-scripts.ui
index 76addff..cb46276 100644
--- a/extensions/list_tools/data/ui/personalize-scripts.ui
+++ b/extensions/list_tools/data/ui/personalize-scripts.ui
@@ -40,7 +40,7 @@
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkScrolledWindow" id="scripts_scrolledwindow">
-                        <property name="width_request">250</property>
+                        <property name="width_request">350</property>
                         <property name="height_request">300</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
@@ -58,6 +58,7 @@
                     <child>
                       <object class="GtkVButtonBox" id="vbuttonbox3">
                         <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
                         <property name="spacing">6</property>
                         <property name="layout_style">start</property>
                         <child>
diff --git a/extensions/list_tools/data/ui/script-editor.ui b/extensions/list_tools/data/ui/script-editor.ui
index 2bf54af..a03b64a 100644
--- a/extensions/list_tools/data/ui/script-editor.ui
+++ b/extensions/list_tools/data/ui/script-editor.ui
@@ -27,20 +27,6 @@
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="label4">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">_Command:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">name_entry</property>
-          </object>
-          <packing>
-            <property name="top_attach">1</property>
-            <property name="bottom_attach">2</property>
-            <property name="x_options">GTK_FILL</property>
-          </packing>
-        </child>
-        <child>
           <object class="GtkEntry" id="name_entry">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
@@ -52,24 +38,6 @@
           </packing>
         </child>
         <child>
-          <object class="GtkEntry" id="command_entry">
-            <property name="width_request">400</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="invisible_char">&#x25CF;</property>
-            <property name="secondary_icon_stock">gtk-help</property>
-            <property name="secondary_icon_activatable">True</property>
-            <property name="secondary_icon_sensitive">True</property>
-            <property name="secondary_icon_tooltip_text">Help</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="right_attach">2</property>
-            <property name="top_attach">1</property>
-            <property name="bottom_attach">2</property>
-          </packing>
-        </child>
-        <child>
           <object class="GtkCheckButton" id="wait_command_checkbutton">
             <property name="label" translatable="yes">_Wait for the command to finish</property>
             <property name="visible">True</property>
@@ -100,309 +68,47 @@
           </packing>
         </child>
         <child>
-          <object class="GtkHBox" id="command_help_box">
+          <object class="GtkCheckButton" id="shell_script_checkbutton">
+            <property name="label" translatable="yes">_Terminal command (shell script)</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="use_underline">True</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="right_attach">2</property>
+            <property name="top_attach">3</property>
+            <property name="bottom_attach">4</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label23">
+            <property name="visible">True</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Sh_ortcut:</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">shortcut_combobox</property>
+          </object>
+          <packing>
+            <property name="top_attach">2</property>
+            <property name="bottom_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHBox" id="hbox1">
+            <property name="visible">True</property>
+            <property name="spacing">6</property>
             <child>
-              <object class="GtkTable" id="table2">
+              <object class="GtkComboBox" id="shortcut_combobox">
                 <property name="visible">True</property>
-                <property name="n_rows">10</property>
-                <property name="n_columns">2</property>
-                <property name="column_spacing">12</property>
-                <property name="row_spacing">6</property>
-                <child>
-                  <object class="GtkLabel" id="label3">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">%U</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label5">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">%F</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="top_attach">2</property>
-                    <property name="bottom_attach">3</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label6">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">%B</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label7">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">%P</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="top_attach">6</property>
-                    <property name="bottom_attach">7</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label9">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">The file uri</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label10">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">The file path</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">2</property>
-                    <property name="bottom_attach">3</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label11">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">The file basename</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label12">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">The parent folder path</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">6</property>
-                    <property name="bottom_attach">7</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label14">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Special code</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label15">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Description</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label8">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes" comments="Translate only 'message' and 'default_value'.">%ask{ message }{ default value }</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="top_attach">7</property>
-                    <property name="bottom_attach">8</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label13">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Ask an input value</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">7</property>
-                    <property name="bottom_attach">8</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label1">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes" comments="Translate only 'attribute name'">%attr{ attribute name }</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="top_attach">8</property>
-                    <property name="bottom_attach">9</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label16">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">A file attribute</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">8</property>
-                    <property name="bottom_attach">9</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label17">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">%N</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="top_attach">4</property>
-                    <property name="bottom_attach">5</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label18">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">The file basename without extension</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">4</property>
-                    <property name="bottom_attach">5</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label19">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">%E</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="top_attach">5</property>
-                    <property name="bottom_attach">6</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label20">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">The file extension</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">5</property>
-                    <property name="bottom_attach">6</property>
-                  </packing>
-                </child>
+                <property name="model">shortcut_liststore</property>
                 <child>
-                  <object class="GtkLabel" id="label21">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes" comments="Translate only 'text'.">%quote{ text }</property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="top_attach">9</property>
-                    <property name="bottom_attach">10</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label22">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Quote the text </property>
-                    <attributes>
-                      <attribute name="size" value="8000"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">9</property>
-                    <property name="bottom_attach">10</property>
-                  </packing>
+                  <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                  <attributes>
+                    <attribute name="sensitive">1</attribute>
+                    <attribute name="text">0</attribute>
+                  </attributes>
                 </child>
               </object>
               <packing>
@@ -410,6 +116,9 @@
                 <property name="position">0</property>
               </packing>
             </child>
+            <child>
+              <placeholder/>
+            </child>
           </object>
           <packing>
             <property name="left_attach">1</property>
@@ -419,22 +128,368 @@
           </packing>
         </child>
         <child>
-          <object class="GtkCheckButton" id="shell_script_checkbutton">
-            <property name="label" translatable="yes">_Terminal command (shell script)</property>
+          <object class="GtkVBox" id="vbox1">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="use_underline">True</property>
-            <property name="draw_indicator">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkEntry" id="command_entry">
+                <property name="width_request">400</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">&#x25CF;</property>
+                <property name="secondary_icon_stock">gtk-help</property>
+                <property name="secondary_icon_activatable">True</property>
+                <property name="secondary_icon_sensitive">True</property>
+                <property name="secondary_icon_tooltip_text">Help</property>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHBox" id="command_help_box">
+                <child>
+                  <object class="GtkTable" id="table2">
+                    <property name="visible">True</property>
+                    <property name="n_rows">10</property>
+                    <property name="n_columns">2</property>
+                    <property name="column_spacing">12</property>
+                    <property name="row_spacing">6</property>
+                    <child>
+                      <object class="GtkLabel" id="label3">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">%U</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label5">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">%F</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label6">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">%B</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label7">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">%P</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="top_attach">6</property>
+                        <property name="bottom_attach">7</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label9">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">The file uri</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label10">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">The file path</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label11">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">The file basename</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label12">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">The parent folder path</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">6</property>
+                        <property name="bottom_attach">7</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label14">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Special code</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label15">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Description</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label8">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes" comments="Translate only 'message' and 'default_value'.">%ask{ message }{ default value }</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="top_attach">7</property>
+                        <property name="bottom_attach">8</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label13">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Ask an input value</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">7</property>
+                        <property name="bottom_attach">8</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label1">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes" comments="Translate only 'attribute name'">%attr{ attribute name }</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="top_attach">8</property>
+                        <property name="bottom_attach">9</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label16">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">A file attribute</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">8</property>
+                        <property name="bottom_attach">9</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label17">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">%N</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="top_attach">4</property>
+                        <property name="bottom_attach">5</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label18">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">The file basename without extension</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">4</property>
+                        <property name="bottom_attach">5</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label19">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">%E</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="top_attach">5</property>
+                        <property name="bottom_attach">6</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label20">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">The file extension</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">5</property>
+                        <property name="bottom_attach">6</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label21">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes" comments="Translate only 'text'.">%quote{ text }</property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="top_attach">9</property>
+                        <property name="bottom_attach">10</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label22">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Quote the text </property>
+                        <attributes>
+                          <attribute name="size" value="8000"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">9</property>
+                        <property name="bottom_attach">10</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
           </object>
           <packing>
+            <property name="left_attach">1</property>
             <property name="right_attach">2</property>
-            <property name="top_attach">3</property>
-            <property name="bottom_attach">4</property>
+            <property name="top_attach">1</property>
+            <property name="bottom_attach">2</property>
           </packing>
         </child>
         <child>
-          <placeholder/>
+          <object class="GtkAlignment" id="alignment1">
+            <property name="visible">True</property>
+            <property name="top_padding">5</property>
+            <child>
+              <object class="GtkLabel" id="label4">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <property name="yalign">0</property>
+                <property name="label" translatable="yes">_Command:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">command_entry</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="top_attach">1</property>
+            <property name="bottom_attach">2</property>
+          </packing>
         </child>
       </object>
       <packing>
@@ -443,4 +498,12 @@
       </packing>
     </child>
   </object>
+  <object class="GtkListStore" id="shortcut_liststore">
+    <columns>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+      <!-- column-name sensitive -->
+      <column type="gboolean"/>
+    </columns>
+  </object>
 </interface>
diff --git a/extensions/list_tools/dlg-personalize-scripts.c b/extensions/list_tools/dlg-personalize-scripts.c
index 17ad911..13df74d 100644
--- a/extensions/list_tools/dlg-personalize-scripts.c
+++ b/extensions/list_tools/dlg-personalize-scripts.c
@@ -22,6 +22,7 @@
 
 #include <config.h>
 #include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
 #include <gthumb.h>
 #include "dlg-personalize-scripts.h"
 #include "gth-script.h"
@@ -36,6 +37,7 @@
 enum {
 	COLUMN_SCRIPT,
 	COLUMN_NAME,
+	COLUMN_SHORTCUT,
 	COLUMN_VISIBLE,
 	NUM_COLUMNS
 };
@@ -129,6 +131,22 @@ row_inserted_cb (GtkTreeModel *tree_model,
 }
 
 
+static char *
+get_script_shortcut (GthScript *script)
+{
+	guint        keyval;
+	char        *shortcut;
+
+	keyval = gth_script_get_shortcut (script);
+	if ((keyval >= GDK_KP_0) && (keyval <= GDK_KP_9))
+		shortcut = g_strdup_printf ("%c", '0' + (keyval - GDK_KP_0));
+	else
+		shortcut = g_strdup ("");
+
+	return shortcut;
+}
+
+
 static void
 set_script_list (DialogData *data,
 		 GList      *script_list)
@@ -139,14 +157,20 @@ set_script_list (DialogData *data,
 
 	for (scan = script_list; scan; scan = scan->next) {
 		GthScript   *script = scan->data;
+		char        *shortcut;
 		GtkTreeIter  iter;
 
+		shortcut = get_script_shortcut (script);
+
 		gtk_list_store_append (data->list_store, &iter);
 		gtk_list_store_set (data->list_store, &iter,
 				    COLUMN_SCRIPT, script,
 				    COLUMN_NAME, gth_script_get_display_name (script),
+				    COLUMN_SHORTCUT, shortcut,
 				    COLUMN_VISIBLE, gth_script_is_visible (script),
 				   -1);
+
+		g_free (shortcut);
 	}
 
 	g_signal_handlers_unblock_by_func (data->list_store, row_inserted_cb, data);
@@ -242,6 +266,20 @@ add_columns (GtkTreeView *treeview,
         gtk_tree_view_column_set_expand (column, TRUE);
         gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
 
+        /* the shortcut column */
+
+	column = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title (column, _("Shortcut"));
+
+	renderer = gtk_cell_renderer_text_new ();
+	g_object_set (renderer, "xalign", 0.5, NULL);
+        gtk_tree_view_column_pack_start (column, renderer, TRUE);
+        gtk_tree_view_column_set_attributes (column, renderer,
+                                             "text", COLUMN_SHORTCUT,
+                                             NULL);
+
+        gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+
 	/* the checkbox column */
 
 	column = gtk_tree_view_column_new ();
@@ -339,13 +377,20 @@ script_editor_dialog__response_cb (GtkDialog *dialog,
 	else
 		change_list = get_script_iter (data, script, &iter);
 
-	if (change_list)
+	if (change_list) {
+		char *shortcut;
+
+		shortcut = get_script_shortcut (script);
 		gtk_list_store_set (data->list_store, &iter,
 				    COLUMN_SCRIPT, script,
 				    COLUMN_NAME, gth_script_get_display_name (script),
+				    COLUMN_SHORTCUT, shortcut,
 				    COLUMN_VISIBLE, gth_script_is_visible (script),
 				    -1);
 
+		g_free (shortcut);
+	}
+
 	gtk_widget_destroy (GTK_WIDGET (dialog));
 
 	g_object_unref (script);
@@ -494,6 +539,7 @@ dlg_personalize_scripts (GthBrowser *browser)
 	data->list_store = gtk_list_store_new (NUM_COLUMNS,
 					       G_TYPE_OBJECT,
 					       G_TYPE_STRING,
+					       G_TYPE_STRING,
 					       G_TYPE_BOOLEAN);
 	data->list_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (data->list_store));
 	g_object_unref (data->list_store);
diff --git a/extensions/list_tools/gth-script-editor-dialog.c b/extensions/list_tools/gth-script-editor-dialog.c
index b2f1be0..fd3fc9e 100644
--- a/extensions/list_tools/gth-script-editor-dialog.c
+++ b/extensions/list_tools/gth-script-editor-dialog.c
@@ -22,15 +22,22 @@
 
 #include <config.h>
 #include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
 #include <gthumb.h>
 #include "gth-script-editor-dialog.h"
+#include "gth-script-file.h"
 
 
 #define GET_WIDGET(name) _gtk_builder_get_widget (self->priv->builder, (name))
+#define NO_SHORTCUT 0
 
 
 static gpointer parent_class = NULL;
 
+enum {
+	SHORTCUT_NAME_COLUMN = 0,
+	SHORTCUT_SENSITIVE_COLUMN
+};
 
 struct _GthScriptEditorDialogPrivate {
 	GtkBuilder *builder;
@@ -138,13 +145,15 @@ gth_script_editor_dialog_construct (GthScriptEditorDialog *self,
 				    const char            *title,
 			            GtkWindow             *parent)
 {
-	GtkWidget *content;
+	GtkWidget   *content;
+	GtkTreeIter  iter;
+	int          i;
 
 	if (title != NULL)
-    		gtk_window_set_title (GTK_WINDOW (self), title);
-  	if (parent != NULL)
-    		gtk_window_set_transient_for (GTK_WINDOW (self), parent);
-    	gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
+		gtk_window_set_title (GTK_WINDOW (self), title);
+	if (parent != NULL)
+		gtk_window_set_transient_for (GTK_WINDOW (self), parent);
+	gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
 	gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE);
 	gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), 5);
 	gtk_container_set_border_width (GTK_CONTAINER (self), 5);
@@ -153,20 +162,37 @@ gth_script_editor_dialog_construct (GthScriptEditorDialog *self,
 	gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_SAVE, GTK_RESPONSE_OK);
 	gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_HELP, GTK_RESPONSE_HELP);
 
-    	self->priv->builder = _gtk_builder_new_from_file ("script-editor.ui", "list_tools");
+	self->priv->builder = _gtk_builder_new_from_file ("script-editor.ui", "list_tools");
+
+	content = _gtk_builder_get_widget (self->priv->builder, "script_editor");
+	gtk_container_set_border_width (GTK_CONTAINER (content), 5);
+	gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), content, TRUE, TRUE, 0);
+
+	g_signal_connect (GET_WIDGET ("command_entry"),
+			  "icon-press",
+			  G_CALLBACK (command_entry_icon_press_cb),
+			  self);
+
+	gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("shortcut_liststore")), &iter);
+	gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("shortcut_liststore")), &iter,
+			    SHORTCUT_NAME_COLUMN, _("none"),
+			    -1);
+
+	for (i = 0; i <= 9; i++) {
+		char *value;
 
-    	content = _gtk_builder_get_widget (self->priv->builder, "script_editor");
-    	gtk_container_set_border_width (GTK_CONTAINER (content), 5);
-  	gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), content, TRUE, TRUE, 0);
+		value = g_strdup_printf (_("key %d on the numeric keypad"), i);
+		gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("shortcut_liststore")), &iter);
+		gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("shortcut_liststore")), &iter,
+				    SHORTCUT_NAME_COLUMN, value,
+				    -1);
 
-  	g_signal_connect (GET_WIDGET ("command_entry"),
-  			  "icon-press",
-  			  G_CALLBACK (command_entry_icon_press_cb),
-  			  self);
+		g_free (value);
+	}
 
-  	/**/
+	/**/
 
-  	gth_script_editor_dialog_set_script (self, NULL);
+	gth_script_editor_dialog_set_script (self, NULL);
 }
 
 
@@ -191,6 +217,7 @@ _gth_script_editor_dialog_set_new_script (GthScriptEditorDialog *self)
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("shell_script_checkbutton")), TRUE);
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("for_each_file_checkbutton")), FALSE);
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("wait_command_checkbutton")), FALSE);
+	gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("shortcut_combobox")), NO_SHORTCUT);
 }
 
 
@@ -198,6 +225,11 @@ void
 gth_script_editor_dialog_set_script (GthScriptEditorDialog *self,
 				     GthScript             *script)
 {
+	GtkTreeIter  iter;
+	GtkTreePath *path;
+	GList       *script_list;
+	GList       *scan;
+
 	g_free (self->priv->script_id);
 	self->priv->script_id = NULL;
 	self->priv->script_visible = TRUE;
@@ -205,6 +237,8 @@ gth_script_editor_dialog_set_script (GthScriptEditorDialog *self,
 	_gth_script_editor_dialog_set_new_script (self);
 
 	if (script != NULL) {
+		guint keyval;
+
 		self->priv->script_id = g_strdup (gth_script_get_id (script));
 		self->priv->script_visible = gth_script_is_visible (script);
 
@@ -213,8 +247,44 @@ gth_script_editor_dialog_set_script (GthScriptEditorDialog *self,
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("shell_script_checkbutton")), gth_script_is_shell_script (script));
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("for_each_file_checkbutton")), gth_script_for_each_file (script));
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("wait_command_checkbutton")), gth_script_wait_command (script));
+
+		keyval = gth_script_get_shortcut (script);
+		if ((keyval >= GDK_KP_0) && (keyval <= GDK_KP_9))
+			gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("shortcut_combobox")), (keyval - GDK_KP_0) + 1);
+		else
+			gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("shortcut_combobox")), NO_SHORTCUT);
 	}
 
+	if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (GET_WIDGET ("shortcut_liststore")), &iter)) {
+		do {
+			gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("shortcut_liststore")), &iter,
+					    SHORTCUT_SENSITIVE_COLUMN, TRUE,
+					    -1);
+		}
+		while (gtk_tree_model_iter_next (GTK_TREE_MODEL (GET_WIDGET ("shortcut_liststore")), &iter));
+	}
+
+	script_list = gth_script_file_get_scripts (gth_script_file_get ());
+	for (scan = script_list; scan; scan = scan->next) {
+		GthScript *other_script = scan->data;
+		guint      keyval;
+
+		keyval = gth_script_get_shortcut (other_script);
+		if ((keyval >= GDK_KP_0) && (keyval <= GDK_KP_9)) {
+			if (g_strcmp0 (gth_script_get_id (other_script), self->priv->script_id) == 0)
+				continue;
+
+			path = gtk_tree_path_new_from_indices (keyval - GDK_KP_0 + 1, -1);
+			gtk_tree_model_get_iter (GTK_TREE_MODEL (GET_WIDGET ("shortcut_liststore")), &iter, path);
+			gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("shortcut_liststore")), &iter,
+					    SHORTCUT_SENSITIVE_COLUMN, FALSE,
+					    -1);
+
+			gtk_tree_path_free (path);
+		}
+	}
+	_g_object_list_unref (script_list);
+
 	update_sensitivity (self);
 }
 
@@ -224,10 +294,19 @@ gth_script_editor_dialog_get_script (GthScriptEditorDialog  *self,
 				     GError                **error)
 {
 	GthScript *script;
+	int        keyval_index;
+	guint      keyval;
 
 	script = gth_script_new ();
 	if (self->priv->script_id != NULL)
 		g_object_set (script, "id", self->priv->script_id, NULL);
+
+	keyval_index = gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("shortcut_combobox")));
+	if ((keyval_index >= 1) && (keyval_index <= 10))
+		keyval = GDK_KP_0 + (keyval_index - 1);
+	else
+		keyval = GDK_VoidSymbol;
+
 	g_object_set (script,
 		      "display-name", gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("name_entry"))),
 		      "command", gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("command_entry"))),
@@ -235,6 +314,7 @@ gth_script_editor_dialog_get_script (GthScriptEditorDialog  *self,
 		      "shell-script", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("shell_script_checkbutton"))),
 		      "for-each-file", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("for_each_file_checkbutton"))),
 		      "wait-command", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("wait_command_checkbutton"))),
+		      "shortcut", keyval,
 		      NULL);
 
 	if (g_strcmp0 (gth_script_get_display_name (script), "") == 0) {
diff --git a/extensions/list_tools/gth-script.c b/extensions/list_tools/gth-script.c
index fb692ed..21e14a0 100644
--- a/extensions/list_tools/gth-script.c
+++ b/extensions/list_tools/gth-script.c
@@ -22,6 +22,7 @@
 
 #include <config.h>
 #include <gthumb.h>
+#include <gdk/gdkkeysyms.h>
 #include "gth-script.h"
 
 
@@ -33,7 +34,8 @@ enum {
         PROP_VISIBLE,
         PROP_SHELL_SCRIPT,
         PROP_FOR_EACH_FILE,
-        PROP_WAIT_COMMAND
+        PROP_WAIT_COMMAND,
+        PROP_SHORTCUT
 };
 
 
@@ -45,6 +47,7 @@ struct _GthScriptPrivate {
 	gboolean  shell_script;
 	gboolean  for_each_file;
 	gboolean  wait_command;
+	guint     shortcut;
 };
 
 
@@ -68,6 +71,7 @@ gth_script_real_create_element (DomDomizable *base,
 					       "shell-script", (self->priv->shell_script ? "true" : "false"),
 					       "for-each-file", (self->priv->for_each_file ? "true" : "false"),
 					       "wait-command", (self->priv->wait_command ? "true" : "false"),
+					       "shortcut", gdk_keyval_name (self->priv->shortcut),
 					       NULL);
 	if (! self->priv->visible)
 		dom_element_set_attribute (element, "display", "none");
@@ -93,6 +97,7 @@ gth_script_real_load_from_element (DomDomizable *base,
 		      "shell-script", (g_strcmp0 (dom_element_get_attribute (element, "shell-script"), "true") == 0),
 		      "for-each-file", (g_strcmp0 (dom_element_get_attribute (element, "for-each-file"), "true") == 0),
 		      "wait-command", (g_strcmp0 (dom_element_get_attribute (element, "wait-command"), "true") == 0),
+		      "shortcut", gdk_keyval_from_name (dom_element_get_attribute (element, "shortcut")),
 		      NULL);
 }
 
@@ -112,6 +117,7 @@ gth_script_real_duplicate (GthDuplicable *duplicable)
 		      "shell-script", script->priv->shell_script,
 		      "for-each-file", script->priv->for_each_file,
 		      "wait-command", script->priv->wait_command,
+		      "shortcut", script->priv->shortcut,
 		      NULL);
 
 	return (GObject *) new_script;
@@ -174,6 +180,9 @@ gth_script_set_property (GObject      *object,
 	case PROP_WAIT_COMMAND:
 		self->priv->wait_command = g_value_get_boolean (value);
 		break;
+	case PROP_SHORTCUT:
+		self->priv->shortcut = g_value_get_uint (value);
+		break;
 	default:
 		break;
 	}
@@ -212,6 +221,9 @@ gth_script_get_property (GObject    *object,
 	case PROP_WAIT_COMMAND:
 		g_value_set_boolean (value, self->priv->wait_command);
 		break;
+	case PROP_SHORTCUT:
+		g_value_set_uint (value, self->priv->wait_command);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 		break;
@@ -283,6 +295,15 @@ gth_script_class_init (GthScriptClass *klass)
 							       "Whether to wait command to finish",
 							       FALSE,
 							       G_PARAM_READWRITE));
+	g_object_class_install_property (object_class,
+					 PROP_SHORTCUT,
+					 g_param_spec_uint ("shortcut",
+							    "Shortcut",
+							    "The keyboard shortcut to activate the script",
+							    0,
+							    G_MAXUINT,
+							    GDK_VoidSymbol,
+							    G_PARAM_READWRITE));
 }
 
 
@@ -813,3 +834,10 @@ gth_script_get_command_line (GthScript  *script,
 
 	return result;
 }
+
+
+guint
+gth_script_get_shortcut (GthScript *script)
+{
+	return script->priv->shortcut;
+}
diff --git a/extensions/list_tools/gth-script.h b/extensions/list_tools/gth-script.h
index 8152b8c..5d3e16d 100644
--- a/extensions/list_tools/gth-script.h
+++ b/extensions/list_tools/gth-script.h
@@ -65,6 +65,7 @@ char *            gth_script_get_command_line          (GthScript  *script,
 						        GtkWindow  *parent,
 						        GList      *file_list /* GthFileData */,
 						        GError    **error);
+guint             gth_script_get_shortcut              (GthScript  *script);
 
 G_END_DECLS
 
diff --git a/extensions/list_tools/main.c b/extensions/list_tools/main.c
index d84c379..c1a03d3 100644
--- a/extensions/list_tools/main.c
+++ b/extensions/list_tools/main.c
@@ -32,6 +32,7 @@ gthumb_extension_activate (void)
 {
 	gth_hook_add_callback ("gth-browser-construct", 10, G_CALLBACK (list_tools__gth_browser_construct_cb), NULL);
 	gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK (list_tools__gth_browser_update_sensitivity_cb), NULL);
+	gth_hook_add_callback ("gth-browser-file-list-key-press", 10, G_CALLBACK (list_tools__gth_browser_file_list_key_press_cb), NULL);
 }
 
 
diff --git a/gthumb/dom.c b/gthumb/dom.c
index bb9904c..79ee312 100644
--- a/gthumb/dom.c
+++ b/gthumb/dom.c
@@ -380,9 +380,11 @@ dom_element_set_attribute (DomElement *self,
 {
 	g_return_if_fail (DOM_IS_ELEMENT (self));
 	g_return_if_fail (name != NULL);
-	g_return_if_fail (value != NULL);
 
-	g_hash_table_insert (self->attributes, g_strdup (name), g_strdup (value));
+	if (value == NULL)
+		g_hash_table_remove (self->attributes, name);
+	else
+		g_hash_table_insert (self->attributes, g_strdup (name), g_strdup (value));
 }
 
 



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