nautilus r14687 - in trunk: . src src/file-manager
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r14687 - in trunk: . src src/file-manager
- Date: Mon, 6 Oct 2008 10:41:43 +0000 (UTC)
Author: alexl
Date: Mon Oct 6 10:41:42 2008
New Revision: 14687
URL: http://svn.gnome.org/viewvc/nautilus?rev=14687&view=rev
Log:
2008-10-06 Alexander Larsson <alexl redhat com>
Based on patch from Cosimo Cecchi
* src/file-manager/fm-tree-view.c:
* src/nautilus-emblem-sidebar.c:
Use gtk_menu_popup instead of gnome_popup_menu_do_popup_modal
Don't use GNOME_PAD
Modified:
trunk/ChangeLog
trunk/src/file-manager/fm-tree-view.c
trunk/src/nautilus-emblem-sidebar.c
Modified: trunk/src/file-manager/fm-tree-view.c
==============================================================================
--- trunk/src/file-manager/fm-tree-view.c (original)
+++ trunk/src/file-manager/fm-tree-view.c Mon Oct 6 10:41:42 2008
@@ -43,8 +43,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
-#include <libgnomeui/gnome-uidefs.h>
-#include <libgnomeui/gnome-popup-menu.h>
#include <libnautilus-private/nautilus-clipboard.h>
#include <libnautilus-private/nautilus-clipboard-monitor.h>
#include <libnautilus-private/nautilus-desktop-icon-file.h>
@@ -104,6 +102,7 @@
GtkWidget *popup_unmount;
GtkWidget *popup_eject;
NautilusFile *popup_file;
+ guint popup_file_idle_handler;
guint selection_changed_timer;
};
@@ -679,6 +678,10 @@
gboolean show_unmount = FALSE;
gboolean show_eject = FALSE;
GMount *mount = NULL;
+
+ if (view->details->popup_file != NULL) {
+ return FALSE; /* Already up, ignore */
+ }
if (!gtk_tree_view_get_path_at_pos (treeview, event->x, event->y,
&path, NULL, NULL, NULL)) {
@@ -752,20 +755,13 @@
gtk_widget_hide (view->details->popup_unmount_separator);
}
- g_object_ref (view);
-
- gnome_popup_menu_do_popup_modal (view->details->popup,
- NULL, NULL, event, NULL,
- GTK_WIDGET (treeview));
-
+ gtk_menu_popup (GTK_MENU (view->details->popup),
+ NULL, NULL, NULL, NULL,
+ event->button, event->time);
+
gtk_tree_view_set_cursor (view->details->tree_widget, cursor_path, NULL, FALSE);
gtk_tree_path_free (cursor_path);
- nautilus_file_unref (view->details->popup_file);
- view->details->popup_file = NULL;
-
- g_object_unref (view);
-
return TRUE;
} else if (event->button == 2 && event->type == GDK_BUTTON_PRESS) {
NautilusFile *file;
@@ -1155,6 +1151,39 @@
}
}
+static gboolean
+free_popup_file_in_idle_cb (gpointer data)
+{
+ FMTreeView *view;
+
+ view = FM_TREE_VIEW (data);
+
+ if (view->details->popup_file != NULL) {
+ nautilus_file_unref (view->details->popup_file);
+ view->details->popup_file = NULL;
+ }
+ view->details->popup_file_idle_handler = 0;
+ return FALSE;
+}
+
+static void
+popup_menu_deactivated (GtkMenuShell *menu_shell, gpointer data)
+{
+ FMTreeView *view;
+
+ view = FM_TREE_VIEW (data);
+
+ /* The popup menu is deactivated. (I.E. hidden)
+ We want to free popup_file, but can't right away as it might immediately get
+ used if we're deactivation due to activating a menu item. So, we free it in
+ idle */
+
+ if (view->details->popup_file != NULL &&
+ view->details->popup_file_idle_handler == 0) {
+ view->details->popup_file_idle_handler = g_idle_add (free_popup_file_in_idle_cb, view);
+ }
+}
+
static void
create_popup_menu (FMTreeView *view)
{
@@ -1166,6 +1195,11 @@
}
popup = gtk_menu_new ();
+
+ g_signal_connect (popup, "deactivate",
+ G_CALLBACK (popup_menu_deactivated),
+ view);
+
/* add the "open" menu item */
menu_image = gtk_image_new_from_stock (GTK_STOCK_OPEN,
@@ -1543,6 +1577,11 @@
view->details->popup = NULL;
}
+ if (view->details->popup_file_idle_handler != 0) {
+ g_source_remove (view->details->popup_file_idle_handler);
+ view->details->popup_file_idle_handler = 0;
+ }
+
if (view->details->popup_file != NULL) {
nautilus_file_unref (view->details->popup_file);
view->details->popup_file = NULL;
Modified: trunk/src/nautilus-emblem-sidebar.c
==============================================================================
--- trunk/src/nautilus-emblem-sidebar.c (original)
+++ trunk/src/nautilus-emblem-sidebar.c Mon Oct 6 10:41:42 2008
@@ -44,8 +44,6 @@
#include <gtk/gtk.h>
#include <librsvg/rsvg.h>
#include <glib/gi18n.h>
-#include <libgnomeui/gnome-uidefs.h>
-#include <libgnomeui/gnome-popup-menu.h>
#include <gconf/gconf-client.h>
#include <libnautilus-private/nautilus-icon-dnd.h>
#include <libnautilus-private/nautilus-emblem-utils.h>
@@ -192,9 +190,9 @@
nautilus_emblem_can_rename_emblem (keyword));
- gnome_popup_menu_do_popup_modal (emblem_sidebar->details->popup,
- NULL, NULL, event, NULL,
- widget);
+ gtk_menu_popup (GTK_MENU (emblem_sidebar->details->popup),
+ NULL, NULL, NULL, NULL, event->button,
+ event->time);
}
return TRUE;
@@ -299,15 +297,15 @@
label = gtk_label_new (_("Enter a new name for the displayed emblem:"));
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label,
- FALSE, FALSE, GNOME_PAD);
+ FALSE, FALSE, 8);
- hbox = gtk_hbox_new (FALSE, GNOME_PAD);
- gtk_box_pack_start (GTK_BOX (hbox), image, TRUE, TRUE, GNOME_PAD);
+ hbox = gtk_hbox_new (FALSE, 8);
+ gtk_box_pack_start (GTK_BOX (hbox), image, TRUE, TRUE, 8);
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
- gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, FALSE, GNOME_PAD);
+ gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, FALSE, 8);
gtk_widget_show_all (hbox);
/* it would be nice to have the text selected, ready to be overwritten
@@ -317,7 +315,7 @@
gtk_entry_set_text (GTK_ENTRY (entry), orig_name);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox,
- TRUE, TRUE, GNOME_PAD);
+ TRUE, TRUE, 8);
return dialog;
@@ -548,12 +546,12 @@
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- label, FALSE, FALSE, GNOME_PAD);
+ label, FALSE, FALSE, 8);
gtk_widget_show (label);
scroller = eel_scrolled_wrap_table_new (TRUE, &table);
- eel_wrap_table_set_x_spacing (EEL_WRAP_TABLE (table), GNOME_PAD);
- eel_wrap_table_set_y_spacing (EEL_WRAP_TABLE (table), GNOME_PAD);
+ eel_wrap_table_set_x_spacing (EEL_WRAP_TABLE (table), 8);
+ eel_wrap_table_set_y_spacing (EEL_WRAP_TABLE (table), 8);
num_emblems=0;
list = emblems;
@@ -586,9 +584,9 @@
num_emblems++;
}
- gtk_container_set_border_width (GTK_CONTAINER (dialog), GNOME_PAD);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 8);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- scroller, TRUE, TRUE, GNOME_PAD);
+ scroller, TRUE, TRUE, 8);
gtk_widget_show_all (scroller);
gtk_widget_grab_focus (first_entry);
@@ -877,7 +875,7 @@
/* The emblems wrapped table */
scroller = eel_scrolled_wrap_table_new (TRUE, &emblems_table);
- gtk_container_set_border_width (GTK_CONTAINER (emblems_table), GNOME_PAD);
+ gtk_container_set_border_width (GTK_CONTAINER (emblems_table), 8);
/* set up dnd for adding emblems */
gtk_drag_dest_set (scroller,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]