heraia/trunk/libheraia/heraia_ui.c File Reference

#include <libheraia.h>

Include dependency graph for heraia_ui.c:

Go to the source code of this file.

Functions

static gboolean load_heraia_glade_xml (heraia_window_t *main_window)
static void heraia_ui_connect_signals (heraia_window_t *main_window)
static void record_and_hide_about_box (heraia_window_t *main_window)
static void refresh_file_labels (heraia_window_t *main_window)
static void close_heraia (heraia_window_t *main_window)
void on_quit_activate (GtkWidget *widget, gpointer data)
void on_new_activate (GtkWidget *widget, gpointer data)
void on_preferences_activate (GtkWidget *widget, gpointer data)
void a_propos_activate (GtkWidget *widget, gpointer data)
void move_and_show_dialog_box (GtkWidget *dialog_box, window_prop_t *dialog_prop)
void record_dialog_box_position (GtkWidget *dialog_box, window_prop_t *dialog_prop)
void record_all_dialog_box_positions (heraia_window_t *main_window)
void record_and_hide_dialog_box (GtkWidget *dialog_box, window_prop_t *dialog_prop)
static void a_propos_response (GtkWidget *widget, gint response, gpointer data)
static void a_propos_close (GtkWidget *widget, gpointer data)
static gboolean a_propos_delete (GtkWidget *widget, GdkEvent *event, gpointer data)
void on_delete_activate (GtkWidget *widget, gpointer data)
void on_cut_activate (GtkWidget *widget, gpointer data)
void on_copy_activate (GtkWidget *widget, gpointer data)
void on_paste_activate (GtkWidget *widget, gpointer data)
void refresh_event_handler (GtkWidget *widget, gpointer data)
void on_open_activate (GtkWidget *widget, gpointer data)
void on_save_activate (GtkWidget *widget, gpointer data)
void on_save_as_activate (GtkWidget *widget, gpointer data)
void on_DIMenu_activate (GtkWidget *widget, gpointer data)
gboolean delete_main_window_event (GtkWidget *widget, GdkEvent *event, gpointer data)
gboolean delete_dt_window_event (GtkWidget *widget, GdkEvent *event, gpointer data)
void destroy_dt_window (GtkWidget *widget, GdkEvent *event, gpointer data)
static gchar * make_absolute_path (gchar *filename)
static void set_the_working_directory (GtkFileChooser *file_chooser, gchar *filename)
gboolean select_file_to_load (heraia_window_t *main_window)
gchar * select_a_file_to_save (heraia_window_t *main_window)
void update_main_window_name (heraia_window_t *main_window)
void set_notebook_tab_name (heraia_window_t *main_window)
void init_heraia_interface (heraia_window_t *main_window)
void connect_cursor_moved_signal (heraia_window_t *main_window)
int load_heraia_ui (heraia_window_t *main_window)
void add_text_to_textview (GtkTextView *textview, const char *format,...)
void kill_text_from_textview (GtkTextView *textview)
GtkWidget * gtk_radio_button_get_active (GSList *group)
GtkWidget * gtk_radio_button_get_active_from_widget (GtkRadioButton *radio_group_member)
gboolean is_cmi_checked (GtkWidget *check_menu_item)
GtkWidget * heraia_get_widget (GladeXML *xml, gchar *widget_name)
void destroy_a_single_widget (GtkWidget *widget)
static void init_one_cmi_window_state (GtkWidget *dialog_box, GtkWidget *cmi, window_prop_t *dialog_prop)
void init_window_states (heraia_window_t *main_window)


Function Documentation

void a_propos_activate ( GtkWidget *  widget,
gpointer  data 
)

Shows apropos's dialog box

Definition at line 75 of file heraia_ui.c.

References all_window_prop_t::about_box, heraia_get_widget(), xml_t::main, move_and_show_dialog_box(), PACKAGE_NAME, PACKAGE_VERSION, heraia_window_t::win_prop, and heraia_window_t::xmls.

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

static void a_propos_close ( GtkWidget *  widget,
gpointer  data 
) [static]

Definition at line 216 of file heraia_ui.c.

References record_and_hide_about_box().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

static gboolean a_propos_delete ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
) [static]

Definition at line 222 of file heraia_ui.c.

References record_and_hide_about_box().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

static void a_propos_response ( GtkWidget *  widget,
gint  response,
gpointer  data 
) [static]

To close the A propos dialog box (with the "close" button)

Definition at line 210 of file heraia_ui.c.

References record_and_hide_about_box().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

void add_text_to_textview ( GtkTextView *  textview,
const char *  format,
  ... 
)

static void close_heraia ( heraia_window_t main_window  )  [static]

Before closing heraia we need to do few things

Definition at line 1104 of file heraia_ui.c.

References record_all_dialog_box_positions(), and save_main_preferences().

Referenced by delete_main_window_event(), and on_quit_activate().

Here is the call graph for this function:

void connect_cursor_moved_signal ( heraia_window_t main_window  ) 

Connects the signal that the cursor has moved to the refreshing function

Definition at line 782 of file heraia_ui.c.

References heraia_window_t::current_DW, data_window_t::current_hexwidget, and refresh_event_handler().

Referenced by heraia_hex_document_new().

Here is the call graph for this function:

gboolean delete_dt_window_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
)

call back functions for the data interpretor window destruction

Definition at line 477 of file heraia_ui.c.

References heraia_get_widget(), xml_t::main, and heraia_window_t::xmls.

Referenced by connect_data_interpretor_signals().

Here is the call graph for this function:

gboolean delete_main_window_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
)

When the user destroys or delete the main window

Definition at line 464 of file heraia_ui.c.

References close_heraia().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

void destroy_a_single_widget ( GtkWidget *  widget  ) 

Destroys a single widget if it exists

Definition at line 1093 of file heraia_ui.c.

Referenced by destroy_container_widget(), dt_cancel_button_clicked(), dt_ok_button_clicked(), and ldt_remove_button_clicked().

void destroy_dt_window ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
)

Definition at line 486 of file heraia_ui.c.

References heraia_get_widget(), xml_t::main, and heraia_window_t::xmls.

Referenced by connect_data_interpretor_signals().

Here is the call graph for this function:

GtkWidget* gtk_radio_button_get_active ( GSList *  group  ) 

Try to find the active radio button widget in a group This does not take into account inconsistant states returns the first active radio button otherwise NULL

Definition at line 1022 of file heraia_ui.c.

Referenced by gtk_radio_button_get_active_from_widget().

GtkWidget* gtk_radio_button_get_active_from_widget ( GtkRadioButton *  radio_group_member  ) 

gtk_radio_button_get_active_from_widget: : widget to get radio group from

Returns:
: the active GtkRadioButton within the group from

Definition at line 1046 of file heraia_ui.c.

References gtk_radio_button_get_active().

Referenced by which_endianness().

Here is the call graph for this function:

GtkWidget* heraia_get_widget ( GladeXML *  xml,
gchar *  widget_name 
)

This is a wrapper to the glade xml get widget. It is intended to simplify the developpers lives if they have to choose or propose other means to do the same thing than libglade (say, for example, GtkBuilder :)

For debug purposes only (verbose) fprintf(stdout, "Getting Widget named %s\n", widget_name);

Definition at line 1074 of file heraia_ui.c.

Referenced by a_propos_activate(), add_data_type_name_to_treeview(), add_entry_to_plugins_menu(), close_data_interpretor_window(), close_data_type_window(), connect_data_interpretor_signals(), connect_data_type_signals(), connect_list_data_types_signals(), create_treatment_container_widget(), create_ud_data_interpretor_widgets(), data_interpretor_init_interface(), delete_dt_window_event(), delete_ldt_window_event(), destroy_dt_window(), destroy_ldt_window(), dt_name_entry_leave_notify_event(), dt_size_spinbutton_value_changed(), fill_data_type_widgets(), heraia_ui_connect_signals(), init_heraia_interface(), init_plugin_name_tv(), init_window_states(), interpret_as_date(), interpret_as_number(), ldt_edit_button_clicked(), ldt_remove_button_clicked(), load_file_to_analyse(), load_mp_file_preferences_options(), log_window_connect_signals(), logw_close_clicked(), main_pref_window_connect_signals(), mw_cmi_plw_toggle(), my_log(), on_DIMenu_activate(), on_ldt_menu_activate(), on_mp_tb_fp_bt_clicked(), on_preferences_activate(), plugin_list_window_connect_signals(), plw_close_clicked(), plw_refresh_clicked(), pn_treeview_selection_changed_cb(), pref_window_delete(), record_all_dialog_box_positions(), record_and_hide_about_box(), refresh_file_labels(), refresh_hex_datas_entry(), save_mp_file_preferences_options(), select_a_file_to_save(), select_file_to_load(), set_notebook_tab_name(), set_spinbutton_max_range(), show_data_type_window(), show_hide_log_window(), update_main_window_name(), and which_endianness().

static void heraia_ui_connect_signals ( heraia_window_t main_window  )  [static]

void init_heraia_interface ( heraia_window_t main_window  ) 

Here we might init some call backs and menu options and display the interface (main && sub-windows) This function should be called only once at main program's init time

Definition at line 718 of file heraia_ui.c.

References heraia_window_t::current_doc, heraia_get_widget(), init_window_states(), xml_t::main, refresh_file_labels(), and heraia_window_t::xmls.

Referenced by main().

Here is the call graph for this function:

static void init_one_cmi_window_state ( GtkWidget *  dialog_box,
GtkWidget *  cmi,
window_prop_t dialog_prop 
) [static]

Definition at line 1115 of file heraia_ui.c.

References window_prop_t::displayed, window_prop_t::x, and window_prop_t::y.

Referenced by init_window_states().

void init_window_states ( heraia_window_t main_window  ) 

gboolean is_cmi_checked ( GtkWidget *  check_menu_item  ) 

Tells whether a GtkCheckMenuItem is Checked or not

Definition at line 1062 of file heraia_ui.c.

Referenced by on_ldt_menu_activate().

void kill_text_from_textview ( GtkTextView *  textview  ) 

Kills the text from a textview

Definition at line 1004 of file heraia_ui.c.

Referenced by plw_refresh_clicked(), pn_treeview_selection_changed_cb(), and realize_some_numerical_stat().

static gboolean load_heraia_glade_xml ( heraia_window_t main_window  )  [static]

Loads the glade xml files that describes the heraia project tries the following paths in that order :

  • /etc/heraia/heraia.glade
  • /home/[user]/.heraia/heraia.glade
  • PWD/heraia.glade

filename = g_strdup_printf("treatment.glade"); main_window->xmls->treatment = load_glade_xml_file(main_window->location_list, filename); g_free(filename);

Definition at line 752 of file heraia_ui.c.

References load_glade_xml_file(), heraia_window_t::location_list, xml_t::main, and heraia_window_t::xmls.

Referenced by load_heraia_ui().

Here is the call graph for this function:

int load_heraia_ui ( heraia_window_t main_window  ) 

Loads, if possible, the glade xml file and then connects the signals and inits the following windows :

  • log window
  • data_interpretor window
  • list data types

Definition at line 870 of file heraia_ui.c.

References data_interpretor_init_interface(), data_type_init_interface(), heraia_window_t::debug, heraia_ui_connect_signals(), list_data_types_init_interface(), load_heraia_glade_xml(), load_preference_file(), log_window_init_interface(), main_pref_window_init_interface(), and setup_preferences().

Referenced by main().

Here is the call graph for this function:

static gchar* make_absolute_path ( gchar *  filename  )  [static]

Returns an absolute path to the filename the string should be freed when no longer needed very UGLy !

Definition at line 500 of file heraia_ui.c.

Referenced by set_the_working_directory().

void move_and_show_dialog_box ( GtkWidget *  dialog_box,
window_prop_t dialog_prop 
)

Move the dialog box to the wanted position, shows it and says it in the displayed prop

Definition at line 100 of file heraia_ui.c.

References window_prop_t::displayed, window_prop_t::x, and window_prop_t::y.

Referenced by a_propos_activate(), mw_cmi_plw_toggle(), on_DIMenu_activate(), on_ldt_menu_activate(), on_preferences_activate(), show_hide_log_window(), and show_hide_widget().

void on_copy_activate ( GtkWidget *  widget,
gpointer  data 
)

Copy, edit menu

Definition at line 254 of file heraia_ui.c.

References log_message().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

void on_cut_activate ( GtkWidget *  widget,
gpointer  data 
)

Cut, edit menu

Definition at line 244 of file heraia_ui.c.

References log_message().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

void on_delete_activate ( GtkWidget *  widget,
gpointer  data 
)

Delete, edit menu

Definition at line 234 of file heraia_ui.c.

References log_message().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

void on_DIMenu_activate ( GtkWidget *  widget,
gpointer  data 
)

void on_new_activate ( GtkWidget *  widget,
gpointer  data 
)

New, file menu

Definition at line 47 of file heraia_ui.c.

References log_message().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

void on_open_activate ( GtkWidget *  widget,
gpointer  data 
)

This handles the menuitem "Ouvrir" to open a file

Definition at line 334 of file heraia_ui.c.

References heraia_window_t::current_DW, data_window_t::current_hexwidget, heraia_window_t::event, heraia_window_t::filename, HERAIA_REFRESH_NEW_FILE, load_file_to_analyse(), refresh_event_handler(), and select_file_to_load().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

void on_paste_activate ( GtkWidget *  widget,
gpointer  data 
)

Paste, edit menu

Definition at line 265 of file heraia_ui.c.

References log_message().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

void on_preferences_activate ( GtkWidget *  widget,
gpointer  data 
)

Preferences, file menu : Displays the preference window (as a modal window)

Definition at line 58 of file heraia_ui.c.

References heraia_get_widget(), xml_t::main, all_window_prop_t::main_pref_window, move_and_show_dialog_box(), heraia_window_t::win_prop, and heraia_window_t::xmls.

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

void on_quit_activate ( GtkWidget *  widget,
gpointer  data 
)

Quit, file menu

Definition at line 36 of file heraia_ui.c.

References close_heraia().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

void on_save_activate ( GtkWidget *  widget,
gpointer  data 
)

Here we attemp to save the edited file TODO : be more accurate on error (error type, message and filename)

Definition at line 352 of file heraia_ui.c.

References heraia_window_t::current_doc, heraia_hex_document_get_filename(), heraia_hex_document_save(), HERAIA_NOERR, and log_message().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

void on_save_as_activate ( GtkWidget *  widget,
gpointer  data 
)

This handle the save_as menu entry (here the filename changes)

Definition at line 373 of file heraia_ui.c.

References heraia_window_t::current_doc, HERAIA_CANCELLED, heraia_hex_document_save_as(), HERAIA_NOERR, log_message(), select_a_file_to_save(), set_notebook_tab_name(), and update_main_window_name().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

void record_all_dialog_box_positions ( heraia_window_t main_window  ) 

static void record_and_hide_about_box ( heraia_window_t main_window  )  [static]

Record position and hide about dialog box

Definition at line 194 of file heraia_ui.c.

References all_window_prop_t::about_box, heraia_get_widget(), xml_t::main, record_and_hide_dialog_box(), heraia_window_t::win_prop, and heraia_window_t::xmls.

Referenced by a_propos_close(), a_propos_delete(), and a_propos_response().

Here is the call graph for this function:

void record_and_hide_dialog_box ( GtkWidget *  dialog_box,
window_prop_t dialog_prop 
)

Record position and hide a dialog box

Definition at line 178 of file heraia_ui.c.

References window_prop_t::displayed, and record_dialog_box_position().

Referenced by mw_cmi_plw_toggle(), on_DIMenu_activate(), on_ldt_menu_activate(), plw_close_clicked(), pref_window_delete(), record_and_hide_about_box(), show_hide_log_window(), and show_hide_widget().

Here is the call graph for this function:

void record_dialog_box_position ( GtkWidget *  dialog_box,
window_prop_t dialog_prop 
)

Records one dialog position

Definition at line 114 of file heraia_ui.c.

References window_prop_t::displayed, window_prop_t::x, and window_prop_t::y.

Referenced by record_all_dialog_box_positions(), and record_and_hide_dialog_box().

void refresh_event_handler ( GtkWidget *  widget,
gpointer  data 
)

This function is here to ensure that everything will be refreshed upon a signal event.

Definition at line 310 of file heraia_ui.c.

References heraia_window_t::event, HERAIA_REFRESH_CURSOR_MOVE, HERAIA_REFRESH_NOTHING, refresh_all_plugins(), refresh_data_interpretor_window(), and refresh_file_labels().

Referenced by connect_cursor_moved_signal(), and on_open_activate().

Here is the call graph for this function:

static void refresh_file_labels ( heraia_window_t main_window  )  [static]

This function is refreshing the labels on the main window in order to reflect cursor position, selected positions and total selected size

Definition at line 278 of file heraia_ui.c.

References heraia_window_t::current_DW, data_window_t::current_hexwidget, ghex_get_cursor_position(), heraia_get_widget(), xml_t::main, and heraia_window_t::xmls.

Referenced by init_heraia_interface(), and refresh_event_handler().

Here is the call graph for this function:

gchar* select_a_file_to_save ( heraia_window_t main_window  ) 

This function opens a dialog box that allow one to choose a file name to the file which is about to be saved

Definition at line 621 of file heraia_ui.c.

References heraia_window_t::filename, heraia_get_widget(), xml_t::main, set_the_working_directory(), and heraia_window_t::xmls.

Referenced by on_save_as_activate().

Here is the call graph for this function:

gboolean select_file_to_load ( heraia_window_t main_window  ) 

This function does open a file selector dialog box and returns the selected filename. We do fill the main_window->filename parameter here !

for the moment we do not want to retrieve multiples selections but this could be a valuable thing in the future

We want the file selection path to be the one of the previous openned file if any !

Definition at line 558 of file heraia_ui.c.

References heraia_window_t::filename, heraia_get_widget(), log_message(), xml_t::main, set_the_working_directory(), and heraia_window_t::xmls.

Referenced by on_open_activate().

Here is the call graph for this function:

void set_notebook_tab_name ( heraia_window_t main_window  ) 

Sets notebook's tab's name. This function should only be called when a new filename was set (open and save as functions)

Definition at line 686 of file heraia_ui.c.

References heraia_window_t::current_doc, heraia_get_widget(), xml_t::main, and heraia_window_t::xmls.

Referenced by load_file_to_analyse(), and on_save_as_activate().

Here is the call graph for this function:

static void set_the_working_directory ( GtkFileChooser *  file_chooser,
gchar *  filename 
) [static]

Sets the working directory for the file chooser to the directory of the filename (even if filename is a relative filename such as ../docs/test_file)

Definition at line 539 of file heraia_ui.c.

References make_absolute_path().

Referenced by select_a_file_to_save(), and select_file_to_load().

Here is the call graph for this function:

void update_main_window_name ( heraia_window_t main_window  ) 

Update main window heraia's name to reflect the current edited file

Definition at line 668 of file heraia_ui.c.

References heraia_window_t::current_doc, heraia_get_widget(), xml_t::main, and heraia_window_t::xmls.

Referenced by load_file_to_analyse(), and on_save_as_activate().

Here is the call graph for this function:


Generated on Sat Jan 17 20:57:30 2009 for Heraia by  doxygen 1.5.6