mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-24 18:25:50 +00:00
Use nautilus_get_home_directory_uri everywhere instead of open coding it
2006-12-08 Paolo Borelli <pborelli@katamail.com> * libnautilus-private/nautilus-desktop-link.c: * libnautilus-private/nautilus-file-utilities.c: * libnautilus-private/nautilus-query.c: * src/nautilus-navigation-window.c: * src/nautilus-navigation-window.h: * src/nautilus-pathbar.c: * src/nautilus-places-sidebar.c: * src/nautilus-shell.c: * src/nautilus-window-manage-views.c: * src/nautilus-window.c: * src/file-manager/fm-tree-model.c: * src/file-manager/fm-tree-view.c: Use nautilus_get_home_directory_uri everywhere instead of open coding it and other minor cleanups.
This commit is contained in:
parent
0b0aba3a4d
commit
fca9952aad
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2006-12-08 Paolo Borelli <pborelli@katamail.com>
|
||||
|
||||
* libnautilus-private/nautilus-desktop-link.c:
|
||||
* libnautilus-private/nautilus-file-utilities.c:
|
||||
* libnautilus-private/nautilus-query.c:
|
||||
* src/nautilus-navigation-window.c:
|
||||
* src/nautilus-navigation-window.h:
|
||||
* src/nautilus-pathbar.c:
|
||||
* src/nautilus-places-sidebar.c:
|
||||
* src/nautilus-shell.c:
|
||||
* src/nautilus-window-manage-views.c:
|
||||
* src/nautilus-window.c:
|
||||
* src/file-manager/fm-tree-model.c:
|
||||
* src/file-manager/fm-tree-view.c:
|
||||
|
||||
Use nautilus_get_home_directory_uri everywhere instead of
|
||||
open coding it and other minor cleanups.
|
||||
|
||||
2006-12-08 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* libnautilus-private/nautilus-monitor.c:
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <gtk/gtksignal.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <libgnomevfs/gnome-vfs.h>
|
||||
#include <libnautilus-private/nautilus-file-utilities.h>
|
||||
#include <libnautilus-private/nautilus-trash-monitor.h>
|
||||
#include <libnautilus-private/nautilus-global-preferences.h>
|
||||
#include <string.h>
|
||||
|
@ -130,10 +131,8 @@ nautilus_desktop_link_new (NautilusDesktopLinkType type)
|
|||
switch (type) {
|
||||
case NAUTILUS_DESKTOP_LINK_HOME:
|
||||
link->details->filename = g_strdup ("home");
|
||||
|
||||
link->details->display_name = eel_preferences_get (NAUTILUS_PREFERENCES_DESKTOP_HOME_NAME);
|
||||
|
||||
link->details->activation_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
|
||||
link->details->activation_uri = nautilus_get_home_directory_uri ();
|
||||
link->details->icon = g_strdup ("gnome-fs-home");
|
||||
|
||||
eel_preferences_add_callback (NAUTILUS_PREFERENCES_DESKTOP_HOME_NAME,
|
||||
|
|
|
@ -323,7 +323,7 @@ nautilus_is_home_directory_file_escaped (char *escaped_dirname,
|
|||
GnomeVFSURI *vfs_uri;
|
||||
|
||||
if (escaped_home_dir_dirname == NULL) {
|
||||
uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
|
||||
uri = nautilus_get_home_directory_uri ();
|
||||
vfs_uri = gnome_vfs_uri_new (uri);
|
||||
g_free (uri);
|
||||
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "nautilus-query.h"
|
||||
#include <libgnomevfs/gnome-vfs-utils.h>
|
||||
#include <eel/eel-gtk-macros.h>
|
||||
#include <eel/eel-glib-extensions.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <libnautilus-private/nautilus-file-utilities.h>
|
||||
|
||||
struct NautilusQueryDetails {
|
||||
char *text;
|
||||
|
@ -143,9 +143,9 @@ encode_home_uri (const char *uri)
|
|||
{
|
||||
char *home_uri;
|
||||
const char *encoded_uri;
|
||||
|
||||
home_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
|
||||
|
||||
|
||||
home_uri = nautilus_get_home_directory_uri ();
|
||||
|
||||
if (g_str_has_prefix (uri, home_uri)) {
|
||||
encoded_uri = uri + strlen (home_uri);
|
||||
if (*encoded_uri == '/') {
|
||||
|
@ -169,7 +169,7 @@ decode_home_uri (const char *uri)
|
|||
if (g_str_has_prefix (uri, "file:")) {
|
||||
decoded_uri = g_strdup (uri);
|
||||
} else {
|
||||
home_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
|
||||
home_uri = nautilus_get_home_directory_uri ();
|
||||
|
||||
decoded_uri = g_strconcat (home_uri, "/", uri, NULL);
|
||||
|
||||
|
|
|
@ -1023,9 +1023,11 @@ done_loading_callback (NautilusDirectory *directory,
|
|||
}
|
||||
set_done_loading (root->model, node, TRUE);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
|
||||
make_iter_for_node (node, &iter, root->model->details->stamp);
|
||||
g_signal_emit_by_name (root->model, "row_loaded", &iter);
|
||||
g_signal_emit (root->model,
|
||||
tree_model_signals[ROW_LOADED], 0,
|
||||
&iter);
|
||||
}
|
||||
|
||||
static NautilusFileAttributes
|
||||
|
|
|
@ -34,11 +34,11 @@
|
|||
|
||||
#include "fm-tree-model.h"
|
||||
#include "fm-properties-window.h"
|
||||
#include <string.h>
|
||||
#include <eel/eel-alert-dialog.h>
|
||||
#include <eel/eel-glib-extensions.h>
|
||||
#include <eel/eel-gtk-extensions.h>
|
||||
#include <eel/eel-preferences.h>
|
||||
#include <eel/eel-string.h>
|
||||
#include <eel/eel-stock-dialogs.h>
|
||||
#include <eel/eel-vfs-extensions.h>
|
||||
#include <gtk/gtkmain.h>
|
||||
|
@ -66,6 +66,7 @@
|
|||
#include <libnautilus-private/nautilus-debug-log.h>
|
||||
#include <libnautilus-private/nautilus-file-attributes.h>
|
||||
#include <libnautilus-private/nautilus-file-operations.h>
|
||||
#include <libnautilus-private/nautilus-file-utilities.h>
|
||||
#include <libnautilus-private/nautilus-global-preferences.h>
|
||||
#include <libnautilus-private/nautilus-program-choosing.h>
|
||||
#include <libnautilus-private/nautilus-tree-view-drag-dest.h>
|
||||
|
@ -346,7 +347,7 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
|
|||
|
||||
uri = nautilus_file_get_activation_uri (file);
|
||||
if (uri != NULL
|
||||
&& eel_str_has_prefix (uri, NAUTILUS_COMMAND_SPECIFIER)) {
|
||||
&& g_str_has_prefix (uri, NAUTILUS_COMMAND_SPECIFIER)) {
|
||||
|
||||
uri += strlen (NAUTILUS_COMMAND_SPECIFIER);
|
||||
nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER,
|
||||
|
@ -355,8 +356,8 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
|
|||
nautilus_launch_application_from_command (screen, NULL, uri, NULL, FALSE);
|
||||
|
||||
} else if (uri != NULL
|
||||
&& eel_str_has_prefix (uri, NAUTILUS_DESKTOP_COMMAND_SPECIFIER)) {
|
||||
|
||||
&& g_str_has_prefix (uri, NAUTILUS_DESKTOP_COMMAND_SPECIFIER)) {
|
||||
|
||||
file_uri = nautilus_file_get_uri (file);
|
||||
nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER,
|
||||
"tree view launch_desktop_file window=%p: %s",
|
||||
|
@ -1388,7 +1389,7 @@ create_tree (FMTreeView *view)
|
|||
(view->details->child_model, "row_loaded",
|
||||
G_CALLBACK (row_loaded_callback),
|
||||
view, G_CONNECT_AFTER);
|
||||
home_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
|
||||
home_uri = nautilus_get_home_directory_uri ();
|
||||
fm_tree_model_add_root_uri (view->details->child_model, home_uri, _("Home Folder"), "gnome-fs-home", NULL);
|
||||
g_free (home_uri);
|
||||
fm_tree_model_add_root_uri (view->details->child_model, "file:///", _("File System"), "gnome-fs-directory", NULL);
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include <eel/eel-gtk-macros.h>
|
||||
#include <eel/eel-stock-dialogs.h>
|
||||
#include <eel/eel-string.h>
|
||||
#include <eel/eel-vfs-extensions.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gtk/gtkmain.h>
|
||||
|
@ -63,12 +62,7 @@
|
|||
#include <gtk/gtkliststore.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <libgnome/gnome-macros.h>
|
||||
#include <libgnome/gnome-util.h>
|
||||
#include <libgnomeui/gnome-messagebox.h>
|
||||
#include <libgnomeui/gnome-uidefs.h>
|
||||
#include <libgnomeui/gnome-window-icon.h>
|
||||
#include <libgnomevfs/gnome-vfs-uri.h>
|
||||
#include <libgnomevfs/gnome-vfs-utils.h>
|
||||
#include <libnautilus-private/nautilus-file-utilities.h>
|
||||
#include <libnautilus-private/nautilus-file-attributes.h>
|
||||
#include <libnautilus-private/nautilus-global-preferences.h>
|
||||
|
@ -764,18 +758,6 @@ nautilus_navigation_window_go_forward (NautilusNavigationWindow *window)
|
|||
nautilus_navigation_window_back_or_forward (window, FALSE, 0);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_navigation_window_go_home (NautilusNavigationWindow *window)
|
||||
{
|
||||
char *home_uri;
|
||||
|
||||
home_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
|
||||
|
||||
g_assert (home_uri != NULL);
|
||||
nautilus_window_go_to (NAUTILUS_WINDOW (window), home_uri);
|
||||
g_free (home_uri);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_navigation_window_allow_back (NautilusNavigationWindow *window, gboolean allow)
|
||||
{
|
||||
|
|
|
@ -82,7 +82,6 @@ struct _NautilusNavigationWindowClass {
|
|||
};
|
||||
|
||||
GType nautilus_navigation_window_get_type (void);
|
||||
void nautilus_navigation_window_go_home (NautilusNavigationWindow *window);
|
||||
void nautilus_navigation_window_allow_back (NautilusNavigationWindow *window,
|
||||
gboolean allow);
|
||||
void nautilus_navigation_window_allow_forward (NautilusNavigationWindow *window,
|
||||
|
|
|
@ -189,7 +189,7 @@ desktop_location_changed_callback (gpointer user_data)
|
|||
g_free (path_bar->desktop_path);
|
||||
g_free (path_bar->home_path);
|
||||
path_bar->desktop_path = nautilus_get_desktop_directory_uri ();
|
||||
path_bar->home_path = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
|
||||
path_bar->home_path = nautilus_get_home_directory_uri ();
|
||||
desktop_is_home = (strcmp (path_bar->home_path, path_bar->desktop_path) == 0);
|
||||
|
||||
if (path_bar->home_icon) {
|
||||
|
@ -212,7 +212,7 @@ nautilus_path_bar_init (NautilusPathBar *path_bar)
|
|||
path_bar->icon_size = NAUTILUS_PATH_BAR_ICON_SIZE;
|
||||
|
||||
path_bar->desktop_path = nautilus_get_desktop_directory_uri ();
|
||||
path_bar->home_path = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
|
||||
path_bar->home_path = nautilus_get_home_directory_uri ();
|
||||
path_bar->root_path = g_strdup ("file:///");
|
||||
desktop_is_home = (strcmp (path_bar->home_path, path_bar->desktop_path) == 0);
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ update_places (NautilusPlacesSidebar *sidebar)
|
|||
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 ());
|
||||
mount_uri = nautilus_get_home_directory_uri ();
|
||||
display_name = g_filename_display_basename (g_get_home_dir ());
|
||||
last_iter = add_place (sidebar, PLACES_BUILT_IN,
|
||||
display_name, "gnome-fs-home",
|
||||
|
|
|
@ -149,8 +149,9 @@ open_window (NautilusShell *shell, const char *uri, const char *startup_id,
|
|||
}
|
||||
} else {
|
||||
home_uri = NULL;
|
||||
|
||||
if (uri == NULL) {
|
||||
home_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
|
||||
home_uri = nautilus_get_home_directory_uri ();
|
||||
uri = home_uri;
|
||||
}
|
||||
|
||||
|
|
|
@ -942,7 +942,7 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
|
|||
better test for that */
|
||||
|
||||
if (!gnome_vfs_uris_match (location, "file:///")) {
|
||||
home_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
|
||||
home_uri = nautilus_get_home_directory_uri ();
|
||||
if (!gnome_vfs_uris_match (home_uri, location)) {
|
||||
nautilus_window_go_home (NAUTILUS_WINDOW (window));
|
||||
} else {
|
||||
|
|
|
@ -42,30 +42,18 @@
|
|||
#include "nautilus-search-bar.h"
|
||||
#include <eel/eel-debug.h>
|
||||
#include <eel/eel-marshal.h>
|
||||
#include <eel/eel-gdk-extensions.h>
|
||||
#include <eel/eel-gdk-pixbuf-extensions.h>
|
||||
#include <eel/eel-gtk-extensions.h>
|
||||
#include <eel/eel-gtk-macros.h>
|
||||
#include <eel/eel-stock-dialogs.h>
|
||||
#include <eel/eel-string.h>
|
||||
#include <eel/eel-vfs-extensions.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtkmain.h>
|
||||
#include <gtk/gtkmenubar.h>
|
||||
#include <gtk/gtkmenuitem.h>
|
||||
#include <gtk/gtkoptionmenu.h>
|
||||
#include <gtk/gtktogglebutton.h>
|
||||
#include <gtk/gtkvbox.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <libgnome/gnome-macros.h>
|
||||
#include <libgnome/gnome-util.h>
|
||||
#include <libgnomeui/gnome-messagebox.h>
|
||||
#include <libgnomeui/gnome-uidefs.h>
|
||||
#include <libgnomeui/gnome-window-icon.h>
|
||||
#include <libgnomevfs/gnome-vfs-uri.h>
|
||||
#include <libgnomevfs/gnome-vfs-utils.h>
|
||||
#include <libnautilus-private/nautilus-file-utilities.h>
|
||||
#include <libnautilus-private/nautilus-file-attributes.h>
|
||||
#include <libnautilus-private/nautilus-global-preferences.h>
|
||||
|
@ -259,8 +247,6 @@ nautilus_window_go_up_signal (NautilusWindow *window, gboolean close_behind)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
nautilus_window_go_up (NautilusWindow *window, gboolean close_behind)
|
||||
{
|
||||
|
@ -366,7 +352,6 @@ nautilus_window_allow_reload (NautilusWindow *window, gboolean allow)
|
|||
action = gtk_action_group_get_action (window->details->main_action_group,
|
||||
NAUTILUS_ACTION_RELOAD);
|
||||
gtk_action_set_sensitive (action, allow);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -374,12 +359,8 @@ nautilus_window_go_home (NautilusWindow *window)
|
|||
{
|
||||
char *home_uri;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
|
||||
|
||||
home_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
|
||||
|
||||
g_assert (home_uri != NULL);
|
||||
nautilus_window_go_to (window, home_uri);
|
||||
home_uri = nautilus_get_home_directory_uri ();
|
||||
nautilus_window_open_location (window, home_uri, FALSE);
|
||||
g_free (home_uri);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue