예제 #1
0
파일: main.c 프로젝트: trgill/plugind
int main(int argc, char **argv) {

    struct plugin plugin;
    sem_init(&exit_sem, 0, 0);

	if (create_plugin_list(&plugin_list) != PLUGIN_OK) {
		printf("Failure to load list\n");
		exit(1);
	}

	if (start_plugin_list(plugin_list) != PLUGIN_OK) {
		printf("Failure to start plugin list\n");
		exit(1);
	}

    struct MHD_Daemon *daemon;

    daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, 
                             &answer_to_connection, NULL, MHD_OPTION_END);
    if (NULL == daemon) 
	printf("Failed to start HTTP daemon");

    while(sem_wait(&exit_sem) != 0);

    MHD_stop_daemon (daemon);

    printf("exiting...\n");

}
예제 #2
0
bool PluginManageDlg::ShowModal(GtkWindow *parent_win, bool &dict_changed, bool &order_changed)
{
	window = gtk_dialog_new();
	oStarDictPluginSystemInfo.pluginwin = window;
	gtk_window_set_transient_for(GTK_WINDOW(window), parent_win);
	//gtk_dialog_set_has_separator(GTK_DIALOG(window), false);
	gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_HELP, GTK_RESPONSE_HELP);
	pref_button = gtk_dialog_add_button(GTK_DIALOG(window), _("Configure Pl_ug-in"), STARDICT_RESPONSE_CONFIGURE);
	gtk_widget_set_sensitive(pref_button, FALSE);
	gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
	gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_CLOSE);
	g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(response_handler), this);
	GtkWidget *vbox;
#if GTK_MAJOR_VERSION >= 3
	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
#else
	vbox = gtk_vbox_new (FALSE, 5);
#endif
	gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
	GtkWidget *pluginlist = create_plugin_list();
	gtk_box_pack_start (GTK_BOX (vbox), pluginlist, true, true, 0);
	GtkWidget *expander = gtk_expander_new (_("<b>Plug-in Details</b>"));
	gtk_expander_set_use_markup(GTK_EXPANDER(expander), TRUE);
	gtk_box_pack_start (GTK_BOX (vbox), expander, false, false, 0);
	detail_label = gtk_label_new (NULL);
	gtk_label_set_line_wrap(GTK_LABEL(detail_label), TRUE);
	gtk_label_set_selectable(GTK_LABEL (detail_label), TRUE);
	gtk_container_add (GTK_CONTAINER (expander), detail_label);
	gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG (window))), vbox, true, true, 0);
	gtk_widget_show_all (gtk_dialog_get_content_area(GTK_DIALOG (window)));
	gtk_window_set_title (GTK_WINDOW (window), _("Manage Plugins"));
	gtk_window_set_default_size(GTK_WINDOW(window), 250, 350);
	dict_changed_ = false;
	order_changed_ = false;
	gint result;
	while (true) {
		result = gtk_dialog_run(GTK_DIALOG(window));
		if (result ==GTK_RESPONSE_HELP || result == STARDICT_RESPONSE_CONFIGURE) {
		} else {
			break;
		}
	}
	/* When do we get GTK_RESPONSE_NONE response? Unable to reproduce. */
	if (result != GTK_RESPONSE_NONE) {
		dict_changed = dict_changed_;
		order_changed = order_changed_;
		gtk_widget_destroy(GTK_WIDGET(window));
	}
	window = NULL;
	treeview = NULL;
	detail_label = NULL;
	pref_button = NULL;
	plugin_tree_model = NULL;
	oStarDictPluginSystemInfo.pluginwin = NULL;

	return result == GTK_RESPONSE_NONE;
}
예제 #3
0
static void configure (void)
{
    if (config_win)
    {
        gtk_window_present ((GtkWindow *) config_win);
        return;
    }

    config_win = gtk_dialog_new_with_buttons (_("LADSPA Host Settings"), NULL,
     0, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
    gtk_window_set_default_size ((GtkWindow *) config_win, 480, 360);

    GtkWidget * vbox = gtk_dialog_get_content_area ((GtkDialog *) config_win);

    GtkWidget * hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
    gtk_box_pack_start ((GtkBox *) vbox, hbox, 0, 0, 0);

    GtkWidget * label = gtk_label_new (_("Module paths:"));
    gtk_box_pack_start ((GtkBox *) hbox, label, 0, 0, 0);

    label = gtk_label_new (0);
    gtk_label_set_markup ((GtkLabel *) label,
     _("<small>Separate multiple paths with a colon.\n"
     "These paths are searched in addition to LADSPA_PATH.\n"
     "After adding new paths, press Enter to scan for new plugins.</small>"));
    gtk_misc_set_padding ((GtkMisc *) label, 12, 6);
    gtk_misc_set_alignment ((GtkMisc *) label, 0, 0);
    gtk_box_pack_start ((GtkBox *) vbox, label, 0, 0, 0);

    GtkWidget * entry = gtk_entry_new ();
    gtk_box_pack_start ((GtkBox *) hbox, entry, 1, 1, 0);

    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
    gtk_box_pack_start ((GtkBox *) vbox, hbox, 1, 1, 0);

    GtkWidget * vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
    gtk_box_pack_start ((GtkBox *) hbox, vbox2, 1, 1, 0);

    label = gtk_label_new (_("Available plugins:"));
    gtk_box_pack_start ((GtkBox *) vbox2, label, 0, 0, 0);

    GtkWidget * scrolled = gtk_scrolled_window_new (NULL, NULL);
    gtk_box_pack_start ((GtkBox *) vbox2, scrolled, 1, 1, 0);

    plugin_list = create_plugin_list ();
    gtk_container_add ((GtkContainer *) scrolled, plugin_list);

    GtkWidget * hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
    gtk_box_pack_start ((GtkBox *) vbox2, hbox2, 0, 0, 0);

    GtkWidget * enable_button = gtk_button_new_with_label (_("Enable"));
    gtk_box_pack_end ((GtkBox *) hbox2, enable_button, 0, 0, 0);

    vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
    gtk_box_pack_start ((GtkBox *) hbox, vbox2, 1, 1, 0);

    label = gtk_label_new (_("Enabled plugins:"));
    gtk_box_pack_start ((GtkBox *) vbox2, label, 0, 0, 0);

    scrolled = gtk_scrolled_window_new (NULL, NULL);
    gtk_box_pack_start ((GtkBox *) vbox2, scrolled, 1, 1, 0);

    loaded_list = create_loaded_list ();
    gtk_container_add ((GtkContainer *) scrolled, loaded_list);

    hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
    gtk_box_pack_start ((GtkBox *) vbox2, hbox2, 0, 0, 0);

    GtkWidget * disable_button = gtk_button_new_with_label (_("Disable"));
    gtk_box_pack_end ((GtkBox *) hbox2, disable_button, 0, 0, 0);

    GtkWidget * settings_button = gtk_button_new_with_label (_("Settings"));
    gtk_box_pack_end ((GtkBox *) hbox2, settings_button, 0, 0, 0);

    if (module_path)
        gtk_entry_set_text ((GtkEntry *) entry, module_path);

    g_signal_connect (config_win, "response", (GCallback) gtk_widget_destroy, NULL);
    g_signal_connect (config_win, "destroy", (GCallback) gtk_widget_destroyed, & config_win);
    g_signal_connect (entry, "activate", (GCallback) set_module_path, NULL);
    g_signal_connect (plugin_list, "destroy", (GCallback) gtk_widget_destroyed, & plugin_list);
    g_signal_connect (enable_button, "clicked", (GCallback) enable_selected, NULL);
    g_signal_connect (loaded_list, "destroy", (GCallback) gtk_widget_destroyed, & loaded_list);
    g_signal_connect (disable_button, "clicked", (GCallback) disable_selected, NULL);
    g_signal_connect (settings_button, "clicked", (GCallback) configure_selected, NULL);

    gtk_widget_show_all (config_win);
}