Commit 055bcd06 authored by Jim Krehl's avatar Jim Krehl
Browse files

changed default places

svn path=/branches/version-2/; revision=192
parent a674b545
......@@ -4,7 +4,28 @@
xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"
>
<bookmark href="HOME" added="2007-01-25T23:17:19Z" modified="2007-01-25T23:17:19Z" visited="2007-01-25T23:17:19Z">
<title>Home Dir</title>
<title>Home</title>
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="inode/directory"/>
<bookmark:applications>
<bookmark:application name="nautilus" exec="nautilus --browser %u" timestamp="1169767039" count="1"/>
</bookmark:applications>
</metadata>
</info>
</bookmark>
<bookmark href="DOCUMENTS" added="2007-01-25T23:17:19Z" modified="2007-01-25T23:17:19Z" visited="2007-01-25T23:17:19Z">
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="inode/directory"/>
<bookmark:applications>
<bookmark:application name="nautilus" exec="nautilus --browser %u" timestamp="1169767039" count="1"/>
</bookmark:applications>
</metadata>
</info>
</bookmark>
<bookmark href="network:" added="2007-01-25T23:17:19Z" modified="2007-01-25T23:17:19Z" visited="2007-01-25T23:17:19Z">
<title>Network Servers</title>
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="inode/directory"/>
......@@ -15,7 +36,6 @@
</info>
</bookmark>
<bookmark href="DESKTOP" added="2007-01-25T23:17:19Z" modified="2007-01-25T23:17:19Z" visited="2007-01-25T23:17:19Z">
<title>Desktop</title>
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="inode/directory"/>
......
......@@ -429,104 +429,6 @@ exit:
g_free (bookmark_path);
}
void
migrate_user_dirs_to_user_bookmark_file ()
{
LibSlabBookmarkFile *bm_file;
gchar *bookmark_path;
gchar *bookmark_path_cp_dest;
gchar *contents;
gchar **uris;
gchar *uri_new;
gchar *path;
GError *error = NULL;
gint i;
if (! get_main_menu_user_data_file_path (& bookmark_path, DIRS_BOOKMARK_FILENAME, TRUE)) {
g_free (bookmark_path);
bookmark_path = libslab_get_user_dirs_store_path (FALSE);
bookmark_path_cp_dest = libslab_get_user_dirs_store_path (TRUE);
g_file_get_contents (bookmark_path, & contents, NULL, & error);
if (error)
libslab_handle_g_error (
& error, "%s: can't read user dirs store path [%s]\n",
G_STRFUNC, bookmark_path);
else
g_file_set_contents (bookmark_path_cp_dest, contents, -1, & error);
if (error)
libslab_handle_g_error (
& error, "%s: can't save user dirs store path [%s]\n",
G_STRFUNC, bookmark_path_cp_dest);
g_free (contents);
g_free (bookmark_path);
bookmark_path = bookmark_path_cp_dest;
bm_file = libslab_bookmark_file_new ();
libslab_bookmark_file_load_from_file (bm_file, bookmark_path, & error);
if (error) {
libslab_handle_g_error (
& error, "%s: can't read user dirs store path [%s]\n",
G_STRFUNC, bookmark_path);
}
else {
uris = libslab_bookmark_file_get_uris (bm_file, NULL);
for (i = 0; uris && uris [i]; ++i) {
if (! strcmp (uris [i], "HOME"))
uri_new = g_filename_to_uri (g_get_home_dir (), NULL, NULL);
else if (! strcmp (uris [i], "DESKTOP")) {
path = g_build_filename (g_get_home_dir (), "Desktop", NULL);
uri_new = g_filename_to_uri (path, NULL, NULL);
g_free (path);
}
else if (! strcmp (uris [i], "SPREADSHEET")) {
path = g_build_filename (g_get_home_dir (), "Documents", g_strconcat (_("New Spreadsheet"), ".ods", NULL), NULL);
uri_new = g_filename_to_uri (path, NULL, NULL);
g_free (path);
}
else if (! strcmp (uris [i], "DOCUMENT")) {
path = g_build_filename (g_get_home_dir (), "Documents", g_strconcat (_("New Document"), ".odt", NULL), NULL);
uri_new = g_filename_to_uri (path, NULL, NULL);
g_free (path);
}
else
uri_new = NULL;
if (uri_new)
libslab_bookmark_file_move_item (bm_file, uris [i], uri_new, NULL);
g_free (uri_new);
}
libslab_bookmark_file_to_file (bm_file, bookmark_path, & error);
if (error)
libslab_handle_g_error (
& error, "%s: can't write user dirs store [%s]\n",
G_STRFUNC, bookmark_path);
g_strfreev (uris);
}
libslab_bookmark_file_free (bm_file);
}
g_free (bookmark_path);
}
void
migrate_showable_file_types ()
{
......
......@@ -27,7 +27,6 @@ G_BEGIN_DECLS
void migrate_system_gconf_to_bookmark_file (void);
void migrate_user_apps_gconf_to_bookmark_file (void);
void migrate_user_dirs_to_user_bookmark_file (void);
void migrate_showable_file_types (void);
G_END_DECLS
......
......@@ -60,7 +60,6 @@ main_menu_applet_init (PanelApplet *applet, const gchar *iid, gpointer user_data
migrate_system_gconf_to_bookmark_file ();
migrate_user_apps_gconf_to_bookmark_file ();
migrate_user_dirs_to_user_bookmark_file ();
migrate_showable_file_types ();
main_menu_ui_new (applet);
......
......@@ -145,25 +145,53 @@ update_store (LibSlabBookmarkFile *bm_file_old, LibSlabBookmarkFile *bm_file_new
static GtkWidget *
get_directory_tile (LibSlabBookmarkFile *bm_file, const gchar *uri)
{
gchar *title;
gchar *icon;
gboolean found;
gchar *title;
gchar *path;
gchar *icon = NULL;
gchar *uri_new = NULL;
GtkWidget *tile;
if (bm_file) {
title = libslab_bookmark_file_get_title (bm_file, uri, NULL);
found = libslab_bookmark_file_get_icon (bm_file, uri, & icon, NULL, NULL);
if (! strcmp (uri, "HOME")) {
uri_new = g_filename_to_uri (g_get_home_dir (), NULL, NULL);
icon = "gnome-fs-home";
}
else if (! strcmp (uri, "DOCUMENTS")) {
path = g_build_filename (g_get_home_dir (), "Documents", NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
uri_new = g_filename_to_uri (path, NULL, NULL);
if (! found)
icon = NULL;
g_free (path);
}
else if (! strcmp (uri, "DESKTOP")) {
path = g_build_filename (g_get_home_dir (), "Desktop", NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
uri_new = g_filename_to_uri (path, NULL, NULL);
icon = "gnome-fs-desktop";
}
g_free (path);
}
else
uri_new = g_strdup (uri);
if (! strcmp (uri_new, "file:///"))
icon = "drive-harddisk";
else if (! strcmp (uri_new, "network:"))
icon = "network-workgroup";
else
/* do nothing */ ;
if (bm_file)
title = libslab_bookmark_file_get_title (bm_file, uri, NULL);
tile = directory_tile_new (uri, title, icon);
tile = directory_tile_new (uri_new, title, icon);
g_free (title);
g_free (icon);
g_free (uri_new);
return tile;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment