/* * display the file open dialog */ void gtkui_plugin_load(void) { GtkWidget *dialog; char *filename; int response = 0; #ifdef OS_WINDOWS char *path = get_full_path("/lib/", ""); #else char *path = INSTALL_LIBDIR "/" EC_PROGRAM "/"; #endif DEBUG_MSG("gtk_plugin_load"); dialog = gtk_file_selection_new ("Select a plugin..."); gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), path); #ifdef OS_WINDOWS SAFE_FREE(path); #endif response = gtk_dialog_run (GTK_DIALOG (dialog)); if (response == GTK_RESPONSE_OK) { gtk_widget_hide(dialog); filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (dialog)); gtkui_load_plugin(filename); /* update the list */ gtkui_create_plug_array(); } gtk_widget_destroy (dialog); }
/* * display the file open dialog */ void gtkui_plugin_load(GSimpleAction *action, GVariant *value, gpointer data) { GtkWidget *dialog, *chooser, *content; gchar *filename; int response = 0; #ifdef OS_WINDOWS char *path = get_full_path("/lib/", ""); #else char *path = INSTALL_LIBDIR "/" PROGRAM "/"; #endif (void) action; (void) value; (void) data; DEBUG_MSG("gtk_plugin_load"); dialog = gtk_dialog_new_with_buttons("Select a plugin...", GTK_WINDOW(window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_USE_HEADER_BAR, "_Cancel", GTK_RESPONSE_CANCEL, "_OK", GTK_RESPONSE_OK, NULL); gtk_container_set_border_width(GTK_CONTAINER(dialog), 10); content = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); chooser = gtk_file_chooser_widget_new(GTK_FILE_CHOOSER_ACTION_OPEN); gtk_container_add(GTK_CONTAINER(content), chooser); gtk_widget_show(chooser); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(chooser), path); #ifdef OS_WINDOWS SAFE_FREE(path); #endif response = gtk_dialog_run (GTK_DIALOG (dialog)); if (response == GTK_RESPONSE_OK) { gtk_widget_hide(dialog); filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser)); gtkui_load_plugin(filename); /* update the list */ gtkui_create_plug_array(); g_free(filename); } gtk_widget_destroy (dialog); }
/* * display the file open dialog */ void gtkui_plugin_load(void) { GtkWidget *dialog; gchar *filename; int response = 0; #ifdef OS_WINDOWS char *path = get_full_path("/lib/", ""); #else char *path = INSTALL_LIBDIR "/" EC_PROGRAM "/"; #endif DEBUG_MSG("gtk_plugin_load"); dialog = gtk_file_chooser_dialog_new("Select a plugin...", GTK_WINDOW(window), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_OPEN, GTK_RESPONSE_OK, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), path); #ifdef OS_WINDOWS SAFE_FREE(path); #endif response = gtk_dialog_run (GTK_DIALOG (dialog)); if (response == GTK_RESPONSE_OK) { gtk_widget_hide(dialog); filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); gtkui_load_plugin(filename); /* update the list */ gtkui_create_plug_array(); g_free(filename); } gtk_widget_destroy (dialog); }