summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2007-03-26 13:12:16 +0000
committerBastien Nocera <hadess@src.gnome.org>2007-03-26 13:12:16 +0000
commit08d8c41ffe63e4aa7f987710533a6f1313c50845 (patch)
tree1ec6882389550f9f46c767c0e76632b352c10203 /src
parent3bae771f128b21e8b6582ee49bb6451c04145e35 (diff)
reviewed by: Ross Burton <ross@burtonini.com>
2007-03-26 Bastien Nocera <hadess@hadess.net> reviewed by: Ross Burton <ross@burtonini.com> * libjuicer/sj-util.c: (xdg_user_dir_lookup), (sj_get_default_music_directory), (sj_add_default_dirs): * libjuicer/sj-util.h: * src/sj-main.c: (baseuri_changed_cb), (main): * src/sj-prefs.c: (baseuri_changed_cb), (on_edit_preferences_cb): * src/sound-juicer.h: Use xdg-user-dirs to set a nice default target for encoded files, also add the directory to the list of directories listed in the drop-down menu (Closes: #404542) svn path=/trunk/; revision=1744
Diffstat (limited to 'src')
-rw-r--r--src/sj-main.c9
-rw-r--r--src/sj-prefs.c16
-rw-r--r--src/sound-juicer.h2
3 files changed, 20 insertions, 7 deletions
diff --git a/src/sj-main.c b/src/sj-main.c
index 3c7ae57..2781d55 100644
--- a/src/sj-main.c
+++ b/src/sj-main.c
@@ -80,7 +80,8 @@ GtkListStore *track_store;
static BaconMessageConnection *connection;
GtkCellRenderer *toggle_renderer, *title_renderer, *artist_renderer;
-const char *base_uri, *path_pattern, *file_pattern;
+const char *path_pattern, *file_pattern;
+char *base_uri;
NautilusBurnDrive *drive = NULL;
gboolean strip_chars;
gboolean eject_finished;
@@ -521,10 +522,11 @@ AlbumDetails* multiple_album_dialog(GList *albums)
void baseuri_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
{
g_assert (strcmp (entry->key, GCONF_BASEURI) == 0);
+ g_free (base_uri);
if (entry->value == NULL) {
- base_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
+ base_uri = sj_get_default_music_directory ();
} else {
- base_uri = gconf_value_get_string (entry->value);
+ base_uri = g_strdup (gconf_value_get_string (entry->value));
}
/* TODO: sanity check the URI somewhat */
}
@@ -1566,6 +1568,7 @@ int main (int argc, char **argv)
nautilus_burn_shutdown ();
+ g_free (base_uri);
g_object_unref (metadata);
g_object_unref (extractor);
g_object_unref (gconf_client);
diff --git a/src/sj-prefs.c b/src/sj-prefs.c
index c779ca9..41f2b86 100644
--- a/src/sj-prefs.c
+++ b/src/sj-prefs.c
@@ -30,6 +30,7 @@
#include <profiles/gnome-media-profiles.h>
#include <nautilus-burn-drive.h>
#include <nautilus-burn-drive-selection.h>
+#include "libjuicer/sj-util.h"
#include "gconf-bridge.h"
#include "sj-extracting.h"
#include "sj-prefs.h"
@@ -182,11 +183,18 @@ static void baseuri_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *
const char* base_uri, *current_uri;
g_return_if_fail (strcmp (entry->key, GCONF_BASEURI) == 0);
- if (entry->value == NULL) {
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (basepath_fcb), g_get_home_dir());
+ base_uri = NULL;
+ if (entry->value != NULL)
+ base_uri = gconf_value_get_string (entry->value);
+
+ if (base_uri == NULL || base_uri[0] == '\0') {
+ char *dir;
+
+ dir = sj_get_default_music_directory ();
+ gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (basepath_fcb), dir);
+ g_free (dir);
} else {
g_return_if_fail (entry->value->type == GCONF_VALUE_STRING);
- base_uri = gconf_value_get_string (entry->value);
current_uri = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (basepath_fcb));
if (current_uri == NULL || strcmp (current_uri, base_uri) != 0) {
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (basepath_fcb), base_uri);
@@ -382,6 +390,7 @@ void on_edit_preferences_cb (GtkMenuItem *item, gpointer user_data)
cd_option = glade_xml_get_widget (glade, "cd_option");
basepath_fcb = glade_xml_get_widget (glade, "path_chooser");
+ sj_add_default_dirs (GTK_FILE_CHOOSER (basepath_fcb));
path_option = glade_xml_get_widget (glade, "path_option");
file_option = glade_xml_get_widget (glade, "file_option");
audio_profile = glade_xml_get_widget (glade, "audio_profile");
@@ -416,3 +425,4 @@ void on_edit_preferences_cb (GtkMenuItem *item, gpointer user_data)
gtk_widget_show_all (prefs_dialog);
}
}
+
diff --git a/src/sound-juicer.h b/src/sound-juicer.h
index 41ebc69..92019c4 100644
--- a/src/sound-juicer.h
+++ b/src/sound-juicer.h
@@ -102,7 +102,7 @@ extern NautilusBurnDrive *drive;
/**
* The root path to write files too
*/
-extern const char *base_uri;
+extern char *base_uri;
/**
* The pattern to expand when naming folders