Commit 08298ddd authored by Andreas J. Guelzow's avatar Andreas J. Guelzow Committed by Andreas J. Guelzow

add mor eitems to file/xml preference page

2002-04-17  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* dialog-preferences.c : add mor eitems to file/xml
	  preference page

2002-04-17  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* src/gui-file.c : replace gnome-config with get/set methods from
	  src/gnumeric-gconf.h
	* schemas/gnumeric-general.schemas : new schemas
	* src/gnumeric-gconf-priv.h : new keys
	* src/gnumeric-gconf.[ch] : new get/set methods
parent 19a240df
2002-04-17 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/gui-file.c : replace gnome-config with get/set methods from
src/gnumeric-gconf.h
* schemas/gnumeric-general.schemas : new schemas
* src/gnumeric-gconf-priv.h : new keys
* src/gnumeric-gconf.[ch] : new get/set methods
2002-04-17 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/gui-util.[ch] (gnumeric_dialog_show) : deleted
......
2002-04-17 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/gui-file.c : replace gnome-config with get/set methods from
src/gnumeric-gconf.h
* schemas/gnumeric-general.schemas : new schemas
* src/gnumeric-gconf-priv.h : new keys
* src/gnumeric-gconf.[ch] : new get/set methods
2002-04-17 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/gui-util.[ch] (gnumeric_dialog_show) : deleted
......
2002-04-17 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/gui-file.c : replace gnome-config with get/set methods from
src/gnumeric-gconf.h
* schemas/gnumeric-general.schemas : new schemas
* src/gnumeric-gconf-priv.h : new keys
* src/gnumeric-gconf.[ch] : new get/set methods
2002-04-17 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/gui-util.[ch] (gnumeric_dialog_show) : deleted
......
......@@ -208,6 +208,39 @@
<long>This integer (between 0 and 9) gives the amount compression performed by Gnumeric when saving files in the default file format. 0 is no compression while 9 is maximum compression.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/core/file/save/single_sheet</key>
<applyto>/apps/gnumeric/core/file/save/single_sheet</applyto>
<owner>Gnumeric</owner>
<type>bool</type>
<default>TRUE</default>
<locale name="C">
<short>Warn When Exporting Into Single Sheet Format</short>
<long>Some file formats can contain only a single sheet. This variable determines whether the user will be warned if only a single sheet of a multi-sheet workbook is being saved.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/core/file/save/def-overwrite</key>
<applyto>/apps/gnumeric/core/file/save/def-overwrite</applyto>
<owner>Gnumeric</owner>
<type>bool</type>
<default>FALSE</default>
<locale name="C">
<short>Default To Overwriting Files</short>
<long>Before an existing file is being overwritten, gnumeric will present a warning dialog. Setting this option will make the overwrite button in that dialog the default button.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/core/file/import/all-openers</key>
<applyto>/apps/gnumeric/core/file/import/all-openers</applyto>
<owner>Gnumeric</owner>
<type>bool</type>
<default>FALSE</default>
<locale name="C">
<short>Import Uses All Openers</short>
<long>Setting this option will make the import menu item use all available file openers rather than just those marked as importers.</long>
</locale>
</schema>
</schemalist>
</gconfschemafile>
......@@ -208,6 +208,39 @@
<long>This integer (between 0 and 9) gives the amount compression performed by Gnumeric when saving files in the default file format. 0 is no compression while 9 is maximum compression.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/core/file/save/single_sheet</key>
<applyto>/apps/gnumeric/core/file/save/single_sheet</applyto>
<owner>Gnumeric</owner>
<type>bool</type>
<default>TRUE</default>
<locale name="C">
<short>Warn When Exporting Into Single Sheet Format</short>
<long>Some file formats can contain only a single sheet. This variable determines whether the user will be warned if only a single sheet of a multi-sheet workbook is being saved.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/core/file/save/def-overwrite</key>
<applyto>/apps/gnumeric/core/file/save/def-overwrite</applyto>
<owner>Gnumeric</owner>
<type>bool</type>
<default>FALSE</default>
<locale name="C">
<short>Default To Overwriting Files</short>
<long>Before an existing file is being overwritten, gnumeric will present a warning dialog. Setting this option will make the overwrite button in that dialog the default button.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/core/file/import/all-openers</key>
<applyto>/apps/gnumeric/core/file/import/all-openers</applyto>
<owner>Gnumeric</owner>
<type>bool</type>
<default>FALSE</default>
<locale name="C">
<short>Import Uses All Openers</short>
<long>Setting this option will make the import menu item use all available file openers rather than just those marked as importers.</long>
</locale>
</schema>
</schemalist>
</gconfschemafile>
2002-04-17 Andreas J. Guelzow <aguelzow@taliesin.ca>
* dialog-preferences.c : add mor eitems to file/xml
preference page
2002-04-17 Andreas J. Guelzow <aguelzow@taliesin.ca>
* dialog-preferences.c : add file/xml preference page
......
......@@ -980,6 +980,68 @@ cb_pref_file_xml_compression_changed (GtkSpinButton *button, PrefState *state)
NULL);
}
static void
cb_pref_file_set_overwrite (GConfClient *gconf, guint cnxn_id, GConfEntry *entry,
GtkToggleButton *button)
{
gboolean is_set_gconf = gconf_client_get_bool (gconf,
GNUMERIC_GCONF_FILE_OVERWRITE_DEFAULT,
NULL);
gboolean is_set_button = gtk_toggle_button_get_active (button);
if (is_set_gconf != is_set_button)
gtk_toggle_button_set_active (button, is_set_gconf);
}
static void
cb_pref_file_overwrite_toggled (GtkToggleButton *button, PrefState *state)
{
gconf_client_set_bool (state->gconf,
GNUMERIC_GCONF_FILE_OVERWRITE_DEFAULT,
gtk_toggle_button_get_active (button),
NULL);
}
static void
cb_pref_file_set_single_sheet_warn (GConfClient *gconf, guint cnxn_id, GConfEntry *entry,
GtkToggleButton *button)
{
gboolean is_set_gconf = gconf_client_get_bool (gconf,
GNUMERIC_GCONF_FILE_SINGLE_SHEET_SAVE,
NULL);
gboolean is_set_button = gtk_toggle_button_get_active (button);
if (is_set_gconf != is_set_button)
gtk_toggle_button_set_active (button, is_set_gconf);
}
static void
cb_pref_file_single_sheet_warn_toggled (GtkToggleButton *button, PrefState *state)
{
gconf_client_set_bool (state->gconf,
GNUMERIC_GCONF_FILE_SINGLE_SHEET_SAVE,
gtk_toggle_button_get_active (button),
NULL);
}
static void
cb_pref_file_set_import_all_op (GConfClient *gconf, guint cnxn_id, GConfEntry *entry,
GtkToggleButton *button)
{
gboolean is_set_gconf = gconf_client_get_bool (gconf,
GNUMERIC_GCONF_FILE_IMPORT_USES_ALL_OP,
NULL);
gboolean is_set_button = gtk_toggle_button_get_active (button);
if (is_set_gconf != is_set_button)
gtk_toggle_button_set_active (button, is_set_gconf);
}
static void
cb_pref_file_import_all_op_toggled (GtkToggleButton *button, PrefState *state)
{
gconf_client_set_bool (state->gconf,
GNUMERIC_GCONF_FILE_IMPORT_USES_ALL_OP,
gtk_toggle_button_get_active (button),
NULL);
}
static
GtkWidget *pref_file_page_initializer (PrefState *state, gpointer data,
......@@ -1004,6 +1066,27 @@ GtkWidget *pref_file_page_initializer (PrefState *state, gpointer data,
cb_pref_file_set_xml_compression,
cb_pref_file_xml_compression_changed);
/* Overwrite Default check box */
dialog_pref_create_checkbox (GNUMERIC_GCONF_FILE_OVERWRITE_DEFAULT,
"/schemas" GNUMERIC_GCONF_FILE_OVERWRITE_DEFAULT,
page, row++, state,
cb_pref_file_set_overwrite,
cb_pref_file_overwrite_toggled);
/* Single Sheet Warning check box */
dialog_pref_create_checkbox (GNUMERIC_GCONF_FILE_SINGLE_SHEET_SAVE,
"/schemas" GNUMERIC_GCONF_FILE_SINGLE_SHEET_SAVE,
page, row++, state,
cb_pref_file_set_single_sheet_warn,
cb_pref_file_single_sheet_warn_toggled);
/* Import with all Openers check box */
dialog_pref_create_checkbox (GNUMERIC_GCONF_FILE_IMPORT_USES_ALL_OP,
"/schemas" GNUMERIC_GCONF_FILE_IMPORT_USES_ALL_OP,
page, row++, state,
cb_pref_file_set_import_all_op,
cb_pref_file_import_all_op_toggled);
gtk_widget_show_all (page);
return page;
}
......
......@@ -51,8 +51,12 @@
#define GNUMERIC_GCONF_FONT_BOLD GNUMERIC_GCONF_FONT_DIRECTORY "/bold"
#define GNUMERIC_GCONF_FONT_ITALIC GNUMERIC_GCONF_FONT_DIRECTORY "/italic"
#define GNUMERIC_GCONF_FILE_HISTORY_N "/apps/gnumeric/core/file/history/n"
#define GNUMERIC_GCONF_FILE_HISTORY_FILES "/apps/gnumeric/core/file/history/files"
#define GNUMERIC_GCONF_FILE_DIRECTORY "/apps/gnumeric/core/file"
#define GNUMERIC_GCONF_FILE_HISTORY_N GNUMERIC_GCONF_FILE_DIRECTORY "/history/n"
#define GNUMERIC_GCONF_FILE_HISTORY_FILES GNUMERIC_GCONF_FILE_DIRECTORY "/history/files"
#define GNUMERIC_GCONF_FILE_IMPORT_USES_ALL_OP GNUMERIC_GCONF_FILE_DIRECTORY "/import/all-openers"
#define GNUMERIC_GCONF_FILE_OVERWRITE_DEFAULT GNUMERIC_GCONF_FILE_DIRECTORY "/save/def-overwrite"
#define GNUMERIC_GCONF_FILE_SINGLE_SHEET_SAVE GNUMERIC_GCONF_FILE_DIRECTORY "/save/single_sheet"
#define GNUMERIC_GCONF_WORKBOOK_NSHEETS "/apps/gnumeric/core/workbook/n-sheet"
......
......@@ -582,3 +582,54 @@ gnm_gconf_set_xml_compression_level (gint val)
GNUMERIC_GCONF_XML_COMPRESSION,
val, NULL);
}
gboolean
gnm_gconf_get_import_uses_all_openers (void)
{
return gconf_client_get_bool (application_get_gconf_client (),
GNUMERIC_GCONF_FILE_IMPORT_USES_ALL_OP,
NULL);
}
void
gnm_gconf_set_import_uses_all_openers (gboolean val)
{
gconf_client_set_bool (application_get_gconf_client (),
GNUMERIC_GCONF_FILE_IMPORT_USES_ALL_OP,
val, NULL);
}
gboolean
gnm_gconf_get_file_overwrite_default_answer (void)
{
return gconf_client_get_bool (application_get_gconf_client (),
GNUMERIC_GCONF_FILE_OVERWRITE_DEFAULT,
NULL);
}
void
gnm_gconf_set_file_overwrite_default_answer (gboolean val)
{
gconf_client_set_bool (application_get_gconf_client (),
GNUMERIC_GCONF_FILE_OVERWRITE_DEFAULT,
val, NULL);
}
gboolean
gnm_gconf_get_file_ask_single_sheet_save (void)
{
return gconf_client_get_bool (application_get_gconf_client (),
GNUMERIC_GCONF_FILE_SINGLE_SHEET_SAVE,
NULL);
}
void
gnm_gconf_set_file_ask_single_sheet_save (gboolean val)
{
gconf_client_set_bool (application_get_gconf_client (),
GNUMERIC_GCONF_FILE_SINGLE_SHEET_SAVE,
val, NULL);
}
......@@ -94,6 +94,15 @@ void gnm_gconf_set_recent_funcs (GSList *list);
guint gnm_gconf_get_num_of_recent_funcs (void);
void gnm_gconf_set_num_of_recent_funcs (guint val);
gboolean gnm_gconf_get_import_uses_all_openers (void);
void gnm_gconf_set_import_uses_all_openers (gboolean val);
gboolean gnm_gconf_get_file_overwrite_default_answer (void);
void gnm_gconf_set_file_overwrite_default_answer (gboolean val);
gboolean gnm_gconf_get_file_ask_single_sheet_save (void);
void gnm_gconf_set_file_ask_single_sheet_save (gboolean val);
/* others */
gnum_float gnm_gconf_get_horizontal_dpi (void);
void gnm_gconf_set_horizontal_dpi (gnum_float val);
......
......@@ -19,9 +19,9 @@
#include "workbook-control-gui-priv.h"
#include "workbook-view.h"
#include "workbook.h"
#include "gnumeric-gconf.h"
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-config.h>
#include <libgnome/gnome-util.h>
#include <errno.h>
#include <sys/stat.h>
......@@ -92,12 +92,11 @@ gui_file_import (WorkbookControlGUI *wbcg)
GnumFileOpener *fo = NULL;
gchar const *file_name;
if (gnome_config_get_bool_with_default (
"Gnumeric/File/ImportUsesAllOpeners=false", NULL)) {
if (gnm_gconf_get_import_uses_all_openers ())
importers = get_file_openers ();
} else {
else
importers = get_file_importers ();
}
importers = g_list_copy (importers);
importers = g_list_sort (importers, file_opener_description_cmp);
......@@ -165,9 +164,8 @@ can_try_save_to (WorkbookControlGUI *wbcg, const char *name)
msg = g_strdup_printf (
_("Workbook %s already exists.\n"
"Do you want to save over it?"), name);
result = gnumeric_dialog_question_yes_no (wbcg, msg,
gnome_config_get_bool_with_default (
"Gnumeric/File/FileOverwriteDefaultAnswer=false", NULL));
result = gnumeric_dialog_question_yes_no (
wbcg, msg, gnm_gconf_get_file_overwrite_default_answer());
g_free (msg);
}
......@@ -182,7 +180,7 @@ check_multiple_sheet_support_if_needed (GnumFileSaver *fs,
gboolean ret_val = TRUE;
if (gnum_file_saver_get_save_scope (fs) == FILE_SAVE_SHEET &&
gnome_config_get_bool_with_default ("Gnumeric/File/AskBeforeSavingOneSheet=true", NULL)) {
gnm_gconf_get_file_ask_single_sheet_save ()) {
GList *sheets;
gchar *msg = _("Selected file format doesn't support "
"saving multiple sheets in one file.\n"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment