Almost a fix for bug 45436
- From: Stefano Teso <stefano teso gmail com>
- To: nautilus-list gnome org
- Subject: Almost a fix for bug 45436
- Date: Sat, 24 Mar 2007 14:25:57 +0100
Hi,
I prepared a patch to fix GNOME love bug 45436 [1] ("update the
statusbar with bookmark location when the mouse hovers the history
sidebar"), except that it patches the places sidebar instead. (Ahem.)
It has a couple of problems (I'm not sure if this is the right way to do
it, and the patch makes in-place drag'n drop of bookmarks -- for manual
sorting -- dog slow) so I didn't open a bug for it.
----
Stefano
[1] http://bugzilla.gnome.org/show_bug.cgi?id=45436
Index: src/nautilus-places-sidebar.c
===================================================================
--- src/nautilus-places-sidebar.c (revision 12831)
+++ src/nautilus-places-sidebar.c (working copy)
@@ -73,6 +73,9 @@
NautilusWindowInfo *window;
NautilusBookmarkList *bookmarks;
+ /* Statusbar update */
+ gboolean statusbar_pushed;
+
/* DnD */
GList *drag_list;
gboolean drag_data_received;
@@ -1558,6 +1561,59 @@
}
static void
+bookmarks_leave_notify_event_cb (GtkWidget *widget,
+ GdkEventCrossing *event,
+ NautilusPlacesSidebar *sidebar)
+{
+ if (sidebar->statusbar_pushed) {
+ nautilus_window_info_set_status (sidebar->window, NULL);
+ sidebar->statusbar_pushed = FALSE;
+ }
+}
+
+static void
+bookmarks_motion_notify_event_cb (GtkWidget *widget,
+ GdkEventMotion *event,
+ NautilusPlacesSidebar *sidebar)
+{
+ GtkTreeView *view;
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ char *uri, *text;
+
+ if (sidebar->statusbar_pushed) {
+ nautilus_window_info_set_status (sidebar->window, NULL);
+ sidebar->statusbar_pushed = FALSE;
+ }
+
+ view = GTK_TREE_VIEW (widget);
+ gtk_tree_view_get_path_at_pos (view,
+ (gint) event->x,
+ (gint) event->y,
+ &path,
+ NULL,
+ NULL,
+ NULL);
+
+ if (path != NULL) {
+ model = gtk_tree_view_get_model (view);
+ if (gtk_tree_model_get_iter (model, &iter, path)) {
+ gtk_tree_model_get (model, &iter, PLACES_SIDEBAR_COLUMN_URI, &uri, -1);
+ if (uri != NULL) {
+ text = g_strdup_printf (_("Location \"%s\""), uri);
+ nautilus_window_info_set_status (sidebar->window,
+ text);
+ sidebar->statusbar_pushed = TRUE;
+ g_free (text);
+ g_free (uri);
+ }
+ }
+ gtk_tree_path_free (path);
+ }
+}
+
+static void
nautilus_places_sidebar_init (NautilusPlacesSidebar *sidebar)
{
GtkTreeView *tree_view;
@@ -1643,6 +1699,11 @@
g_signal_connect (tree_view, "key-press-event",
G_CALLBACK (bookmarks_key_press_event_cb), sidebar);
+ g_signal_connect (tree_view, "leave-notify-event",
+ G_CALLBACK (bookmarks_leave_notify_event_cb), sidebar);
+ g_signal_connect (tree_view, "motion-notify-event",
+ G_CALLBACK (bookmarks_motion_notify_event_cb), sidebar);
+
g_signal_connect (tree_view, "drag-data-delete",
G_CALLBACK (drag_data_delete_callback), sidebar);
g_signal_connect (tree_view, "drag-motion",
@@ -1669,6 +1730,8 @@
desktop_location_changed_callback,
sidebar,
G_OBJECT (sidebar));
+
+ sidebar->statusbar_pushed = FALSE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]