[gthumb] script editor: use the new template editor



commit 21a4b2071052a01b522b022ddbb6397420205805
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun May 16 12:49:52 2021 +0200

    script editor: use the new template editor

 .../list_tools/data/ui/personalize-scripts.ui      |  46 +-
 extensions/list_tools/data/ui/script-editor.ui     | 579 ++++-----------------
 extensions/list_tools/gth-script-editor-dialog.c   |  78 ++-
 3 files changed, 183 insertions(+), 520 deletions(-)
---
diff --git a/extensions/list_tools/data/ui/personalize-scripts.ui 
b/extensions/list_tools/data/ui/personalize-scripts.ui
index 94f1a46a..35ffa246 100644
--- a/extensions/list_tools/data/ui/personalize-scripts.ui
+++ b/extensions/list_tools/data/ui/personalize-scripts.ui
@@ -1,30 +1,30 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
+<!-- Generated with glade 3.38.2 -->
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkBox" id="dialog_content">
     <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="border_width">15</property>
+    <property name="can-focus">False</property>
+    <property name="border-width">15</property>
     <property name="orientation">vertical</property>
     <property name="spacing">2</property>
     <child>
       <object class="GtkBox" id="vbox4">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="border_width">6</property>
+        <property name="can-focus">False</property>
+        <property name="border-width">6</property>
         <property name="orientation">vertical</property>
         <property name="spacing">12</property>
         <child>
           <object class="GtkBox" id="vbox6">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
               <object class="GtkLabel" id="scripts_label">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
+                <property name="can-focus">False</property>
                 <property name="halign">start</property>
                 <property name="label" translatable="yes">Co_mmands:</property>
               </object>
@@ -37,16 +37,16 @@
             <child>
               <object class="GtkBox" id="hbox3">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
+                <property name="can-focus">False</property>
                 <property name="spacing">12</property>
                 <child>
                   <object class="GtkScrolledWindow" id="scripts_scrolledwindow">
-                    <property name="width_request">500</property>
-                    <property name="height_request">300</property>
+                    <property name="width-request">500</property>
+                    <property name="height-request">500</property>
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
+                    <property name="can-focus">True</property>
                     <property name="vexpand">True</property>
-                    <property name="shadow_type">etched-in</property>
+                    <property name="shadow-type">etched-in</property>
                     <child>
                       <placeholder/>
                     </child>
@@ -60,17 +60,17 @@
                 <child>
                   <object class="GtkButtonBox" id="vbuttonbox3">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
-                    <property name="layout_style">start</property>
+                    <property name="layout-style">start</property>
                     <child>
                       <object class="GtkButton" id="new_button">
                         <property name="label">gtk-new</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="use_stock">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">True</property>
+                        <property name="use-stock">True</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -82,9 +82,9 @@
                       <object class="GtkButton" id="edit_button">
                         <property name="label">gtk-edit</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="use_stock">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">True</property>
+                        <property name="use-stock">True</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -96,9 +96,9 @@
                       <object class="GtkButton" id="delete_button">
                         <property name="label">gtk-remove</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="use_stock">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">True</property>
+                        <property name="use-stock">True</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
diff --git a/extensions/list_tools/data/ui/script-editor.ui b/extensions/list_tools/data/ui/script-editor.ui
index f6a0bb29..80b6c978 100644
--- a/extensions/list_tools/data/ui/script-editor.ui
+++ b/extensions/list_tools/data/ui/script-editor.ui
@@ -1,118 +1,118 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
+<!-- Generated with glade 3.38.2 -->
 <interface>
-  <requires lib="gtk+" version="3.10"/>
+  <requires lib="gtk+" version="3.16"/>
   <object class="GtkBox" id="script_editor">
     <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="border_width">15</property>
+    <property name="can-focus">False</property>
+    <property name="border-width">15</property>
     <property name="orientation">vertical</property>
     <property name="spacing">12</property>
     <child>
       <object class="GtkTable" id="table1">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="n_rows">6</property>
-        <property name="n_columns">2</property>
-        <property name="column_spacing">12</property>
-        <property name="row_spacing">6</property>
+        <property name="can-focus">False</property>
+        <property name="n-rows">6</property>
+        <property name="n-columns">2</property>
+        <property name="column-spacing">12</property>
+        <property name="row-spacing">6</property>
         <child>
           <object class="GtkLabel" id="label2">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="label" translatable="yes">_Name:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">name_entry</property>
+            <property name="use-underline">True</property>
+            <property name="mnemonic-widget">name_entry</property>
             <property name="xalign">1</property>
           </object>
           <packing>
-            <property name="x_options">GTK_FILL</property>
-            <property name="y_options">GTK_FILL</property>
+            <property name="x-options">GTK_FILL</property>
+            <property name="y-options">GTK_FILL</property>
           </packing>
         </child>
         <child>
           <object class="GtkEntry" id="name_entry">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="invisible_char">●</property>
+            <property name="can-focus">True</property>
+            <property name="invisible-char">●</property>
           </object>
           <packing>
-            <property name="left_attach">1</property>
-            <property name="right_attach">2</property>
-            <property name="y_options">GTK_FILL</property>
+            <property name="left-attach">1</property>
+            <property name="right-attach">2</property>
+            <property name="y-options">GTK_FILL</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="use_action_appearance">False</property>
+            <property name="use-action-appearance">False</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="xalign">0</property>
-            <property name="draw_indicator">True</property>
+            <property name="can-focus">True</property>
+            <property name="receives-default">False</property>
+            <property name="halign">start</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">5</property>
-            <property name="bottom_attach">6</property>
-            <property name="y_options">GTK_FILL</property>
+            <property name="right-attach">2</property>
+            <property name="top-attach">5</property>
+            <property name="bottom-attach">6</property>
+            <property name="y-options">GTK_FILL</property>
           </packing>
         </child>
         <child>
           <object class="GtkCheckButton" id="for_each_file_checkbutton">
             <property name="label" translatable="yes">E_xecute command once for every file</property>
-            <property name="use_action_appearance">False</property>
+            <property name="use-action-appearance">False</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="xalign">0</property>
-            <property name="draw_indicator">True</property>
+            <property name="can-focus">True</property>
+            <property name="receives-default">False</property>
+            <property name="halign">start</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">4</property>
-            <property name="bottom_attach">5</property>
+            <property name="right-attach">2</property>
+            <property name="top-attach">4</property>
+            <property name="bottom-attach">5</property>
           </packing>
         </child>
         <child>
           <object class="GtkCheckButton" id="shell_script_checkbutton">
             <property name="label" translatable="yes">_Terminal command (shell script)</property>
-            <property name="use_action_appearance">False</property>
+            <property name="use-action-appearance">False</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="xalign">0</property>
-            <property name="draw_indicator">True</property>
+            <property name="can-focus">True</property>
+            <property name="receives-default">False</property>
+            <property name="halign">start</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>
+            <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="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="label" translatable="yes">Sh_ortcut:</property>
-            <property name="use_underline">True</property>
+            <property name="use-underline">True</property>
             <property name="xalign">1</property>
           </object>
           <packing>
-            <property name="top_attach">2</property>
-            <property name="bottom_attach">3</property>
-            <property name="x_options">GTK_FILL</property>
-            <property name="y_options">GTK_FILL</property>
+            <property name="top-attach">2</property>
+            <property name="bottom-attach">3</property>
+            <property name="x-options">GTK_FILL</property>
+            <property name="y-options">GTK_FILL</property>
           </packing>
         </child>
         <child>
           <object class="GtkBox" id="accel_box">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="spacing">6</property>
             <child>
               <placeholder/>
@@ -122,27 +122,41 @@
             </child>
           </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>
-            <property name="y_options">GTK_FILL</property>
+            <property name="left-attach">1</property>
+            <property name="right-attach">2</property>
+            <property name="top-attach">2</property>
+            <property name="bottom-attach">3</property>
+            <property name="y-options">GTK_FILL</property>
           </packing>
         </child>
         <child>
-          <object class="GtkBox" id="vbox1">
+          <object class="GtkLabel" id="label4">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">6</property>
+            <property name="can-focus">False</property>
+            <property name="margin-top">5</property>
+            <property name="label" translatable="yes">_Command:</property>
+            <property name="use-underline">True</property>
+            <property name="xalign">1</property>
+            <property name="yalign">0</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="GtkBox">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <property name="hexpand">True</property>
             <child>
               <object class="GtkEntry" id="command_entry">
-                <property name="width_request">400</property>
+                <property name="width-request">500</property>
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="invisible_char">●</property>
-                <property name="secondary_icon_name">help-browser-symbolic</property>
-                <property name="secondary_icon_tooltip_text">Help</property>
+                <property name="can-focus">True</property>
+                <property name="invisible-char">●</property>
+                <property name="secondary-icon-tooltip-text">Help</property>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -151,394 +165,17 @@
               </packing>
             </child>
             <child>
-              <object class="GtkBox" id="command_help_box">
-                <property name="can_focus">False</property>
+              <object class="GtkButton" id="edit_command_button">
+                <property name="visible">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">True</property>
+                <property name="tooltip-text" translatable="yes">Edit command</property>
                 <child>
-                  <object class="GtkTable" id="table2">
+                  <object class="GtkImage">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="n_rows">11</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="can_focus">False</property>
-                        <property name="label">%U</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="size" value="8000"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label5">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label">%F</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="size" value="8000"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label6">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label">%B</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="size" value="8000"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="top_attach">3</property>
-                        <property name="bottom_attach">4</property>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label7">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label">%P</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="size" value="8000"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="top_attach">6</property>
-                        <property name="bottom_attach">7</property>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label9">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">The file uri</property>
-                        <property name="xalign">0</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>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label10">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">The file path</property>
-                        <property name="xalign">0</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>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label11">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">The file basename</property>
-                        <property name="xalign">0</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>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label12">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">The parent folder path</property>
-                        <property name="xalign">0</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>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label14">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Special code</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="weight" value="bold"/>
-                          <attribute name="size" value="8000"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label15">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Description</property>
-                        <property name="xalign">0</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>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label8">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes" comments="Translate only 'message' and 
'default_value'.">%ask{ message }{ default value }</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="size" value="8000"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="top_attach">8</property>
-                        <property name="bottom_attach">9</property>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label13">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Ask an input value</property>
-                        <property name="xalign">0</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>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label1">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes" comments="Translate only 'attribute 
name'">%attr{ attribute name }</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="size" value="8000"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="top_attach">9</property>
-                        <property name="bottom_attach">10</property>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label16">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">A file attribute</property>
-                        <property name="xalign">0</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>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label17">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">%N</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="size" value="8000"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="top_attach">4</property>
-                        <property name="bottom_attach">5</property>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label18">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">The file basename without 
extension</property>
-                        <property name="xalign">0</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>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label19">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">%E</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="size" value="8000"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="top_attach">5</property>
-                        <property name="bottom_attach">6</property>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label20">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">The file extension</property>
-                        <property name="xalign">0</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>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label21">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes" comments="Translate only 'text'.">%quote{ 
text }</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="size" value="8000"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="top_attach">10</property>
-                        <property name="bottom_attach">11</property>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label22">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Quote the text </property>
-                        <property name="xalign">0</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">10</property>
-                        <property name="bottom_attach">11</property>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label25">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label">%T</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="size" value="8000"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="top_attach">7</property>
-                        <property name="bottom_attach">8</property>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label24">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">The current date and time</property>
-                        <property name="xalign">0</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>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
+                    <property name="can-focus">False</property>
+                    <property name="icon-name">document-edit-symbolic</property>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
                 </child>
               </object>
               <packing>
@@ -547,37 +184,15 @@
                 <property name="position">1</property>
               </packing>
             </child>
+            <style>
+              <class name="linked"/>
+            </style>
           </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>
-            <property name="y_options">GTK_FILL</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkAlignment" id="alignment1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="top_padding">5</property>
-            <child>
-              <object class="GtkLabel" id="label4">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">_Command:</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">command_entry</property>
-                <property name="xalign">1</property>
-                <property name="yalign">0</property>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="top_attach">1</property>
-            <property name="bottom_attach">2</property>
-            <property name="x_options">GTK_FILL</property>
-            <property name="y_options">GTK_FILL</property>
+            <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>
       </object>
diff --git a/extensions/list_tools/gth-script-editor-dialog.c 
b/extensions/list_tools/gth-script-editor-dialog.c
index 29d8dbc0..749b168f 100644
--- a/extensions/list_tools/gth-script-editor-dialog.c
+++ b/extensions/list_tools/gth-script-editor-dialog.c
@@ -31,6 +31,20 @@
 #define NO_SHORTCUT 0
 
 
+static GthTemplateCode Command_Special_Codes[] = {
+       { GTH_TEMPLATE_CODE_TYPE_QUOTED, N_("Quoted text"), GTH_SCRIPT_CODE_QUOTE, 1 },
+       { GTH_TEMPLATE_CODE_TYPE_SIMPLE, N_("File URI"), GTH_SCRIPT_CODE_URI, 0 },
+       { GTH_TEMPLATE_CODE_TYPE_SIMPLE, N_("File path"), GTH_SCRIPT_CODE_PATH, 0 },
+       { GTH_TEMPLATE_CODE_TYPE_SIMPLE, N_("File name"), GTH_SCRIPT_CODE_BASENAME, 0 },
+       { GTH_TEMPLATE_CODE_TYPE_SIMPLE, N_("File name, no extension"), 
GTH_SCRIPT_CODE_BASENAME_NO_EXTENSION, 0 },
+       { GTH_TEMPLATE_CODE_TYPE_SIMPLE, N_("File extension"), GTH_SCRIPT_CODE_EXTENSION, 0 },
+       { GTH_TEMPLATE_CODE_TYPE_SIMPLE, N_("Folder path"), GTH_SCRIPT_CODE_PARENT_PATH, 0 },
+       { GTH_TEMPLATE_CODE_TYPE_DATE, N_("Timestamp"), GTH_SCRIPT_CODE_TIMESTAMP, 1 },
+       { GTH_TEMPLATE_CODE_TYPE_ASK_VALUE, N_("Ask a value"), GTH_SCRIPT_CODE_ASK_VALUE, 2 },
+       { GTH_TEMPLATE_CODE_TYPE_FILE_ATTRIBUTE, N_("File attribute"), GTH_SCRIPT_CODE_FILE_ATTRIBUTE, 1 },
+};
+
+
 enum {
        SHORTCUT_NAME_COLUMN = 0,
        SHORTCUT_SENSITIVE_COLUMN
@@ -45,7 +59,6 @@ struct _GthScriptEditorDialogPrivate {
        gboolean     wait_command;
        gboolean     shell_script;
        gboolean     for_each_file;
-       gboolean     help_visible;
        GthShortcut *shortcut;
 };
 
@@ -91,7 +104,6 @@ gth_script_editor_dialog_init (GthScriptEditorDialog *dialog)
        dialog->priv->wait_command = FALSE;
        dialog->priv->shell_script = FALSE;
        dialog->priv->for_each_file = FALSE;
-       dialog->priv->help_visible = FALSE;
        dialog->priv->shortcut = NULL;
        dialog->priv->shortcut_window = NULL;
 }
@@ -105,19 +117,53 @@ update_sensitivity (GthScriptEditorDialog *self)
 
 
 static void
-command_entry_icon_press_cb (GtkEntry             *entry,
-                             GtkEntryIconPosition  icon_pos,
-                             GdkEvent             *event,
-                             gpointer              user_data)
+command_editor_dialog_response_cb (GtkDialog *dialog,
+                                  int        response_id,
+                                  gpointer   user_data)
 {
        GthScriptEditorDialog *self = user_data;
+       char                  *value;
+
+       switch (response_id) {
+       case GTK_RESPONSE_OK:
+               value = gth_template_editor_dialog_get_template (GTH_TEMPLATE_EDITOR_DIALOG (dialog));
+               if (value != NULL) {
+                       gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("command_entry")), value);
+                       gtk_widget_destroy (GTK_WIDGET (dialog));
+
+                       g_free (value);
+               }
+               break;
+
+       default:
+               gtk_widget_destroy (GTK_WIDGET (dialog));
+               break;
+       }
+}
+
 
-       self->priv->help_visible = ! self->priv->help_visible;
+static void
+edit_command_button_clicked_cb (GtkButton *button,
+                               gpointer   user_data)
+{
+       GthScriptEditorDialog *self = user_data;
+       GtkWidget             *dialog;
 
-       if (self->priv->help_visible)
-               gtk_widget_show (GET_WIDGET("command_help_box"));
-       else
-               gtk_widget_hide (GET_WIDGET("command_help_box"));
+       dialog = gth_template_editor_dialog_new (Command_Special_Codes,
+                                                G_N_ELEMENTS (Command_Special_Codes),
+                                                0,
+                                                _("Edit Command"),
+                                                GTK_WINDOW (self));
+       gth_template_editor_dialog_set_preview_func (GTH_TEMPLATE_EDITOR_DIALOG (dialog),
+                                                    (TemplatePreviewFunc) gth_script_get_preview,
+                                                    NULL);
+       gth_template_editor_dialog_set_template (GTH_TEMPLATE_EDITOR_DIALOG (dialog),
+                                                gtk_entry_get_text (GTK_ENTRY (GET_WIDGET 
("command_entry"))));
+       g_signal_connect (dialog,
+                         "response",
+                         G_CALLBACK (command_editor_dialog_response_cb),
+                         self);
+       gtk_widget_show (dialog);
 }
 
 
@@ -149,8 +195,10 @@ gth_script_editor_dialog_construct (GthScriptEditorDialog *self,
 {
        if (title != NULL)
                gtk_window_set_title (GTK_WINDOW (self), title);
-       if (parent != NULL)
+       if (parent != NULL) {
                gtk_window_set_transient_for (GTK_WINDOW (self), parent);
+               _gtk_dialog_add_to_window_group (GTK_DIALOG (self));
+       }
 
        gtk_dialog_add_buttons (GTK_DIALOG (self),
                                _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
@@ -170,9 +218,9 @@ gth_script_editor_dialog_construct (GthScriptEditorDialog *self,
        gtk_widget_show (self->priv->accel_button);
        gtk_box_pack_start (GTK_BOX (GET_WIDGET ("accel_box")), self->priv->accel_button, FALSE, FALSE, 0);
 
-       g_signal_connect (GET_WIDGET ("command_entry"),
-                         "icon-press",
-                         G_CALLBACK (command_entry_icon_press_cb),
+       g_signal_connect (GET_WIDGET ("edit_command_button"),
+                         "clicked",
+                         G_CALLBACK (edit_command_button_clicked_cb),
                          self);
 
        /**/


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