mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Update the preferences dialog to allow any unicode character as the
separator. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13470 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
2006-03-04 David Hampton <hampton@employees.org>
|
||||
|
||||
* src/gnome-utils/dialog-preferences.c:
|
||||
* src/gnome-utils/glade/preferences.glade:
|
||||
* src/gnome/schemas/apps_gnucash_general.schemas.in:
|
||||
* src/engine/Account.c:
|
||||
* src/app-utils/gnc-ui-util.c: Update the preferences dialog to
|
||||
allow any unicode character as the separator.
|
||||
|
||||
2006-03-03 David Hampton <hampton@employees.org>
|
||||
|
||||
* numerous: Convert the account separator from a single character
|
||||
|
||||
@@ -74,7 +74,7 @@ gnc_configure_account_separator (void)
|
||||
|
||||
string = gnc_gconf_get_string(GCONF_GENERAL, KEY_ACCOUNT_SEPARATOR, NULL);
|
||||
|
||||
if (!string || safe_strcmp(string, "colon") == 0)
|
||||
if (!string || !*string || safe_strcmp(string, "colon") == 0)
|
||||
separator = ":";
|
||||
else if (safe_strcmp(string, "slash") == 0)
|
||||
separator = "/";
|
||||
|
||||
@@ -80,7 +80,8 @@ gnc_set_account_separator (const gchar *separator)
|
||||
gint count;
|
||||
|
||||
uc = g_utf8_get_char_validated(separator, -1);
|
||||
if ((uc == (gunichar)-2) || (uc == (gunichar)-1)) {
|
||||
if ((uc == (gunichar)-2) || (uc == (gunichar)-1) || g_unichar_isalnum(uc)) {
|
||||
account_uc_separator = ':';
|
||||
strcpy(account_separator, ":");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <glade/glade.h>
|
||||
|
||||
#include "dialog-utils.h"
|
||||
@@ -113,6 +114,31 @@ typedef struct addition_t {
|
||||
GSList *add_ins = NULL;
|
||||
|
||||
|
||||
/** This function is called whenever the account separator is changed
|
||||
* in gconf. It updates the label in the "Account" page of the
|
||||
* preferences dialog.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param unused A pointer to the changed gconf entry.
|
||||
*
|
||||
* @param dialog A pointer to the preferences dialog.
|
||||
*/
|
||||
static void
|
||||
gnc_account_separator_prefs_cb (GConfEntry *unused, GtkWidget *dialog)
|
||||
{
|
||||
GtkWidget *label;
|
||||
gchar *sample;
|
||||
|
||||
label = gnc_glade_lookup_widget(dialog, "sample_account");
|
||||
sample = g_strjoin(gnc_get_account_separator_string(),
|
||||
_("Income"), _("Salary"), _("Taxable"), NULL);
|
||||
DEBUG(" Label set to '%s'", sample);
|
||||
gtk_label_set_text(GTK_LABEL(label), sample);
|
||||
g_free(sample);
|
||||
}
|
||||
|
||||
|
||||
/** This function compares two add-ins to see if they specify the same
|
||||
* tab name.
|
||||
*
|
||||
@@ -983,6 +1009,77 @@ gnc_prefs_connect_currency_edit (GNCCurrencyEdit *gce)
|
||||
/**********/
|
||||
|
||||
|
||||
/** The user changed a gtk entry. Update gconf.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param entry A pointer to the entry that was changed.
|
||||
*
|
||||
* @param user_data Unused.
|
||||
*/
|
||||
static void
|
||||
gnc_prefs_entry_user_cb (GtkEntry *entry,
|
||||
gpointer user_data)
|
||||
{
|
||||
const gchar *name, *text;
|
||||
|
||||
g_return_if_fail(GTK_IS_ENTRY(entry));
|
||||
name = gtk_widget_get_name(GTK_WIDGET(entry)) + PREFIX_LEN;
|
||||
text = gtk_entry_get_text(entry);
|
||||
DEBUG("Entry %s set to '%s'", name, text);
|
||||
gnc_gconf_set_string(name, NULL, text, NULL);
|
||||
}
|
||||
|
||||
|
||||
/** A gtk entry was updated in gconf. Update the user visible dialog.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param entry A pointer to the gtk entry that changed.
|
||||
*
|
||||
* @param value The new value of the combo box.
|
||||
*/
|
||||
static void
|
||||
gnc_prefs_entry_gconf_cb (GtkEntry *entry,
|
||||
const gchar *value)
|
||||
{
|
||||
g_return_if_fail(GTK_IS_ENTRY(entry));
|
||||
ENTER("entry %p, value '%s'", entry, value);
|
||||
g_signal_handlers_block_by_func(G_OBJECT(entry),
|
||||
G_CALLBACK(gnc_prefs_entry_user_cb),
|
||||
NULL);
|
||||
gtk_entry_set_text(entry, value);
|
||||
g_signal_handlers_unblock_by_func(G_OBJECT(entry),
|
||||
G_CALLBACK(gnc_prefs_entry_user_cb), NULL);
|
||||
LEAVE(" ");
|
||||
}
|
||||
|
||||
|
||||
/** Connect a entry widget to the user callback function. Set the
|
||||
* starting state of the entry from its value in gconf.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param entry A pointer to the entry that should be connected.
|
||||
*/
|
||||
static void
|
||||
gnc_prefs_connect_entry (GtkEntry *entry)
|
||||
{
|
||||
const gchar *name, *text;
|
||||
|
||||
g_return_if_fail(GTK_IS_ENTRY(entry));
|
||||
name = gtk_widget_get_name(GTK_WIDGET(entry)) + PREFIX_LEN;
|
||||
text = gnc_gconf_get_string(name, NULL, NULL);
|
||||
gtk_entry_set_text(GTK_ENTRY(entry), text ? text : "");
|
||||
DEBUG(" Entry %s set to '%s'", name, text);
|
||||
g_signal_connect(G_OBJECT(entry), "changed",
|
||||
G_CALLBACK(gnc_prefs_entry_user_cb), NULL);
|
||||
}
|
||||
|
||||
|
||||
/**********/
|
||||
|
||||
|
||||
/** The user changed a GncPeriodSelect widget. Update gconf.
|
||||
* GncPeriodSelect choices are stored as an int.
|
||||
*
|
||||
@@ -1235,6 +1332,9 @@ gnc_prefs_connect_one (const gchar *name,
|
||||
} else if (GTK_IS_COMBO_BOX(widget)) {
|
||||
DEBUG(" %s - combo box", name);
|
||||
gnc_prefs_connect_combo_box(GTK_COMBO_BOX(widget));
|
||||
} else if (GTK_IS_ENTRY(widget)) {
|
||||
DEBUG(" %s - entry", name);
|
||||
gnc_prefs_connect_entry(GTK_ENTRY(widget));
|
||||
} else {
|
||||
DEBUG(" %s - unsupported %s", name,
|
||||
G_OBJECT_TYPE_NAME(G_OBJECT(widget)));
|
||||
@@ -1306,6 +1406,8 @@ gnc_preferences_dialog_create(void)
|
||||
label = glade_xml_get_widget(xml, "locale_currency2");
|
||||
gtk_label_set_label(GTK_LABEL(label), currency_name);
|
||||
|
||||
gnc_account_separator_prefs_cb(NULL, dialog);
|
||||
|
||||
LEAVE("dialog %p", dialog);
|
||||
return dialog;
|
||||
}
|
||||
@@ -1442,6 +1544,10 @@ gnc_preferences_gconf_changed (GConfClient *client,
|
||||
DEBUG("widget %p - combo_box", widget);
|
||||
gnc_prefs_combo_box_gconf_cb(GTK_COMBO_BOX(widget),
|
||||
gconf_value_get_int(entry->value));
|
||||
} else if (GTK_IS_ENTRY(widget)) {
|
||||
DEBUG("widget %p - entry", widget);
|
||||
gnc_prefs_entry_gconf_cb(GTK_ENTRY(widget),
|
||||
gconf_value_get_string(entry->value));
|
||||
} else {
|
||||
DEBUG("widget %p - unsupported %s", widget,
|
||||
G_OBJECT_TYPE_NAME(G_OBJECT(widget)));
|
||||
@@ -1523,8 +1629,12 @@ gnc_preferences_dialog (void)
|
||||
|
||||
gnc_gconf_add_notification(G_OBJECT(dialog), NULL,
|
||||
gnc_preferences_gconf_changed);
|
||||
gnc_gconf_general_register_cb(KEY_ACCOUNT_SEPARATOR,
|
||||
(GncGconfGeneralCb)gnc_account_separator_prefs_cb,
|
||||
dialog);
|
||||
gnc_register_gui_component(DIALOG_PREFERENCES_CM_CLASS,
|
||||
NULL, close_handler, dialog);
|
||||
|
||||
LEAVE(" ");
|
||||
}
|
||||
|
||||
|
||||
@@ -438,127 +438,6 @@
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="gconf/general/account_separator/dash">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Income-Salary-Taxable</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">- (_Dash)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_padding">12</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="gconf/general/account_separator/period">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Income.Salary.Taxable</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">. (_Period)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">gconf/general/account_separator/dash</property>
|
||||
</widget>
|
||||
<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="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="gconf/general/account_separator/slash">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Income/Salary/Taxable</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">/ (_Slash)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">gconf/general/account_separator/dash</property>
|
||||
</widget>
|
||||
<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="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="gconf/general/account_separator/backslash">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Income\Salary\Taxable</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">\ (_Backslash)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">gconf/general/account_separator/dash</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="gconf/general/account_separator/colon">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Income:Salary:Taxable</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">: (Co_lon)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">gconf/general/account_separator/dash</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_padding">12</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label79">
|
||||
<property name="visible">True</property>
|
||||
@@ -723,6 +602,102 @@
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="gconf/general/account_separator">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">The character that will be used between components of an account name. Legal values are any single non-alphanumeric unicode character, or any of the following strings: "colon" "slash", "backslash", "dash" and "period".</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<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"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="sample_account">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<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="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label108">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Character:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_padding">12</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label109">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Sample:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_padding">12</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
|
||||
@@ -27,11 +27,7 @@
|
||||
<default>colon</default>
|
||||
<locale name="C">
|
||||
<short>Character to use as separator between account names</short>
|
||||
<long>
|
||||
This setting determines the character that will be used
|
||||
between components of an account name. Possible choices are
|
||||
"colon" "slash", "backslash", "dash" and "period".
|
||||
</long>
|
||||
<long>This setting determines the character that will be used between components of an account name. Possible values are any single non-alphanumeric unicode character, or any of the following strings: "colon" "slash", "backslash", "dash" and "period".</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user