nautilus r14113 - in branches/gnome-2-22: . libnautilus-private src
- From: davidz svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r14113 - in branches/gnome-2-22: . libnautilus-private src
- Date: Wed, 30 Apr 2008 02:16:54 +0100 (BST)
Author: davidz
Date: Wed Apr 30 01:16:53 2008
New Revision: 14113
URL: http://svn.gnome.org/viewvc/nautilus?rev=14113&view=rev
Log:
2008-04-29 David Zeuthen <davidz redhat com>
* libnautilus-private/nautilus-autorun.c:
* libnautilus-private/nautilus-autorun.h:
* libnautilus-private/nautilus-file-operations.c:
(volume_mount_cb), (nautilus_file_operations_mount_volume):
* libnautilus-private/nautilus-file-operations.h:
* libnautilus-private/nautilus-mime-actions.c:
(activation_mount_not_mounted_callback):
* libnautilus-private/nautilus-vfs-file.c:
(vfs_file_mount_callback):
* src/nautilus-application.c: (startup_volume_mount_cb),
(volume_added_callback):
* src/nautilus-places-sidebar.c: (open_selected_bookmark),
(mount_shortcut_cb):
* src/nautilus-window-manage-views.c: (mount_not_mounted_callback):
Fix how autorunning works. Instead of inhibiting autorunning
every time we run something, we turn things around and instead
allow automounting only in the instance where Nautilus automounted
something itself. So in essence this patch is s/inhibit/allow/.
This fixes an annoying problem where Nautilus would do autorun
everytime something was mounted even from the command line. A
consequence of this are windows popping up and other annoyances.
This patch fixes that problem.
* src/nautilus-x-content-bar.c: (nautilus_x_content_bar_init):
Make sure the label is ellipsized.
Modified:
branches/gnome-2-22/ChangeLog
branches/gnome-2-22/libnautilus-private/nautilus-autorun.c
branches/gnome-2-22/libnautilus-private/nautilus-autorun.h
branches/gnome-2-22/libnautilus-private/nautilus-file-operations.c
branches/gnome-2-22/libnautilus-private/nautilus-file-operations.h
branches/gnome-2-22/libnautilus-private/nautilus-mime-actions.c
branches/gnome-2-22/libnautilus-private/nautilus-vfs-file.c
branches/gnome-2-22/src/nautilus-application.c
branches/gnome-2-22/src/nautilus-places-sidebar.c
branches/gnome-2-22/src/nautilus-window-manage-views.c
branches/gnome-2-22/src/nautilus-x-content-bar.c
Modified: branches/gnome-2-22/libnautilus-private/nautilus-autorun.c
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-autorun.c (original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-autorun.c Wed Apr 30 01:16:53 2008
@@ -1353,54 +1353,31 @@
return NULL;
}
-
-static GList *inhibit_mount_handling_for = NULL;
-
-
static gboolean
-remove_inhibit_file_cb (gpointer data)
+remove_allow_volume (gpointer data)
{
- GFile *file = data;
- GList *l;
+ GVolume *volume = data;
- l = g_list_find (inhibit_mount_handling_for, file);
- if (l != NULL) {
- inhibit_mount_handling_for = g_list_delete_link (inhibit_mount_handling_for, l);
- g_object_unref (file);
- }
-
+ g_object_set_data (G_OBJECT (volume), "nautilus-allow-autorun", NULL);
return FALSE;
}
void
-nautilus_inhibit_autorun_for_file (GFile *file)
-{
- inhibit_mount_handling_for = g_list_prepend (inhibit_mount_handling_for, g_object_ref (file));
- g_timeout_add_full (0,
- 5000,
- remove_inhibit_file_cb,
- g_object_ref (file),
- g_object_unref);
-}
-
-static gboolean
-remove_inhibit_volume (gpointer data)
+nautilus_allow_autorun_for_volume (GVolume *volume)
{
- GVolume *volume = data;
-
- g_object_set_data (G_OBJECT (volume), "nautilus-inhibit-autorun", NULL);
- return FALSE;
+ g_object_set_data (G_OBJECT (volume), "nautilus-allow-autorun", GINT_TO_POINTER (1));
}
void
-nautilus_inhibit_autorun_for_volume (GVolume *volume)
+nautilus_allow_autorun_for_volume_finish (GVolume *volume)
{
- g_object_set_data (G_OBJECT (volume), "nautilus-inhibit-autorun", GINT_TO_POINTER (1));
- g_timeout_add_full (0,
- 5000,
- remove_inhibit_volume,
- g_object_ref (volume),
- g_object_unref);
+ if (g_object_get_data (G_OBJECT (volume), "nautilus-allow-autorun") != NULL) {
+ g_timeout_add_full (0,
+ 5000,
+ remove_allow_volume,
+ g_object_ref (volume),
+ g_object_unref);
+ }
}
static gboolean
@@ -1420,17 +1397,16 @@
static gboolean
should_autorun_mount (GMount *mount)
{
- GFile *root, *file;
- GList *l;
+ GFile *root;
GVolume *enclosing_volume;
gboolean ignore_autorun;
- ignore_autorun = FALSE;
+ ignore_autorun = TRUE;
enclosing_volume = g_mount_get_volume (mount);
if (enclosing_volume != NULL) {
- if (g_object_get_data (G_OBJECT (enclosing_volume), "nautilus-inhibit-autorun") != NULL) {
- ignore_autorun = TRUE;
- g_object_set_data (G_OBJECT (enclosing_volume), "nautilus-inhibit-autorun", NULL);
+ if (g_object_get_data (G_OBJECT (enclosing_volume), "nautilus-allow-autorun") != NULL) {
+ ignore_autorun = FALSE;
+ g_object_set_data (G_OBJECT (enclosing_volume), "nautilus-allow-autorun", NULL);
}
}
@@ -1443,18 +1419,6 @@
root = g_mount_get_root (mount);
- for (l = inhibit_mount_handling_for; l != NULL; l = l->next) {
- file = l->data;
- if (g_file_has_prefix (file, root)) {
- ignore_autorun = TRUE;
-
- inhibit_mount_handling_for = g_list_delete_link (inhibit_mount_handling_for, l);
- g_object_unref (file);
-
- break;
- }
- }
-
/* only do autorun on local files or files where g_volume_should_automount() returns TRUE */
ignore_autorun = TRUE;
if ((g_file_is_native (root) && !should_skip_native_mount_root (root)) ||
Modified: branches/gnome-2-22/libnautilus-private/nautilus-autorun.h
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-autorun.h (original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-autorun.h Wed Apr 30 01:16:53 2008
@@ -89,7 +89,7 @@
void nautilus_autorun_launch_for_mount (GMount *mount, GAppInfo *app_info);
-void nautilus_inhibit_autorun_for_volume (GVolume *volume);
-void nautilus_inhibit_autorun_for_file (GFile *file);
+void nautilus_allow_autorun_for_volume (GVolume *volume);
+void nautilus_allow_autorun_for_volume_finish (GVolume *volume);
#endif /* NAUTILUS_AUTORUN_H */
Modified: branches/gnome-2-22/libnautilus-private/nautilus-file-operations.c
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-file-operations.c (original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-file-operations.c Wed Apr 30 01:16:53 2008
@@ -2028,11 +2028,9 @@
GError *error;
char *primary;
char *name;
- gboolean inhibit_autorun;
-
- inhibit_autorun = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (mount_op), "inhibit-autorun"));
error = NULL;
+ nautilus_allow_autorun_for_volume_finish (G_VOLUME (source_object));
if (!g_volume_mount_finish (G_VOLUME (source_object), res, &error)) {
if (error->code != G_IO_ERROR_FAILED_HANDLED) {
name = g_volume_get_name (G_VOLUME (source_object));
@@ -2044,12 +2042,8 @@
g_free (primary);
}
g_error_free (error);
- } else {
- if (inhibit_autorun) {
- nautilus_inhibit_autorun_for_volume (G_VOLUME (source_object));
- }
}
-
+
g_object_unref (mount_op);
}
@@ -2057,12 +2051,13 @@
void
nautilus_file_operations_mount_volume (GtkWindow *parent_window,
GVolume *volume,
- gboolean inhibit_autorun)
+ gboolean allow_autorun)
{
GMountOperation *mount_op;
mount_op = eel_mount_operation_new (parent_window);
- g_object_set_data (G_OBJECT (mount_op), "inhibit-autorun", GINT_TO_POINTER (inhibit_autorun));
+ if (allow_autorun)
+ nautilus_allow_autorun_for_volume (volume);
g_volume_mount (volume, 0, mount_op, NULL, volume_mount_cb, mount_op);
}
Modified: branches/gnome-2-22/libnautilus-private/nautilus-file-operations.h
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-file-operations.h (original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-file-operations.h Wed Apr 30 01:16:53 2008
@@ -93,7 +93,7 @@
gboolean check_trash);
void nautilus_file_operations_mount_volume (GtkWindow *parent_window,
GVolume *volume,
- gboolean inhibit_autorun);
+ gboolean allow_autorun);
void nautilus_file_operations_copy (GList *files,
Modified: branches/gnome-2-22/libnautilus-private/nautilus-mime-actions.c
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-mime-actions.c (original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-mime-actions.c Wed Apr 30 01:16:53 2008
@@ -1258,7 +1258,6 @@
g_error_free (error);
} else {
location = nautilus_file_get_location (file);
- nautilus_inhibit_autorun_for_file (location);
g_object_unref (G_OBJECT (location));
}
Modified: branches/gnome-2-22/libnautilus-private/nautilus-vfs-file.c
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-vfs-file.c (original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-vfs-file.c Wed Apr 30 01:16:53 2008
@@ -239,7 +239,6 @@
res, &error);
nautilus_file_operation_complete (op, mounted_on, error);
if (mounted_on) {
- nautilus_inhibit_autorun_for_file (mounted_on);
g_object_unref (mounted_on);
}
if (error) {
Modified: branches/gnome-2-22/src/nautilus-application.c
==============================================================================
--- branches/gnome-2-22/src/nautilus-application.c (original)
+++ branches/gnome-2-22/src/nautilus-application.c Wed Apr 30 01:16:53 2008
@@ -174,9 +174,7 @@
GAsyncResult *res,
gpointer user_data)
{
- if (g_volume_mount_finish (G_VOLUME (source_object), res, NULL)) {
- nautilus_inhibit_autorun_for_volume (G_VOLUME (source_object));
- }
+ g_volume_mount_finish (G_VOLUME (source_object), res, NULL);
}
static void
@@ -1348,7 +1346,7 @@
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_MEDIA_AUTOMOUNT) &&
g_volume_should_automount (volume) &&
g_volume_can_mount (volume)) {
- nautilus_file_operations_mount_volume (NULL, volume, FALSE);
+ nautilus_file_operations_mount_volume (NULL, volume, TRUE);
}
}
Modified: branches/gnome-2-22/src/nautilus-places-sidebar.c
==============================================================================
--- branches/gnome-2-22/src/nautilus-places-sidebar.c (original)
+++ branches/gnome-2-22/src/nautilus-places-sidebar.c Wed Apr 30 01:16:53 2008
@@ -1294,7 +1294,7 @@
GVolume *volume;
gtk_tree_model_get (model, &iter, PLACES_SIDEBAR_COLUMN_VOLUME, &volume, -1);
if (volume != NULL) {
- nautilus_file_operations_mount_volume (NULL, volume, TRUE);
+ nautilus_file_operations_mount_volume (NULL, volume, FALSE);
g_object_unref (volume);
}
}
@@ -1409,7 +1409,7 @@
-1);
if (volume != NULL) {
- nautilus_file_operations_mount_volume (NULL, volume, TRUE);
+ nautilus_file_operations_mount_volume (NULL, volume, FALSE);
g_object_unref (volume);
}
}
Modified: branches/gnome-2-22/src/nautilus-window-manage-views.c
==============================================================================
--- branches/gnome-2-22/src/nautilus-window-manage-views.c (original)
+++ branches/gnome-2-22/src/nautilus-window-manage-views.c Wed Apr 30 01:16:53 2008
@@ -923,7 +923,6 @@
window->details->mount_error = NULL;
g_error_free (error);
} else {
- nautilus_inhibit_autorun_for_file (G_FILE (source_object));
nautilus_file_invalidate_all_attributes (window->details->determine_view_file);
nautilus_file_call_when_ready (window->details->determine_view_file,
NAUTILUS_FILE_ATTRIBUTE_INFO |
Modified: branches/gnome-2-22/src/nautilus-x-content-bar.c
==============================================================================
--- branches/gnome-2-22/src/nautilus-x-content-bar.c (original)
+++ branches/gnome-2-22/src/nautilus-x-content-bar.c Wed Apr 30 01:16:53 2008
@@ -271,7 +271,9 @@
hbox = GTK_WIDGET (bar);
bar->priv->label = gtk_label_new (NULL);
- gtk_box_pack_start (GTK_BOX (bar), bar->priv->label, FALSE, FALSE, 0);
+ gtk_label_set_ellipsize (GTK_LABEL (bar->priv->label), PANGO_ELLIPSIZE_END);
+ gtk_misc_set_alignment (GTK_MISC (bar->priv->label), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (bar), bar->priv->label, TRUE, TRUE, 0);
bar->priv->button = gtk_button_new ();
gtk_box_pack_end (GTK_BOX (hbox), bar->priv->button, FALSE, FALSE, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]