/** * callback called when select a line in the tree * fill the entry of the name, dates and balances * * \param selection the GtkTreeSelection * \param table the GtkTable containing the widgets to set the value of the selection * * \return FALSE */ gboolean gsb_reconcile_config_select ( GtkTreeSelection *selection, GtkWidget *table ) { GtkTreeIter iter; GtkTreeModel *model; gboolean good; good = gtk_tree_selection_get_selected (selection, &model, &iter); if (good) { gint reconcile_number; gtk_tree_model_get (model, &iter, RECONCILIATION_RECONCILE_COLUMN, &reconcile_number, -1 ); if (reconcile_number) { /* we are on a payment method, we fill the fields */ gsb_autofunc_entry_set_value ( reconcile_name_entry, gsb_data_reconcile_get_name (reconcile_number), reconcile_number ); gsb_autofunc_date_set ( reconcile_init_date_entry, gsb_data_reconcile_get_init_date (reconcile_number), reconcile_number); gsb_autofunc_date_set ( reconcile_final_date_entry, gsb_data_reconcile_get_final_date (reconcile_number), reconcile_number ); gsb_autofunc_real_set ( reconcile_init_balance_entry, gsb_data_reconcile_get_init_balance (reconcile_number), reconcile_number ); gsb_autofunc_real_set ( reconcile_final_balance_entry, gsb_data_reconcile_get_final_balance (reconcile_number), reconcile_number ); /* we make the table sensitive */ gtk_widget_set_sensitive ( table, TRUE ); } else gtk_widget_set_sensitive ( table, FALSE ); } else gtk_widget_set_sensitive ( table, FALSE ); return FALSE; }
/** * called when change the selection of the fyear * * \param tree_selection * \param null * * \return FALSE * */ gboolean gsb_fyear_config_select ( GtkTreeSelection *tree_selection, gpointer null ) { GtkTreeModel *model; GtkTreeIter iter; gint fyear_number; GtkWidget *tree_view; GtkWidget *widget; if (!gtk_tree_selection_get_selected ( GTK_TREE_SELECTION (tree_selection), &model, &iter )) return FALSE; gtk_tree_model_get ( GTK_TREE_MODEL (model), &iter, FYEAR_NUMBER_COLUMN, &fyear_number, -1 ); tree_view = GTK_WIDGET (gtk_tree_selection_get_tree_view (tree_selection)); /* set the name */ widget = g_object_get_data ( G_OBJECT (model), "fyear_name_entry" ); gsb_autofunc_entry_set_value ( widget, gsb_data_fyear_get_name (fyear_number), fyear_number ); /* set the beginning date */ widget = g_object_get_data ( G_OBJECT (model), "fyear_begin_date_entry" ); gsb_calendar_entry_set_color (widget, TRUE); gsb_autofunc_date_set ( widget, gsb_data_fyear_get_beginning_date (fyear_number), fyear_number ); /* set the end date */ widget = g_object_get_data ( G_OBJECT (model), "fyear_end_date_entry" ); gsb_calendar_entry_set_color (widget, TRUE); gsb_autofunc_date_set ( widget, gsb_data_fyear_get_end_date (fyear_number), fyear_number ); /* set the button */ widget = g_object_get_data ( G_OBJECT (model), "fyear_show_button" ); gsb_autofunc_checkbutton_set_value ( widget, gsb_data_fyear_get_form_show (fyear_number), fyear_number ); /* set the invalid label */ widget = g_object_get_data ( G_OBJECT (model), "invalid_label" ); if (gsb_data_fyear_get_invalid (fyear_number)) { gtk_label_set_markup ( GTK_LABEL (widget), gsb_data_fyear_get_invalid_message (fyear_number)); gtk_widget_show (widget); } else gtk_widget_hide (widget); /* sensitive what is needed */ gtk_widget_set_sensitive ( g_object_get_data ( G_OBJECT (model), "paddingbox_details" ), TRUE ); gtk_widget_set_sensitive ( g_object_get_data ( G_OBJECT (model), "remove_fyear_button" ), TRUE ); return FALSE; }
/** * Callback used when a payment method is selected in payment methods * list. * * \param selection the tree selection * \param tree_view * * \return FALSE */ gboolean gsb_payment_method_config_select ( GtkTreeSelection *selection, GtkWidget *tree_view ) { GtkTreeIter iter; gboolean good; good = gtk_tree_selection_get_selected (selection, NULL, &iter); if (good) { GtkTreeModel *model; gint payment_number; model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)); gtk_tree_model_get (model, &iter, PAYMENT_METHODS_NUMBER_COLUMN, &payment_number, -1 ); if (payment_number ) { gtk_widget_set_sensitive ( details_paddingbox, TRUE ); /* Filling entries */ gsb_autofunc_entry_set_value ( payment_name_entry, gsb_data_payment_get_name (payment_number), payment_number ); gsb_autofunc_spin_set_value ( payment_last_number_entry, gsb_data_payment_get_last_number_to_int ( payment_number ), payment_number ); gsb_autofunc_checkbutton_set_value ( button_show_entry, gsb_data_payment_get_show_entry (payment_number), payment_number ); gsb_autofunc_checkbutton_set_value ( button_auto_numbering, gsb_data_payment_get_automatic_numbering (payment_number), payment_number ); gtk_option_menu_set_history ( GTK_OPTION_MENU ( payment_sign_button ), gsb_data_payment_get_sign (payment_number)); /* Activating widgets */ gtk_widget_set_sensitive ( button_auto_numbering, gsb_data_payment_get_show_entry (payment_number)); gtk_widget_set_sensitive ( payment_last_number_entry, gsb_data_payment_get_automatic_numbering (payment_number)); /* We can remove this entry */ gtk_widget_set_sensitive ( payment_remove_button, TRUE ); } else { /* Blanking entries */ gsb_autofunc_entry_set_value ( payment_name_entry, NULL, 0); gsb_autofunc_spin_set_value ( payment_last_number_entry, 0, 0 ); gsb_autofunc_checkbutton_set_value ( button_show_entry, FALSE, 0 ); gsb_autofunc_checkbutton_set_value ( button_auto_numbering, FALSE, 0 ); /* Some widgets are useless */ gtk_widget_set_sensitive ( button_auto_numbering, FALSE ); gtk_widget_set_sensitive ( payment_last_number_entry, FALSE ); /* We set menu to "Neutral" as a default*/ gtk_option_menu_set_history ( GTK_OPTION_MENU ( payment_sign_button ), 0); /* Nothing to remove */ gtk_widget_set_sensitive ( payment_remove_button, TRUE ); gtk_widget_set_sensitive ( details_paddingbox, FALSE ); } } else { /* Blanking entries */ gsb_autofunc_entry_set_value ( payment_name_entry, NULL, 0); gsb_autofunc_spin_set_value ( payment_last_number_entry, 0, 0 ); gsb_autofunc_checkbutton_set_value ( button_show_entry, FALSE, 0 ); gsb_autofunc_checkbutton_set_value ( button_auto_numbering, FALSE, 0 ); /* Some widgets are useless */ gtk_widget_set_sensitive ( button_auto_numbering, FALSE ); gtk_widget_set_sensitive ( payment_last_number_entry, FALSE ); /* We set menu to "Neutral" as a default*/ gtk_option_menu_set_history ( GTK_OPTION_MENU ( payment_sign_button ), 0); /* Nothing to remove */ gtk_widget_set_sensitive ( payment_remove_button, TRUE ); gtk_widget_set_sensitive ( details_paddingbox, FALSE ); } return ( FALSE ); }