/** * Create a vbox that contains all controls used to display * information related to current reconciliation. * * \return A newly-allocated frame containing the reconcile widget */ GtkWidget *gsb_reconcile_create_box ( void ) { GtkWidget *frame, *label, *table, *vbox, *hbox, *button, *separator; frame = gtk_frame_new ( NULL ); vbox = gtk_vbox_new ( FALSE, 3 ); gtk_container_set_border_width ( GTK_CONTAINER ( vbox ), 3 ); gtk_container_add ( GTK_CONTAINER ( frame ), vbox ); /* the title of the frame */ label = gtk_label_new ( NULL ); gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT ); gtk_misc_set_alignment ( GTK_MISC (label), 0.0, 0.0 ); gtk_frame_set_label_widget ( GTK_FRAME(frame), label); /* number of reconcile */ hbox = gtk_hbox_new ( FALSE, 5 ); gtk_box_pack_start ( GTK_BOX ( vbox ), hbox, FALSE, FALSE, 0); label = gtk_label_new ( _("Reconciliation reference: ") ); gtk_box_pack_start ( GTK_BOX ( hbox ), label, FALSE, FALSE, 0); reconcile_number_entry = gtk_entry_new (); gtk_widget_set_tooltip_text ( GTK_WIDGET (reconcile_number_entry), _("If reconciliation reference ends in a digit, it is " "automatically incremented at each reconciliation.\n" "You can let it empty if you don't want to keep a trace of " "the reconciliation.") ); gtk_box_pack_start ( GTK_BOX ( hbox ), reconcile_number_entry, TRUE, TRUE, 0); separator = gtk_hseparator_new(); gtk_box_pack_start ( GTK_BOX ( vbox ), separator, FALSE, FALSE, 0); /* under the reconcile number, we have a table */ table = gtk_table_new ( 3, 5, FALSE ); gtk_table_set_row_spacings ( GTK_TABLE ( table ), 3 ); gtk_box_pack_start ( GTK_BOX ( vbox ), table, FALSE, FALSE, 0); separator = gtk_hseparator_new(); gtk_table_attach_defaults ( GTK_TABLE ( table ), separator, 0, 3, 1, 2 ); separator = gtk_hseparator_new(); gtk_table_attach_defaults ( GTK_TABLE ( table ), separator, 0, 3, 3, 4 ); separator = gtk_vseparator_new (); gtk_table_attach_defaults ( GTK_TABLE ( table ), separator, 1, 2, 0, 5 ); label = gtk_label_new ( _("Date") ); gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, 0, 1); label = gtk_label_new ( _("Balance") ); gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 2, 3, 0, 1); reconcile_last_date_label = gtk_label_new ( NULL ); gtk_table_attach_defaults ( GTK_TABLE ( table ), reconcile_last_date_label, 0, 1, 2, 3 ); /* set the old balance, * an entry the first time, will be unsensitive after */ reconcile_initial_balance_entry = gtk_entry_new ( ); gtk_widget_set_size_request ( reconcile_initial_balance_entry, 50, -1 ); g_signal_connect ( G_OBJECT ( reconcile_initial_balance_entry ), "changed", G_CALLBACK (gsb_reconcile_update_amounts), NULL ); g_signal_connect ( G_OBJECT ( reconcile_initial_balance_entry ), "focus-out-event", G_CALLBACK ( gsb_reconcile_entry_lose_focus ), NULL ); gtk_table_attach_defaults ( GTK_TABLE ( table ), reconcile_initial_balance_entry, 2, 3, 2, 3 ); /* make the new date entry */ reconcile_new_date_entry = gsb_calendar_entry_new (TRUE); gtk_widget_set_size_request ( reconcile_new_date_entry, 50, -1 ); gtk_table_attach_defaults ( GTK_TABLE ( table ), reconcile_new_date_entry, 0, 1, 4, 5 ); /* set the new balance */ reconcile_final_balance_entry = gtk_entry_new (); gtk_widget_set_size_request ( reconcile_final_balance_entry, 50, -1 ); g_signal_connect ( G_OBJECT ( reconcile_final_balance_entry ), "changed", G_CALLBACK (gsb_reconcile_update_amounts), NULL ); g_signal_connect ( G_OBJECT ( reconcile_final_balance_entry ), "focus-out-event", G_CALLBACK ( gsb_reconcile_entry_lose_focus ), NULL ); gtk_table_attach_defaults ( GTK_TABLE ( table ), reconcile_final_balance_entry, 2, 3, 4, 5 ); separator = gtk_hseparator_new(); gtk_box_pack_start ( GTK_BOX ( vbox ), separator, FALSE, FALSE, 0); /* 2nd table under that, with the balances labels */ table = gtk_table_new ( 5, 2, FALSE ); gtk_table_set_row_spacings ( GTK_TABLE ( table ), 5 ); gtk_box_pack_start ( GTK_BOX ( vbox ), table, FALSE, FALSE, 0); label = gtk_label_new ( _("Initial balance: ") ); gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5 ); gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, 0, 1); reconcile_initial_balance_label = gtk_label_new ( NULL ); gtk_misc_set_alignment ( GTK_MISC ( reconcile_initial_balance_label ), 1, 0.5 ); gtk_table_attach_defaults ( GTK_TABLE ( table ), reconcile_initial_balance_label, 1, 2, 0, 1); label = gtk_label_new ( _("Final balance: ") ); gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5 ); gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, 1, 2); reconcile_final_balance_label = gtk_label_new ( NULL ); gtk_misc_set_alignment ( GTK_MISC ( reconcile_final_balance_label ), 1, 0.5 ); gtk_table_attach_defaults ( GTK_TABLE ( table ), reconcile_final_balance_label, 1, 2, 1, 2); label = gtk_label_new ( _("Checking: ") ); gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5 ); gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, 2, 3); reconcile_marked_balance_label = gtk_label_new ( NULL ); gtk_misc_set_alignment ( GTK_MISC ( reconcile_marked_balance_label ), 1, 0.5 ); gtk_table_attach_defaults ( GTK_TABLE ( table ), reconcile_marked_balance_label, 1, 2, 2, 3); separator = gtk_hseparator_new(); gtk_table_attach_defaults ( GTK_TABLE ( table ), separator, 0, 2, 3, 4); label = gtk_label_new ( _("Variance: ") ); gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5 ); gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, 4, 5); reconcile_variation_balance_label = gtk_label_new ( NULL ); gtk_misc_set_alignment ( GTK_MISC ( reconcile_variation_balance_label ), 1, 0.5 ); gtk_table_attach_defaults ( GTK_TABLE ( table ), reconcile_variation_balance_label, 1, 2, 4, 5); /* set the button to sort with the method of paymen */ separator = gtk_hseparator_new(); gtk_box_pack_start ( GTK_BOX ( vbox ), separator, FALSE, FALSE, 0); hbox = gtk_hbox_new ( TRUE, 3 ); gtk_box_pack_start ( GTK_BOX ( vbox ), hbox, FALSE, FALSE, 0); reconcile_sort_list_button = gtk_check_button_new_with_label (_("Sort by method of payment")); gtk_button_set_relief ( GTK_BUTTON (reconcile_sort_list_button), GTK_RELIEF_NONE); g_signal_connect ( G_OBJECT (reconcile_sort_list_button), "clicked", G_CALLBACK (gsb_reconcile_list_button_clicked), NULL ); gtk_box_pack_start ( GTK_BOX ( hbox ), reconcile_sort_list_button, FALSE, FALSE, 0); /* make the buttons */ hbox = gtk_hbox_new ( TRUE, 3 ); gtk_box_pack_end ( GTK_BOX ( vbox ), hbox, FALSE, FALSE, 0); button = gtk_button_new_from_stock ( GTK_STOCK_CANCEL ); gtk_button_set_relief ( GTK_BUTTON ( button), GTK_RELIEF_NONE); g_signal_connect ( G_OBJECT (button), "clicked", G_CALLBACK (gsb_reconcile_cancel), NULL ); gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 0); reconcile_ok_button = gtk_button_new_from_stock ( GTK_STOCK_OK ); gtk_button_set_relief ( GTK_BUTTON ( reconcile_ok_button), GTK_RELIEF_NONE); g_signal_connect ( G_OBJECT ( reconcile_ok_button ), "clicked", G_CALLBACK (gsb_reconcile_finish_reconciliation), NULL ); gtk_box_pack_start ( GTK_BOX ( hbox ), reconcile_ok_button, FALSE, FALSE, 0); separator = gtk_hseparator_new(); gtk_box_pack_end ( GTK_BOX ( vbox ), separator, FALSE, FALSE, 0); gtk_widget_show_all ( frame ); return ( frame ); }
/** * Show a dialog to set wether we want the rows/columns lines, * the background color, the titles... * * \param operation GtkPrintOperation responsible of this job. * \param null Not used. * * \return A newly allocated widget. */ GtkWidget * print_transactions_list_layout_config ( GtkPrintOperation * operation, gpointer null ) { GtkWidget *check_button; GtkWidget *label; GtkWidget *hbox; GtkWidget *entry; GtkWidget *font_button_transactions; GtkWidget *font_button_title; gchar *fontname_transactions; gchar *fontname_title; GtkWidget *init_date_entry; GtkWidget *final_date_entry; GtkWidget *vbox; GtkWidget *paddingbox; GtkSizeGroup * size_group; size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); vbox = gtk_vbox_new ( FALSE, 6 ); gtk_container_set_border_width ( GTK_CONTAINER(vbox), 12 ); paddingbox = new_paddingbox_with_title ( vbox, FALSE, _("Layout") ); /* set up the title and dates, this is never saved, so ask each time */ /* title line */ hbox = gtk_hbox_new (FALSE, 10); gtk_box_pack_start (GTK_BOX (paddingbox), hbox, FALSE, FALSE, 0); entry = gsb_automem_entry_new (&title_string, NULL, NULL); check_button = gsb_autofunc_checkbutton_new (_("Print a title: "), gsb_data_print_config_get_draw_title (), G_CALLBACK (sens_desensitive_pointeur), entry, G_CALLBACK (gsb_data_print_config_set_draw_title), 0); gtk_box_pack_start (GTK_BOX (hbox), check_button, FALSE, FALSE, 0); gtk_widget_set_sensitive (entry, gsb_data_print_config_get_draw_title ()); gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); /* add the dates interval */ hbox = gtk_hbox_new (FALSE, 10); check_button = gsb_autofunc_checkbutton_new (_("Select dates interval: "), gsb_data_print_config_get_draw_interval_dates (), G_CALLBACK (sens_desensitive_pointeur), hbox, G_CALLBACK (gsb_data_print_config_set_draw_interval_dates), 0); gtk_box_pack_start (GTK_BOX (paddingbox), check_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (paddingbox), hbox, FALSE, FALSE, 0); label = gtk_label_new (_("Initial date : ")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); init_date_entry = gsb_calendar_entry_new (FALSE); if (draw_initial_date) gsb_calendar_entry_set_date (init_date_entry, draw_initial_date); gtk_box_pack_start (GTK_BOX (hbox), init_date_entry, FALSE, FALSE, 0); label = gtk_label_new (_("Final date : ")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); final_date_entry = gsb_calendar_entry_new (FALSE); if (draw_final_date) gsb_calendar_entry_set_date (final_date_entry, draw_final_date); gtk_box_pack_start (GTK_BOX (hbox), final_date_entry, FALSE, FALSE, 0); g_object_set_data ( G_OBJECT ( operation ), "init_date_entry", init_date_entry ); g_object_set_data ( G_OBJECT ( operation ), "final_date_entry", final_date_entry ); check_button = gsb_autofunc_checkbutton_new (_("Use value date"), gsb_data_print_config_get_draw_dates_are_value_dates (), NULL, NULL, G_CALLBACK (gsb_data_print_config_set_draw_dates_are_value_dates), 0); gtk_box_pack_start (GTK_BOX (hbox), check_button, FALSE, FALSE, 0); if (!gsb_data_print_config_get_draw_interval_dates ()) gtk_widget_set_sensitive (hbox, FALSE); /* set up all the checkbuttons */ check_button = gsb_autofunc_checkbutton_new (_("Draw the lines between transactions"), gsb_data_print_config_get_draw_lines (), NULL, NULL, G_CALLBACK (gsb_data_print_config_set_draw_lines), 0); gtk_box_pack_start (GTK_BOX (paddingbox), check_button, FALSE, FALSE, 0); check_button = gsb_autofunc_checkbutton_new (_("Draw the lines between the columns"), gsb_data_print_config_get_draw_column (), NULL, NULL, G_CALLBACK (gsb_data_print_config_set_draw_column), 0); gtk_box_pack_start (GTK_BOX (paddingbox), check_button, FALSE, FALSE, 0); check_button = gsb_autofunc_checkbutton_new (_("Fill the background as the transactions list"), gsb_data_print_config_get_draw_background (), NULL, NULL, G_CALLBACK (gsb_data_print_config_set_draw_background), 0); gtk_box_pack_start (GTK_BOX (paddingbox), check_button, FALSE, FALSE, 0); check_button = gsb_autofunc_checkbutton_new (_("Print the archives lines"), gsb_data_print_config_get_draw_archives (), NULL, NULL, G_CALLBACK (gsb_data_print_config_set_draw_archives), 0); gtk_box_pack_start (GTK_BOX (paddingbox), check_button, FALSE, FALSE, 0); check_button = gsb_autofunc_checkbutton_new (_("Print the names of the columns"), gsb_data_print_config_get_draw_columns_name (), NULL, NULL, G_CALLBACK (gsb_data_print_config_set_draw_columns_name), 0); gtk_box_pack_start (GTK_BOX (paddingbox), check_button, FALSE, FALSE, 0); paddingbox = new_paddingbox_with_title ( vbox, FALSE, _("Fonts") ); /* set up the font of the transactions, * by default use the font of the lists */ hbox = gtk_hbox_new (FALSE, 12); gtk_box_pack_start (GTK_BOX (paddingbox), hbox, FALSE, FALSE, 0); label = gtk_label_new (_("Transactions font")); gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT ); gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5); gtk_size_group_add_widget ( size_group, label ); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); fontname_transactions = pango_font_description_to_string (gsb_data_print_config_get_font_transactions ()); font_button_transactions = gtk_font_button_new_with_font ( fontname_transactions ); gtk_font_button_set_use_font ( GTK_FONT_BUTTON(font_button_transactions), TRUE ); gtk_font_button_set_use_size ( GTK_FONT_BUTTON(font_button_transactions), TRUE ); gtk_font_button_set_title ( GTK_FONT_BUTTON(font_button_transactions), _("Choosing font") ); gtk_box_pack_start (GTK_BOX (hbox), font_button_transactions, TRUE, TRUE, 0); /* set up the font for the title */ hbox = gtk_hbox_new (FALSE, 12); gtk_box_pack_start (GTK_BOX (paddingbox), hbox, FALSE, FALSE, 0); label = gtk_label_new (_("Title font")); gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT ); gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5); gtk_size_group_add_widget ( size_group, label ); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); fontname_title = pango_font_description_to_string (gsb_data_print_config_get_font_title ()); font_button_title = gtk_font_button_new_with_font ( fontname_title ); gtk_font_button_set_use_font ( GTK_FONT_BUTTON(font_button_title), TRUE ); gtk_font_button_set_use_size ( GTK_FONT_BUTTON(font_button_title), TRUE ); gtk_font_button_set_title ( GTK_FONT_BUTTON(font_button_title), _("Choosing font") ); gtk_box_pack_start (GTK_BOX (hbox), font_button_title, TRUE, TRUE, 0); /* save what we have done in all cases, so if we cancel and come back, our values * come back */ gsb_data_print_config_set_font_transaction (pango_font_description_from_string (fontname_transactions)); gsb_data_print_config_set_font_title (pango_font_description_from_string (fontname_title)); draw_initial_date = gsb_calendar_entry_get_date (init_date_entry); draw_final_date = gsb_calendar_entry_get_date (final_date_entry); g_object_set_data ( G_OBJECT(operation), "font_transaction_button", font_button_transactions ); g_object_set_data ( G_OBJECT(operation), "font_title_button", font_button_title ); gtk_widget_show_all ( vbox ); return vbox; }
/** * create the page to create new reconciles * * \param * * \return a GtkWidget, the page to the assistant * */ static GtkWidget *gsb_assistant_reconcile_config_page_new_reconcile ( void ) { GtkWidget *page; GtkWidget *label; GtkWidget *paddingbox; GtkWidget *table; GtkWidget *button; GtkWidget *hbox; page = gtk_box_new ( GTK_ORIENTATION_VERTICAL, 0 ); gtk_container_set_border_width ( GTK_CONTAINER(page), 12 ); paddingbox = new_paddingbox_with_title ( page, FALSE, _("Fill the fields and click the button \"Create the new reconciliation\"")); /* create the table, this is the same as the reconcile config, * but here it's to create new ones */ table = gtk_table_new ( 4, 3, FALSE ); gtk_table_set_row_spacings ( GTK_TABLE ( table ), 6 ); gtk_table_set_col_spacings ( GTK_TABLE ( table ), 6 ); gtk_box_pack_start ( GTK_BOX (paddingbox), table, FALSE, FALSE, 0 ); /* set the name */ label = gtk_label_new ( _("Reconciliation reference: ") ); gtk_misc_set_alignment (GTK_MISC (label), 0, 1); gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT ); gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, 0, 0, 0 ); reconcile_name_entry = gtk_entry_new (); gtk_table_attach ( GTK_TABLE ( table ), reconcile_name_entry, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 10, 0 ); /* set the choice of account */ label = gtk_label_new ( _("Account: ") ); gtk_misc_set_alignment (GTK_MISC (label), 0, 1); gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT ); gtk_table_attach ( GTK_TABLE ( table ), label, 2, 3, 0, 1, GTK_SHRINK | GTK_FILL, 0, 10, 0 ); reconcile_account_button = gsb_account_create_combo_list ( NULL, NULL, TRUE ); gtk_combo_box_set_active ( GTK_COMBO_BOX (reconcile_account_button), 0 ); gtk_table_attach ( GTK_TABLE ( table ), reconcile_account_button, 3, 4, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 0 ); /* set the initial date */ label = gtk_label_new ( _("Initial date: ") ); gtk_misc_set_alignment (GTK_MISC (label), 0, 1); gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT ); gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 1, 2, GTK_SHRINK | GTK_FILL, 0, 0, 0 ); reconcile_init_date_entry = gsb_calendar_entry_new (FALSE); gtk_table_attach ( GTK_TABLE ( table ), reconcile_init_date_entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 10, 0 ); /* set the final date */ label = gtk_label_new ( _("Final date: ") ); gtk_misc_set_alignment (GTK_MISC (label), 0, 1); gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT ); gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 2, 3, GTK_SHRINK | GTK_FILL, 0, 0, 0 ); reconcile_final_date_entry = gsb_calendar_entry_new (FALSE); gtk_table_attach ( GTK_TABLE ( table ), reconcile_final_date_entry, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, 0, 10, 0 ); /* set the initial balance */ label = gtk_label_new ( _("Initial balance: ") ); gtk_misc_set_alignment (GTK_MISC (label), 0, 1); gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT ); gtk_table_attach ( GTK_TABLE ( table ), label, 2, 3, 1, 2, GTK_SHRINK | GTK_FILL, 0, 10, 0 ); reconcile_init_balance_entry = gtk_entry_new (); gtk_table_attach ( GTK_TABLE ( table ), reconcile_init_balance_entry, 3, 4, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 0 ); /* set the final balance */ label = gtk_label_new ( _("Final balance: ") ); gtk_misc_set_alignment (GTK_MISC (label), 0, 1); gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT ); gtk_table_attach ( GTK_TABLE ( table ), label, 2, 3, 2, 3, GTK_SHRINK | GTK_FILL, 0, 10, 0 ); reconcile_final_balance_entry = gtk_entry_new (); gtk_table_attach ( GTK_TABLE ( table ), reconcile_final_balance_entry, 3, 4, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 0 ); /* create the button */ hbox = gtk_box_new ( GTK_ORIENTATION_HORIZONTAL, 0 ); gtk_box_set_homogeneous ( GTK_BOX ( hbox ), TRUE ); gtk_box_pack_start ( GTK_BOX (page), hbox, FALSE, FALSE, 0 ); button = gtk_button_new_with_label (_("Create the new reconciliation")); gtk_box_pack_end ( GTK_BOX (hbox), button, FALSE, FALSE, 0 ); /* create the label */ label = gtk_label_new (NULL); gtk_box_pack_start ( GTK_BOX (page), label, TRUE, TRUE, 0 ); /* if we change anything in the entries, hide the label */ g_signal_connect ( G_OBJECT (reconcile_name_entry), "changed", G_CALLBACK (gsb_assistant_reconcile_config_hide_label_error), label ); g_signal_connect ( G_OBJECT (reconcile_init_date_entry), "changed", G_CALLBACK (gsb_assistant_reconcile_config_hide_label_error), label ); g_signal_connect ( G_OBJECT (reconcile_final_date_entry), "changed", G_CALLBACK (gsb_assistant_reconcile_config_hide_label_error), label ); g_signal_connect ( G_OBJECT (reconcile_init_balance_entry), "changed", G_CALLBACK (gsb_assistant_reconcile_config_hide_label_error), label ); g_signal_connect ( G_OBJECT (reconcile_final_balance_entry), "changed", G_CALLBACK (gsb_assistant_reconcile_config_hide_label_error), label ); /* connect the button and give the message label as param */ g_signal_connect ( G_OBJECT (button), "clicked", G_CALLBACK (gsb_assistant_reconcile_config_page_add_new_reconcile), label ); gtk_widget_show_all (page); return page; }
/** * create the scheduled part : that widgets are created at the beginning * and normally never destroyed, they are showed only for * scheduled transactions * Cela ne fonctionne pas : tous les widgets sont détruits par la * fonction gsb_form_create_widgets ( ) * * \param table a GtkTable with the dimension SCHEDULED_HEIGHT*SCHEDULED_WIDTH to be filled * * \return FALSE * */ gboolean gsb_form_scheduler_create ( GtkWidget *table ) { gint row, column; struct_element *element; devel_debug (NULL); if (!table) return FALSE; /* just in case... be sure that not created */ if (scheduled_element_list) gsb_form_scheduler_free_list ( ); /* check the dimensions, * if problem give a warning message but continue the program with changing the values */ g_object_get ( G_OBJECT (table), "n-columns", &column, "n-rows", &row, NULL ); if ( column != SCHEDULED_WIDTH || row != SCHEDULED_HEIGHT ) { warning_debug ( _("gsb_form_scheduler_create is called with a bad table,\n" "the number of rows or columns is not good.\n" "The function will resize the table to the correct values but " "should check that warning.")); gtk_table_resize ( GTK_TABLE (table), SCHEDULED_HEIGHT, SCHEDULED_WIDTH ); } /* ok, now fill the form * we play with height and width, but for now it's fix : 6 columns and 1 line */ for ( row=0 ; row < SCHEDULED_HEIGHT ; row++ ) for ( column=0 ; column < SCHEDULED_WIDTH ; column++ ) { gint element_number; GtkWidget *widget = NULL; const gchar *tooltip_text = NULL; gchar *text_auto [] = { _("Manual"), _("Automatic"), NULL }; gchar *text_frequency [] = { _("Once"), _("Weekly"), _("Monthly"), _("Bimonthly"), _("Quarterly"), _("Yearly"), _("Custom"), NULL }; gchar *text_frequency_user [] = { _("Days"), _("Weeks"), _("Months"), _("Years"), NULL }; element_number = row*SCHEDULED_WIDTH + column; switch ( element_number ) { case SCHEDULED_FORM_ACCOUNT: widget = gsb_account_create_combo_list ( G_CALLBACK ( gsb_form_scheduler_change_account ), NULL, FALSE); gtk_combo_box_set_active ( GTK_COMBO_BOX (widget), 0 ); tooltip_text = _("Choose the account"); break; case SCHEDULED_FORM_AUTO: widget = gsb_combo_box_new_with_index ( text_auto, NULL, NULL ); tooltip_text = _("Automatic/manual scheduled transaction"); break; case SCHEDULED_FORM_FREQUENCY_BUTTON: widget = gsb_combo_box_new_with_index ( text_frequency, G_CALLBACK (gsb_form_scheduler_frequency_button_changed), NULL ); tooltip_text = _("Frequency"); break; case SCHEDULED_FORM_LIMIT_DATE: widget = gsb_calendar_entry_new (FALSE); g_signal_connect ( G_OBJECT (widget), "button-press-event", G_CALLBACK (gsb_form_scheduler_button_press_event), GINT_TO_POINTER (element_number)); g_signal_connect ( G_OBJECT (widget), "focus-in-event", G_CALLBACK (gsb_form_entry_get_focus), GINT_TO_POINTER (element_number)); g_signal_connect_after ( G_OBJECT (widget), "focus-out-event", G_CALLBACK (gsb_form_scheduler_entry_lose_focus), GINT_TO_POINTER (element_number)); tooltip_text = _("Limit date"); break; case SCHEDULED_FORM_FREQUENCY_USER_ENTRY: widget = gtk_entry_new (); g_signal_connect ( G_OBJECT (widget), "focus-in-event", G_CALLBACK (gsb_form_entry_get_focus), GINT_TO_POINTER (element_number)); g_signal_connect_after ( G_OBJECT (widget), "focus-out-event", G_CALLBACK (gsb_form_scheduler_entry_lose_focus), GINT_TO_POINTER (element_number)); tooltip_text = _("Own frequency"); break; case SCHEDULED_FORM_FREQUENCY_USER_BUTTON: widget = gsb_combo_box_new_with_index ( text_frequency_user, NULL, NULL ); tooltip_text = _("Custom frequency"); break; } if (!widget) continue; if (tooltip_text) gtk_widget_set_tooltip_text ( GTK_WIDGET (widget), tooltip_text); /* save the element */ element = g_malloc0 (sizeof (struct_element)); element -> element_number = element_number; element -> element_widget = widget; scheduled_element_list = g_slist_append ( scheduled_element_list, element ); /* set in the form */ gtk_table_attach ( GTK_TABLE (table), widget, column, column+1, row, row+1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); } gsb_form_scheduler_clean ( ); return FALSE; }