GnuCash  5.6-150-g038405b370+
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 156 of file dialog-preferences.c.

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

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

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

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

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

1580 {
1581  GtkWidget *dialog;
1582 
1583  ENTER("");
1584  if (gnc_forall_gui_components (DIALOG_PREFERENCES_CM_CLASS,
1585  show_handler, NULL))
1586  {
1587  LEAVE("existing window");
1588  return;
1589  }
1590 
1591  dialog = gnc_preferences_dialog_create(parent);
1592 
1593  gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(dialog), parent);
1594  gtk_widget_show (dialog);
1595 
1596  gnc_register_gui_component (DIALOG_PREFERENCES_CM_CLASS,
1597  NULL, close_handler, dialog);
1598 
1599  LEAVE(" ");
1600 }
#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 1207 of file dialog-preferences.c.

1208 {
1209  switch (response)
1210  {
1211  case GTK_RESPONSE_HELP:
1212  gnc_gnome_help (GTK_WINDOW(dialog), DF_MANUAL, DL_GLOBPREFS);
1213  break;
1214 
1215  case GTK_RESPONSE_DELETE_EVENT:
1216  default:
1217  if (gnc_account_separator_validate (GTK_WIDGET(dialog)))
1218  {
1219  gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(dialog));
1220  gnc_unregister_gui_component_by_data (DIALOG_PREFERENCES_CM_CLASS,
1221  dialog);
1222  gtk_widget_destroy (GTK_WIDGET(dialog));
1223  }
1224  else
1225  gnc_preferences_select_account_page (dialog);
1226  break;
1227  }
1228 }
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 122 of file dialog-preferences.c.