/** * initialize module */ gboolean ui_log_init( ) { _ui = ui_builder("niftyconf-log.ui"); /* initialize loglevel combobox */ NftLoglevel i; for(i = L_MAX + 1; i < L_MIN - 1; i++) { gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (UI("combobox")), nft_log_level_to_string(i)); } /* set combobox to current loglevel */ gtk_combo_box_set_active(GTK_COMBO_BOX(UI("combobox")), (gint) nft_log_level_get() - 1); /* register our custom logger function */ nft_log_func_register(_logger, UI("textview")); /* register prefs class for this module */ if(!nft_prefs_class_register (prefs(), "ui-log", _this_from_prefs, _this_to_prefs)) g_error("Failed to register prefs class for \"ui-log\""); return TRUE; }
/** initialize setup tree module */ gboolean ui_info_hardware_init( ) { if(!(_ui = ui_builder("niftyconf-info-hardware.ui"))) return FALSE; return TRUE; }
/** initialize this module */ gboolean ui_setup_ledlist_init( ) { _ui = ui_builder("niftyconf-setup-ledlist.ui"); /* set selection mode for tree */ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(UI("treeview"))); gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); /* connect signal handler */ g_signal_connect(selection, "changed", G_CALLBACK(on_selection_changed), NULL); /* initialize setup treeview */ GtkTreeViewColumn *col = GTK_TREE_VIEW_COLUMN(UI("column_led")); GtkCellRenderer *renderer = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(col, renderer, TRUE); gtk_tree_view_column_add_attribute(col, renderer, "text", C_CHAIN_LED); return TRUE; }
/** initialize setup module */ gboolean ui_setup_init() { _builder = ui_builder("niftyconf-setup.ui"); /* initialize tree module */ if(!ui_setup_ledlist_init()) return false; if(!ui_setup_tree_init()) return false; if(!ui_setup_props_init()) return false; /* attach children */ GtkBox *box_tree = GTK_BOX(_ui("box_tree")); gtk_box_pack_start(box_tree, ui_setup_tree_get_widget(), true, true, 0); GtkBox *box_props = GTK_BOX(_ui("box_props")); gtk_box_pack_start(box_props, ui_setup_props_get_widget(), false, false, 0); /* initialize file-filter to only show XML files in "open" filechooser * dialog */ GtkFileFilter *filter = GTK_FILE_FILTER(_ui("filefilter")); gtk_file_filter_add_mime_type(filter, "application/xml"); gtk_file_filter_add_mime_type(filter, "text/xml"); /* clear "plugin family" comobobox */ gtk_list_store_clear(GTK_LIST_STORE( gtk_combo_box_get_model( GTK_COMBO_BOX(_ui("hardware_add_plugin_combobox"))))); /* build "plugin family" combobox for "add hardware" dialog */ for(int p = 0; p < led_hardware_plugin_total_count(); p++) { gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (_ui ("hardware_add_plugin_combobox")), led_hardware_plugin_get_family_by_n (p)); } gtk_combo_box_set_active(GTK_COMBO_BOX (_ui("hardware_add_plugin_combobox")), 0); /* initialize pixel-format module */ led_pixel_format_new(); /* build "pixelformat" combobox for "add hardware" dialog */ size_t f; for(f = led_pixel_format_get_n_formats(); f > 0; f--) { const char *format = led_pixel_format_to_string(led_pixel_format_get_nth (f - 1)); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (_ui ("hardware_add_pixelformat_comboboxtext")), format); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (_ui ("chain_add_pixelformat_comboboxtext")), format); } gtk_combo_box_set_active(GTK_COMBO_BOX (_ui ("hardware_add_pixelformat_comboboxtext")), 0); gtk_combo_box_set_active(GTK_COMBO_BOX (_ui("chain_add_pixelformat_comboboxtext")), 0); /* start with fresh empty setup */ LedSetup *setup; if(!(setup = led_setup_new())) return false; setup_register_to_gui(setup); // g_object_unref(ui); return true; }