GnuCash c935c2f+
Loading...
Searching...
No Matches
Public Member Functions
GncGtkAccountListUIItem Class Reference
Inheritance diagram for GncGtkAccountListUIItem:
GncOptionGtkUIItem GncOptionUIItem

Public Member Functions

 GncGtkAccountListUIItem (GtkWidget *widget)
 
void set_ui_item_from_option (GncOption &option) noexcept override
 
void set_option_from_ui_item (GncOption &option) noexcept override
 
- Public Member Functions inherited from GncOptionGtkUIItem
 GncOptionGtkUIItem (GtkWidget *widget, GncOptionUIType type)
 
 GncOptionGtkUIItem (const GncOptionGtkUIItem &item)
 
 GncOptionGtkUIItem (GncOptionGtkUIItem &&)=default
 
virtual void set_selectable (bool) const noexcept override
 Control wether the widget is sensitive.
 
void clear_ui_item () override
 Clear the data from the widget.
 
void set_widget (GtkWidget *widget)
 
virtual GtkWidget * get_widget () const
 
virtual SCM get_widget_scm_value (const GncOption &) const
 
- Public Member Functions inherited from GncOptionUIItem
 GncOptionUIItem (GncOptionUIType type)
 
GncOptionUIType get_ui_type () const noexcept
 
virtual void set_dirty (bool status) noexcept
 
virtual bool get_dirty () const noexcept
 

Detailed Description

Definition at line 874 of file gnc-option-gtk-ui.cpp.

Constructor & Destructor Documentation

◆ GncGtkAccountListUIItem()

GncGtkAccountListUIItem::GncGtkAccountListUIItem ( GtkWidget *  widget)
inlineexplicit

Definition at line 877 of file gnc-option-gtk-ui.cpp.

877 :
878 GncOptionGtkUIItem{widget, GncOptionUIType::ACCOUNT_LIST} {}
class GncOptionGtkUIItem Gtk-specific Interface class for Option Widget

Member Function Documentation

◆ set_option_from_ui_item()

void GncGtkAccountListUIItem::set_option_from_ui_item ( GncOption option)
inlineoverridevirtualnoexcept

Implements GncOptionUIItem.

Definition at line 895 of file gnc-option-gtk-ui.cpp.

896 {
897 auto widget{GNC_TREE_VIEW_ACCOUNT(get_widget())};
898 auto acc_list = gnc_tree_view_account_get_selected_accounts(widget);
899 GncOptionAccountList acc_vec;
900 acc_vec.reserve(g_list_length(acc_list));
901 for (auto node = acc_list; node; node = g_list_next(node))
902 {
903 auto guid{qof_entity_get_guid(node->data)};
904 acc_vec.push_back(*guid);
905 }
906 g_list_free(acc_list);
907 option.set_value(acc_vec);
908 }
GList * gnc_tree_view_account_get_selected_accounts(GncTreeViewAccount *view)
This function returns a list of the accounts associated with the selected items in the account tree v...
const GncGUID * qof_entity_get_guid(gconstpointer ent)

◆ set_ui_item_from_option()

void GncGtkAccountListUIItem::set_ui_item_from_option ( GncOption option)
inlineoverridevirtualnoexcept

Implements GncOptionUIItem.

Definition at line 879 of file gnc-option-gtk-ui.cpp.

880 {
881 auto widget{GNC_TREE_VIEW_ACCOUNT(get_widget())};
882 GList *acc_list = nullptr;
883 const GncOptionAccountList& accounts =
884 option.get_value<GncOptionAccountList>();
885 auto book{gnc_get_current_book()};
886 for (auto guid : accounts)
887 {
888 auto account{xaccAccountLookup(&guid, book)};
889 acc_list = g_list_prepend(acc_list, account);
890 }
891 acc_list = g_list_reverse(acc_list);
892 gnc_tree_view_account_set_selected_accounts(widget, acc_list, TRUE);
893 g_list_free(acc_list);
894 }
Account * xaccAccountLookup(const GncGUID *guid, QofBook *book)
The xaccAccountLookup() subroutine will return the account associated with the given id,...
Definition Account.cpp:2050
void gnc_tree_view_account_set_selected_accounts(GncTreeViewAccount *view, GList *account_list, gboolean show_last)
This function selects a set of accounts in the account tree view.

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