コード例 #1
0
static gboolean
gnc_plugin_page_invoice_focus (InvoiceWindow *iw)
{
    GtkWidget *regWidget = gnc_invoice_get_register(iw);
    GtkWidget *notes = gnc_invoice_get_notes(iw);
    GnucashSheet *sheet;

    if (!GNUCASH_IS_REGISTER(regWidget))
        return FALSE;

    sheet = gnucash_register_get_sheet (GNUCASH_REGISTER(regWidget));

    // Test for the sheet being read only
    if (!gnucash_sheet_is_read_only (sheet))
    {
        if (!gtk_widget_is_focus (GTK_WIDGET(sheet)))
            gtk_widget_grab_focus (GTK_WIDGET(sheet));
    }
    else // set focus to the notes field
    {
        if (!gtk_widget_is_focus (GTK_WIDGET(notes)))
            gtk_widget_grab_focus (GTK_WIDGET(notes));
    }
    return FALSE;
}
コード例 #2
0
ファイル: gnucash-register.c プロジェクト: Mechtilde/gnucash
GtkWidget *
gnucash_register_new (Table *table, gchar *state_section)
{
    GnucashRegister *reg;
    GtkWidget *widget;

    widget = gnucash_register_create_widget(table);
    reg = GNUCASH_REGISTER(widget);

    gnucash_register_configure (GNUCASH_SHEET(reg->sheet), state_section);

    return widget;
}
コード例 #3
0
static void
gnc_plugin_page_invoice_refresh_cb (GHashTable *changes, gpointer user_data)
{
    GncPluginPageInvoice *page = user_data;
    GncPluginPageInvoicePrivate *priv;
    GtkWidget *reg;

    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(page));

    /* We're only looking for forced updates here. */
    if (changes)
        return;

    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
    reg = gnc_invoice_get_register(priv->iw);
    gnucash_register_refresh_from_prefs(GNUCASH_REGISTER(reg));
    gtk_widget_queue_draw(priv->widget);
}
コード例 #4
0
ファイル: table-gnome.c プロジェクト: rratliff/gnucash
void
gnc_table_init_gui (GtkWidget *widget, gchar * state_key)
{
    GNCHeaderWidths widths;
    GnucashSheet *sheet;
    GnucashRegister *greg;
    Table *table;
    GList *node;
    gchar *key;
    guint value;
 
    // Stuff for per-register settings load.
    g_return_if_fail (widget != NULL);
    g_return_if_fail (GNUCASH_IS_REGISTER (widget));
    
    PINFO("state_key=%s",state_key);
    
    ENTER("widget=%p, data=%p", widget, "");
    

    greg = GNUCASH_REGISTER (widget);
    sheet = GNUCASH_SHEET (greg->sheet);
    table = sheet->table;

    table->gui_handlers.redraw_help = table_ui_redraw_cb;
    table->gui_handlers.destroy = table_destroy_cb;
    table->ui_data = sheet;

    g_object_ref (sheet);

    /* config the cell-block styles */

    widths = gnc_header_widths_new ();

    if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
    {
        node = gnc_table_layout_get_cells (table->layout);
        for (; node; node = node->next)
        {
            BasicCell *cell = node->data;

            if (cell->expandable)
                continue;

            /* Remember whether the column is visible */
            key = g_strdup_printf("%s_width", cell->cell_name);
            // FIXME the actual state loading is currently not implemented
            value = 0;
            if (value != 0)
                gnc_header_widths_set_width (widths, cell->cell_name, value);
            g_free(key);
        }
    }

    gnucash_sheet_create_styles (sheet);

    gnucash_sheet_set_header_widths (sheet, widths);

    gnucash_sheet_compile_styles (sheet);

    gnucash_sheet_table_load (sheet, TRUE);
    gnucash_sheet_cursor_set_from_table (sheet, TRUE);
    gnucash_sheet_redraw_all (sheet);

    gnc_header_widths_destroy (widths);

    LEAVE(" ");
}