static void
rb_cd_recorder_plugin_init (RBCdRecorderPlugin *plugin)
{
    rb_debug ("RBCdRecorderPlugin initializing");

    nautilus_burn_init ();
}
Beispiel #2
0
int
main (int argc, char *argv[])
{
        GConfClient              *gc;
        GtkWidget                *dialog;
        NcbSelection             *selection;
        NcbSelectionDialogSource  source_type;
        char                     *source_name;
        char                     *last_device;
        static char              *source_device;
        static char              *source_iso;
        static char              *source_cue;
        GOptionContext           *context;
        GnomeProgram             *program;
        static const GOptionEntry options []  = {
                { "source-device", 0, 0, G_OPTION_ARG_FILENAME, &source_device,
                  N_("Use CD/DVD device as source instead of burn:///"), N_("DEVICE") },
                { "source-iso", 0, 0, G_OPTION_ARG_FILENAME, &source_iso,
                  N_("Use ISO image as source instead of burn:///"), N_("FILENAME") },
                { "source-cue", 0, 0, G_OPTION_ARG_FILENAME, &source_cue,
                  N_("Use CUE/TOC file as source instead of burn:///"), N_("FILENAME") },
                { NULL}
        };

        bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
        textdomain (GETTEXT_PACKAGE);

        context = g_option_context_new (NULL);

        g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);

        program = gnome_program_init ("nautilus-cd-burner", VERSION,
                                      LIBGNOMEUI_MODULE, argc, argv,
                                      GNOME_PARAM_GOPTION_CONTEXT, context,
                                      GNOME_PARAM_APP_DATADIR, SHAREDIR,
                                      GNOME_PARAM_NONE);

        nautilus_burn_init ();

        dialog = ncb_selection_dialog_new ();
        g_signal_connect (dialog, "response", G_CALLBACK (selection_dialog_response), NULL);
        gtk_widget_show (dialog);

        if (source_iso != NULL) {
                char *path;

                path = expand_path_input (source_iso);
                if (path == NULL) {
                        goto out;
                }

                source_type = NCB_SELECTION_DIALOG_SOURCE_ISO;
                source_name = path;
        } else if (source_cue != NULL) {
                char *path;

                path = expand_path_input (source_cue);
                if (path == NULL) {
                        goto out;
                }

                source_type = NCB_SELECTION_DIALOG_SOURCE_CUE;
                source_name = path;
        } else if (source_device != NULL) {
                source_type = NCB_SELECTION_DIALOG_SOURCE_DEVICE;
                source_name = g_strdup (source_device);
        } else {
                source_type = NCB_SELECTION_DIALOG_SOURCE_BURN_FOLDER;
                source_name = NULL;
        }

        selection = ncb_selection_dialog_get_selection (NCB_SELECTION_DIALOG (dialog));
        ncb_selection_set_source (selection, source_type, source_name);

        gc = gconf_client_get_default ();
        last_device = gconf_load_device (gc);
        if (last_device != NULL) {
                NautilusBurnDrive *drive;

                drive = nautilus_burn_drive_monitor_get_drive_for_device (nautilus_burn_get_drive_monitor (),
                                                                          last_device);
                ncb_selection_set_drive (selection, drive);
                if (drive != NULL) {
                        g_object_unref (drive);
                } else {
                        g_warning ("Drive not found for saved device: %s", last_device);
                }
                g_free (last_device);
        }

        g_object_unref (selection);

        g_object_unref (gc);

        g_free (source_name);

        gtk_main ();

 out:
        g_object_unref (program);
        nautilus_burn_shutdown ();

        return 0;
}