[nautilus] Propagate activation in slot-info interface



commit 02529b86015195128ebcbe3702888445727d5679
Author: Holger Berndt <berndth gmx de>
Date:   Sat Jun 6 21:31:46 2009 +0200

    Propagate activation in slot-info interface

 libnautilus-private/nautilus-window-slot-info.c |    6 ++++++
 libnautilus-private/nautilus-window-slot-info.h |    2 ++
 src/file-manager/fm-icon-view.c                 |   15 +++++++++++++++
 src/nautilus-window-slot.c                      |   10 ++++++++++
 4 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/libnautilus-private/nautilus-window-slot-info.c b/libnautilus-private/nautilus-window-slot-info.c
index 3b930af..9adff6c 100644
--- a/libnautilus-private/nautilus-window-slot-info.c
+++ b/libnautilus-private/nautilus-window-slot-info.c
@@ -96,6 +96,12 @@ nautilus_window_slot_info_set_status (NautilusWindowSlotInfo *slot,
 								    status);
 }
 
+void
+nautilus_window_slot_info_make_hosting_pane_active (NautilusWindowSlotInfo *slot)
+{
+	g_assert (NAUTILUS_IS_WINDOW_SLOT_INFO (slot));
+	(* NAUTILUS_WINDOW_SLOT_INFO_GET_IFACE (slot)->make_hosting_pane_active) (slot);
+}
 
 void
 nautilus_window_slot_info_open_location (NautilusWindowSlotInfo  *slot,
diff --git a/libnautilus-private/nautilus-window-slot-info.h b/libnautilus-private/nautilus-window-slot-info.h
index eb8e3f1..bc4a066 100644
--- a/libnautilus-private/nautilus-window-slot-info.h
+++ b/libnautilus-private/nautilus-window-slot-info.h
@@ -73,6 +73,7 @@ struct _NautilusWindowSlotInfoIface
 				       NautilusWindowOpenMode mode,
 				       NautilusWindowOpenFlags flags,
 				       GList *selection);
+	void   (* make_hosting_pane_active) (NautilusWindowSlotInfo *slot);
 };
 
 
@@ -85,6 +86,7 @@ void                              nautilus_window_slot_info_open_location
 										 GList                             *selection);
 void                              nautilus_window_slot_info_set_status          (NautilusWindowSlotInfo            *slot,
 										 const char *status);
+void                              nautilus_window_slot_info_make_hosting_pane_active (NautilusWindowSlotInfo       *slot);
 
 char *                            nautilus_window_slot_info_get_current_location (NautilusWindowSlotInfo           *slot);
 NautilusView *                    nautilus_window_slot_info_get_current_view     (NautilusWindowSlotInfo           *slot);
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index bdb71f8..60ab3c5 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -2661,6 +2661,19 @@ store_layout_timestamp (NautilusIconContainer *container,
 	return TRUE;
 }
 
+static gboolean
+focus_in_event_callback (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
+{
+	NautilusWindowSlotInfo *slot_info;
+	FMIconView *icon_view = FM_ICON_VIEW (user_data);
+	
+	/* make the corresponding slot (and the pane that contains it) active */
+	slot_info = fm_directory_view_get_nautilus_window_slot (FM_DIRECTORY_VIEW (icon_view));
+	nautilus_window_slot_info_make_hosting_pane_active (slot_info);
+
+	return FALSE; 
+}
+
 static NautilusIconContainer *
 create_icon_container (FMIconView *icon_view)
 {
@@ -2670,6 +2683,8 @@ create_icon_container (FMIconView *icon_view)
 
 	GTK_WIDGET_SET_FLAGS (icon_container, GTK_CAN_FOCUS);
 	
+	g_signal_connect_object (icon_container, "focus_in_event",
+			 G_CALLBACK (focus_in_event_callback), icon_view, 0);
 	g_signal_connect_object (icon_container, "activate",	
 			 G_CALLBACK (icon_container_activate_callback), icon_view, 0);
 	g_signal_connect_object (icon_container, "activate_alternate",	
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 5d4bfd8..680f2fb 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -240,6 +240,15 @@ nautilus_window_slot_get_location_uri (NautilusWindowSlotInfo *slot)
 	return NULL;
 }
 
+static void
+nautilus_window_slot_make_hosting_pane_active (NautilusWindowSlot *slot)
+{
+	g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+	g_assert (NAUTILUS_IS_WINDOW_PANE (slot->pane));
+	
+	nautilus_window_set_active_slot (slot->pane->window, slot);
+}
+
 char *
 nautilus_window_slot_get_title (NautilusWindowSlot *slot)
 {
@@ -646,5 +655,6 @@ nautilus_window_slot_info_iface_init (NautilusWindowSlotInfoIface *iface)
 	iface->set_status = nautilus_window_slot_set_status;
 	iface->get_title = nautilus_window_slot_get_title;
 	iface->open_location = nautilus_window_slot_open_location_full;
+    iface->make_hosting_pane_active = nautilus_window_slot_make_hosting_pane_active; 
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]