2006/1/3, Alain Perry <[EMAIL PROTECTED]>: > I'm really gonna flood this list...
So here I go again, with 2 patches for Nautilus (pathbar and sidebar localization, and Documents folder "management"), 1 for gnome-panel (actually, just a small change in the existing patch, to make it use the new icon) and the boring icon I made to test those parts of them that needed it. -- Alain Perry
--- nautilus-2.13.3.orig/src/nautilus-places-sidebar.c 2005-12-12 17:29:53.000000000 +0100
+++ nautilus-2.13.3/src/nautilus-places-sidebar.c 2006-01-03 15:48:11.000000000 +0100
@@ -147,13 +147,9 @@
desktop_path = nautilus_get_desktop_directory ();
if (strcmp (g_get_home_dir(), desktop_path) != 0) {
- char *display_name;
-
mount_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
- display_name = g_filename_display_basename (g_get_home_dir ());
last_iter = add_place (sidebar->store, PLACES_BUILT_IN,
- display_name, "gnome-fs-home", mount_uri);
- g_free (display_name);
+ _("Home"), "gnome-fs-home", mount_uri);
if (strcmp (location, mount_uri) == 0) {
gtk_tree_selection_select_iter (selection, &last_iter);
}
--- nautilus-2.13.3.orig/src/nautilus-pathbar.c 2006-01-03 14:09:54.000000000 +0100
+++ nautilus-2.13.3/src/nautilus-pathbar.c 2006-01-03 14:46:10.000000000 +0100
@@ -292,7 +292,7 @@
g_free (path_bar->desktop_path);
path_bar->desktop_path = NULL;
}
-
+
if (path_bar->root_icon) {
g_object_unref (path_bar->root_icon);
path_bar->root_icon = NULL;
@@ -1123,11 +1123,19 @@
static const char *
get_dir_name (ButtonData *button_data)
{
- if (button_data->type == DESKTOP_BUTTON || (button_data->type == HOME_BUTTON && desktop_is_home)) {
- return _("Desktop");
- } else {
- return button_data->dir_name;
- }
+ switch (button_data->type)
+ {
+ case HOME_BUTTON:
+ if (desktop_is_home)
+ return _("Desktop");
+ else
+ return _("Home");
+ case DESKTOP_BUTTON:
+ return _("Desktop");
+ default:
+ return button_data->dir_name;
+ }
+ return button_data->dir_name;
}
/* We always want to request the same size for the label, whether
--- nautilus-2.13.3.orig/src/nautilus-places-sidebar.c 2006-01-03 15:05:34.000000000 +0100
+++ nautilus-2.13.3/src/nautilus-places-sidebar.c 2006-01-03 14:51:43.000000000 +0100
@@ -136,7 +136,7 @@
GList *volumes, *l;
GnomeVFSVolume *volume;
int bookmark_count, index;
- char *location, *icon, *mount_uri, *name, *desktop_path;
+ char *location, *icon, *mount_uri, *name, *desktop_path, *documents_path;
selection = gtk_tree_view_get_selection (sidebar->tree_view);
gtk_list_store_clear (sidebar->store);
@@ -156,6 +156,18 @@
g_free (mount_uri);
}
+ documents_path = g_build_filename (g_get_home_dir (), "Documents", NULL);
+ if (g_file_test (documents_path, G_FILE_TEST_IS_DIR)) {
+ mount_uri = gnome_vfs_get_uri_from_local_path (documents_path);
+ last_iter = add_place (sidebar->store, PLACES_BUILT_IN,
+ _("Documents"), "gnome-fs-documents", mount_uri);
+ if (strcmp (location, mount_uri) == 0) {
+ gtk_tree_selection_select_iter (selection, &last_iter);
+ }
+ g_free (mount_uri);
+ }
+ g_free (documents_path);
+
mount_uri = gnome_vfs_get_uri_from_local_path (desktop_path);
last_iter = add_place (sidebar->store, PLACES_BUILT_IN,
_("Desktop"), "gnome-fs-desktop", mount_uri);
--- nautilus-2.13.3.orig/src/nautilus-pathbar.h 2006-01-03 14:09:54.000000000 +0100
+++ nautilus-2.13.3/src/nautilus-pathbar.h 2006-01-03 14:52:32.000000000 +0100
@@ -41,10 +41,12 @@
char *root_path;
char *home_path;
char *desktop_path;
+ char *documents_path;
GdkPixbuf *root_icon;
GdkPixbuf *home_icon;
GdkPixbuf *desktop_icon;
+ GdkPixbuf *documents_icon;
GList *button_list;
GList *first_scrolled_button;
--- nautilus-2.13.3.orig/src/nautilus-pathbar.c 2006-01-03 15:05:34.000000000 +0100
+++ nautilus-2.13.3/src/nautilus-pathbar.c 2006-01-03 15:04:38.000000000 +0100
@@ -50,6 +50,7 @@
ROOT_BUTTON,
HOME_BUTTON,
DESKTOP_BUTTON,
+ DOCUMENTS_BUTTON,
VOLUME_BUTTON
} ButtonType;
@@ -66,6 +67,7 @@
#define DEFAULT_ICON "gnome-fs-directory"
#define DEFAULT_DESKTOP_ICON "gnome-fs-desktop"
+#define DEFAULT_DOCUMENTS_ICON "gnome-fs-documents"
#define DEFAULT_HOME_ICON "gnome-fs-home"
#define DEFAULT_FILESYSTEM_ICON "gnome-dev-harddisk"
@@ -212,6 +214,7 @@
path_bar->icon_size = NAUTILUS_PATH_BAR_ICON_SIZE;
path_bar->desktop_path = nautilus_get_desktop_directory_uri ();
+ path_bar->documents_path = gnome_vfs_get_uri_from_local_path (g_build_filename (g_get_home_dir(), "Documents", NULL));
path_bar->home_path = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
path_bar->root_path = g_strdup ("file:///");
desktop_is_home = (strcmp (path_bar->home_path, path_bar->desktop_path) == 0);
@@ -292,6 +295,10 @@
g_free (path_bar->desktop_path);
path_bar->desktop_path = NULL;
}
+ if (path_bar->documents_path) {
+ g_free (path_bar->documents_path);
+ path_bar->documents_path = NULL;
+ }
if (path_bar->root_icon) {
g_object_unref (path_bar->root_icon);
@@ -305,6 +312,10 @@
g_object_unref (path_bar->desktop_icon);
path_bar->desktop_icon = NULL;
}
+ if (path_bar->documents_icon) {
+ g_object_unref (path_bar->documents_icon);
+ path_bar->documents_icon = NULL;
+ }
G_OBJECT_CLASS (nautilus_path_bar_parent_class)->finalize (object);
}
@@ -916,6 +927,10 @@
g_object_unref (path_bar->desktop_icon);
path_bar->desktop_icon = NULL;
}
+ if (path_bar->documents_icon) {
+ g_object_unref (path_bar->documents_icon);
+ path_bar->documents_icon = NULL;
+ }
for (list = path_bar->button_list; list; list = list->next) {
@@ -1102,6 +1117,24 @@
g_free (icon_name);
return path_bar->desktop_icon;
+ case DOCUMENTS_BUTTON:
+ if (path_bar->documents_icon != NULL) {
+ return path_bar->documents_icon;
+ }
+ icon_name = get_icon_name_for_file_path (path_bar->documents_path);
+ if (strcmp (icon_name, DEFAULT_ICON) == 0) {
+ path_bar->documents_icon = nautilus_icon_factory_get_pixbuf_from_name (DEFAULT_DOCUMENTS_ICON,
+ NULL, NAUTILUS_PATH_BAR_ICON_SIZE,
+ TRUE, NULL);
+ } else {
+ path_bar->documents_icon = nautilus_icon_factory_get_pixbuf_from_name (icon_name,
+ NULL, NAUTILUS_PATH_BAR_ICON_SIZE,
+ TRUE, NULL);
+ }
+
+ g_free (icon_name);
+ return path_bar->documents_icon;
+
default:
return NULL;
}
@@ -1132,6 +1165,8 @@
return _("Home");
case DESKTOP_BUTTON:
return _("Desktop");
+ case DOCUMENTS_BUTTON:
+ return _("Documents");
default:
return button_data->dir_name;
}
@@ -1291,6 +1326,9 @@
return NORMAL_BUTTON;
}
}
+ if (path_bar->documents_path != NULL && is_file_path_equal (path, path_bar->documents_path)) {
+ return DOCUMENTS_BUTTON;
+ }
if (is_file_path_mounted_volume (path, button_data)) {
return VOLUME_BUTTON;
}
@@ -1353,6 +1391,7 @@
break;
case HOME_BUTTON:
case DESKTOP_BUTTON:
+ case DOCUMENTS_BUTTON:
case VOLUME_BUTTON:
button_data->image = gtk_image_new ();
button_data->label = gtk_label_new (NULL);
--- nautilus-2.13.3.orig/libnautilus-private/nautilus-file-utilities.c 2006-01-03 14:09:51.000000000 +0100
+++ nautilus-2.13.3/libnautilus-private/nautilus-file-utilities.c 2006-01-03 14:38:16.000000000 +0100
@@ -338,6 +338,30 @@
}
gboolean
+nautilus_is_documents_directory_file_escaped (char *escaped_dirname,
+ char *escaped_file)
+{
+ static char *escaped_documents_dir_dirname = NULL;
+ static char *escaped_documents_dir_filename = NULL;
+ char *uri;
+ GnomeVFSURI *vfs_uri;
+
+ if (escaped_documents_dir_dirname == NULL) {
+ uri = gnome_vfs_get_uri_from_local_path (g_build_filename (g_get_home_dir (), "Documents", NULL));
+ vfs_uri = gnome_vfs_uri_new (uri);
+ g_free (uri);
+
+ escaped_documents_dir_filename = gnome_vfs_uri_extract_short_path_name (vfs_uri);
+ escaped_documents_dir_dirname = gnome_vfs_uri_extract_dirname (vfs_uri);
+
+ gnome_vfs_uri_unref (vfs_uri);
+ }
+
+ return (strcmp (escaped_dirname, escaped_documents_dir_dirname) == 0 &&
+ strcmp (escaped_file, escaped_documents_dir_filename) == 0);
+}
+
+gboolean
nautilus_is_desktop_directory_file_escaped (char *escaped_dirname,
char *escaped_file)
{
--- nautilus-2.13.3.orig/libnautilus-private/nautilus-file.c 2006-01-03 14:09:52.000000000 +0100
+++ nautilus-2.13.3/libnautilus-private/nautilus-file.c 2006-01-03 14:32:43.000000000 +0100
@@ -2337,6 +2337,22 @@
}
gboolean
+nautilus_file_is_documents (NautilusFile *file)
+{
+ GnomeVFSURI *dir_vfs_uri;
+
+ dir_vfs_uri = file->details->directory->details->vfs_uri;
+
+ if (dir_vfs_uri == NULL ||
+ strcmp (dir_vfs_uri->method_string, "file") != 0) {
+ return FALSE;
+ }
+
+ return nautilus_is_documents_directory_file_escaped (dir_vfs_uri->text,
+ file->details->relative_uri);
+}
+
+gboolean
nautilus_file_is_in_desktop (NautilusFile *file)
{
/* This handles visiting other people's desktops, but it can arguably
--- nautilus-2.13.3.orig/libnautilus-private/nautilus-icon-factory.c 2006-01-03 14:09:51.000000000 +0100
+++ nautilus-2.13.3/libnautilus-private/nautilus-icon-factory.c 2006-01-03 14:39:30.000000000 +0100
@@ -71,6 +71,7 @@
#define ICON_NAME_TRASH_EMPTY "gnome-fs-trash-empty"
#define ICON_NAME_TRASH_FULL "gnome-fs-trash-full"
#define ICON_NAME_HOME "gnome-fs-home"
+#define ICON_NAME_DOCUMENTS "gnome-fs-documents"
#define NAUTILUS_EMBLEM_NAME_PREFIX "emblem-"
@@ -813,6 +814,9 @@
if (nautilus_file_is_home (file)) {
return ICON_NAME_HOME;
}
+ if (nautilus_file_is_documents (file)) {
+ return ICON_NAME_DOCUMENTS;
+ }
ret = NULL;
uri = nautilus_file_get_uri (file);
=== modified file 'gnome-panel/panel-menu-items.c'
--- gnome-panel/panel-menu-items.c
+++ gnome-panel/panel-menu-items.c
@@ -521,6 +521,7 @@
GtkWidget *places_menu;
GtkWidget *item;
char *gconf_name;
+ char *path;
places_menu = panel_create_menu ();
@@ -532,6 +533,16 @@
gconf_name);
if (gconf_name)
g_free (gconf_name);
+
+ path = g_build_filename (g_get_home_dir (), "Documents", NULL);
+ if (g_file_test (path, G_FILE_TEST_IS_DIR))
+ panel_menu_items_append_place_item ("gnome-fs-documents",
+ _("Documents"),
+ _("Documents directory"),
+ places_menu,
+ G_CALLBACK (activate_uri),
+ "Documents");
+ g_free (path);
if (!gconf_client_get_bool (panel_gconf_get_client (),
DESKTOP_IS_HOME_DIR_KEY,
@@ -666,6 +677,10 @@
panel_menu_items_append_from_desktop (menu, "yelp.desktop", NULL);
panel_menu_items_append_from_desktop (menu, "gnome-about.desktop", NULL);
+ if (g_file_test (DATADIR"/omf/about-ubuntu/about-ubuntu-C.omf",
+ G_FILE_TEST_IS_REGULAR))
+ panel_menu_items_append_from_desktop (menu, "ubuntu-about.desktop", NULL);
+
if (parent->priv->append_lock_logout)
panel_menu_items_append_lock_logout (menu);
}
@@ -932,10 +947,7 @@
menuitem = g_object_new (PANEL_TYPE_DESKTOP_MENU_ITEM, NULL);
- /* Translators: Desktop is used here as in "Desktop Environment" (this
- * is not the Desktop folder). Do not keep "Desktop Environment|" in
- * the translation. */
- accel_label = gtk_accel_label_new (Q_("Desktop Environment|Desktop"));
+ accel_label = gtk_accel_label_new (_("System"));
gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
gtk_container_add (GTK_CONTAINER (menuitem), accel_label);
gnome-fs-documents.svg
Description: image/svg
-- ubuntu-desktop mailing list [email protected] http://lists.ubuntu.com/mailman/listinfo/ubuntu-desktop
