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;
        }
    }
}
Example #2
0
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;
        }
    }
}
Example #3
0
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;
        }
    }
}
Example #4
0
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(" ");
}
/* We've got a refresh event */
static void
refresh_handler (GHashTable *changes, gpointer data)
{
    GNCGeneralSearch *gsl = data;
    GNCGeneralSearchPrivate *priv;
    const EventInfo *info;

    priv = _PRIVATE(gsl);
    if (changes)
    {
        info = gnc_gui_get_entity_events (changes, &priv->guid);
        if (info)
        {
            if (info->event_mask & QOF_EVENT_DESTROY)
                gsl->selected_item = NULL;
            reset_selection_text (gsl);
        }
    }
}
Example #6
0
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;
            }
        }
    }
}