Index: GNOME_Panel_Popup.xml
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/GNOME_Panel_Popup.xml,v
retrieving revision 1.3
diff -u -r1.3 GNOME_Panel_Popup.xml
--- GNOME_Panel_Popup.xml	26 May 2003 13:41:07 -0000	1.3
+++ GNOME_Panel_Popup.xml	5 Jun 2004 18:54:17 -0000
@@ -7,7 +7,9 @@
          <menuitem name="remove" verb="RemoveAppletFromPanel" _label="_Remove From Panel"
                    pixtype="stock" pixname="gtk-remove"/>
 
-         <menuitem name="lock" verb="LockAppletToPanel" _label="_Lock"/>
+         <menuitem name="lock" verb="LockAppletToPanel" _label="_Lock To Panel"
+		 
+		           type="toggle"/>
    
          <menuitem name="move" verb="MoveApplet" _label="_Move"/>
    
Index: applet.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/applet.c,v
retrieving revision 1.232
diff -u -r1.232 applet.c
--- a/applet.c	2 Jun 2004 12:30:18 -0000	1.232
+++ b/applet.c	5 Jun 2004 19:45:21 -0000
@@ -92,20 +92,43 @@
 }
 
 static void
-panel_applet_lock (GtkWidget  *menuitem,
+panel_applet_init_locked_state (GtkCheckMenuItem  *checkmenuitem,
+		   AppletInfo *info, gboolean locked)
+{
+	gtk_check_menu_item_set_active(checkmenuitem, locked);
+	
+	if (info->move_item)
+		gtk_widget_set_sensitive (info->move_item, !locked);
+}
+
+static void
+panel_applet_lock (GtkCheckMenuItem  *checkmenuitem,
 		   AppletInfo *info)
 {
 	gboolean locked;
 
 	locked = panel_applet_toggle_locked (info);
 
-	gtk_label_set_label (GTK_LABEL (GTK_BIN (menuitem)->child),
-			     locked ? _("Un_lock") : _("_Lock"));
-
+	gtk_check_menu_item_set_active(checkmenuitem, locked);
+	
 	if (info->move_item)
 		gtk_widget_set_sensitive (info->move_item, !locked);
 }
 
+void
+panel_applet_set_locked_state (AppletInfo *info, gboolean state)
+{
+	PanelWidget *panel_widget;
+
+	panel_widget = PANEL_WIDGET (info->widget->parent);
+	
+	panel_widget_set_applet_locked (panel_widget, info->widget, state);
+
+	panel_applet_save_position (info, info->id, TRUE);
+	panel_applet_set_dnd_enabled (info, !state);
+
+}
+
 static void
 move_applet_callback (GtkWidget *widget, AppletInfo *info)
 {
@@ -457,10 +480,10 @@
 		gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
 		gtk_widget_set_sensitive (menuitem, removable);
 
-		menuitem = gtk_image_menu_item_new ();
-		image = gtk_image_new ();
-		setup_menuitem (menuitem, GTK_ICON_SIZE_MENU, image, locked ? _("Un_lock") : _("_Lock"), FALSE);
-		g_signal_connect (menuitem, "activate",
+		menuitem = gtk_check_menu_item_new();
+		setup_menuitem (menuitem, GTK_ICON_SIZE_MENU, NULL, _("_Lock To Panel"), FALSE);
+		panel_applet_init_locked_state(GTK_CHECK_MENU_ITEM (menuitem), info, locked);
+		g_signal_connect (menuitem, "toggled",
 				  G_CALLBACK (panel_applet_lock), info);
 		gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
 		gtk_widget_set_sensitive (menuitem, lockable);
 
Index: applet.h
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/applet.h,v
retrieving revision 1.54
diff -u -r1.54 applet.h
--- a/applet.h	2 Jun 2004 12:30:18 -0000	1.54
+++ b/applet.h	5 Jun 2004 19:52:59 -0000
@@ -102,6 +102,8 @@
 
 gboolean    panel_applet_toggle_locked  (AppletInfo *info);
 
+void  		 panel_applet_set_locked_state (AppletInfo *info, gboolean state);
+
 G_END_DECLS
 
 #endif

Index: panel-applet-frame.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-applet-frame.c,v
retrieving revision 1.117
diff -u -r1.117 panel-applet-frame.c
--- panel-applet-frame.c	2 Jun 2004 12:30:19 -0000	1.117
+++ panel-applet-frame.c	5 Jun 2004 20:08:08 -0000
@@ -102,11 +102,11 @@
 	removable = panel_profile_list_is_writable (PANEL_GCONF_APPLETS);
 
 	locked = panel_widget_get_applet_locked (panel_widget, GTK_WIDGET (frame));
-
+	
 	bonobo_ui_component_set_prop (frame->priv->ui_component,
-				      "/popups/button3/placeholder/lock",
-				      "label",
-				      locked ? _("Un_lock") : _("_Lock"),
+				      "/commands/LockAppletToPanel",
+				      "state",
+				      locked ? "1" : "0",
 				      NULL);
 
 	/* First sensitivity */
@@ -233,11 +233,20 @@
 }
 
 static void
-popup_handle_lock (BonoboUIComponent *uic,
-		   PanelAppletFrame  *frame,
-		   const char        *verb)
+listener_popup_handle_lock (BonoboUIComponent *uic, const char *path,
+                   Bonobo_UIComponent_EventType type, const char *state,
+                   PanelAppletFrame *frame)
 {
-	panel_applet_toggle_locked (frame->priv->applet_info);
+	gboolean state_f;
+
+	if(type != Bonobo_UIComponent_STATE_CHANGED)
+        return;
+
+	if(!state)
+	    return;
+	
+	state_f=atoi(state);
+	panel_applet_set_locked_state (frame->priv->applet_info, state_f);
 
 	panel_applet_frame_sync_menu_state (frame);
 }
@@ -261,7 +270,6 @@
 
 static BonoboUIVerb popup_verbs [] = {
         BONOBO_UI_UNSAFE_VERB ("RemoveAppletFromPanel", popup_handle_remove),
-	BONOBO_UI_UNSAFE_VERB ("LockAppletToPanel",     popup_handle_lock),
         BONOBO_UI_UNSAFE_VERB ("MoveApplet",            popup_handle_move),
 
         BONOBO_UI_VERB_END
@@ -1282,9 +1290,12 @@
 	bonobo_ui_util_set_ui (frame->priv->ui_component, DATADIR,
 			       "GNOME_Panel_Popup.xml", "panel", NULL);
 
+	bonobo_ui_component_add_listener(frame->priv->ui_component,	"LockAppletToPanel",
+				(BonoboUIListenerFn)listener_popup_handle_lock, frame);
+	
 	bonobo_ui_component_add_verb_list_with_data (
 		frame->priv->ui_component, popup_verbs, frame);
-
+	
 	control = bonobo_control_frame_get_control (control_frame);
 	if (!control) {
 		CORBA_exception_free (&ev);
