[gtk+/places-sidebar] Replace nautilus_window_set_initiated_unmount() with an initiated-unmount signal
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/places-sidebar] Replace nautilus_window_set_initiated_unmount() with an initiated-unmount signal
- Date: Mon, 3 Oct 2011 21:51:55 +0000 (UTC)
commit 81184518610e58256e24643823a0430badc3edd0
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Oct 3 11:51:46 2011 -0500
Replace nautilus_window_set_initiated_unmount() with an initiated-unmount signal
This signal just carries a boolean initiated_unmount argument, which
is meant to say True when the unmount/eject starts, and False when
the operation finishes.
We may want to rename all of this to unmount_started / stopped, etc.
I don't know if the caller needs to know about the mount_op in question,
or if it can be inferred from what the caller knows to be the current
shown location on the GtkPlacesSidebar.
Signed-off-by: Federico Mena Quintero <federico gnome org>
gtk/gtkplacessidebar.c | 40 ++++++++++++++++++++++++++++++----------
1 files changed, 30 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 16993cd..20b83e8 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -83,6 +83,8 @@ struct _GtkPlacesSidebarClass {
void (* location_selected) (GtkPlacesSidebar *sidebar,
GFile *location,
GtkPlacesOpenMode open_mode);
+ void (* initiated_unmount) (GtkPlacesSidebar *sidebar,
+ gboolean initiated_unmount);
};
enum {
@@ -121,6 +123,7 @@ typedef enum {
enum {
LOCATION_SELECTED,
+ INITIATED_UNMOUNT,
LAST_SIGNAL,
};
@@ -196,6 +199,13 @@ emit_location_selected (GtkPlacesSidebar *sidebar, GFile *location, GtkPlacesOpe
location, open_mode);
}
+static void
+emit_initiated_unmount (GtkPlacesSidebar *sidebar, gboolean initiated_unmount)
+{
+ g_signal_emit (sidebar, places_sidebar_signals[INITIATED_UNMOUNT], 0,
+ initiated_unmount);
+}
+
static GdkPixbuf *
get_eject_icon (GtkPlacesSidebar *sidebar,
gboolean highlighted)
@@ -1960,7 +1970,7 @@ unmount_done (gpointer data)
GtkPlacesSidebar *sidebar;
sidebar = data;
- nautilus_window_set_initiated_unmount (sidebar->window, FALSE);
+ emit_initiated_unmount (sidebar, FALSE);
g_object_unref (sidebar);
}
@@ -1969,7 +1979,7 @@ do_unmount (GMount *mount,
GtkPlacesSidebar *sidebar)
{
if (mount != NULL) {
- nautilus_window_set_initiated_unmount (sidebar->window, TRUE);
+ emit_initiated_unmount (sidebar, TRUE);
nautilus_file_operations_unmount_mount_full (NULL, mount, FALSE, TRUE,
unmount_done,
g_object_ref (sidebar));
@@ -2014,7 +2024,7 @@ drive_eject_cb (GObject *source_object,
char *name;
sidebar = user_data;
- nautilus_window_set_initiated_unmount (sidebar->window, FALSE);
+ emit_initiated_unmount (sidebar, FALSE);
g_object_unref (sidebar);
error = NULL;
@@ -2043,7 +2053,7 @@ volume_eject_cb (GObject *source_object,
char *name;
sidebar = user_data;
- nautilus_window_set_initiated_unmount (sidebar->window, FALSE);
+ emit_initiated_unmount (sidebar, FALSE);
g_object_unref (sidebar);
error = NULL;
@@ -2072,7 +2082,7 @@ mount_eject_cb (GObject *source_object,
char *name;
sidebar = user_data;
- nautilus_window_set_initiated_unmount (sidebar->window, FALSE);
+ emit_initiated_unmount (sidebar, FALSE);
g_object_unref (sidebar);
error = NULL;
@@ -2100,15 +2110,15 @@ do_eject (GMount *mount,
mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar))));
if (mount != NULL) {
- nautilus_window_set_initiated_unmount (sidebar->window, TRUE);
+ emit_initiated_unmount (sidebar, TRUE);
g_mount_eject_with_operation (mount, 0, mount_op, NULL, mount_eject_cb,
g_object_ref (sidebar));
} else if (volume != NULL) {
- nautilus_window_set_initiated_unmount (sidebar->window, TRUE);
+ emit_initiated_unmount (sidebar, TRUE);
g_volume_eject_with_operation (volume, 0, mount_op, NULL, volume_eject_cb,
g_object_ref (sidebar));
} else if (drive != NULL) {
- nautilus_window_set_initiated_unmount (sidebar->window, TRUE);
+ emit_initiated_unmount (sidebar, TRUE);
g_drive_eject_with_operation (drive, 0, mount_op, NULL, drive_eject_cb,
g_object_ref (sidebar));
}
@@ -2316,7 +2326,7 @@ drive_stop_cb (GObject *source_object,
char *name;
sidebar = user_data;
- nautilus_window_set_initiated_unmount (sidebar->window, FALSE);
+ emit_initiated_unmount (sidebar, FALSE);
g_object_unref (sidebar);
error = NULL;
@@ -2353,7 +2363,7 @@ stop_shortcut_cb (GtkMenuItem *item,
GMountOperation *mount_op;
mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar))));
- nautilus_window_set_initiated_unmount (sidebar->window, TRUE);
+ emit_initiated_unmount (sidebar, TRUE);
g_drive_stop (drive, G_MOUNT_UNMOUNT_NONE, mount_op, NULL, drive_stop_cb,
g_object_ref (sidebar));
g_object_unref (mount_op);
@@ -3300,6 +3310,16 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
G_TYPE_NONE, 2,
G_TYPE_OBJECT,
G_TYPE_ENUM);
+
+ places_sidebar_signals [INITIATED_UNMOUNT] =
+ g_signal_new (I_("initiated-unmount"),
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkPlacesSidebarClass, initiated_unmount),
+ NULL, NULL,
+ gtk_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE, 1,
+ G_TYPE_BOOLEAN);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]