=== added file 'data/playlist-ui.xml'
--- data/playlist-ui.xml	1970-01-01 00:00:00 +0000
+++ data/playlist-ui.xml	2006-09-23 22:46:16 +0000
@@ -0,0 +1,6 @@
+<ui>
+	<popup name="totem-playlist-popup">
+		<menuitem name="remove" action="remove"/>
+		<menuitem name="copy-location" action="copy-location"/>
+	</popup>
+</ui>

=== modified file 'data/Makefile.am'
--- data/Makefile.am	2006-09-23 11:35:33 +0000
+++ data/Makefile.am	2006-09-23 22:46:16 +0000
@@ -10,6 +10,7 @@
 	stock-tool-brightness-contrast-22.png	\
 	totem.glade			\
 	playlist.glade			\
+	playlist-ui.xml			\
 	mozilla-viewer.glade		\
 	properties.glade		\
 	skip_to.glade			\

=== modified file 'data/playlist.glade'
--- data/playlist.glade	2006-08-24 09:43:54 +0000
+++ data/playlist.glade	2006-09-23 22:46:16 +0000
@@ -312,29 +312,4 @@
     </widget>
   </child>
 </widget>
-
-<widget class="GtkMenu" id="menu1">
-
-  <child>
-    <widget class="GtkImageMenuItem" id="copy1">
-      <property name="visible">True</property>
-      <property name="label" translatable="yes">_Copy Location</property>
-      <property name="use_underline">True</property>
-      <signal name="activate" handler="on_copy1_activate" last_modification_time="Wed, 07 Apr 2004 21:06:11 GMT"/>
-
-      <child internal-child="image">
-	<widget class="GtkImage" id="image3">
-	  <property name="visible">True</property>
-	  <property name="stock">gtk-copy</property>
-	  <property name="icon_size">1</property>
-	  <property name="xalign">0.5</property>
-	  <property name="yalign">0.5</property>
-	  <property name="xpad">0</property>
-	  <property name="ypad">0</property>
-	</widget>
-      </child>
-    </widget>
-  </child>
-</widget>
-
 </glade-interface>

=== modified file 'src/totem-playlist.c'
--- src/totem-playlist.c	2006-09-23 11:35:33 +0000
+++ src/totem-playlist.c	2006-09-23 22:46:16 +0000
@@ -67,6 +67,9 @@
 	GtkTreeSelection *selection;
 	TotemPlParser *parser;
 
+	GtkActionGroup *action_group;
+	GtkUIManager *ui_manager;
+
 	/* This is a scratch list for when we're removing files */
 	GList *list;
 
@@ -128,6 +131,14 @@
 	{ "_NETSCAPE_URL", 0, 1 },
 };
 
+static void playlist_remove_action_activated (GtkAction *action, TotemPlaylist *playlist);
+static void playlist_copy_location_action_activated (GtkAction *action, TotemPlaylist *playlist);
+
+static const GtkActionEntry entries[] = {
+	{ "remove", GTK_STOCK_REMOVE, "_Remove", NULL, "Remove file from playlist", G_CALLBACK (playlist_remove_action_activated) },
+	{ "copy-location", GTK_STOCK_COPY, "_Copy location", NULL, "Copy the location to the clipboard", G_CALLBACK (playlist_copy_location_action_activated) }
+};
+
 static GtkWidgetClass *parent_class = NULL;
 
 static void totem_playlist_class_init (TotemPlaylistClass *class);
@@ -449,7 +460,7 @@
 }
 
 static void
-on_copy1_activate (GtkButton *button, TotemPlaylist *playlist)
+playlist_copy_location_action_activated (GtkAction *action, TotemPlaylist *playlist)
 {
 	GList *l;
 	GtkTreePath *path;
@@ -482,33 +493,65 @@
 }
 
 static gboolean
+playlist_show_popup_menu (TotemPlaylist *playlist, GdkEventButton *event)
+{
+	guint button = 0;
+       	guint32 time;
+	GtkTreePath *path;
+	gint count;
+	GtkWidget *menu;
+	GtkAction *action; 
+
+	if (event != NULL) {
+		button = event->button;
+		time = event->time;
+
+		if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (playlist->_priv->treeview),
+				 event->x, event->y, &path, NULL, NULL, NULL)) {
+			if (!gtk_tree_selection_path_is_selected (playlist->_priv->selection, path)) {
+				gtk_tree_selection_unselect_all (playlist->_priv->selection);
+				gtk_tree_selection_select_path (playlist->_priv->selection, path);
+			}
+			gtk_tree_path_free (path);
+		} else {
+			gtk_tree_selection_unselect_all (playlist->_priv->selection);
+		}
+	} else {
+		time = gtk_get_current_event_time ();
+	}
+
+	count = gtk_tree_selection_count_selected_rows (playlist->_priv->selection);
+	
+	if (count == 0) {
+		return FALSE;
+	}
+
+	action = gtk_action_group_get_action (playlist->_priv->action_group, "copy-location");
+	gtk_action_set_sensitive (action, count == 1);
+
+	menu = gtk_ui_manager_get_widget (playlist->_priv->ui_manager, "/totem-playlist-popup");
+
+	gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
+			button, time);
+
+	return TRUE;
+}
+
+static gboolean
 treeview_button_pressed (GtkTreeView *treeview, GdkEventButton *event,
 		TotemPlaylist *playlist)
 {
-	GtkTreePath *path;
-	GtkWidget *menu;
-
-	if (event->type != GDK_BUTTON_PRESS
-			|| event->button != 3)
-		return FALSE;
-
-	if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (treeview),
-				event->x, event->y, &path,
-				NULL, NULL, NULL) == FALSE)
-	{
-		return FALSE;
+	if (event->type == GDK_BUTTON_PRESS && event->button == 3) {
+		return playlist_show_popup_menu (playlist, event);
 	}
 
-	gtk_tree_selection_unselect_all (playlist->_priv->selection);
-	gtk_tree_selection_select_path (playlist->_priv->selection, path);
-	gtk_tree_path_free (path);
-
-	menu = glade_xml_get_widget (playlist->_priv->xml, "menu1");
-	gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
-			event->button, event->time);
-	gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
-
-	return TRUE;
+	return FALSE;
+}
+
+static gboolean
+playlist_treeview_popup_menu (GtkTreeView *treeview, TotemPlaylist *playlist)
+{
+	return playlist_show_popup_menu (playlist, NULL);
 }
 
 static void
@@ -712,7 +755,7 @@
 }
 
 static void
-totem_playlist_remove_files (GtkWidget *widget, TotemPlaylist *playlist)
+playlist_remove_files (TotemPlaylist *playlist)
 {
 	GtkTreeSelection *selection;
 	GtkTreeRowReference *ref;
@@ -820,6 +863,18 @@
 }
 
 static void
+playlist_remove_button_clicked (GtkWidget *button, TotemPlaylist *playlist)
+{
+	playlist_remove_files (playlist);
+}
+
+static void
+playlist_remove_action_activated (GtkAction *action, TotemPlaylist *playlist)
+{
+	playlist_remove_files (playlist);
+}
+
+static void
 totem_playlist_save_playlist (TotemPlaylist *playlist, char *filename, gint active_format)
 {
 	PlaylistSaveType *cur = NULL;
@@ -1053,33 +1108,6 @@
 	totem_playlist_move_files (playlist, FALSE);
 }
 
-static void
-totem_playlist_popup_menu (TotemPlaylist *playlist, guint time)
-{
-	GtkTreePath *path;
-	GtkWidget *menu;
-	int x, y;
-
-	if (gdk_window_get_pointer (playlist->_priv->treeview->window,
-			&x, &y, NULL) == NULL)
-		return;
-
-	if (gtk_tree_view_get_path_at_pos
-			(GTK_TREE_VIEW (playlist->_priv->treeview),
-			 x, y, &path, NULL, NULL, NULL) == FALSE) {
-		return;
-	}
-
-	gtk_tree_selection_unselect_all (playlist->_priv->selection);
-	gtk_tree_selection_select_path (playlist->_priv->selection, path);
-	gtk_tree_path_free (path);
-
-	menu = glade_xml_get_widget (playlist->_priv->xml, "menu1");
-	gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
-			0, time);
-	gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
-}
-
 static int
 totem_playlist_key_press (GtkWidget *win, GdkEventKey *event, TotemPlaylist *playlist)
 {
@@ -1091,17 +1119,6 @@
 				(playlist->_priv->selection);
 			return TRUE;
 		}
-
-		if (event->state & GDK_SHIFT_MASK
-		    && event->keyval == GDK_F10) {
-			totem_playlist_popup_menu (playlist, event->time);
-			return TRUE;
-		}
-	}
-
-	if (event->keyval == GDK_Menu) {
-		totem_playlist_popup_menu (playlist, event->time);
-		return TRUE;
 	}
 
 	/* If we have modifiers, and either Ctrl, Mod1 (Alt), or any
@@ -1117,7 +1134,7 @@
 
 	if (event->keyval == GDK_Delete)
 	{
-		totem_playlist_remove_files (NULL, playlist);
+		playlist_remove_files (playlist);
 		return TRUE;
 	}
 
@@ -1241,6 +1258,8 @@
 			G_CALLBACK (treeview_row_changed), playlist);
 	g_signal_connect (G_OBJECT (treeview), "button-press-event",
 			G_CALLBACK (treeview_button_pressed), playlist);
+	g_signal_connect (G_OBJECT (treeview), "popup-menu",
+			G_CALLBACK (playlist_treeview_popup_menu), playlist);
 
 	/* Drag'n'Drop */
 	g_signal_connect (G_OBJECT (treeview), "drag_data_received",
@@ -1448,6 +1467,14 @@
 		gtk_tree_path_free (playlist->_priv->current);
 	g_object_unref (playlist->_priv->parser);
 
+	if (playlist->_priv->ui_manager != NULL) {
+		g_object_unref (G_OBJECT (playlist->_priv->ui_manager));
+	}
+
+	if (playlist->_priv->action_group != NULL) {
+		g_object_unref (G_OBJECT (playlist->_priv->action_group));
+	}
+
 	if (G_OBJECT_CLASS (parent_class)->finalize != NULL) {
 		(* G_OBJECT_CLASS (parent_class)->finalize) (object);
 	}
@@ -1458,6 +1485,7 @@
 {
 	TotemPlaylist *playlist;
 	GtkWidget *container, *item;
+	char *filename;
 
 	playlist = TOTEM_PLAYLIST (g_object_new (GTK_TYPE_PLAYLIST, NULL));
 
@@ -1470,6 +1498,25 @@
 		return NULL;
 	}
 
+	/* popup menu */
+	playlist->_priv->action_group = 
+		gtk_action_group_new ("playlist-action-group");
+	gtk_action_group_set_translation_domain (playlist->_priv->action_group,
+			GETTEXT_PACKAGE);
+	gtk_action_group_add_actions (playlist->_priv->action_group, entries,
+			G_N_ELEMENTS (entries), playlist);
+
+	playlist->_priv->ui_manager = gtk_ui_manager_new ();
+	gtk_ui_manager_insert_action_group (playlist->_priv->ui_manager,
+			playlist->_priv->action_group, -1);
+
+	filename = totem_interface_get_full_path ("playlist-ui.xml");
+	if (!gtk_ui_manager_add_ui_from_file (playlist->_priv->ui_manager, filename, NULL)) {
+		totem_playlist_finalize (G_OBJECT (playlist));
+		return NULL;
+	}
+	g_free (filename);
+
 	/* Connect the buttons */
 	item = glade_xml_get_widget (playlist->_priv->xml, "add_button");
 	g_signal_connect (G_OBJECT (item), "clicked",
@@ -1477,7 +1524,7 @@
 			playlist);
 	item = glade_xml_get_widget (playlist->_priv->xml, "remove_button");
 	g_signal_connect (G_OBJECT (item), "clicked",
-			G_CALLBACK (totem_playlist_remove_files),
+			G_CALLBACK (playlist_remove_button_clicked),
 			playlist);
 	item = glade_xml_get_widget (playlist->_priv->xml, "save_button");
 	g_signal_connect (G_OBJECT (item), "clicked",
@@ -1492,10 +1539,6 @@
 			G_CALLBACK (totem_playlist_down_files),
 			playlist);
 
-	item = glade_xml_get_widget (playlist->_priv->xml, "copy1");
-	g_signal_connect (G_OBJECT (item), "activate",
-			G_CALLBACK (on_copy1_activate), playlist);
-
 	gtk_widget_add_events (GTK_WIDGET (playlist), GDK_KEY_PRESS_MASK);
 	g_signal_connect (G_OBJECT (playlist), "key_press_event",
 			G_CALLBACK (totem_playlist_key_press), playlist);

