GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Files | Data Structures | Macros | Typedefs | Functions | Variables
Preferences Dialog

Files

file  dialog-preferences.c
 Dialog for handling user preferences.
 
file  dialog-preferences.h
 Dialog for handling user preferences.
 

Data Structures

struct  addition_t
 
struct  copy_data
 

Macros

#define DIALOG_PREFERENCES_CM_CLASS   "dialog-newpreferences"
 
#define GNC_PREFS_GROUP   "dialogs.preferences"
 
#define PREF_PREFIX_LEN   sizeof("pref/") - 1
 
#define PREFS_WIDGET_HASH   "prefs_widget_hash"
 
#define NOTEBOOK   "notebook"
 

Typedefs

typedef struct addition_t addition
 

Functions

void gnc_preferences_response_cb (GtkDialog *dialog, gint response, GtkDialog *unused)
 
void gnc_account_separator_pref_changed_cb (GtkEntry *entry, GtkWidget *dialog)
 
gboolean gnc_account_separator_validate_cb (GtkEntry *entry, GdkEvent *event, GtkWidget *dialog)
 
void gnc_preferences_add_page (const gchar *filename, const gchar *widgetname, const gchar *tabname)
 
void gnc_preferences_add_to_page (const gchar *filename, const gchar *widgetname, const gchar *tabname)
 
void gnc_preferences_dialog (void)
 

Variables

GSList * add_ins = NULL
 

Detailed Description

Typedef Documentation

typedef struct addition_t addition

This data structure holds the information for a single addition to the preferences dialog.

Function Documentation

void gnc_account_separator_pref_changed_cb ( GtkEntry *  entry,
GtkWidget *  dialog 
)

This function is called whenever the account separator is changed in the preferences dialog. It updates the example label in the "Account" page of the preferences dialog.

Definition at line 147 of file dialog-preferences.c.

148 {
149  GtkWidget *label, *image;
150  gchar *sample;
151  gchar *separator;
152 
153  gchar *conflict_msg = gnc_account_separator_is_valid (gtk_entry_get_text (entry), &separator);
154 
155  label = g_object_get_data(G_OBJECT(dialog), "sample_account");
156  DEBUG("Sample Account pointer is %p", label );
157  /* Translators: Both %s will be the account separator character; the
158  resulting string is a demonstration how the account separator
159  character will look like. You can replace these three account
160  names with other account names that are more suitable for your
161  language - just keep in mind to have exactly two %s in your
162  translation. */
163  sample = g_strdup_printf(_("Income%sSalary%sTaxable"),
164  separator, separator);
165  PINFO(" Label set to '%s'", sample);
166  gtk_label_set_text(GTK_LABEL(label), sample);
167  g_free(sample);
168 
169  /* Check if the new separator clashes with existing account names */
170  image = g_object_get_data(G_OBJECT(dialog), "separator_error");
171  DEBUG("Separator Error Image pointer is %p", image );
172 
173  if (conflict_msg)
174  {
175  gtk_widget_set_tooltip_text(GTK_WIDGET(image), conflict_msg);
176  gtk_widget_show (GTK_WIDGET(image));
177  g_free ( conflict_msg );
178  }
179  else
180  gtk_widget_hide (GTK_WIDGET(image));
181 
182  g_free (separator);
183 }
#define PINFO(format, args...)
Definition: qoflog.h:249
#define DEBUG(format, args...)
Definition: qoflog.h:255
void gnc_preferences_add_page ( const gchar *  filename,
const gchar *  widgetname,
const gchar *  tabname 
)

This function adds a full page of preferences to the preferences dialog. When the dialog is created, the specified widget will be pulled from the specified glade file and added to the preferences dialog with the specified tab name. The tab name may not be duplicated. For example, the Business code might have a full page of its own preferences.

Parameters
filenameThe name of a glade file.
widgetnameThe name of the widget to extract from the glade file.
tabnameThe (translated!) name this page of preferences should have in the dialog notebook.

Definition at line 326 of file dialog-preferences.c.

329 {
330  gnc_preferences_add_page_internal(filename, widgetname, tabname, TRUE);
331 }
void gnc_preferences_add_to_page ( const gchar *  filename,
const gchar *  widgetname,
const gchar *  tabname 
)

This function adds a partial page of preferences to the preferences dialog. When the dialog is created, the specified widget will be pulled from the specified glade file and added to the preferences dialog with the specified tab name. The tab name may be duplicated. For example, the HBCI preferences may share a "Data Import" page with QIF and other methods.

Parameters
filenameThe name of a glade file.
widgetnameThe name of the widget to extract from the glade file.
tabnameThe (translated!) name this page of preferences should have in the dialog notebook.

Definition at line 341 of file dialog-preferences.c.

344 {
345  gnc_preferences_add_page_internal(filename, widgetname, tabname, FALSE);
346 }
void gnc_preferences_dialog ( void  )

This function creates the preferences dialog and presents it to the user. The preferences dialog is a singleton, so if a preferences dialog already exists it will be raised to the top of the window stack instead of creating a new dialog.

Definition at line 1264 of file dialog-preferences.c.

1265 {
1266  GtkWidget *dialog;
1267 
1268  ENTER("");
1269  if (gnc_forall_gui_components(DIALOG_PREFERENCES_CM_CLASS,
1270  show_handler, NULL))
1271  {
1272  LEAVE("existing window");
1273  return;
1274  }
1275 
1276  dialog = gnc_preferences_dialog_create();
1277 
1278  gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(dialog));
1279  gtk_widget_show(dialog);
1280 
1281  gnc_register_gui_component(DIALOG_PREFERENCES_CM_CLASS,
1282  NULL, close_handler, dialog);
1283 
1284  LEAVE(" ");
1285 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
void gnc_preferences_response_cb ( GtkDialog *  dialog,
gint  response,
GtkDialog *  unused 
)

Handle a user click on one of the buttons at the bottom of the preference dialog. Also handles delete_window events, which have conveniently converted to a response by GtkDialog.

Definition at line 934 of file dialog-preferences.c.

935 {
936  switch (response)
937  {
938  case GTK_RESPONSE_HELP:
939  gnc_gnome_help(HF_HELP, HL_GLOBPREFS);
940  break;
941 
942  default:
943  gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(dialog));
944  gnc_unregister_gui_component_by_data(DIALOG_PREFERENCES_CM_CLASS,
945  dialog);
946  gtk_widget_destroy(GTK_WIDGET(dialog));
947  break;
948  }
949 }
void gnc_gnome_help(const char *file_name, const char *anchor)

Variable Documentation

GSList* add_ins = NULL

A list of all additions that have been made to the preferences dialog. The data fields for this list are addition data structures.

Definition at line 116 of file dialog-preferences.c.