Heraia  0.1.8
user_prefs.c File Reference

Users preference may be somewhere around here. More...

#include <libheraia.h>
Include dependency graph for user_prefs.c:

Go to the source code of this file.

Functions

static void verify_preference_file_path_presence (gchar *pathname)
 verify preference file path presence and creates it if it does not already exists More...
 
static void verify_preference_file_name_presence (gchar *filename)
 Verify preference file's presence and creates it if it does not exists already. More...
 
static void save_window_preferences (GKeyFile *file, gchar *name, window_prop_t *window_prop)
 Window preferences. More...
 
static void save_mp_file_preferences_options (heraia_struct_t *main_struct, prefs_t *prefs)
 Save only file preferences related options. More...
 
static void save_mp_display_preferences_options (heraia_struct_t *main_struct, prefs_t *prefs)
 Save only display related preferences. More...
 
static void save_mp_files_filenames (heraia_struct_t *main_struct, prefs_t *prefs)
 Saves files filenames to the config file. More...
 
static void save_di_preferences (heraia_struct_t *main_struct, prefs_t *prefs)
 Saves data interpretor state and preferences. More...
 
static void save_mpwp_preferences (heraia_struct_t *main_struct, prefs_t *prefs)
 Saves main preferences window state and preferences. More...
 
static void load_window_preferences (GKeyFile *file, gchar *name, window_prop_t *window_prop)
 Window preferences. More...
 
static void load_mp_file_preferences_options (heraia_struct_t *main_struct, prefs_t *prefs)
 Load only main preferences related options. More...
 
static void load_mp_display_preferences_options (heraia_struct_t *main_struct, prefs_t *prefs)
 Load display related preferences. More...
 
static void load_mp_files_filenames (heraia_struct_t *main_struct, prefs_t *prefs)
 Load files filenames from the config file. More...
 
static void load_di_preferences (heraia_struct_t *main_struct, prefs_t *prefs)
 Load data interpretor state and preferences. More...
 
static void load_mpwp_preferences (heraia_struct_t *main_struct, prefs_t *prefs)
 Load main preferences window state and preferences. More...
 
void verify_preference_file (prefs_t *prefs)
 Verify preference file presence and creates it if it does not already exists. More...
 
prefs_tinit_preference_struct (gchar *pathname, gchar *filename)
 Look out if the preference structure exists or not. More...
 
void free_preference_struct (prefs_t *prefs)
 Destroys a preference structure. More...
 
void save_preferences (heraia_struct_t *main_struct, prefs_t *prefs)
 Save all preferences to the user preference file. More...
 
void load_preferences (heraia_struct_t *main_struct, prefs_t *prefs)
 Sets up the preferences as loaded in the preference file. More...
 

Detailed Description

Users preference may be somewhere around here.

Definition in file user_prefs.c.

Function Documentation

void free_preference_struct ( prefs_t prefs)

Destroys a preference structure.

Parameters
prefsthe preference structure to be freed

Definition at line 148 of file user_prefs.c.

References prefs_t::file, prefs_t::filename, and prefs_t::pathname.

Referenced by close_a_project(), and on_projects_save_as_activate().

Here is the caller graph for this function:

prefs_t* init_preference_struct ( gchar *  pathname,
gchar *  filename 
)

Look out if the preference structure exists or not.

If not it creates it.

See also
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
Parameters
pathnameis the pathname where the preference file is
filenameis the filename of the preference file itself

Definition at line 130 of file user_prefs.c.

References prefs_t::file, prefs_t::filename, and prefs_t::pathname.

Referenced by heraia_init_main_struct(), on_projects_open_activate(), and on_projects_save_as_activate().

Here is the caller graph for this function:

static void load_di_preferences ( heraia_struct_t main_struct,
prefs_t prefs 
)
static

Load data interpretor state and preferences.

Parameters
main_struct: main structure
prefsis a 'prefs_t *' filled preference structure

< Selected tab in data interpretor's window

< Stream size in data interpretor's window

< Endianness in data interpretor's window

Definition at line 555 of file user_prefs.c.

References heraia_struct_t::current_DW, di_set_endianness(), di_set_selected_tab(), di_set_stream_size(), prefs_t::file, GN_DI_PREFS, KN_DI_ENDIANNESS, KN_DI_SELECTED_TAB, KN_DI_STREAM_SIZE, xml_t::main, and heraia_struct_t::xmls.

Referenced by load_preferences().

Here is the call graph for this function:

Here is the caller graph for this function:

static void load_mp_display_preferences_options ( heraia_struct_t main_struct,
prefs_t prefs 
)
static

Load display related preferences.

Parameters
main_structthe main structure
prefsis a 'prefs_t *' filled preference structure

Definition at line 530 of file user_prefs.c.

References prefs_t::file, GN_DISPLAY_PREFS, heraia_get_widget(), KN_DISP_OFFSETS, KN_DISP_THOUSAND, xml_t::main, and heraia_struct_t::xmls.

Referenced by load_preferences().

Here is the call graph for this function:

Here is the caller graph for this function:

static void load_mp_files_filenames ( heraia_struct_t main_struct,
prefs_t prefs 
)
static

Load files filenames from the config file.

Parameters
main_structthe main structure
prefspreference structure

< The list that will contain all filenames to be loaded

< list of the current position of the cursor in the documents

Definition at line 486 of file user_prefs.c.

References heraia_struct_t::current_doc, prefs_t::file, ghex_set_cursor_position(), GN_GLOBAL_PREFS, heraia_get_widget(), doc_t::hex_widget, KN_CURRENT_TAB, KN_FILES_CURSOR_POSITIONS, KN_FILES_FILENAMES, load_file_to_analyse(), xml_t::main, and heraia_struct_t::xmls.

Referenced by load_mp_file_preferences_options().

Here is the call graph for this function:

Here is the caller graph for this function:

static void load_mpwp_preferences ( heraia_struct_t main_struct,
prefs_t prefs 
)
static

Load main preferences window state and preferences.

Parameters
main_struct: main structure
prefsis a 'prefs_t *' filled preference structure

< main preferences's notebook

< tool button from the toolbar

< Selected tab in data interpretor's window

Definition at line 579 of file user_prefs.c.

References heraia_struct_t::current_DW, prefs_t::file, GN_MPWP_PREFS, heraia_get_widget(), KN_MPWP_SELECTED_TAB, xml_t::main, and heraia_struct_t::xmls.

Referenced by load_preferences().

Here is the call graph for this function:

Here is the caller graph for this function:

void load_preferences ( heraia_struct_t main_struct,
prefs_t prefs 
)

Sets up the preferences as loaded in the preference file.

Parameters
main_structthe main structure
prefsis a 'prefs_t *' filled preference structure

Definition at line 620 of file user_prefs.c.

References load_di_preferences(), load_mp_display_preferences_options(), load_mp_file_preferences_options(), load_mpwp_preferences(), load_preference_file(), and log_message().

Referenced by load_heraia_ui(), and on_projects_open_activate().

Here is the call graph for this function:

Here is the caller graph for this function:

static void load_window_preferences ( GKeyFile *  file,
gchar *  name,
window_prop_t window_prop 
)
static

Window preferences.

Parameters
filea GKeyFile where values are stored
namea keyname (basically a window name)
window_propall window properties to save (structure window_prop_t)

Definition at line 404 of file user_prefs.c.

References window_prop_t::displayed, GN_GLOBAL_PREFS, window_prop_t::height, window_prop_t::width, window_prop_t::x, and window_prop_t::y.

Referenced by load_mp_file_preferences_options().

Here is the caller graph for this function:

static void save_di_preferences ( heraia_struct_t main_struct,
prefs_t prefs 
)
static

Saves data interpretor state and preferences.

Parameters
main_struct: main structure
prefsis a 'prefs_t *' filled preference structure

< Selected tab in data interpretor's window

< Stream size in data interpretor's window

< Endianness in data interpretor's window

Definition at line 315 of file user_prefs.c.

References heraia_struct_t::current_DW, di_get_endianness(), di_get_selected_tab(), di_get_stream_size(), prefs_t::file, GN_DI_PREFS, KN_DI_ENDIANNESS, KN_DI_SELECTED_TAB, and KN_DI_STREAM_SIZE.

Referenced by save_preferences().

Here is the call graph for this function:

Here is the caller graph for this function:

static void save_mp_display_preferences_options ( heraia_struct_t main_struct,
prefs_t prefs 
)
static

Save only display related preferences.

Parameters
main_struct: main structure
prefsis a 'prefs_t *' filled preference structure

Definition at line 293 of file user_prefs.c.

References prefs_t::file, GN_DISPLAY_PREFS, is_toggle_button_activated(), KN_DISP_OFFSETS, KN_DISP_THOUSAND, xml_t::main, and heraia_struct_t::xmls.

Referenced by save_preferences().

Here is the call graph for this function:

Here is the caller graph for this function:

static void save_mp_files_filenames ( heraia_struct_t main_struct,
prefs_t prefs 
)
static

Saves files filenames to the config file.

Parameters
main_structthe main structure
prefspreference structure

< A list that will contain all the files filenames

< One filename

< list of the current position of the cursor in the documents

< Current selected tab in the main notebook

< One document (from the documents array in the main_struct

< Main notebook in the file view in the main window

Definition at line 240 of file user_prefs.c.

References doc_t_document_get_filename(), heraia_struct_t::documents, prefs_t::file, ghex_get_cursor_position(), GN_GLOBAL_PREFS, heraia_get_widget(), doc_t::hex_widget, KN_CURRENT_TAB, KN_FILES_CURSOR_POSITIONS, KN_FILES_FILENAMES, xml_t::main, and heraia_struct_t::xmls.

Referenced by save_mp_file_preferences_options().

Here is the call graph for this function:

Here is the caller graph for this function:

static void save_mpwp_preferences ( heraia_struct_t main_struct,
prefs_t prefs 
)
static

Saves main preferences window state and preferences.

Parameters
main_struct: main structure
prefsis a 'prefs_t *' filled preference structure

< main preferences's notebook

< Selected tab in data interpretor's window

Definition at line 349 of file user_prefs.c.

References heraia_struct_t::current_DW, prefs_t::file, GN_MPWP_PREFS, heraia_get_widget(), KN_MPWP_SELECTED_TAB, xml_t::main, and heraia_struct_t::xmls.

Referenced by save_preferences().

Here is the call graph for this function:

Here is the caller graph for this function:

void save_preferences ( heraia_struct_t main_struct,
prefs_t prefs 
)

Save all preferences to the user preference file.

Parameters
main_structthe main structure
prefsis a 'prefs_t *' filled preference structure

Definition at line 376 of file user_prefs.c.

References save_di_preferences(), save_mp_display_preferences_options(), save_mp_file_preferences_options(), save_mpwp_preferences(), and save_preferences_to_file().

Referenced by close_a_project(), on_projects_save_as_activate(), and pref_window_delete().

Here is the call graph for this function:

Here is the caller graph for this function:

static void save_window_preferences ( GKeyFile *  file,
gchar *  name,
window_prop_t window_prop 
)
static

Window preferences.

Parameters
filea GKeyFile where values are stored
namea keyname (basically a window name)
window_propall window properties to save (structure window_prop_t)

Definition at line 165 of file user_prefs.c.

References window_prop_t::displayed, GN_GLOBAL_PREFS, window_prop_t::height, window_prop_t::width, window_prop_t::x, and window_prop_t::y.

Referenced by save_mp_file_preferences_options().

Here is the caller graph for this function:

void verify_preference_file ( prefs_t prefs)

Verify preference file presence and creates it if it does not already exists.

Parameters
prefsis a 'prefs_t *' filled preference structure

Definition at line 113 of file user_prefs.c.

References prefs_t::filename, prefs_t::pathname, verify_preference_file_name_presence(), and verify_preference_file_path_presence().

Referenced by heraia_init_main_struct().

Here is the call graph for this function:

Here is the caller graph for this function:

static void verify_preference_file_name_presence ( gchar *  filename)
static

Verify preference file's presence and creates it if it does not exists already.

Parameters
filenameis a name of a file to look presence for

Definition at line 82 of file user_prefs.c.

Referenced by verify_preference_file().

Here is the caller graph for this function:

static void verify_preference_file_path_presence ( gchar *  pathname)
static

verify preference file path presence and creates it if it does not already exists

Parameters
pathnameis a path to look presence for

Definition at line 62 of file user_prefs.c.

Referenced by verify_preference_file().

Here is the caller graph for this function: