+/* This will only work with descriptors in the new format. */
+Lisp_Object
+widget_gui_parse_item_keywords (Lisp_Object item)
+{
+ int i, length;
+ Lisp_Object *contents;
+ Lisp_Object gui_item = allocate_gui_item ();
+ Lisp_Object desc = find_keyword_in_vector (item, Q_descriptor);
+
+ CHECK_VECTOR (item);
+ length = XVECTOR_LENGTH (item);
+ contents = XVECTOR_DATA (item);
+
+ if (!NILP (desc) && !STRINGP (desc) && !VECTORP (desc))
+ syntax_error ("Invalid GUI item descriptor", item);
+
+ if (length & 1)
+ {
+ if (!SYMBOLP (contents [0]))
+ syntax_error ("Invalid GUI item descriptor", item);
+ contents++; /* Ignore the leading symbol. */
+ length--;
+ }
+
+ for (i = 0; i < length;)
+ {
+ Lisp_Object key = contents [i++];
+ Lisp_Object val = contents [i++];
+ gui_item_add_keyval_pair (gui_item, key, val, ERROR_ME_NOT);
+ }
+
+ return gui_item;
+}
+
+/* Update a gui item from a partial descriptor. */
+int
+update_gui_item_keywords (Lisp_Object gui_item, Lisp_Object item)
+{
+ int i, length, retval = 0;
+ Lisp_Object *contents;
+
+ CHECK_VECTOR (item);
+ length = XVECTOR_LENGTH (item);
+ contents = XVECTOR_DATA (item);
+
+ if (length & 1)
+ {
+ if (!SYMBOLP (contents [0]))
+ syntax_error ("Invalid GUI item descriptor", item);
+ contents++; /* Ignore the leading symbol. */
+ length--;
+ }
+
+ for (i = 0; i < length;)
+ {
+ Lisp_Object key = contents [i++];
+ Lisp_Object val = contents [i++];
+ if (gui_item_add_keyval_pair (gui_item, key, val, ERROR_ME_NOT))
+ retval = 1;
+ }
+ return retval;
+}
+