~ubuntu-branches/ubuntu/utopic/rhythmbox/utopic-proposed

« back to all changes in this revision

Viewing changes to widgets/rb-druid.c

Tags: upstream-0.9.2
ImportĀ upstreamĀ versionĀ 0.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
287
287
                         RBDruid *druid)
288
288
{
289
289
        char *file;
290
 
        char *utf8_file;
291
 
        GError *error = NULL;
292
290
 
293
291
        rb_debug ("got response");
294
292
 
295
 
        if (response_id != GTK_RESPONSE_OK) {
 
293
        if (response_id != GTK_RESPONSE_ACCEPT) {
296
294
                gtk_widget_destroy (GTK_WIDGET (dialog));
297
295
                return;
298
296
        }
299
297
 
300
 
#ifndef HAVE_GTK_2_3
301
 
        file = g_strdup (gtk_file_selection_get_filename (GTK_FILE_SELECTION (dialog)));
302
 
 
303
 
#else
304
298
        file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
305
299
        if (file == NULL) {
306
300
                file = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog));
307
301
        }
308
 
#endif
309
302
 
310
303
        gtk_widget_destroy (GTK_WIDGET (dialog));
311
304
 
312
305
        if (file == NULL)
313
306
                return;
314
307
 
315
 
        utf8_file = g_filename_to_utf8 (file, -1, NULL, NULL, &error);
 
308
        gtk_entry_set_text (GTK_ENTRY (druid->priv->path_entry), file);
316
309
        g_free (file);
317
 
        if (error != NULL) {
318
 
                rb_error_dialog (_("Error reading filename: %s"), error->message);
319
 
                return;
320
 
        }
321
 
 
322
 
        gtk_entry_set_text (GTK_ENTRY (druid->priv->path_entry), utf8_file);
323
 
        g_free (utf8_file);
324
310
}
325
311
 
326
312
 
330
316
        GtkWidget *dialog;
331
317
        rb_debug ("browse");
332
318
 
333
 
        dialog = rb_ask_dir (_("Choose a directory"), NULL,
334
 
                              GTK_WINDOW (druid->priv->window));
 
319
        dialog = rb_file_chooser_new (_("Load folder into Library"),
 
320
                                      GTK_WINDOW (druid->priv->window),
 
321
                                      GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
 
322
                                      TRUE);
335
323
        gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
336
324
 
337
325
        g_signal_connect_object (G_OBJECT (dialog), "response",
417
405
{
418
406
        rb_debug ("druid finished!");
419
407
        if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->priv->page2_skip_radiobutton))) {
420
 
                char * uri = g_strdup (gtk_entry_get_text (GTK_ENTRY (druid->priv->path_entry)));
 
408
                const char *uri = gtk_entry_get_text (GTK_ENTRY (druid->priv->path_entry));
421
409
                
422
410
                rb_debug ("page2 next; adding %s to library", uri);
423
 
                    
424
 
                rhythmdb_add_uri_async (druid->priv->db, uri);
425
 
                g_free (uri);
 
411
                rhythmdb_add_uri (druid->priv->db, uri);
426
412
        }
427
413
        eel_gconf_set_boolean (CONF_FIRST_TIME, TRUE);
428
414
        gnome_druid_set_buttons_sensitive (GNOME_DRUID (druid_widget),