KitListGui Class Reference

Encapsulates the methods for the application's GUI front end. More...

#include <kitlistgui.hpp>

List of all members.

Public Member Functions

 KitListGui (int argc, char **argv, Service &service)
 ~KitListGui ()
virtual void open_file (const Glib::ustring &filename)
 Opens an existing XML document.
virtual void raise ()
 Make this application topmost.
virtual void safe_open_file (const Glib::ustring &filename)
 Opens an existing XML document, checking for unsaved changes.
void run ()
 Starts the GUI application running.

Protected Member Functions

virtual void init ()
virtual gint get_max_recent_files ()
virtual ModelItemContainerget_selected_items ()
 Returns a list of items selected in the item list.
virtual void add_items (const ModelItemContainer &items)
 Associates the passed list of items with the currently selected category.
virtual void close_add_item_window ()
virtual void cancel_add_item_window ()
virtual void close_add_category_window ()
 Called when the add/rename category dialog is closed using the 'OK' button.
virtual void cancel_add_category_window ()
 Called when the add/rename category dialog is closed using the 'Cancel' button.
virtual long get_selected_category ()
 Returns the ID of the currently selected Category.
virtual void init_add_item_window ()
virtual void delete_selected_items ()
 Deletes the currently selected items.
virtual ModelItemContainercopy_selected_items_to_clipboard ()
virtual bool confirm_lose_changes (const Glib::ustring &message)
 Shows a confirmation message.
virtual void update_recent_files_menu ()
 Updates the recent files sub menu.
virtual void update_recent_files (const Glib::ustring &filename)
virtual bool on_delete_event (GdkEventAny *event)
 Called when the application is closed by the user.
virtual void on_menu_quit ()
 Called when the user chooses to quit the application.
virtual void on_menu_file_new ()
 Creates a new empty model.
virtual void on_menu_file_open ()
 Allows the user to open an existing XML document.
virtual void on_menu_save ()
 Saves the current application state.
virtual void on_menu_save_as ()
 Saves the current application state in a new document.
virtual void on_menu_recent_file (const Glib::ustring &filename)
 displays the most recent files menu
virtual void on_menu_add ()
virtual void on_menu_delete ()
 Called when the user chooses to delete items.
virtual void on_menu_cut ()
virtual void on_menu_copy ()
 Called when the use chooses the 'copy' menu option.
virtual void on_menu_paste ()
 Called when the user chooses the 'paste' menu option.
virtual void on_menu_show_all ()
 Causes all items to be displayed.
virtual void on_menu_show_checked ()
 Causes only checked items to be displayed.
virtual void on_menu_show_unchecked ()
 Causes only unchecked items to be displayed.
virtual void on_menu_select_all ()
 Called when the user chooses the 'select all' menu option.
virtual void on_menu_check_selected ()
 Marks all selected items as checked.
virtual void on_menu_uncheck_selected ()
 Marks all selected items as unchecked.
virtual void on_menu_create_category ()
 Called when the user chooses to create a new category.
virtual void on_menu_delete_category ()
 Called when the user chooses the delete category menu option.
virtual void on_menu_rename_category ()
 Called when the user chooses to rename a category.
virtual void on_menu_help_about ()
virtual void on_menu_help_contents ()
virtual void on_clipboard_get (Gtk::SelectionData &selection_date, guint)
virtual void on_clipboard_clear ()
 This method gets called after a second 'copy' operation.
virtual void on_clipboard_received (const Gtk::SelectionData &selection_data)
virtual void on_category_change ()
virtual void on_cell_edit (const Glib::ustring s)
 Callback method called when a cell has been edited in the item list.
virtual bool choose_filename (Glib::ustring &filename)
 Displays a file chooser dialog for a user to choose a filename.
virtual void update_paste_status ()
 Enables or disables the paste menu option.
virtual void paste_status_received (const Glib::StringArrayHandle &targets_array)
virtual void paste_from_xml (const Glib::ustring &document)
virtual void refresh_item_list ()
virtual void refresh_category_list (long cat_id=-2)
 Refreshes the category combo box list.
virtual void selected_row_callback (const Gtk::TreeModel::iterator &iter)
virtual void set_selected (bool checked)
virtual void toggle_selected ()
void on_row_changed (const Gtk::TreeModel::Path path, const Gtk::TreeModel::iterator iter)
 Callback method called when an item has been modified in the item list.
virtual void update_item_count (size_t n)

Protected Attributes

Glib::ustring m_filename
 The filename currently associated with the loaded model.
Glib::ustring m_clipboard_items
 Holder for items pasted to the clipboard.
bool m_ignore_list_events
 Temporarily ignore events on the item list.
Gtk::Main m_kit
 The main application.
Gtk::Window * m_window
 The main application window.
Gtk::Window * m_window_add_item
 The 'Add Item' dialog.
Gtk::Window * m_window_add_category
 The 'Add Category' dialog.
Gtk::Entry * m_entry_add_item
 The text entry field of the 'Add Item' dialog.
Gtk::Entry * m_entry_add_category
 The text entry field of the 'Add Category' dialog.
Gtk::ImageMenuItem * m_file_save_menu_item
 The file save menu item.
Gtk::ToolButton * m_file_save_tool_button
 The file save toolbar button.
Gtk::MenuItem * m_recent_files_menu_item
 The recent files menu item.
Gtk::ImageMenuItem * m_paste_menu_item
 The menu paste button.
Gtk::CheckButton * m_checkbutton_add_item
 The check button field of the 'Add Item' dialog.
Gtk::ComboBox * m_category_combo
 The combo box holding a list of categories.
Glib::RefPtr< Gtk::ListStore > m_ref_category_list_store
 The model backing the category combo box.
ModelCategoryColumns m_category_cols
 The definition of the category combo box columns.
Gtk::TreeView * m_item_tree_view
 The item list view definition.
ModelItemColumns m_item_cols
 The definition of the item list's columns.
Servicem_service
 The business/service object.
Glib::RefPtr< Gtk::ListStore > m_ref_item_tree_model
 The model backing the item list.
Gtk::Statusbar * m_status_bar
 The application status bar.
enum gui_state m_state
 Indicates whether a category is being created or renamed.
long m_current_cat_id
 temporary reference to a category id, usually being renamed


Detailed Description

Encapsulates the methods for the application's GUI front end.

This is the GTK+ implementation.

Definition at line 97 of file kitlistgui.hpp.


Constructor & Destructor Documentation

KitListGui::KitListGui ( int  argc,
char **  argv,
Service service 
)

Constructor to create the GUI application.

Parameters:
argc command line argument count passed to Gtk::Main
argv command line arguments passed to Gtk::Main
service a reference to the Service object, providing all business/service methods.

Definition at line 277 of file kitlistgui.cpp.

References init().

KitListGui::~KitListGui (  ) 

Definition at line 303 of file kitlistgui.cpp.


Member Function Documentation

void KitListGui::init (  )  [protected, virtual]

Initialises all the GUI components prior to the GUI application being run.

Definition at line 1859 of file kitlistgui.cpp.

References cancel_add_category_window(), cancel_add_item_window(), close_add_category_window(), close_add_item_window(), anonymous_namespace{kitlistgui.cpp}::DEFAULT_FILENAME, file_exists(), anonymous_namespace{kitlistgui.cpp}::GCONF_KEY, anonymous_namespace{kitlistgui.cpp}::GCONF_KEY_CURRENT_FILENAME, get_glade_ref_ptr(), Service::get_items(), anonymous_namespace{kitlistgui.cpp}::GLADE_APP_FILE, KITLIST_SERVICE_IFACE, KITLIST_SERVICE_NAME, KITLIST_SERVICE_OBJECT, m_category_cols, m_category_combo, m_checkbutton_add_item, ModelItemColumns::m_col_checked, ModelItemColumns::m_col_num, ModelItemColumns::m_col_text, ModelCategoryColumns::m_col_text, m_entry_add_category, m_entry_add_item, m_file_save_menu_item, m_file_save_tool_button, m_filename, m_ignore_list_events, m_item_cols, m_item_tree_view, m_paste_menu_item, m_recent_files_menu_item, m_ref_category_list_store, m_ref_item_tree_model, m_service, m_status_bar, m_window, m_window_add_category, m_window_add_item, on_category_change(), on_delete_event(), on_menu_add(), on_menu_check_selected(), on_menu_copy(), on_menu_create_category(), on_menu_cut(), on_menu_delete(), on_menu_delete_category(), on_menu_file_new(), on_menu_file_open(), on_menu_help_about(), on_menu_help_contents(), on_menu_paste(), on_menu_quit(), on_menu_rename_category(), on_menu_save(), on_menu_save_as(), on_menu_select_all(), on_menu_show_all(), on_menu_show_checked(), on_menu_show_unchecked(), on_menu_uncheck_selected(), on_row_changed(), Service::open_as_xml(), refresh_category_list(), refresh_item_list(), Service::require_filename(), Service::set_model_dirty(), toggle_selected(), update_item_count(), and update_recent_files_menu().

Referenced by KitListGui().

gint KitListGui::get_max_recent_files (  )  [protected, virtual]

ModelItemContainer * KitListGui::get_selected_items (  )  [protected, virtual]

Returns a list of items selected in the item list.

Definition at line 822 of file kitlistgui.cpp.

References Service::find_item(), ModelItemColumns::m_col_num, m_item_cols, m_item_tree_view, m_ref_item_tree_model, and m_service.

Referenced by copy_selected_items_to_clipboard(), set_selected(), and toggle_selected().

void KitListGui::add_items ( const ModelItemContainer items  )  [protected, virtual]

Associates the passed list of items with the currently selected category.

Where items already exist in the Category, then are not duplicated, just silently ignored.

Definition at line 1335 of file kitlistgui.cpp.

References Service::copy_items(), get_selected_category(), m_service, and refresh_item_list().

Referenced by paste_from_xml().

void KitListGui::close_add_item_window (  )  [protected, virtual]

Called when the user closes the 'Add Item' dialog using the 'OK' button.

Definition at line 1814 of file kitlistgui.cpp.

References Service::create_item(), get_selected_category(), m_checkbutton_add_item, m_entry_add_item, m_service, m_window_add_item, refresh_item_list(), Item::set_checked(), and Item::set_description().

Referenced by init().

void KitListGui::cancel_add_item_window (  )  [protected, virtual]

Called when the user closes the 'Add Item' dialog using the 'Cancel' button.

Definition at line 1834 of file kitlistgui.cpp.

References m_window_add_item.

Referenced by init().

void KitListGui::close_add_category_window (  )  [protected, virtual]

Called when the add/rename category dialog is closed using the 'OK' button.

The same dialog is used for both creating a new category and renaming an existing one. m_state is used to indicate which operation is relevant (create or rename) and m_current_cat_id is used to indicate the category being renamed for the rename operation.

Definition at line 1089 of file kitlistgui.cpp.

References ADD_CATEGORY, Service::create_category(), Service::find_category(), Category::get_id(), m_current_cat_id, m_entry_add_category, m_service, m_state, m_window_add_category, refresh_category_list(), refresh_item_list(), Service::set_model_dirty(), and Category::set_name().

Referenced by init().

void KitListGui::cancel_add_category_window (  )  [protected, virtual]

Called when the add/rename category dialog is closed using the 'Cancel' button.

Definition at line 1114 of file kitlistgui.cpp.

References m_window_add_category.

Referenced by init().

long KitListGui::get_selected_category (  )  [protected, virtual]

Returns the ID of the currently selected Category.

Returns -1 if no Category is currently selected, or the 'all items' option is selected.

Definition at line 1797 of file kitlistgui.cpp.

References m_category_cols, m_category_combo, and ModelCategoryColumns::m_col_num.

Referenced by add_items(), close_add_item_window(), on_menu_add(), on_menu_cut(), on_menu_delete_category(), on_menu_rename_category(), refresh_category_list(), and refresh_item_list().

void KitListGui::init_add_item_window (  )  [protected, virtual]

Initialises the 'Add Item' dialog prior to it being displayed.

Definition at line 1784 of file kitlistgui.cpp.

References m_entry_add_item.

Referenced by on_menu_add().

void KitListGui::delete_selected_items (  )  [protected, virtual]

Deletes the currently selected items.

The items are flagged as deleted. When save is called, they will no longer be persisted, i.e. they will be permanently deleted.

Definition at line 868 of file kitlistgui.cpp.

References Service::delete_item(), ModelItemColumns::m_col_num, m_item_cols, m_item_tree_view, m_ref_item_tree_model, m_service, refresh_item_list(), and selected_row_callback().

Referenced by on_menu_delete().

ModelItemContainer * KitListGui::copy_selected_items_to_clipboard (  )  [protected, virtual]

bool KitListGui::confirm_lose_changes ( const Glib::ustring &  message  )  [protected, virtual]

void KitListGui::update_recent_files_menu (  )  [protected, virtual]

Updates the recent files sub menu.

Definition at line 431 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::GCONF_KEY_RECENT_FILES, m_recent_files_menu_item, and on_menu_recent_file().

Referenced by init(), and update_recent_files().

void KitListGui::update_recent_files ( const Glib::ustring &  filename  )  [protected, virtual]

Updates the list of most recently used files.

Parameters:
filename The filename to append to the list it it does not already exist.

Definition at line 468 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::GCONF_KEY_RECENT_FILES, get_max_recent_files(), and update_recent_files_menu().

Referenced by on_menu_recent_file(), on_menu_save(), on_menu_save_as(), and open_file().

bool KitListGui::on_delete_event ( GdkEventAny *  event  )  [protected, virtual]

Called when the application is closed by the user.

Definition at line 497 of file kitlistgui.cpp.

References confirm_lose_changes(), Service::is_model_dirty(), m_service, and Service::set_model_dirty().

Referenced by init().

void KitListGui::on_menu_quit (  )  [protected, virtual]

Called when the user chooses to quit the application.

Definition at line 511 of file kitlistgui.cpp.

References confirm_lose_changes(), Service::is_model_dirty(), m_service, m_window, and Service::set_model_dirty().

Referenced by init().

void KitListGui::on_menu_file_new (  )  [protected, virtual]

void KitListGui::on_menu_file_open (  )  [protected, virtual]

Allows the user to open an existing XML document.

If there are unsaved changes, the user is first prompted to discard them or cancel the operation.

Definition at line 575 of file kitlistgui.cpp.

References confirm_lose_changes(), anonymous_namespace{kitlistgui.cpp}::DEFAULT_FILENAME_EXTENSION, Service::is_model_dirty(), m_service, m_status_bar, m_window, open_file(), and anonymous_namespace{kitlistgui.cpp}::SB_SAVE.

Referenced by init().

void KitListGui::on_menu_save (  )  [protected, virtual]

void KitListGui::on_menu_save_as (  )  [protected, virtual]

void KitListGui::on_menu_recent_file ( const Glib::ustring &  filename  )  [protected, virtual]

void KitListGui::on_menu_add (  )  [protected, virtual]

void KitListGui::on_menu_delete (  )  [protected, virtual]

Called when the user chooses to delete items.

The user is prompted to confirm deletion, prior to the items being flagged as deleted in the model. Once the model is saved, the will be permanently deleted from the persistence store.

Definition at line 900 of file kitlistgui.cpp.

References delete_selected_items(), and m_window.

Referenced by init().

void KitListGui::on_menu_cut (  )  [protected, virtual]

void KitListGui::on_menu_copy (  )  [protected, virtual]

Called when the use chooses the 'copy' menu option.

Definition at line 985 of file kitlistgui.cpp.

References copy_selected_items_to_clipboard().

Referenced by init().

void KitListGui::on_menu_paste (  )  [protected, virtual]

Called when the user chooses the 'paste' menu option.

Definition at line 994 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::item_target_text, m_clipboard_items, on_clipboard_received(), paste_from_xml(), and update_paste_status().

Referenced by init().

virtual void KitListGui::on_menu_show_all (  )  [inline, protected, virtual]

Causes all items to be displayed.

Definition at line 214 of file kitlistgui.hpp.

References m_service, refresh_item_list(), and Service::show_all().

Referenced by init().

virtual void KitListGui::on_menu_show_checked (  )  [inline, protected, virtual]

Causes only checked items to be displayed.

Definition at line 216 of file kitlistgui.hpp.

References m_service, refresh_item_list(), and Service::show_checked_only().

Referenced by init().

virtual void KitListGui::on_menu_show_unchecked (  )  [inline, protected, virtual]

Causes only unchecked items to be displayed.

Definition at line 218 of file kitlistgui.hpp.

References m_service, refresh_item_list(), and Service::show_unchecked_only().

Referenced by init().

void KitListGui::on_menu_select_all (  )  [protected, virtual]

Called when the user chooses the 'select all' menu option.

Definition at line 1008 of file kitlistgui.cpp.

References m_item_tree_view.

Referenced by init().

virtual void KitListGui::on_menu_check_selected (  )  [inline, protected, virtual]

Marks all selected items as checked.

Definition at line 221 of file kitlistgui.hpp.

References set_selected().

Referenced by init().

virtual void KitListGui::on_menu_uncheck_selected (  )  [inline, protected, virtual]

Marks all selected items as unchecked.

Definition at line 223 of file kitlistgui.hpp.

References set_selected().

Referenced by init().

void KitListGui::on_menu_create_category (  )  [protected, virtual]

void KitListGui::on_menu_delete_category (  )  [protected, virtual]

Called when the user chooses the delete category menu option.

Displays a confirmation box before deleting the currently selected category.

Definition at line 1125 of file kitlistgui.cpp.

References Service::delete_category(), get_selected_category(), m_service, m_status_bar, m_window, refresh_category_list(), refresh_item_list(), and anonymous_namespace{kitlistgui.cpp}::SB_MSG.

Referenced by init().

void KitListGui::on_menu_rename_category (  )  [protected, virtual]

void KitListGui::on_menu_help_about (  )  [protected, virtual]

Shows the help about dialog

Definition at line 1256 of file kitlistgui.cpp.

Referenced by init().

void KitListGui::on_menu_help_contents (  )  [protected, virtual]

Displays the help documentation

Definition at line 1242 of file kitlistgui.cpp.

Referenced by init().

void KitListGui::on_clipboard_get ( Gtk::SelectionData &  selection_data,
guint   
) [protected, virtual]

Called when the current clipboard contents are required.

Definition at line 1293 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::item_target_custom, anonymous_namespace{kitlistgui.cpp}::item_target_text, and m_clipboard_items.

Referenced by copy_selected_items_to_clipboard().

void KitListGui::on_clipboard_clear (  )  [protected, virtual]

This method gets called after a second 'copy' operation.

i.e. if we have previously called Clipboard::set() and then called it a second time. However, I think this is intended to only clean up data objects that may have been allocated by a previous call to on_clipboard_get() where we might have created an expensive object based on a list of IDs or something. This gives us the opportunity to release the big object.

However, in the way we're using the clipboard, we're holding the expensive object (in this case an XML document). We should probably be holding the list of selected ID's and only creating the XML document when the clipboard contents are requested.

As things are, we don't want to clear the XML document... m_clipboard_items.clear();

Definition at line 1324 of file kitlistgui.cpp.

Referenced by copy_selected_items_to_clipboard().

void KitListGui::on_clipboard_received ( const Gtk::SelectionData &  selection_data  )  [protected, virtual]

Callback notification method for capturing clipboard contents.

Definition at line 1383 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::item_target_custom, anonymous_namespace{kitlistgui.cpp}::item_target_text, and m_clipboard_items.

Referenced by on_menu_paste().

void KitListGui::on_category_change (  )  [protected, virtual]

Called after the user has changed the currently selected Category.

Definition at line 1842 of file kitlistgui.cpp.

References m_ignore_list_events, and refresh_item_list().

Referenced by init().

void KitListGui::on_cell_edit ( const Glib::ustring  s  )  [protected, virtual]

Callback method called when a cell has been edited in the item list.

Flags the model as dirty.

Definition at line 1433 of file kitlistgui.cpp.

References m_ignore_list_events, m_service, and Service::set_model_dirty().

bool KitListGui::choose_filename ( Glib::ustring &  filename  )  [protected, virtual]

Displays a file chooser dialog for a user to choose a filename.

If the file already exists, the user is asked to confirm whether to overwrite.

Parameters:
filename A reference to a string to populate with the chosen filename.
Returns:
true if the user selects the OK, false otherwise.

Definition at line 1450 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::DEFAULT_FILENAME_EXTENSION, file_exists(), and m_window.

Referenced by on_menu_save_as().

void KitListGui::update_paste_status (  )  [protected, virtual]

Enables or disables the paste menu option.

Definition at line 1549 of file kitlistgui.cpp.

References paste_status_received().

Referenced by copy_selected_items_to_clipboard(), and on_menu_paste().

void KitListGui::paste_status_received ( const Glib::StringArrayHandle &  targets_array  )  [protected, virtual]

Callback method for enabling or disabling the paste menu option based on the clipboard contents.

See also:
KitListGui::update_paste_status()

Definition at line 1561 of file kitlistgui.cpp.

References anonymous_namespace{kitlistgui.cpp}::item_target_custom, anonymous_namespace{kitlistgui.cpp}::item_target_text, and m_paste_menu_item.

Referenced by update_paste_status().

void KitListGui::paste_from_xml ( const Glib::ustring &  document  )  [protected, virtual]

Performs a paste of items from the clipboard.

Definition at line 1347 of file kitlistgui.cpp.

References add_items(), Service::find_item(), m_service, and anonymous_namespace{kitlistgui.cpp}::XML_ELEMENT_ID.

Referenced by on_menu_paste().

void KitListGui::refresh_item_list (  )  [protected, virtual]

void KitListGui::refresh_category_list ( long  cat_id = -2  )  [protected, virtual]

Refreshes the category combo box list.

Parameters:
cat_id the id of the category to select in the combo box. If set to -2 the currently selected category is used, otherwise the specified category ID is used. If the category ID does not exist, or if -1 is specified, then no category is selected.

Definition at line 1675 of file kitlistgui.cpp.

References Service::get_categories(), Category::get_id(), Category::get_name(), get_selected_category(), GuiState::is_deleted(), m_category_cols, m_category_combo, ModelCategoryColumns::m_col_num, ModelCategoryColumns::m_col_text, m_ignore_list_events, m_ref_category_list_store, and m_service.

Referenced by close_add_category_window(), init(), on_menu_create_category(), on_menu_delete_category(), on_menu_file_new(), on_menu_recent_file(), on_menu_rename_category(), and open_file().

void KitListGui::selected_row_callback ( const Gtk::TreeModel::iterator &  iter  )  [protected, virtual]

Called to delete an Item referenced by a row iterator.

Definition at line 1606 of file kitlistgui.cpp.

References Service::delete_item(), ModelItemColumns::m_col_num, m_item_cols, and m_service.

Referenced by delete_selected_items().

void KitListGui::set_selected ( bool  checked  )  [protected, virtual]

Checks or unchecks the currently selected items.

Definition at line 1271 of file kitlistgui.cpp.

References get_selected_items(), m_service, refresh_item_list(), and Service::select_items().

Referenced by on_menu_check_selected(), and on_menu_uncheck_selected().

void KitListGui::toggle_selected (  )  [protected, virtual]

Toggles the checked state of the currently selected items.

Definition at line 1282 of file kitlistgui.cpp.

References get_selected_items(), m_service, refresh_item_list(), and Service::toggle_selected_items().

Referenced by init().

void KitListGui::on_row_changed ( const Gtk::TreeModel::Path  path,
const Gtk::TreeModel::iterator  iter 
) [protected]

Callback method called when an item has been modified in the item list.

Sets the model as dirty and copies the row details to the appropriate Item in the model. The item's state is also set to dirty.

Definition at line 1590 of file kitlistgui.cpp.

References ModelItemColumns::m_col_checked, ModelItemColumns::m_col_num, ModelItemColumns::m_col_text, m_ignore_list_events, m_item_cols, m_service, Service::set_model_dirty(), and Service::update_item().

Referenced by init().

void KitListGui::update_item_count ( size_t  n  )  [protected, virtual]

Writes the count of currently displayed items to the status bar.

Definition at line 1397 of file kitlistgui.cpp.

References m_status_bar, and anonymous_namespace{kitlistgui.cpp}::SB_ITEM_COUNT.

Referenced by init(), and refresh_item_list().

void KitListGui::open_file ( const Glib::ustring &  filename  )  [virtual]

void KitListGui::raise (  )  [virtual]

Make this application topmost.

Definition at line 1850 of file kitlistgui.cpp.

References m_window.

void KitListGui::safe_open_file ( const Glib::ustring &  filename  )  [virtual]

Opens an existing XML document, checking for unsaved changes.

If there are unsaved changes, the user is first prompted to discard them or cancel the operation.

Definition at line 664 of file kitlistgui.cpp.

References confirm_lose_changes(), Service::is_model_dirty(), m_service, m_status_bar, open_file(), and anonymous_namespace{kitlistgui.cpp}::SB_SAVE.

void KitListGui::run (  ) 

Starts the GUI application running.

Definition at line 314 of file kitlistgui.cpp.

References Service::is_model_dirty(), m_filename, m_kit, m_service, m_window, and Service::save_as_xml().


Member Data Documentation

Glib::ustring KitListGui::m_filename [protected]

The filename currently associated with the loaded model.

Should be an empty string if not related to a file.

Definition at line 108 of file kitlistgui.hpp.

Referenced by confirm_lose_changes(), init(), on_menu_file_new(), on_menu_recent_file(), on_menu_save(), on_menu_save_as(), open_file(), and run().

Glib::ustring KitListGui::m_clipboard_items [protected]

Holder for items pasted to the clipboard.

Definition at line 114 of file kitlistgui.hpp.

Referenced by copy_selected_items_to_clipboard(), on_clipboard_get(), on_clipboard_received(), and on_menu_paste().

Temporarily ignore events on the item list.

Definition at line 116 of file kitlistgui.hpp.

Referenced by init(), on_category_change(), on_cell_edit(), on_row_changed(), refresh_category_list(), and refresh_item_list().

Gtk::Main KitListGui::m_kit [protected]

The main application.

Definition at line 118 of file kitlistgui.hpp.

Referenced by run().

Gtk::Window* KitListGui::m_window [protected]

Gtk::Window* KitListGui::m_window_add_item [protected]

The 'Add Item' dialog.

Definition at line 133 of file kitlistgui.hpp.

Referenced by cancel_add_item_window(), close_add_item_window(), init(), and on_menu_add().

Gtk::Window* KitListGui::m_window_add_category [protected]

The 'Add Category' dialog.

Definition at line 135 of file kitlistgui.hpp.

Referenced by cancel_add_category_window(), close_add_category_window(), init(), on_menu_create_category(), and on_menu_rename_category().

Gtk::Entry* KitListGui::m_entry_add_item [protected]

The text entry field of the 'Add Item' dialog.

Definition at line 137 of file kitlistgui.hpp.

Referenced by close_add_item_window(), init(), init_add_item_window(), and on_menu_add().

Gtk::Entry* KitListGui::m_entry_add_category [protected]

The text entry field of the 'Add Category' dialog.

Definition at line 139 of file kitlistgui.hpp.

Referenced by close_add_category_window(), init(), on_menu_create_category(), and on_menu_rename_category().

Gtk::ImageMenuItem* KitListGui::m_file_save_menu_item [protected]

The file save menu item.

Definition at line 141 of file kitlistgui.hpp.

Referenced by init().

Gtk::ToolButton* KitListGui::m_file_save_tool_button [protected]

The file save toolbar button.

Definition at line 143 of file kitlistgui.hpp.

Referenced by init().

Gtk::MenuItem* KitListGui::m_recent_files_menu_item [protected]

The recent files menu item.

Definition at line 145 of file kitlistgui.hpp.

Referenced by init(), and update_recent_files_menu().

Gtk::ImageMenuItem* KitListGui::m_paste_menu_item [protected]

The menu paste button.

Definition at line 147 of file kitlistgui.hpp.

Referenced by init(), and paste_status_received().

Gtk::CheckButton* KitListGui::m_checkbutton_add_item [protected]

The check button field of the 'Add Item' dialog.

Definition at line 153 of file kitlistgui.hpp.

Referenced by close_add_item_window(), and init().

Gtk::ComboBox* KitListGui::m_category_combo [protected]

The combo box holding a list of categories.

Definition at line 155 of file kitlistgui.hpp.

Referenced by get_selected_category(), init(), and refresh_category_list().

Glib::RefPtr<Gtk::ListStore> KitListGui::m_ref_category_list_store [protected]

The model backing the category combo box.

Definition at line 157 of file kitlistgui.hpp.

Referenced by init(), and refresh_category_list().

The definition of the category combo box columns.

Definition at line 159 of file kitlistgui.hpp.

Referenced by get_selected_category(), init(), and refresh_category_list().

Gtk::TreeView* KitListGui::m_item_tree_view [protected]

The item list view definition.

Definition at line 161 of file kitlistgui.hpp.

Referenced by delete_selected_items(), get_selected_items(), init(), and on_menu_select_all().

The definition of the item list's columns.

Definition at line 163 of file kitlistgui.hpp.

Referenced by delete_selected_items(), get_selected_items(), init(), on_row_changed(), refresh_item_list(), and selected_row_callback().

Glib::RefPtr<Gtk::ListStore> KitListGui::m_ref_item_tree_model [protected]

The model backing the item list.

Definition at line 167 of file kitlistgui.hpp.

Referenced by delete_selected_items(), get_selected_items(), init(), and refresh_item_list().

Gtk::Statusbar* KitListGui::m_status_bar [protected]

enum gui_state KitListGui::m_state [protected]

Indicates whether a category is being created or renamed.

Only used whilst the 'Add/Rename dialog is being displayed', or when it has been closed to determine the correct action.

Definition at line 177 of file kitlistgui.hpp.

Referenced by close_add_category_window(), on_menu_create_category(), and on_menu_rename_category().

long KitListGui::m_current_cat_id [protected]

temporary reference to a category id, usually being renamed

Definition at line 178 of file kitlistgui.hpp.

Referenced by close_add_category_window(), on_menu_create_category(), and on_menu_rename_category().


The documentation for this class was generated from the following files:

Copyright 2008, 2009 Frank Dean