static void gnc_job_window_refresh_handler (GHashTable *changes, gpointer user_data) { JobWindow *jw = user_data; const EventInfo *info; GncJob *job = jw_get_job (jw); /* If there isn't a job behind us, close down */ if (!job) { gnc_close_gui_component (jw->component_id); return; } /* Next, close if this is a destroy event */ if (changes) { info = gnc_gui_get_entity_events (changes, &jw->job_guid); if (info && (info->event_mask & QOF_EVENT_DESTROY)) { gnc_close_gui_component (jw->component_id); return; } } }
static void gnc_customer_window_refresh_handler (GHashTable *changes, gpointer user_data) { CustomerWindow *cw = user_data; const EventInfo *info; GncCustomer *customer = cw_get_customer (cw); /* If there isn't a customer behind us, close down */ if (!customer) { gnc_close_gui_component (cw->component_id); return; } /* Next, close if this is a destroy event */ if (changes) { info = gnc_gui_get_entity_events (changes, &cw->customer_guid); if (info && (info->event_mask & QOF_EVENT_DESTROY)) { gnc_close_gui_component (cw->component_id); return; } } }
static void gnc_employee_window_refresh_handler (GHashTable *changes, gpointer user_data) { EmployeeWindow *ew = user_data; const EventInfo *info; GncEmployee *employee = ew_get_employee (ew); /* If there isn't a employee behind us, close down */ if (!employee) { gnc_close_gui_component (ew->component_id); return; } /* Next, close if this is a destroy event */ if (changes) { info = gnc_gui_get_entity_events (changes, &ew->employee_guid); if (info && (info->event_mask & QOF_EVENT_DESTROY)) { gnc_close_gui_component (ew->component_id); return; } } }
static void refresh_handler (GHashTable *changes, gpointer user_data) { GNCLedgerDisplay2 *ld = user_data; const EventInfo *info; gboolean has_leader; GList *splits; ENTER("changes=%p, user_data=%p", changes, user_data); if (ld->loading) { LEAVE("already loading"); return; } has_leader = (ld->ld_type == LD2_SINGLE || ld->ld_type == LD2_SUBACCOUNT); if (has_leader) { Account *leader = gnc_ledger_display2_leader (ld); if (!leader) { gnc_close_gui_component (ld->component_id); LEAVE("no leader"); return; } } if (changes && has_leader) { info = gnc_gui_get_entity_events (changes, &ld->leader); if (info && (info->event_mask & QOF_EVENT_DESTROY)) { gnc_close_gui_component (ld->component_id); LEAVE("destroy"); return; } } /* Its not clear if we should re-run the query, or if we should * just use qof_query_last_run(). Its possible that the dates * changed, requiring a full new query. Similar considerations * needed for multi-user mode. */ splits = qof_query_run (ld->query); //FIXME Not Needed ? gnc_ledger_display2_set_watches (ld, splits); // gnc_ledger_display2_set_watches (ld, splits); //preference changes come this way gnc_ledger_display2_refresh_internal (ld, splits); LEAVE(" "); }
void gnc_bi_import_gui_cancel_cb (GtkWidget *widget, gpointer data) { BillImportGui *gui = data; gnc_close_gui_component (gui->component_id); }
void gnc_job_window_cancel_cb (GtkWidget *widget, gpointer data) { JobWindow *jw = data; gnc_close_gui_component (jw->component_id); }
void gnc_customer_window_cancel_cb (GtkWidget *widget, gpointer data) { CustomerWindow *cw = data; gnc_close_gui_component (cw->component_id); }
void gnc_customer_import_gui_cancel_cb (GtkWidget *widget, gpointer data) { CustomerImportGui *gui = data; gnc_close_gui_component (gui->component_id); }
void gnc_employee_window_cancel_cb (GtkWidget *widget, gpointer data) { EmployeeWindow *ew = data; gnc_close_gui_component (ew->component_id); }
void gnc_ledger_display_close (GNCLedgerDisplay *ld) { if (!ld) return; gnc_close_gui_component (ld->component_id); }
/* Destroy a tax-table window */ void gnc_ui_tax_table_window_destroy (TaxTableWindow *ttw) { if (!ttw) return; gnc_close_gui_component (ttw->component_id); }
static void dialog_response_cb(GtkDialog *dialog, gint response_id, GncSxSinceLastRunDialog *app_dialog) { switch (response_id) { case GTK_RESPONSE_OK: // @@fixme validate current state(GError *errs); // - [ ] instance state constraints // - [x] required variable binding // - [?] ability to create transactions { GList *unbound_variables; unbound_variables = gnc_sx_instance_model_check_variables(app_dialog->editing_model->instances); g_message("%d variables unbound", g_list_length(unbound_variables)); if (g_list_length(unbound_variables) > 0) { // focus first variable GncSxVariableNeeded *first_unbound; GtkTreePath *variable_path; GtkTreeViewColumn *variable_col; gint variable_view_column = 2; gboolean start_editing = TRUE; first_unbound = (GncSxVariableNeeded*)unbound_variables->data; variable_path = _get_path_for_variable(app_dialog->editing_model, first_unbound->instance, first_unbound->variable); variable_col = gtk_tree_view_get_column(app_dialog->instance_view, variable_view_column); gtk_tree_view_set_cursor(app_dialog->instance_view, variable_path, variable_col, start_editing); gtk_tree_path_free(variable_path); g_list_foreach(unbound_variables, (GFunc)g_free, NULL); g_list_free(unbound_variables); return; } } gnc_suspend_gui_refresh(); gnc_sx_slr_model_effect_change(app_dialog->editing_model, FALSE, &app_dialog->created_txns, NULL); gnc_resume_gui_refresh(); if (gtk_toggle_button_get_active(app_dialog->review_created_txns_toggle) && g_list_length(app_dialog->created_txns) > 0) { _show_created_transactions(app_dialog, app_dialog->created_txns); } g_list_free(app_dialog->created_txns); app_dialog->created_txns = NULL; /* FALL THROUGH */ case GTK_RESPONSE_CANCEL: case GTK_RESPONSE_DELETE_EVENT: gnc_close_gui_component(app_dialog->component_id); break; default: g_error("unknown response id [%d]", response_id); break; } }
void gnc_job_window_ok_cb (GtkWidget *widget, gpointer data) { JobWindow *jw = data; /* Make sure this is ok */ if (!gnc_job_verify_ok (jw)) return; /* Now save off the job so we can return it */ jw->created_job = jw_get_job (jw); jw->job_guid = *guid_null (); gnc_close_gui_component (jw->component_id); }
void gnc_employee_window_ok_cb (GtkWidget *widget, gpointer data) { EmployeeWindow *ew = data; gchar *string; /* Check for valid username */ if (check_entry_nonempty (ew->dialog, ew->username_entry, _("You must enter a username."))) return; /* Check for valid username */ if (check_entry_nonempty (ew->dialog, ew->name_entry, _("You must enter the employee's name."))) return; /* Make sure we have an address */ if (check_entry_nonempty (ew->dialog, ew->addr1_entry, NULL) && check_entry_nonempty (ew->dialog, ew->addr2_entry, NULL) && check_entry_nonempty (ew->dialog, ew->addr3_entry, NULL) && check_entry_nonempty (ew->dialog, ew->addr4_entry, NULL)) { const char *msg = _("You must enter an address."); gnc_error_dialog (ew->dialog, "%s", msg); return; } /* Set the employee id if one has not been chosen */ if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (ew->id_entry)), "") == 0) { string = gncEmployeeNextID (ew->book); gtk_entry_set_text (GTK_ENTRY (ew->id_entry), string); g_free(string); } /* Now save it off */ { GncEmployee *employee = ew_get_employee (ew); if (employee) { gnc_ui_to_employee (ew, employee); } ew->created_employee = employee; ew->employee_guid = *guid_null (); } gnc_close_gui_component (ew->component_id); }
void gnc_close_gui_component_by_session (gpointer session) { GList *list; GList *node; list = find_components_by_session (session); for (node = list; node; node = node->next) { ComponentInfo *ci = node->data; gnc_close_gui_component (ci->component_id); } g_list_free (list); }
static void gnc_dialog_query_list_refresh_handler (GHashTable *changes, gpointer user_data) { DialogQueryList *dql = (DialogQueryList *)user_data; const EventInfo *info; GList *node; if (changes) { for (node = dql->books; node; node = node->next) { info = gnc_gui_get_entity_events (changes, (const GncGUID*)(node->data)); if (info && (info->event_mask & QOF_EVENT_DESTROY)) { gnc_close_gui_component (dql->component_id); return; } } } }
void gnc_close_gui_component_by_data (const char *component_class, gpointer user_data) { GList *list; GList *node; list = find_components_by_data (user_data); for (node = list; node; node = node->next) { ComponentInfo *ci = node->data; if (component_class && g_strcmp0 (component_class, ci->component_class) != 0) continue; gnc_close_gui_component (ci->component_id); } g_list_free (list); }
void gnc_bi_import_gui_ok_cb (GtkWidget *widget, gpointer data) { BillImportGui *gui = data; gchar *filename = g_strdup( gtk_entry_get_text( GTK_ENTRY(gui->entryFilename) ) ); bi_import_stats stats; bi_import_result res; guint n_fixed, n_deleted, n_invoices_created, n_invoices_updated; GString *info; // import info = g_string_new(""); gtk_list_store_clear (gui->store); res = gnc_bi_import_read_file (filename, gui->regexp->str, gui->store, 0, &stats); if (res == RESULT_OK) { gnc_bi_import_fix_bis (gui->store, &n_fixed, &n_deleted, info, gui->type); if (info->len > 0) gnc_info_dialog (gui->dialog, "%s", info->str); g_string_free( info, TRUE ); gnc_bi_import_create_bis (gui->store, gui->book, &n_invoices_created, &n_invoices_updated, gui->type, gui->open_mode); gnc_info_dialog (gui->dialog, _("Import results:\n%i lines were ignored\n%i lines imported:\n %u fixes\n %u ignored (not fixable)\n\n %u created\n %u updated (based on id)"), stats.n_ignored, stats.n_imported, n_fixed, n_deleted, n_invoices_created, n_invoices_updated); if (stats.n_ignored > 0) gnc_info2_dialog (gui->dialog, _("These lines were ignored during import"), stats.ignored_lines->str); g_string_free (stats.ignored_lines, TRUE); gnc_close_gui_component (gui->component_id); } else if (res == RESULT_OPEN_FAILED) { gnc_error_dialog (gui->dialog, _("The input file can not be opened.")); } else if (res == RESULT_ERROR_IN_REGEXP) { //gnc_error_dialog (gui->dialog, "The regular expression is faulty:\n\n%s", stats.err->str); } }
void gnc_customer_import_gui_ok_cb (GtkWidget *widget, gpointer data) { CustomerImportGui *gui = data; gchar *filename = g_strdup( gtk_entry_get_text( GTK_ENTRY(gui->entryFilename) ) ); customer_import_stats stats; customer_import_result res; guint n_fixed, n_deleted, n_customers_created, n_customers_updated; gchar *cv_type_text; // import if (g_ascii_strcasecmp (gui->type, "CUSTOMER") == 0) cv_type_text = _("customers"); else cv_type_text = _("vendors"); gtk_list_store_clear (gui->store); res = gnc_customer_import_read_file (filename, gui->regexp->str, gui->store, 0, &stats); if (res == CI_RESULT_OK) { gnc_customer_import_fix_customers (gui->store, &n_fixed, &n_deleted, gui->type); gnc_customer_import_create_customers (gui->store, gui->book, &n_customers_created, &n_customers_updated, gui->type); gnc_info_dialog (GTK_WINDOW (gui->dialog), _("Import results:\n%i lines were ignored\n%i lines imported:\n %u %s fixed\n %u %s ignored (not fixable)\n\n %u %s created\n %u %s updated (based on id)"), \ stats.n_ignored, stats.n_imported, n_fixed, cv_type_text, n_deleted, cv_type_text, n_customers_created, cv_type_text, n_customers_updated, cv_type_text); if (stats.n_ignored > 0) gnc_info2_dialog (gui->dialog, _("These lines were ignored during import"), stats.ignored_lines->str); g_string_free (stats.ignored_lines, TRUE); gnc_close_gui_component (gui->component_id); } else if (res == CI_RESULT_OPEN_FAILED) { gnc_error_dialog (GTK_WINDOW (gui->dialog), _("The input file can not be opened.")); } else if (res == CI_RESULT_ERROR_IN_REGEXP) { //gnc_error_dialog (GTK_WINDOW (gui->dialog), "The regular expression is faulty:\n\n%s", stats.err->str); } }
void gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data) { CustomerWindow *cw = data; gnc_numeric min, max; gchar *string; /* Check for valid company name */ if (check_entry_nonempty (cw->dialog, cw->company_entry, _("You must enter a company name. " "If this customer is an individual (and not a company) " "you should enter the same value for:\nIdentification " "- Company Name, and\nPayment Address - Name."))) return; /* Make sure we have an address */ if (check_entry_nonempty (cw->dialog, cw->addr1_entry, NULL) && check_entry_nonempty (cw->dialog, cw->addr2_entry, NULL) && check_entry_nonempty (cw->dialog, cw->addr3_entry, NULL) && check_entry_nonempty (cw->dialog, cw->addr4_entry, NULL)) { const char *msg = _("You must enter a billing address."); gnc_error_dialog (cw->dialog, "%s", msg); return; } /* Verify terms, discount, and credit are valid (or empty) */ min = gnc_numeric_zero (); max = gnc_numeric_create (100, 1); if (check_edit_amount (cw->dialog, cw->discount_amount, &min, &max, _("Discount percentage must be between 0-100 " "or you must leave it blank."))) return; if (check_edit_amount (cw->dialog, cw->credit_amount, &min, NULL, _("Credit must be a positive amount or " "you must leave it blank."))) return; /* Set the customer id if one has not been chosen */ if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (cw->id_entry)), "") == 0) { string = gncCustomerNextID (cw->book); gtk_entry_set_text (GTK_ENTRY (cw->id_entry), string); g_free(string); } /* Now save it off */ { GncCustomer *customer = cw_get_customer (cw); if (customer) { gnc_ui_to_customer (cw, customer); } cw->created_customer = customer; cw->customer_guid = *guid_null (); } gnc_close_gui_component (cw->component_id); }
void gnc_dialog_query_view_destroy (DialogQueryView *dqv) { if (!dqv) return; gnc_close_gui_component (dqv->component_id); }
void gnc_dialog_query_list_destroy (DialogQueryList *dql) { if (!dql) return; gnc_close_gui_component (dql->component_id); }
void gnc_ui_payment_window_destroy (PaymentWindow *pw) { if (!pw) return; gnc_close_gui_component (pw->component_id); }