[nautilus-actions] Let the user edit its preferred export format



commit 128d5db6eb482c6d359ed903d8b16613e5dab9b4
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sun Oct 25 16:12:34 2009 +0100

    Let the user edit its preferred export format

 ChangeLog                                |    9 +
 src/nact/nact-preferences-editor.c       |   50 +++++-
 src/nact/nautilus-actions-config-tool.ui |  305 +++++++++++++++++-------------
 3 files changed, 232 insertions(+), 132 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 07568c7..6e71eae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-10-25 Pierre Wieser <pwieser trychlos org>
+
+	* src/nact/nact-preferences-editor.c
+	(on_base_runtime_init_dialog, save_preferences):
+	Let the user edit its preferred export format.
+
+	* src/nact/nautilus-actions-config-tool.ui:
+	Add Export tab to Preferences dialog.
+
 2009-10-23 Pierre Wieser <pwieser trychlos org>
 
 	Populates Nautilus background menus and Nautilus toolbar.
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index 4254238..8d48dec 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -269,7 +269,7 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
 	gboolean add_about_item;
 	gboolean create_root_menu;
 	gboolean relabel;
-	gint import_mode;
+	gint import_mode, export_format;
 	GtkWidget *button;
 
 	g_debug( "%s: editor=%p, user_data=%p", thisfn, ( void * ) editor, ( void * ) user_data );
@@ -318,7 +318,7 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
 	button = base_window_get_widget( BASE_WINDOW( editor ), "RelabelProfileButton" );
 	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), relabel );
 
-	/* third tab: tools preferences
+	/* third tab: import tool
 	 */
 	import_mode = na_iprefs_get_import_mode( NA_IPREFS( pivot ), IPREFS_IMPORT_ACTIONS_IMPORT_MODE );
 	switch( import_mode ){
@@ -341,6 +341,29 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
 	}
 	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), TRUE );
 
+	/* fourth tab: export tool
+	 */
+	export_format = na_iprefs_get_export_format( NA_IPREFS( pivot ), IPREFS_EXPORT_FORMAT );
+	switch( export_format ){
+		case IPREFS_EXPORT_FORMAT_ASK:
+			button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportAskButton" );
+			break;
+
+		case IPREFS_EXPORT_FORMAT_GCONF_SCHEMA_V2:
+			button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportGConfSchemaV2Button" );
+			break;
+
+		case IPREFS_EXPORT_FORMAT_GCONF_SCHEMA_V1:
+			button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportGConfSchemaV1Button" );
+			break;
+
+		case IPREFS_EXPORT_FORMAT_GCONF_ENTRY:
+		default:
+			button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportGConfDumpButton" );
+			break;
+	}
+	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), TRUE );
+
 	base_window_signal_connect_by_name(
 			BASE_WINDOW( editor ),
 			"CancelButton",
@@ -390,7 +413,7 @@ save_preferences( NactPreferencesEditor *editor )
 	gint order_mode;
 	gboolean enabled;
 	gboolean relabel;
-	gint import_mode;
+	gint import_mode, export_format;
 
 	application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
 	pivot = nact_application_get_pivot( application );
@@ -436,7 +459,7 @@ save_preferences( NactPreferencesEditor *editor )
 	relabel = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
 	na_iprefs_write_bool( NA_IPREFS( pivot ), IPREFS_RELABEL_PROFILES, relabel );
 
-	/* third tab: tools preferences
+	/* third tab: import tool
 	 */
 	import_mode = IPREFS_IMPORT_NO_IMPORT;
 	button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsRenumberButton" );
@@ -454,6 +477,25 @@ save_preferences( NactPreferencesEditor *editor )
 		}
 	}
 	na_iprefs_set_import_mode( NA_IPREFS( pivot ), IPREFS_IMPORT_ACTIONS_IMPORT_MODE, import_mode );
+
+	/* fourth tab: export tool
+	 */
+	export_format = IPREFS_EXPORT_FORMAT_GCONF_ENTRY;
+	button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportGConfSchemaV1Button" );
+	if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
+		export_format = IPREFS_EXPORT_FORMAT_GCONF_SCHEMA_V1;
+	} else {
+		button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportGConfSchemaV2Button" );
+		if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
+			export_format = IPREFS_EXPORT_FORMAT_GCONF_SCHEMA_V2;
+		} else {
+			button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsExportAskButton" );
+			if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
+				export_format = IPREFS_EXPORT_FORMAT_ASK;
+			}
+		}
+	}
+	na_iprefs_set_export_format( NA_IPREFS( pivot ), IPREFS_EXPORT_FORMAT, export_format );
 }
 
 static gboolean
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index 2f4a293..15e3e59 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -2011,6 +2011,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
                     </child>
                   </object>
                   <packing>
+                    <property name="expand">False</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -2079,6 +2080,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
                     </child>
                   </object>
                   <packing>
+                    <property name="expand">False</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -2118,6 +2120,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
                                   <object class="GtkLabel" id="label45">
                                     <property name="visible">True</property>
                                     <property name="xalign">0</property>
+                                    <property name="ypad">6</property>
                                     <property name="label" translatable="yes">What to do when pasting or duplicating an item in the tree ?</property>
                                     <property name="wrap">True</property>
                                   </object>
@@ -2128,6 +2131,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
                                 <child>
                                   <object class="GtkVBox" id="vbox27">
                                     <property name="visible">True</property>
+                                    <property name="border_width">6</property>
                                     <child>
                                       <object class="GtkCheckButton" id="RelabelMenuButton">
                                         <property name="label" translatable="yes">Relabel _menus</property>
@@ -2194,6 +2198,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
                     </child>
                   </object>
                   <packing>
+                    <property name="expand">False</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -2231,69 +2236,88 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
                             <property name="visible">True</property>
                             <property name="left_padding">12</property>
                             <child>
-                              <object class="GtkVBox" id="vbox32">
+                              <object class="GtkVBox" id="vbox13">
                                 <property name="visible">True</property>
-                                <property name="border_width">6</property>
-                                <property name="homogeneous">True</property>
                                 <child>
-                                  <object class="GtkRadioButton" id="PrefsNoImportButton">
-                                    <property name="label" translatable="yes">Do _not import actions whose UUID already exists.</property>
+                                  <object class="GtkLabel" id="label8">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="tooltip_text" translatable="yes">Do not import actions whose UUID already exists. Existing action will remain unchanged.</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="active">True</property>
-                                    <property name="draw_indicator">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="ypad">10</property>
+                                    <property name="label" translatable="yes">What to do when an action being imported as the same UUID that an already existing one ?</property>
+                                    <property name="wrap">True</property>
                                   </object>
                                   <packing>
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkRadioButton" id="PrefsRenumberButton">
-                                    <property name="label" translatable="yes">_Renumber imported actions whose UUID already exists.</property>
+                                  <object class="GtkVBox" id="vbox32">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="tooltip_text" translatable="yes">Imported actions whose UUID already exists will be renumbered. A 'renumbered' mention will be added to the label of the item. Existing action will remain unchanged.</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="draw_indicator">True</property>
-                                    <property name="group">PrefsNoImportButton</property>
+                                    <property name="border_width">6</property>
+                                    <property name="homogeneous">True</property>
+                                    <child>
+                                      <object class="GtkRadioButton" id="PrefsNoImportButton">
+                                        <property name="label" translatable="yes">Do _not import actions whose UUID already exists.</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="active">True</property>
+                                        <property name="draw_indicator">True</property>
+                                      </object>
+                                      <packing>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkRadioButton" id="PrefsRenumberButton">
+                                        <property name="label" translatable="yes">_Renumber imported actions whose UUID already exists.</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>
+                                        <property name="group">PrefsNoImportButton</property>
+                                      </object>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkRadioButton" id="PrefsOverrideButton">
+                                        <property name="label" translatable="yes">_Override existing actions when importing with same UUID.</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>
+                                        <property name="group">PrefsNoImportButton</property>
+                                      </object>
+                                      <packing>
+                                        <property name="position">2</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkRadioButton" id="PrefsAskButton">
+                                        <property name="label" translatable="yes">_Ask me.</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>
+                                        <property name="group">PrefsNoImportButton</property>
+                                      </object>
+                                      <packing>
+                                        <property name="position">3</property>
+                                      </packing>
+                                    </child>
                                   </object>
                                   <packing>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkRadioButton" id="PrefsOverrideButton">
-                                    <property name="label" translatable="yes">_Override existing actions when importing with same UUID.</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="tooltip_text" translatable="yes">The imported action will silently override the current action which has the same identifiant.
-Be warned: this mode may be dangerous. You will not be prompted another time.</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="draw_indicator">True</property>
-                                    <property name="group">PrefsNoImportButton</property>
-                                  </object>
-                                  <packing>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkRadioButton" id="PrefsAskButton">
-                                    <property name="label" translatable="yes">_Ask me.</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>
-                                    <property name="group">PrefsNoImportButton</property>
-                                  </object>
-                                  <packing>
-                                    <property name="position">3</property>
-                                  </packing>
+                                  <placeholder/>
                                 </child>
                               </object>
                             </child>
@@ -2314,6 +2338,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
                     </child>
                   </object>
                   <packing>
+                    <property name="expand">False</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -2337,99 +2362,123 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
               <object class="GtkVBox" id="vbox41">
                 <property name="visible">True</property>
                 <child>
-                  <object class="GtkFrame" id="frame5">
+                  <object class="GtkVBox" id="vbox12">
                     <property name="visible">True</property>
-                    <property name="border_width">6</property>
-                    <property name="label_xalign">0</property>
-                    <property name="shadow_type">in</property>
                     <child>
-                      <object class="GtkAlignment" id="alignment5">
+                      <object class="GtkFrame" id="frame5">
                         <property name="visible">True</property>
-                        <property name="left_padding">12</property>
+                        <property name="border_width">6</property>
+                        <property name="label_xalign">0</property>
+                        <property name="shadow_type">in</property>
                         <child>
-                          <object class="GtkVBox" id="vbox42">
+                          <object class="GtkAlignment" id="alignment5">
                             <property name="visible">True</property>
-                            <property name="border_width">6</property>
-                            <property name="homogeneous">True</property>
-                            <child>
-                              <object class="GtkRadioButton" id="PrefsNoImportButton1">
-                                <property name="label" translatable="yes">Do _not import actions whose UUID already exists.</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="active">True</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkRadioButton" id="PrefsRenumberButton1">
-                                <property name="label" translatable="yes">_Renumber imported actions whose UUID already exists.</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>
-                                <property name="group">PrefsNoImportButton</property>
-                              </object>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkRadioButton" id="PrefsOverrideButton1">
-                                <property name="label" translatable="yes">_Override existing actions when importing with same UUID.</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>
-                                <property name="group">PrefsNoImportButton</property>
-                              </object>
-                              <packing>
-                                <property name="position">2</property>
-                              </packing>
-                            </child>
+                            <property name="left_padding">12</property>
                             <child>
-                              <object class="GtkRadioButton" id="PrefsAskButton1">
-                                <property name="label" translatable="yes">_Ask me.</property>
+                              <object class="GtkVBox" id="vbox15">
                                 <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="group">PrefsNoImportButton</property>
+                                <child>
+                                  <object class="GtkVBox" id="vbox42">
+                                    <property name="visible">True</property>
+                                    <property name="border_width">6</property>
+                                    <property name="homogeneous">True</property>
+                                    <child>
+                                      <object class="GtkRadioButton" id="PrefsExportGConfSchemaV1Button">
+                                        <property name="label" translatable="yes">Export as a _full GConf schema</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">False</property>
+                                        <property name="tooltip_text" translatable="yes">This used to be the historical export format.
+The exported file may later be imported via :
+- Import assistant of the Nautilus Actions Configuration Tool,
+- or via the gconftool-2 --import-schema-file command-line tool.</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="active">True</property>
+                                        <property name="draw_indicator">True</property>
+                                      </object>
+                                      <packing>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkRadioButton" id="PrefsExportGConfSchemaV2Button">
+                                        <property name="label" translatable="yes">Export as a _light GConf schema</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">False</property>
+                                        <property name="tooltip_text" translatable="yes">The exported file may later be imported via :
+- Import assistant of the Nautilus Actions Configuration Tool,
+- or via the gconftool-2 --import-schema-file command-line tool.</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="draw_indicator">True</property>
+                                        <property name="group">PrefsExportGConfSchemaV1Button</property>
+                                      </object>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkRadioButton" id="PrefsExportGConfDumpButton">
+                                        <property name="label" translatable="yes">Export as a GConf _dump file</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">False</property>
+                                        <property name="tooltip_text" translatable="yes">This should be the preferred format for newly exported actions.
+The exported file may later be imported via :
+- Import assistant of the Nautilus Actions Configuration Tool,
+- or via the gconftool-2 --load command-line tool.</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="draw_indicator">True</property>
+                                        <property name="group">PrefsExportGConfSchemaV1Button</property>
+                                      </object>
+                                      <packing>
+                                        <property name="position">2</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkRadioButton" id="PrefsExportAskButton">
+                                        <property name="label" translatable="yes">_Ask me</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">False</property>
+                                        <property name="tooltip_text" translatable="yes">You will be asked each time an action is about to be exported.</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="draw_indicator">True</property>
+                                        <property name="group">PrefsExportGConfSchemaV1Button</property>
+                                      </object>
+                                      <packing>
+                                        <property name="position">3</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
                               </object>
-                              <packing>
-                                <property name="position">3</property>
-                              </packing>
                             </child>
                           </object>
                         </child>
+                        <child type="label">
+                          <object class="GtkLabel" id="label49">
+                            <property name="visible">True</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">&lt;b&gt;Export format&lt;/b&gt;</property>
+                            <property name="use_markup">True</property>
+                          </object>
+                        </child>
                       </object>
-                    </child>
-                    <child type="label">
-                      <object class="GtkLabel" id="label49">
-                        <property name="visible">True</property>
-                        <property name="xpad">5</property>
-                        <property name="label" translatable="yes">&lt;b&gt;Export mode&lt;/b&gt;</property>
-                        <property name="use_markup">True</property>
-                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">0</property>
+                      </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="position">0</property>
                   </packing>
                 </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
               </object>
               <packing>
                 <property name="position">3</property>
@@ -2695,25 +2744,25 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
   </object>
   <object class="GtkSizeGroup" id="CommandLabelSizeGroup">
     <widgets>
-      <widget name="ProfileLabelLabel"/>
-      <widget name="CommandPathLabel"/>
       <widget name="CommandParametersLabel"/>
+      <widget name="CommandPathLabel"/>
+      <widget name="ProfileLabelLabel"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="CommandButtonSizeGroup">
     <widgets>
-      <widget name="CommandPathButton"/>
       <widget name="CommandLegendButton"/>
+      <widget name="CommandPathButton"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="ActionLabelSizeGroup">
     <widgets>
-      <widget name="ActionIconLabelLabel"/>
-      <widget name="ActionMenuLabelLabel"/>
       <widget name="label4"/>
-      <widget name="ActionTooltipLabel"/>
       <widget name="ActionIconLabel"/>
+      <widget name="ActionTooltipLabel"/>
       <widget name="label4"/>
+      <widget name="ActionMenuLabelLabel"/>
+      <widget name="ActionIconLabelLabel"/>
     </widgets>
   </object>
 </interface>



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