GnuCash  4.12-527-g05ffd3d4eb
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 150 of file dialog-preferences.c.

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

416 {
417  gnc_preferences_add_page_internal (filename, widgetname, tabname, TRUE);
418 }

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

431 {
432  gnc_preferences_add_page_internal (filename, widgetname, tabname, FALSE);
433 }

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

1566 {
1567  GtkWidget *dialog;
1568 
1569  ENTER("");
1570  if (gnc_forall_gui_components (DIALOG_PREFERENCES_CM_CLASS,
1571  show_handler, NULL))
1572  {
1573  LEAVE("existing window");
1574  return;
1575  }
1576 
1577  dialog = gnc_preferences_dialog_create(parent);
1578 
1579  gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(dialog), parent);
1580  gtk_widget_show (dialog);
1581 
1582  gnc_register_gui_component (DIALOG_PREFERENCES_CM_CLASS,
1583  NULL, close_handler, dialog);
1584 
1585  LEAVE(" ");
1586 }
#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 1195 of file dialog-preferences.c.

1196 {
1197  switch (response)
1198  {
1199  case GTK_RESPONSE_HELP:
1200  gnc_gnome_help (GTK_WINDOW(dialog), HF_HELP, HL_GLOBPREFS);
1201  break;
1202 
1203  case GTK_RESPONSE_DELETE_EVENT:
1204  default:
1205  if (gnc_account_separator_validate (GTK_WIDGET(dialog)))
1206  {
1207  gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(dialog));
1208  gnc_unregister_gui_component_by_data (DIALOG_PREFERENCES_CM_CLASS,
1209  dialog);
1210  gtk_widget_destroy (GTK_WIDGET(dialog));
1211  }
1212  else
1213  gnc_preferences_select_account_page (dialog);
1214  break;
1215  }
1216 }
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 120 of file dialog-preferences.c.