GnuCash  5.6-133-gc519490283+
Files | Data Structures | Macros | 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
 This data structure holds the information for a single addition to the preferences dialog. More...
 
struct  copy_data
 This data structure is used while building the preferences dialog to copy a grid from a glade file to the dialog under construction. More...
 

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"
 

Functions

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. More...
 
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. More...
 
void gnc_save_on_close_expires_cb (GtkToggleButton *button, GtkWidget *dialog)
 Called when the save-on-close checkbutton is toggled.
 
gboolean gnc_preferences_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
 
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. More...
 
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. More...
 
void gnc_preferences_dialog (GtkWindow *parent)
 This function creates the preferences dialog and presents it to the user. More...
 

Variables

GSList * add_ins = NULL
 A list of all additions that have been made to the preferences dialog. More...
 

Detailed Description

Function Documentation

◆ gnc_account_separator_pref_changed_cb()

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 155 of file dialog-preferences.c.

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

◆ gnc_preferences_add_page()

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 418 of file dialog-preferences.c.

421 {
422  gnc_preferences_add_page_internal (filename, widgetname, tabname, TRUE);
423 }

◆ gnc_preferences_add_to_page()

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 433 of file dialog-preferences.c.

436 {
437  gnc_preferences_add_page_internal (filename, widgetname, tabname, FALSE);
438 }

◆ gnc_preferences_dialog()

void gnc_preferences_dialog ( GtkWindow *  parent)

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 1572 of file dialog-preferences.c.

1573 {
1574  GtkWidget *dialog;
1575 
1576  ENTER("");
1577  if (gnc_forall_gui_components (DIALOG_PREFERENCES_CM_CLASS,
1578  show_handler, NULL))
1579  {
1580  LEAVE("existing window");
1581  return;
1582  }
1583 
1584  dialog = gnc_preferences_dialog_create(parent);
1585 
1586  gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(dialog), parent);
1587  gtk_widget_show (dialog);
1588 
1589  gnc_register_gui_component (DIALOG_PREFERENCES_CM_CLASS,
1590  NULL, close_handler, dialog);
1591 
1592  LEAVE(" ");
1593 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_preferences_response_cb()

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 1200 of file dialog-preferences.c.

1201 {
1202  switch (response)
1203  {
1204  case GTK_RESPONSE_HELP:
1205  gnc_gnome_help (GTK_WINDOW(dialog), DF_MANUAL, DL_GLOBPREFS);
1206  break;
1207 
1208  case GTK_RESPONSE_DELETE_EVENT:
1209  default:
1210  if (gnc_account_separator_validate (GTK_WIDGET(dialog)))
1211  {
1212  gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(dialog));
1213  gnc_unregister_gui_component_by_data (DIALOG_PREFERENCES_CM_CLASS,
1214  dialog);
1215  gtk_widget_destroy (GTK_WIDGET(dialog));
1216  }
1217  else
1218  gnc_preferences_select_account_page (dialog);
1219  break;
1220  }
1221 }
void gnc_gnome_help(GtkWindow *parent, const char *file_name, const char *anchor)
Launch the systems default help browser, gnome's yelp for linux, and open to a given link within a gi...

Variable Documentation

◆ add_ins

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 121 of file dialog-preferences.c.