diff gtk3/dw.c @ 1373:bad3e17ab6e5

Implemented dw_menu_delete_item() for GTK.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 22 Nov 2011 21:10:56 +0000
parents 2f5e54b0c5c4
children 156e32814c83
line wrap: on
line diff
--- a/gtk3/dw.c	Tue Nov 22 20:55:14 2011 +0000
+++ b/gtk3/dw.c	Tue Nov 22 21:10:56 2011 +0000
@@ -3404,6 +3404,38 @@
 }
 
 /*
+ * Deletes the menu item specified.
+ * Parameters:
+ *       menu: The handle to the  menu in which the item was appended.
+ *       id: Menuitem id.
+ * Returns: 
+ *       DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN on failure.
+ */
+int API dw_menu_delete_item(HMENUI menu, unsigned long id)
+{
+   char numbuf[11];
+   GtkWidget *tmphandle;
+   int _locked_by_me = FALSE;
+   int ret = DW_ERROR_UNKNOWN;
+
+   if(!menu)
+      return ret;
+
+   DW_MUTEX_LOCK;
+   snprintf(numbuf, 10, "%lu", id);
+   tmphandle = _find_submenu_id(menu, numbuf);
+
+   if(tmphandle)
+   {
+      gtk_widget_destroy(tmphandle);
+      g_object_set_data(G_OBJECT(menu), numbuf, NULL);
+      ret = DW_ERROR_NONE;
+   }
+   DW_MUTEX_UNLOCK;
+   return ret;
+}
+
+/*
  * Pops up a context menu at given x and y coordinates.
  * Parameters:
  *       menu: The handle the the existing menu.