void app_init (App * app) { GError *err = NULL; app->definitions = gtk_builder_new (); gtk_builder_add_from_file (app->definitions, UI_DEFINITIONS_FILE, &err); if (err != NULL) { g_printerr ("Error while loading app definitions file: %s\n", err->message); g_error_free (err); gtk_main_quit (); } gtk_builder_connect_signals (app->definitions, app); app_init_colors (app); app->filename = NULL; app->display_level = FALSE; app->display_weight = FALSE; GtkCellRenderer *renderer=gtk_cell_renderer_text_new(); GET_UI_ELEMENT(GtkComboBox, combobox_from); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox_from),renderer,FALSE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox_from),renderer, "text",0, NULL); gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_from),0); GET_UI_ELEMENT(GtkComboBox, combobox_to); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox_to),renderer,FALSE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox_to),renderer, "text",0, NULL); gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_to),0); //init non graphical units app->p_graph = malloc(sizeof(graph)); app->p_matrix = malloc(sizeof(matrix)); app->p_matrix->i_size = 3; matrix_malloc(app->p_matrix); matrix_zero(app->p_matrix); //construct the graph from the matrix init_all(app->p_graph, app->p_matrix); }
void app_init (App * app) { GError *err = NULL; app->definitions = gtk_builder_new (); gtk_builder_add_from_file (app->definitions, UI_DEFINITIONS_FILE, &err); if (err != NULL) { g_printerr ("Error while loading app definitions file: %s\n", err->message); g_error_free (err); gtk_main_quit (); } gtk_builder_connect_signals (app->definitions, app); app->objects = gtk_builder_get_objects (app->definitions); app_init_colors (app); }