/** print list of installed plugins + information they provide */ static void _print_plugin_help() { /* save current loglevel */ NftLoglevel ll_current = nft_log_level_get(); nft_log_level_set(L_INFO); int i; for(i = 0; i < led_hardware_plugin_total_count(); i++) { const char *name; if(!(name = led_hardware_plugin_get_family_by_n(i))) continue; printf("======================================\n\n"); LedHardware *h; if(!(h = led_hardware_new("tmp01", name))) continue; printf("\tID Example: %s\n", led_hardware_plugin_get_id_example(h)); led_hardware_destroy(h); } /* restore logolevel */ nft_log_level_set(ll_current); }
/** 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; }