Index: applet.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/applet.c,v
retrieving revision 1.238
diff -u -r1.238 applet.c
--- applet.c	12 Nov 2004 09:52:28 -0000	1.238
+++ applet.c	26 Nov 2004 17:31:56 -0000
@@ -90,20 +90,44 @@
 }
 
 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)
 {
@@ -455,10 +479,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.56
diff -u -r1.56 applet.h
--- applet.h	9 Nov 2004 15:25:43 -0000	1.56
+++ applet.h	26 Nov 2004 17:32:28 -0000
@@ -102,6 +102,8 @@
 
 gboolean    panel_applet_toggle_locked  (AppletInfo *info);
 
+void  		panel_applet_set_locked_state (AppletInfo *info, gboolean state);
+
 void panel_applet_position_menu (GtkMenu   *menu,
 				 int       *x,
 				 int       *y,
Index: panel-applet-frame.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-applet-frame.c,v
retrieving revision 1.127
diff -u -r1.127 panel-applet-frame.c
--- panel-applet-frame.c	23 Nov 2004 09:39:06 -0000	1.127
+++ panel-applet-frame.c	26 Nov 2004 17:33:50 -0000
@@ -108,9 +108,9 @@
 	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 */
@@ -237,11 +237,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);
 }
@@ -265,7 +274,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
@@ -1286,6 +1294,9 @@
 
 	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);
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	26 Nov 2004 17:34:30 -0000
@@ -7,8 +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"/>
    
          </placeholder>
