Gnc-Prefs: migrate int-typed preferences (and GtkCombobox widgets linked to them)

All GtkComboBoxes now use the new preferences backend
so drop the GtkComboBoxes-Gconf wiring as well.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23241 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2013-10-07 14:14:11 +00:00
parent f9e0da38f4
commit 14e8f5620f
15 changed files with 110 additions and 216 deletions

View File

@ -30,11 +30,6 @@
#include "gncTaxTable.h" #include "gncTaxTable.h"
#include "gncInvoice.h" #include "gncInvoice.h"
#define GCONF_SECTION_ORDER "dialogs/business/order"
#define GCONF_SECTION_JOB "dialogs/business/job"
#define GCONF_SECTION_CUSTOMER "dialogs/business/customer"
#define GCONF_SECTION_VENDOR "dialogs/business/vendor"
#define GCONF_SECTION_EMPLOYEE "dialogs/business/employee"
GtkWidget * gnc_owner_select_create (GtkWidget *label, GtkWidget *hbox, GtkWidget * gnc_owner_select_create (GtkWidget *label, GtkWidget *hbox,
QofBook *book, GncOwner *owner); QofBook *book, GncOwner *owner);

View File

@ -46,9 +46,6 @@ typedef enum
} invoice_sort_type_t; } invoice_sort_type_t;
#define GCONF_SECTION_INVOICE "dialogs/business/invoice"
#define GCONF_SECTION_BILL "dialogs/business/bill"
#define GCONF_SECTION_VOUCHER "dialogs/business/voucher"
#define GNC_PREFS_GROUP_INVOICE "dialogs.business.invoice" #define GNC_PREFS_GROUP_INVOICE "dialogs.business.invoice"
#define GNC_PREFS_GROUP_BILL "dialogs.business.bill" #define GNC_PREFS_GROUP_BILL "dialogs.business.bill"
#define GNC_PREFS_GROUP_VOUCHER "dialogs.business.voucher" #define GNC_PREFS_GROUP_VOUCHER "dialogs.business.voucher"

View File

@ -48,8 +48,7 @@
#include "gnc-session.h" #include "gnc-session.h"
#include "gnome-utils/gnc-icons.h" /* for GNC_STOCK_INVOICE_NEW */ #include "gnome-utils/gnc-icons.h" /* for GNC_STOCK_INVOICE_NEW */
#include "gnc-prefs.h" /* for GCONF_PATH */ #include "gnc-prefs.h"
#include "gnc-gconf-utils.h"
#include "gnome-utils/gnc-main-window.h" #include "gnome-utils/gnc-main-window.h"
#include "gnc-plugin-page-register.h" #include "gnc-plugin-page-register.h"
@ -134,6 +133,7 @@ static void update_inactive_actions(GncPluginPage *page);
#define PLUGIN_UI_FILENAME "gnc-plugin-business-ui.xml" #define PLUGIN_UI_FILENAME "gnc-plugin-business-ui.xml"
#define GNC_PREF_EXTRA_TOOLBUTTONS "enable_toolbuttons" #define GNC_PREF_EXTRA_TOOLBUTTONS "enable_toolbuttons"
#define GNC_PREF_INV_PRINT_RPT "invoice_printreport"
/** This variable maintains a pointer to the last window where a /** This variable maintains a pointer to the last window where a
* Business command was executed. It is used to determine where new * Business command was executed. It is used to determine where new
@ -397,9 +397,6 @@ gnc_plugin_business_class_init (GncPluginBusinessClass *klass)
plugin_class->n_actions = gnc_plugin_n_actions; plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME; plugin_class->ui_filename = PLUGIN_UI_FILENAME;
plugin_class->gconf_notifications = NULL;
plugin_class->gconf_section = NULL;
g_type_class_add_private(klass, sizeof(GncPluginBusinessPrivate)); g_type_class_add_private(klass, sizeof(GncPluginBusinessPrivate));
} }
@ -1078,8 +1075,7 @@ static const char* invoice_printreport_values[] =
const char *gnc_plugin_business_get_invoice_printreport(void) const char *gnc_plugin_business_get_invoice_printreport(void)
{ {
int value = gnc_gconf_get_int(GCONF_SECTION_INVOICE, int value = gnc_prefs_get_int (GNC_PREFS_GROUP_INVOICE, GNC_PREF_INV_PRINT_RPT);
"invoice_printreport", NULL);
if (value >= 0 && value < 4) if (value >= 0 && value < 4)
return invoice_printreport_values[value]; return invoice_printreport_values[value];
else else

View File

@ -262,7 +262,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBox" id="gconf/dialogs/business/invoice/invoice_printreport"> <object class="GtkComboBox" id="pref/dialogs.business.invoice/invoice_printreport">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>

View File

@ -752,76 +752,6 @@ gnc_prefs_connect_radio_button_gconf (GtkRadioButton *button)
/****************************************************************************/ /****************************************************************************/
/** The user changed a combo box. Update gconf. Combo box
* choices are stored as an int.
*
* @internal
*
* @param box A pointer to the combo box that was changed.
*
* @param user_data Unused.
*/
static void
gnc_prefs_combo_box_user_cb_gconf (GtkComboBox *box,
gpointer user_data)
{
const gchar *name;
gint active;
g_return_if_fail(GTK_IS_COMBO_BOX(box));
name = gtk_buildable_get_name(GTK_BUILDABLE(box)) + PREFIX_LEN;
active = gtk_combo_box_get_active(box);
DEBUG("Combo box %s set to item %d", name, active);
gnc_gconf_set_int(name, NULL, active, NULL);
}
/** A combo box choice was updated in gconf. Update the user
* visible dialog.
*
* @internal
*
* @param box A pointer to the combo box that changed.
*
* @param value The new value of the combo box.
*/
static void
gnc_prefs_combo_box_gconf_cb_gconf (GtkComboBox *box,
gint value)
{
g_return_if_fail(GTK_IS_COMBO_BOX(box));
ENTER("box %p, value %d", box, value);
g_signal_handlers_block_by_func(G_OBJECT(box),
G_CALLBACK(gnc_prefs_combo_box_user_cb_gconf), NULL);
gtk_combo_box_set_active(box, value);
g_signal_handlers_unblock_by_func(G_OBJECT(box),
G_CALLBACK(gnc_prefs_combo_box_user_cb_gconf), NULL);
LEAVE(" ");
}
/** Connect a combo box widget to the user callback function. Set
* the starting state of the box from its value in gconf.
*
* @internal
*
* @param box A pointer to the combo box that should be connected.
*/
static void
gnc_prefs_connect_combo_box_gconf (GtkComboBox *box)
{
const gchar *name;
gint active;
g_return_if_fail(GTK_IS_COMBO_BOX(box));
name = gtk_buildable_get_name(GTK_BUILDABLE(box)) + PREFIX_LEN;
active = gnc_gconf_get_int(name, NULL, NULL);
gtk_combo_box_set_active(GTK_COMBO_BOX(box), active);
DEBUG(" Combo box %s set to item %d", name, active);
g_signal_connect(G_OBJECT(box), "changed",
G_CALLBACK(gnc_prefs_combo_box_user_cb_gconf), NULL);
}
/****************************************************************************/ /****************************************************************************/
/** The user changed a currency_edit. Update gconf. Currency_edit /** The user changed a currency_edit. Update gconf. Currency_edit
@ -1263,6 +1193,34 @@ gnc_prefs_connect_spin_button (GtkSpinButton *spin)
g_free (pref); g_free (pref);
} }
/****************************************************************************/
/** Connect a GtkComboBox widget to its stored value in the preferences database.
*
* @internal
*
* @param box A pointer to the combo box that should be connected.
*/
static void
gnc_prefs_connect_combo_box (GtkComboBox *box)
{
gchar *group, *pref;
gint active;
g_return_if_fail(GTK_IS_COMBO_BOX(box));
gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(box)), &group, &pref);
// active = gnc_prefs_get_int(group, pref);
// gtk_combo_box_set_active(GTK_COMBO_BOX(box), active);
// DEBUG(" Combo box %s/%s set to item %d", group, pref, active);
gnc_prefs_bind (group, pref, G_OBJECT (box), "active");
g_free (group);
g_free (pref);
}
/****************************************************************************/ /****************************************************************************/
@ -1338,11 +1296,6 @@ gnc_prefs_connect_one_gconf (const gchar *name,
DEBUG(" %s - radio button", name); DEBUG(" %s - radio button", name);
gnc_prefs_connect_radio_button_gconf(GTK_RADIO_BUTTON(widget)); gnc_prefs_connect_radio_button_gconf(GTK_RADIO_BUTTON(widget));
} }
else if (GTK_IS_COMBO_BOX(widget))
{
DEBUG(" %s - combo box", name);
gnc_prefs_connect_combo_box_gconf(GTK_COMBO_BOX(widget));
}
else if (GTK_IS_ENTRY(widget)) else if (GTK_IS_ENTRY(widget))
{ {
DEBUG(" %s - entry", name); DEBUG(" %s - entry", name);
@ -1416,6 +1369,11 @@ gnc_prefs_connect_one (const gchar *name,
DEBUG(" %s - spin button", name); DEBUG(" %s - spin button", name);
gnc_prefs_connect_spin_button(GTK_SPIN_BUTTON(widget)); gnc_prefs_connect_spin_button(GTK_SPIN_BUTTON(widget));
} }
else if (GTK_IS_COMBO_BOX(widget))
{
DEBUG(" %s - combo box", name);
gnc_prefs_connect_combo_box(GTK_COMBO_BOX(widget));
}
else else
{ {
DEBUG(" %s - unsupported %s", name, DEBUG(" %s - unsupported %s", name,
@ -1669,12 +1627,6 @@ gnc_preferences_gconf_changed (GConfClient *client,
DEBUG("widget %p - radio button", widget); DEBUG("widget %p - radio button", widget);
gnc_prefs_radio_button_gconf_cb_gconf(GTK_RADIO_BUTTON(widget)); gnc_prefs_radio_button_gconf_cb_gconf(GTK_RADIO_BUTTON(widget));
} }
else if (GTK_IS_COMBO_BOX(widget))
{
DEBUG("widget %p - combo_box", widget);
gnc_prefs_combo_box_gconf_cb_gconf(GTK_COMBO_BOX(widget),
gconf_value_get_int(entry->value));
}
else if (GTK_IS_ENTRY(widget)) else if (GTK_IS_ENTRY(widget))
{ {
DEBUG("widget %p - entry", widget); DEBUG("widget %p - entry", widget);

View File

@ -31,14 +31,12 @@
#include "dialog-utils.h" #include "dialog-utils.h"
#include "gnc-component-manager.h" #include "gnc-component-manager.h"
#include "gnc-filepath-utils.h" #include "gnc-filepath-utils.h"
#include "gnc-gconf-utils.h"
#include "gnc-prefs.h" #include "gnc-prefs.h"
#include "gnc-gnome-utils.h" #include "gnc-gnome-utils.h"
#include "gnc-engine.h" #include "gnc-engine.h"
#define GCONF_SECTION "dialogs/tip_of_the_day"
#define GNC_PREFS_GROUP "dialogs.totd" #define GNC_PREFS_GROUP "dialogs.totd"
#define KEY_CURRENT_TIP "current_tip" #define GNC_PREF_CURRENT_TIP "current_tip"
#define GNC_PREF_SHOW_TIPS "show_at_startup" #define GNC_PREF_SHOW_TIPS "show_at_startup"
#define DIALOG_TOTD_CM_CLASS "dialog-totd" #define DIALOG_TOTD_CM_CLASS "dialog-totd"
@ -68,7 +66,7 @@ typedef struct
/*********************************************************************** /***********************************************************************
* This function should be called to change the tip number. It * This function should be called to change the tip number. It
* handles clamping the number to the range of tips available, saving * handles clamping the number to the range of tips available, saving
* the number in the GConf database, and updating the dialog window * the number in the preferences database, and updating the dialog window
* with the text of the newly selected tip. * with the text of the newly selected tip.
* *
* @param Tip of the day structure. This points to the dialog and * @param Tip of the day structure. This points to the dialog and
@ -93,7 +91,7 @@ gnc_new_tip_number (TotdDialog *totd_dialog, gint offset)
current_tip_number = tip_count - 1; current_tip_number = tip_count - 1;
if (current_tip_number >= tip_count) if (current_tip_number >= tip_count)
current_tip_number = 0; current_tip_number = 0;
gnc_gconf_set_int(GCONF_SECTION, KEY_CURRENT_TIP, current_tip_number, NULL); gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_CURRENT_TIP, current_tip_number);
/* A tip consists of a translatable string, which might contain a %s /* A tip consists of a translatable string, which might contain a %s
* placeholder, optionally followed by a | and a (non-translated) * placeholder, optionally followed by a | and a (non-translated)
@ -322,7 +320,7 @@ gnc_totd_dialog (GtkWindow *parent, gboolean startup)
{ {
if (!gnc_totd_initialize()) if (!gnc_totd_initialize())
return; return;
current_tip_number = gnc_gconf_get_int(GCONF_SECTION, KEY_CURRENT_TIP, NULL); current_tip_number = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_CURRENT_TIP);
} }
if (gnc_forall_gui_components(DIALOG_TOTD_CM_CLASS, show_handler, NULL)) if (gnc_forall_gui_components(DIALOG_TOTD_CM_CLASS, show_handler, NULL))

View File

@ -45,8 +45,8 @@
#include "dialog-utils.h" #include "dialog-utils.h"
#include "dialog-lot-viewer.h" #include "dialog-lot-viewer.h"
#include "gnc-component-manager.h" #include "gnc-component-manager.h"
#include "gnc-prefs.h"
#include "gnc-ui-util.h" #include "gnc-ui-util.h"
#include "gnc-gconf-utils.h"
#include "misc-gnome-utils.h" #include "misc-gnome-utils.h"
#define LOT_VIEWER_CM_CLASS "dialog-lot-viewer" #define LOT_VIEWER_CM_CLASS "dialog-lot-viewer"
@ -82,10 +82,9 @@ enum split_cols
#define RESPONSE_SCRUB_ACCOUNT 4 #define RESPONSE_SCRUB_ACCOUNT 4
#define RESPONSE_NEW_LOT 5 #define RESPONSE_NEW_LOT 5
#define GCONF_SECTION "dialogs/lot_viewer"
#define GNC_PREFS_GROUP "dialogs.lot_viewer" #define GNC_PREFS_GROUP "dialogs.lot_viewer"
#define GCONF_KEY_HPOSITION "hpane_position" #define GNC_PREF_HPOS "hpane_position"
#define GCONF_KEY_VPOSITION "vpane_position" #define GNC_PREF_VPOS "vpane_position"
struct _GNCLotViewer struct _GNCLotViewer
{ {
@ -96,8 +95,6 @@ struct _GNCLotViewer
GtkButton * delete_button; GtkButton * delete_button;
GtkButton * scrub_lot_button; GtkButton * scrub_lot_button;
GtkButton * new_lot_button; GtkButton * new_lot_button;
GtkPaned * lot_hpaned;
GtkPaned * lot_vpaned;
GtkTreeView * lot_view; GtkTreeView * lot_view;
GtkListStore * lot_store; GtkListStore * lot_store;
GtkTextView * lot_notes; GtkTextView * lot_notes;
@ -722,32 +719,6 @@ lv_only_show_open_lots_changed_cb (GtkWidget *widget, GNCLotViewer * lv)
lv_refresh(lv); lv_refresh(lv);
} }
/* ======================================================================== */
/* Divider moved */
void
lv_paned_notify_cb (GObject *gobject,
GParamSpec *pspec,
gpointer user_data)
{
const gchar *param_name;
gint value;
param_name = g_param_spec_get_name(pspec);
if (strcmp(param_name, "position") != 0)
return;
g_object_get(gobject, "position", &value, NULL);
if (GTK_IS_HPANED(gobject))
{
gnc_gconf_set_int(GCONF_SECTION, GCONF_KEY_HPOSITION, value, NULL);
}
else
{
gnc_gconf_set_int(GCONF_SECTION, GCONF_KEY_VPOSITION, value, NULL);
}
}
/* ======================================================================== */ /* ======================================================================== */
/* Any button was pressed */ /* Any button was pressed */
@ -968,6 +939,7 @@ lv_create (GNCLotViewer *lv)
gchar *win_title; gchar *win_title;
gint position; gint position;
GtkBuilder *builder; GtkBuilder *builder;
GtkWidget *widget;
builder = gtk_builder_new(); builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-lot-viewer.glade", "Lot Viewer Window"); gnc_builder_add_from_file (builder, "dialog-lot-viewer.glade", "Lot Viewer Window");
@ -1000,15 +972,16 @@ lv_create (GNCLotViewer *lv)
lv->remove_split_from_lot_button = GTK_BUTTON(gtk_builder_get_object (builder, "remove split from lot button")); lv->remove_split_from_lot_button = GTK_BUTTON(gtk_builder_get_object (builder, "remove split from lot button"));
lv_init_split_buttons(lv); lv_init_split_buttons(lv);
lv->lot_vpaned = GTK_PANED (gtk_builder_get_object (builder, "lot vpaned"));
position = gnc_gconf_get_int(GCONF_SECTION, GCONF_KEY_VPOSITION, NULL);
if (position)
gtk_paned_set_position (lv->lot_vpaned, position);
lv->lot_hpaned = GTK_PANED (gtk_builder_get_object (builder, "lot hpaned")); if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
position = gnc_gconf_get_int(GCONF_SECTION, GCONF_KEY_HPOSITION, NULL); {
if (position) GObject *object;
gtk_paned_set_position (lv->lot_hpaned, position); object = gtk_builder_get_object (builder, "lot vpaned");
gnc_prefs_bind (GNC_PREFS_GROUP, GNC_PREF_VPOS, object, "position");
object = gtk_builder_get_object (builder, "lot hpaned");
gnc_prefs_bind (GNC_PREFS_GROUP, GNC_PREF_HPOS, object, "position");
}
lv->selected_lot = NULL; lv->selected_lot = NULL;

View File

@ -68,9 +68,8 @@ G_GNUC_UNUSED static QofLogModule log_module = "gnc.printing.checks";
#define GCONF_SECTION "dialogs/print_checks" #define GCONF_SECTION "dialogs/print_checks"
#define GNC_PREFS_GROUP "dialogs.checkprinting" #define GNC_PREFS_GROUP "dialogs.checkprinting"
#define KEY_CHECK_FORMAT_GUID "check_format_guid" #define KEY_CHECK_FORMAT_GUID "check_format_guid"
#define KEY_CHECK_FORMAT "check_format" #define GNC_PREF_CHECK_POSITION "check_position"
#define KEY_CHECK_POSITION "check_position" #define GNC_PREF_FIRST_PAGE_COUNT "first_page_count"
#define KEY_FIRST_PAGE_COUNT "first_page_count"
#define KEY_DATE_FORMAT_USER "date_format_custom" #define KEY_DATE_FORMAT_USER "date_format_custom"
#define GNC_PREF_CUSTOM_PAYEE "custom_payee" #define GNC_PREF_CUSTOM_PAYEE "custom_payee"
#define GNC_PREF_CUSTOM_DATE "custom_date" #define GNC_PREF_CUSTOM_DATE "custom_date"
@ -81,7 +80,7 @@ G_GNUC_UNUSED static QofLogModule log_module = "gnc.printing.checks";
#define GNC_PREF_CUSTOM_MEMO "custom_memo" #define GNC_PREF_CUSTOM_MEMO "custom_memo"
#define GNC_PREF_CUSTOM_TRANSLATION "custom_translation" #define GNC_PREF_CUSTOM_TRANSLATION "custom_translation"
#define GNC_PREF_CUSTOM_ROTATION "custom_rotation" #define GNC_PREF_CUSTOM_ROTATION "custom_rotation"
#define KEY_CUSTOM_UNITS "custom_units" #define GNC_PREF_CUSTOM_UNITS "custom_units"
#define GNC_PREF_PRINT_DATE_FMT "print_date_format" #define GNC_PREF_PRINT_DATE_FMT "print_date_format"
#define GNC_PREF_DEFAULT_FONT "default_font" #define GNC_PREF_DEFAULT_FONT "default_font"
#define GNC_PREF_BLOCKING_CHARS "blocking_chars" #define GNC_PREF_BLOCKING_CHARS "blocking_chars"
@ -569,11 +568,11 @@ gnc_ui_print_save_dialog(PrintCheckDialog *pcd)
check ? check->guid : "custom", NULL); check ? check->guid : "custom", NULL);
} }
active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->position_combobox)); active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->position_combobox));
gnc_gconf_set_int(GCONF_SECTION, KEY_CHECK_POSITION, active, NULL); gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_CHECK_POSITION, active);
active = gtk_spin_button_get_value_as_int(pcd->first_page_count); active = gtk_spin_button_get_value_as_int(pcd->first_page_count);
gnc_gconf_set_int(GCONF_SECTION, KEY_FIRST_PAGE_COUNT, active, NULL); gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_FIRST_PAGE_COUNT, active);
active = gnc_date_format_get_format (GNC_DATE_FORMAT(pcd->date_format)); active = gnc_date_format_get_format (GNC_DATE_FORMAT(pcd->date_format));
gnc_gconf_set_int(GCONF_SECTION, KEY_DATE_FORMAT, active, NULL); gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_DATE_FORMAT, active);
if (active == QOF_DATE_FORMAT_CUSTOM) if (active == QOF_DATE_FORMAT_CUSTOM)
{ {
format = gnc_date_format_get_custom (GNC_DATE_FORMAT(pcd->date_format)); format = gnc_date_format_get_custom (GNC_DATE_FORMAT(pcd->date_format));
@ -621,7 +620,7 @@ gnc_ui_print_save_dialog(PrintCheckDialog *pcd)
gnc_prefs_set_float(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_ROTATION, gnc_prefs_set_float(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_ROTATION,
gtk_spin_button_get_value(pcd->check_rotation)); gtk_spin_button_get_value(pcd->check_rotation));
active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->units_combobox)); active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->units_combobox));
gnc_gconf_set_int(GCONF_SECTION, KEY_CUSTOM_UNITS, active, NULL); gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_UNITS, active);
} }
@ -637,15 +636,10 @@ gnc_ui_print_restore_dialog(PrintCheckDialog *pcd)
/* Options page */ /* Options page */
guid = gnc_gconf_get_string(GCONF_SECTION, KEY_CHECK_FORMAT_GUID, NULL); guid = gnc_gconf_get_string(GCONF_SECTION, KEY_CHECK_FORMAT_GUID, NULL);
if (guid == NULL) if (guid == NULL)
{ gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), 0);
active = gnc_gconf_get_int(GCONF_SECTION, KEY_CHECK_FORMAT, NULL);
gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), active);
}
else if (strcmp(guid, "custom") == 0) else if (strcmp(guid, "custom") == 0)
{
gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox),
pcd->format_max - 1); pcd->format_max - 1);
}
else else
{ {
model = gtk_combo_box_get_model(GTK_COMBO_BOX(pcd->format_combobox)); model = gtk_combo_box_get_model(GTK_COMBO_BOX(pcd->format_combobox));
@ -658,16 +652,16 @@ gnc_ui_print_restore_dialog(PrintCheckDialog *pcd)
gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), 0); gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), 0);
} }
} }
active = gnc_gconf_get_int(GCONF_SECTION, KEY_CHECK_POSITION, NULL); active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_CHECK_POSITION);
/* If the check format used last time no longer exists, then the saved check /* If the check format used last time no longer exists, then the saved check
position may be invalid. If so set it to the first position. */ position may be invalid. If so set it to the first position. */
if (active < 0 || active > pcd->position_max) if (active < 0 || active > pcd->position_max)
active = 0; active = 0;
gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->position_combobox), active); gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->position_combobox), active);
active = gnc_gconf_get_int(GCONF_SECTION, KEY_FIRST_PAGE_COUNT, NULL); active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_FIRST_PAGE_COUNT);
gtk_spin_button_set_value(pcd->first_page_count, (gdouble) active); gtk_spin_button_set_value(pcd->first_page_count, (gdouble) active);
active = gnc_gconf_get_int(GCONF_SECTION, KEY_DATE_FORMAT, NULL); active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_DATE_FORMAT);
gnc_date_format_set_format(GNC_DATE_FORMAT(pcd->date_format), active); gnc_date_format_set_format(GNC_DATE_FORMAT(pcd->date_format), active);
if (active == QOF_DATE_FORMAT_CUSTOM) if (active == QOF_DATE_FORMAT_CUSTOM)
{ {
@ -716,7 +710,7 @@ gnc_ui_print_restore_dialog(PrintCheckDialog *pcd)
gtk_spin_button_set_value(pcd->translation_y, y); gtk_spin_button_set_value(pcd->translation_y, y);
x = gnc_prefs_get_float(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_ROTATION); x = gnc_prefs_get_float(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_ROTATION);
gtk_spin_button_set_value(pcd->check_rotation, x); gtk_spin_button_set_value(pcd->check_rotation, x);
active = gnc_gconf_get_int(GCONF_SECTION, KEY_CUSTOM_UNITS, NULL); active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_UNITS);
gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->units_combobox), active); gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->units_combobox), active);
} }

View File

@ -68,9 +68,8 @@ G_GNUC_UNUSED static QofLogModule log_module = "gnc.printing.checks";
#define GCONF_SECTION "dialogs/print_checks" #define GCONF_SECTION "dialogs/print_checks"
#define GNC_PREFS_GROUP "dialogs.checkprinting" #define GNC_PREFS_GROUP "dialogs.checkprinting"
#define KEY_CHECK_FORMAT_GUID "check_format_guid" #define KEY_CHECK_FORMAT_GUID "check_format_guid"
#define KEY_CHECK_FORMAT "check_format" #define GNC_PREF_CHECK_POSITION "check_position"
#define KEY_CHECK_POSITION "check_position" #define GNC_PREF_FIRST_PAGE_COUNT "first_page_count"
#define KEY_FIRST_PAGE_COUNT "first_page_count"
#define KEY_DATE_FORMAT_USER "date_format_custom" #define KEY_DATE_FORMAT_USER "date_format_custom"
#define GNC_PREF_CUSTOM_PAYEE "custom_payee" #define GNC_PREF_CUSTOM_PAYEE "custom_payee"
#define GNC_PREF_CUSTOM_DATE "custom_date" #define GNC_PREF_CUSTOM_DATE "custom_date"
@ -81,7 +80,7 @@ G_GNUC_UNUSED static QofLogModule log_module = "gnc.printing.checks";
#define GNC_PREF_CUSTOM_MEMO "custom_memo" #define GNC_PREF_CUSTOM_MEMO "custom_memo"
#define GNC_PREF_CUSTOM_TRANSLATION "custom_translation" #define GNC_PREF_CUSTOM_TRANSLATION "custom_translation"
#define GNC_PREF_CUSTOM_ROTATION "custom_rotation" #define GNC_PREF_CUSTOM_ROTATION "custom_rotation"
#define KEY_CUSTOM_UNITS "custom_units" #define GNC_PREF_CUSTOM_UNITS "custom_units"
#define GNC_PREF_PRINT_DATE_FMT "print_date_format" #define GNC_PREF_PRINT_DATE_FMT "print_date_format"
#define GNC_PREF_DEFAULT_FONT "default_font" #define GNC_PREF_DEFAULT_FONT "default_font"
#define GNC_PREF_BLOCKING_CHARS "blocking_chars" #define GNC_PREF_BLOCKING_CHARS "blocking_chars"
@ -570,11 +569,11 @@ gnc_ui_print_save_dialog(PrintCheckDialog *pcd)
check ? check->guid : "custom", NULL); check ? check->guid : "custom", NULL);
} }
active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->position_combobox)); active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->position_combobox));
gnc_gconf_set_int(GCONF_SECTION, KEY_CHECK_POSITION, active, NULL); gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_CHECK_POSITION, active);
active = gtk_spin_button_get_value_as_int(pcd->first_page_count); active = gtk_spin_button_get_value_as_int(pcd->first_page_count);
gnc_gconf_set_int(GCONF_SECTION, KEY_FIRST_PAGE_COUNT, active, NULL); gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_FIRST_PAGE_COUNT, active);
active = gnc_date_format_get_format (GNC_DATE_FORMAT(pcd->date_format)); active = gnc_date_format_get_format (GNC_DATE_FORMAT(pcd->date_format));
gnc_gconf_set_int(GCONF_SECTION, KEY_DATE_FORMAT, active, NULL); gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_DATE_FORMAT, active);
if (active == QOF_DATE_FORMAT_CUSTOM) if (active == QOF_DATE_FORMAT_CUSTOM)
{ {
format = gnc_date_format_get_custom (GNC_DATE_FORMAT(pcd->date_format)); format = gnc_date_format_get_custom (GNC_DATE_FORMAT(pcd->date_format));
@ -622,7 +621,7 @@ gnc_ui_print_save_dialog(PrintCheckDialog *pcd)
gnc_prefs_set_float(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_ROTATION, gnc_prefs_set_float(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_ROTATION,
gtk_spin_button_get_value(pcd->check_rotation)); gtk_spin_button_get_value(pcd->check_rotation));
active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->units_combobox)); active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->units_combobox));
gnc_gconf_set_int(GCONF_SECTION, KEY_CUSTOM_UNITS, active, NULL); gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_UNITS, active);
} }
@ -638,15 +637,10 @@ gnc_ui_print_restore_dialog(PrintCheckDialog *pcd)
/* Options page */ /* Options page */
guid = gnc_gconf_get_string(GCONF_SECTION, KEY_CHECK_FORMAT_GUID, NULL); guid = gnc_gconf_get_string(GCONF_SECTION, KEY_CHECK_FORMAT_GUID, NULL);
if (guid == NULL) if (guid == NULL)
{ gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), 0);
active = gnc_gconf_get_int(GCONF_SECTION, KEY_CHECK_FORMAT, NULL);
gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), active);
}
else if (strcmp(guid, "custom") == 0) else if (strcmp(guid, "custom") == 0)
{
gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox),
pcd->format_max - 1); pcd->format_max - 1);
}
else else
{ {
model = gtk_combo_box_get_model(GTK_COMBO_BOX(pcd->format_combobox)); model = gtk_combo_box_get_model(GTK_COMBO_BOX(pcd->format_combobox));
@ -659,16 +653,16 @@ gnc_ui_print_restore_dialog(PrintCheckDialog *pcd)
gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), 0); gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), 0);
} }
} }
active = gnc_gconf_get_int(GCONF_SECTION, KEY_CHECK_POSITION, NULL); active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_CHECK_POSITION);
/* If the check format used last time no longer exists, then the saved check /* If the check format used last time no longer exists, then the saved check
position may be invalid. If so set it to the first position. */ position may be invalid. If so set it to the first position. */
if (active < 0 || active > pcd->position_max) if (active < 0 || active > pcd->position_max)
active = 0; active = 0;
gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->position_combobox), active); gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->position_combobox), active);
active = gnc_gconf_get_int(GCONF_SECTION, KEY_FIRST_PAGE_COUNT, NULL); active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_FIRST_PAGE_COUNT);
gtk_spin_button_set_value(pcd->first_page_count, (gdouble) active); gtk_spin_button_set_value(pcd->first_page_count, (gdouble) active);
active = gnc_gconf_get_int(GCONF_SECTION, KEY_DATE_FORMAT, NULL); active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_DATE_FORMAT);
gnc_date_format_set_format(GNC_DATE_FORMAT(pcd->date_format), active); gnc_date_format_set_format(GNC_DATE_FORMAT(pcd->date_format), active);
if (active == QOF_DATE_FORMAT_CUSTOM) if (active == QOF_DATE_FORMAT_CUSTOM)
{ {
@ -717,7 +711,7 @@ gnc_ui_print_restore_dialog(PrintCheckDialog *pcd)
gtk_spin_button_set_value(pcd->translation_y, y); gtk_spin_button_set_value(pcd->translation_y, y);
x = gnc_prefs_get_float(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_ROTATION); x = gnc_prefs_get_float(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_ROTATION);
gtk_spin_button_set_value(pcd->check_rotation, x); gtk_spin_button_set_value(pcd->check_rotation, x);
active = gnc_gconf_get_int(GCONF_SECTION, KEY_CUSTOM_UNITS, NULL); active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_UNITS);
gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->units_combobox), active); gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->units_combobox), active);
} }

View File

@ -36,7 +36,6 @@
#include "Account.h" #include "Account.h"
#include "gnc-ui-util.h" #include "gnc-ui-util.h"
#include "dialog-utils.h" #include "dialog-utils.h"
#include "gnc-gconf-utils.h"
#include "gnc-prefs.h" #include "gnc-prefs.h"
#include "gnc-tree-view-account.h" #include "gnc-tree-view-account.h"
#include "gnc-component-manager.h" #include "gnc-component-manager.h"
@ -45,9 +44,8 @@
#include "gnc-ui.h" #include "gnc-ui.h"
#define DIALOG_TAX_INFO_CM_CLASS "dialog-tax-info" #define DIALOG_TAX_INFO_CM_CLASS "dialog-tax-info"
#define GCONF_SECTION "dialogs/tax_info" #define GNC_PREFS_GROUP "dialogs.tax_info"
#define PANED_POSITION "paned_position" #define GNC_PREF_PANED_POS "paned_position"
#define GNC_PREFS_GROUP "dialogs.tax_info"
enum enum
{ {
@ -97,7 +95,6 @@ typedef struct
typedef struct typedef struct
{ {
GtkWidget * dialog; GtkWidget * dialog;
GtkWidget * paned;
GtkWidget * entity_name_display; GtkWidget * entity_name_display;
GtkWidget * entity_name_entry; GtkWidget * entity_name_entry;
@ -1461,12 +1458,11 @@ gnc_tax_info_dialog_create (GtkWidget * parent, TaxInfoDialog *ti_dialog)
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(ti_dialog->dialog)); gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(ti_dialog->dialog));
ti_dialog->paned = GTK_WIDGET(gtk_builder_get_object (builder, "paned"));
if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
{ {
gint position = gnc_gconf_get_int(GCONF_SECTION, PANED_POSITION, NULL); GObject *object = gtk_builder_get_object (builder, "paned");
gtk_paned_set_position(GTK_PANED(ti_dialog->paned), position); gnc_prefs_bind (GNC_PREFS_GROUP, GNC_PREF_PANED_POS, object, "position");
} }
g_object_unref (builder); g_object_unref (builder);
} }
@ -1476,12 +1472,6 @@ close_handler (gpointer user_data)
{ {
TaxInfoDialog *ti_dialog = user_data; TaxInfoDialog *ti_dialog = user_data;
if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
{
gnc_gconf_set_int(GCONF_SECTION, PANED_POSITION,
gtk_paned_get_position(GTK_PANED(ti_dialog->paned)), NULL);
}
gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(ti_dialog->dialog)); gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(ti_dialog->dialog));
gtk_widget_destroy (ti_dialog->dialog); gtk_widget_destroy (ti_dialog->dialog);
} }

View File

@ -1,15 +1,20 @@
<schemalist gettext-domain="GETTEXT_PACKAGE"> <schemalist gettext-domain="GETTEXT_PACKAGE">
<schema id="org.gnucash.dialogs.checkprinting" path="/apps/gnucash/dialogs/print_checks/"> <schema id="org.gnucash.dialogs.checkprinting" path="/apps/gnucash/dialogs/print_checks/">
<key name="check_format" type="i"> <key name="check_format_guid" type="s">
<default>0</default> <default>''</default>
<summary>Index of predefined check format to use</summary> <summary>GUID of predefined check format to use</summary>
<description>This value specifies the predefined check format to use. The number is the 0-based index into the list of known check formats.</description> <description>This value specifies the predefined check format to use. The number is the guid of a known check format.</description>
</key> </key>
<key name="check_position" type="i"> <key name="check_position" type="i">
<default>0</default> <default>0</default>
<summary>Which check position to print</summary> <summary>Which check position to print</summary>
<description>On preprinted checks containing multiple checks per page, this setting specifies which check position to print. The possible values are 0, 1 and 2, corresponding to the top, middle and bottom checks on the page.</description> <description>On preprinted checks containing multiple checks per page, this setting specifies which check position to print. The possible values are 0, 1 and 2, corresponding to the top, middle and bottom checks on the page.</description>
</key> </key>
<key name="first_page_count" type="i">
<default>0</default>
<summary>Number of checks to print on the first page.</summary>
<description>Number of checks to print on the first page.</description>
</key>
<key name="date_format" type="i"> <key name="date_format" type="i">
<default>0</default> <default>0</default>
<summary>Date format to use</summary> <summary>Date format to use</summary>

View File

@ -72,6 +72,11 @@
</schema> </schema>
<schema id="org.gnucash.dialogs.tax_info" path="/apps/gnucash/dialogs/tax_info/"> <schema id="org.gnucash.dialogs.tax_info" path="/apps/gnucash/dialogs/tax_info/">
<key name="paned_position" type="i">
<default>0</default>
<summary>Position of the horizontal pane divider.</summary>
<description>Position of the horizontal pane divider.</description>
</key>
<key name="last-geometry" type="(iiii)"> <key name="last-geometry" type="(iiii)">
<default>(-1,-1,-1,-1)</default> <default>(-1,-1,-1,-1)</default>
<summary>Last window position and size</summary> <summary>Last window position and size</summary>
@ -169,6 +174,16 @@
</schema> </schema>
<schema id="org.gnucash.dialogs.lot_viewer" path="/apps/gnucash/dialogs/lot_viewer/"> <schema id="org.gnucash.dialogs.lot_viewer" path="/apps/gnucash/dialogs/lot_viewer/">
<key name="hpane_position" type="i">
<default>200</default>
<summary>Position of the horizontal pane divider.</summary>
<description>Position of the horizontal pane divider.</description>
</key>
<key name="vpane_position" type="i">
<default>200</default>
<summary>Position of the vertical pane divider.</summary>
<description>Position of the vertical pane divider.</description>
</key>
<key name="last-geometry" type="(iiii)"> <key name="last-geometry" type="(iiii)">
<default>(-1,-1,-1,-1)</default> <default>(-1,-1,-1,-1)</default>
<summary>Last window position and size</summary> <summary>Last window position and size</summary>

View File

@ -18,7 +18,6 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="position">200</property> <property name="position">200</property>
<signal name="notify" handler="lv_paned_notify_cb"/>
<child> <child>
<object class="GtkHPaned" id="lot hpaned"> <object class="GtkHPaned" id="lot hpaned">
<property name="width_request">300</property> <property name="width_request">300</property>
@ -27,7 +26,6 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="border_width">3</property> <property name="border_width">3</property>
<property name="position">200</property> <property name="position">200</property>
<signal name="notify" handler="lv_paned_notify_cb"/>
<child> <child>
<object class="GtkTable" id="table1"> <object class="GtkTable" id="table1">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -34,7 +34,6 @@
#include "gnc-uri-utils.h" #include "gnc-uri-utils.h"
#include "gnc-component-manager.h" #include "gnc-component-manager.h"
#include "gnc-date-edit.h" #include "gnc-date-edit.h"
#include "gnc-gconf-utils.h"
#include "gnc-prefs.h" #include "gnc-prefs.h"
#include "gnc-tree-view-account.h" #include "gnc-tree-view-account.h"
#include "dialog-utils.h" #include "dialog-utils.h"
@ -46,9 +45,8 @@
#include "csv-tree-export.h" #include "csv-tree-export.h"
#include "csv-transactions-export.h" #include "csv-transactions-export.h"
#define GCONF_SECTION "dialogs/export/csv" #define GNC_PREFS_GROUP "dialogs.export.csv"
#define GNC_PREFS_GROUP "dialogs.export.csv" #define GNC_PREF_PANED_POS "paned_position"
#define PANED_POSITION "paned_position"
#define ASSISTANT_CSV_EXPORT_CM_CLASS "assistant-csv-export" #define ASSISTANT_CSV_EXPORT_CM_CLASS "assistant-csv-export"
/* This static indicates the debugging module that this .o belongs to. */ /* This static indicates the debugging module that this .o belongs to. */
@ -746,13 +744,6 @@ csv_export_assistant_summary_page_prepare (GtkAssistant *assistant,
{ {
CsvExportInfo *info = user_data; CsvExportInfo *info = user_data;
gchar *text, *mtext; gchar *text, *mtext;
/* Save the Window size, paned position and directory */
if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
{
gnc_gconf_set_int(GCONF_SECTION, PANED_POSITION,
gtk_paned_get_position(GTK_PANED(info->csva.paned)), NULL);
}
gnc_set_default_directory(GNC_PREFS_GROUP, info->starting_dir); gnc_set_default_directory(GNC_PREFS_GROUP, info->starting_dir);
if (info->failed) if (info->failed)
@ -1009,13 +1000,10 @@ csv_export_assistant_create (CsvExportInfo *info)
G_CALLBACK (csv_export_assistant_destroy_cb), info); G_CALLBACK (csv_export_assistant_destroy_cb), info);
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(info->window)); gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(info->window));
info->csva.paned = GTK_WIDGET(gtk_builder_get_object (builder, "paned"));
if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
{ {
gint position = gnc_gconf_get_int(GCONF_SECTION, PANED_POSITION, NULL); GObject *object = gtk_builder_get_object (builder, "paned");
gtk_paned_set_position(GTK_PANED(info->csva.paned), position); gnc_prefs_bind (GNC_PREFS_GROUP, GNC_PREF_PANED_POS, object, "position");
} }
gtk_builder_connect_signals(builder, info); gtk_builder_connect_signals(builder, info);

View File

@ -52,7 +52,6 @@ typedef struct
typedef struct typedef struct
{ {
GtkWidget *paned;
GtkWidget *acct_info; GtkWidget *acct_info;
GtkWidget *expense_radio; GtkWidget *expense_radio;
GtkWidget *asset_radio; GtkWidget *asset_radio;