void utils_files_go_charmap_sel_changed ( GtkWidget *go_charmap_sel, const gchar *encoding, GtkWidget *dialog ) { GtkWidget *label; gchar *contents; gchar *string; label = g_object_get_data ( G_OBJECT ( dialog ), "charset_label" ); if ( strcmp ( encoding, "UTF-8" ) == 0 ) { gtk_label_set_text ( GTK_LABEL ( label ), _("Select a charset") ); return; } contents = g_object_get_data ( G_OBJECT ( dialog ), "charset_str" ); string = g_convert ( contents, -1, "UTF-8", encoding, NULL, NULL, NULL ); if ( string ) { gtk_label_set_text ( GTK_LABEL ( label ), ""); gtk_label_set_markup ( GTK_LABEL ( label ), make_blue ( string ) ); g_object_set_data ( G_OBJECT ( dialog ), "charset", (gchar *) encoding ); gtk_dialog_set_response_sensitive ( GTK_DIALOG ( dialog ), GTK_RESPONSE_OK, TRUE ); } else { gtk_label_set_text ( GTK_LABEL ( label ), ""); gtk_label_set_markup ( GTK_LABEL ( label ), make_red ( _("The conversion failed try another set of characters") ) ); gtk_dialog_set_response_sensitive ( GTK_DIALOG ( dialog ), GTK_RESPONSE_OK, FALSE ); } }
/** * called when the user click on the button 'create the new reconciliation' * check the entries and create the corresponding reconciliation * * \param button * \param label a message label, hidden at the beginning, that will say ok the reconciliation is created * or if there is a problem... * * \return FALSE * */ static gboolean gsb_assistant_reconcile_config_page_add_new_reconcile ( GtkWidget *button, GtkWidget *label ) { gint reconcile_number; gchar *string; /* first, we check the date are valid */ if ( !gsb_date_check_entry ( reconcile_init_date_entry ) ) { string = make_red ( _("The initial date is not valid, please check it.") ); gtk_label_set_markup ( GTK_LABEL ( label) , string ); gtk_widget_grab_focus (reconcile_init_date_entry); g_free ( string ); return FALSE; } if ( !gsb_date_check_entry ( reconcile_final_date_entry ) ) { string = make_red ( _("The final date is not valid, please check it.") ); gtk_label_set_markup ( GTK_LABEL ( label) , string ); gtk_widget_grab_focus ( reconcile_final_date_entry ); g_free ( string ); return FALSE; } /* check there is a name */ if ( !strlen (gtk_entry_get_text ( GTK_ENTRY ( reconcile_name_entry ) ) ) ) { string = make_red ( _("Please give a name to the new reconciliation.") ); gtk_label_set_markup ( GTK_LABEL ( label) , string ); gtk_widget_grab_focus ( reconcile_name_entry ); g_free ( string ); return FALSE; } /* check if already exist the name */ if ( gsb_data_reconcile_get_number_by_name ( gtk_entry_get_text (GTK_ENTRY (reconcile_name_entry) ) ) ) { string = make_red ( _("That name already exists, please find another one.") ); gtk_label_set_markup ( GTK_LABEL ( label) , string ); gtk_widget_grab_focus ( reconcile_name_entry ); g_free ( string ); return FALSE; } /* ok, now we can create the reconcile */ reconcile_number = gsb_data_reconcile_new ( gtk_entry_get_text ( GTK_ENTRY ( reconcile_name_entry ) ) ); if ( !reconcile_number ) if (gsb_data_reconcile_get_number_by_name ( gtk_entry_get_text ( GTK_ENTRY ( reconcile_name_entry ) ) ) ) { string = make_red ( _("Cannot allocate memory : Bad things will happen soon.") ); gtk_label_set_markup ( GTK_LABEL ( label) , string ); gtk_widget_grab_focus ( reconcile_name_entry ); g_free ( string ); return FALSE; } gsb_data_reconcile_set_init_date ( reconcile_number, gsb_calendar_entry_get_date ( reconcile_init_date_entry ) ); gsb_data_reconcile_set_final_date ( reconcile_number, gsb_calendar_entry_get_date ( reconcile_final_date_entry ) ); gsb_data_reconcile_set_init_balance ( reconcile_number, utils_real_get_from_string ( gtk_entry_get_text ( GTK_ENTRY (reconcile_init_balance_entry ) ) ) ); gsb_data_reconcile_set_final_balance ( reconcile_number, utils_real_get_from_string ( gtk_entry_get_text ( GTK_ENTRY ( reconcile_final_balance_entry ) ) ) ); gsb_data_reconcile_set_account ( reconcile_number, gsb_account_get_combo_account_number ( reconcile_account_button ) ); /* erase the entries but not the account wich can be used again */ gtk_entry_set_text ( GTK_ENTRY (reconcile_name_entry), "" ); gtk_entry_set_text ( GTK_ENTRY (reconcile_init_date_entry), "" ); gtk_entry_set_text ( GTK_ENTRY (reconcile_final_date_entry), "" ); gtk_entry_set_text ( GTK_ENTRY (reconcile_init_balance_entry), "" ); gtk_entry_set_text ( GTK_ENTRY (reconcile_final_balance_entry), "" ); string = make_blue ( g_strdup_printf ( _("Reconciliation %s successfully appended!"), gsb_data_reconcile_get_name ( reconcile_number ) ) ); gtk_label_set_markup ( GTK_LABEL ( label ), string ); g_free ( string ); /* update the list of reconcile in the configuration list */ gsb_reconcile_config_fill ( ); gtk_widget_grab_focus ( reconcile_name_entry ); return FALSE; }
int main(int argc, char const *argv[]) { print< ::color::rgb< ::color::type::split422_t >::category_type >(); print< ::color::rgb< ::color::type::split242_t >::category_type >(); print< ::color::rgb< ::color::type::split224_t >::category_type >(); print< ::color::bgr< ::color::type::split422_t >::category_type >(); print< ::color::bgr< ::color::type::split242_t >::category_type >(); print< ::color::bgr< ::color::type::split224_t >::category_type >(); print< ::color::abgr< ::color::type::split2AAA_t >::category_type >(); print< ::color::bgra< ::color::type::splitAAA2_t >::category_type >(); print< ::color::rgba< ::color::type::splitAAA2_t >::category_type >(); print< ::color::argb< ::color::type::split2AAA_t >::category_type >(); sandbox_test(); extern void test_constant(); test_constant(); extern void check_sizeof(); check_sizeof(); void test_operation(); test_operation(); void image_conversion(); image_conversion(); test_pallete(); ctor_test(); void main_place(); main_place(); void check_get(); check_get(); extern int gray_test( int argc, char const *argv[] ); gray_test( argc, argv ); extern int decompose_test( int argc, char const *argv[] ); decompose_test( argc, argv ); extern void print_bound(); print_bound(); make_blue(); invoke(); extern void check_conversion(); check_conversion(); void make_test_gray_scale(); make_test_gray_scale(); void test_set_invoke(); test_set_invoke(); void test_get_invoke( double value ); test_get_invoke(0.5); return 0; }