glade3 r1771 - in trunk: . gladeui plugins/gtk+ src



Author: tvb
Date: Sun Apr  6 01:31:29 2008
New Revision: 1771
URL: http://svn.gnome.org/viewvc/glade3?rev=1771&view=rev

Log:

	* gladeui/glade-widget.[ch], gladeui/glade-widget-adaptor.c
	  gladeui/glade-xml-utils.[ch], gladeui/glade-project.c,
	  gladeui/glade-property.c, gladeui/glade-signal.c, 
	  plugins/gtk+/glade-gtk.c, src/glade-window.c:
	  Added basic builder support, format can be chosen via a
	  radiomenuitem in the "Edit" menu, currently supports different
	  names for the interface and widget tags, and saves special
	  child widgets accordingly (i.e. notebook tabs and frame labels).



Modified:
   trunk/ChangeLog
   trunk/gladeui/glade-project.c
   trunk/gladeui/glade-property.c
   trunk/gladeui/glade-signal.c
   trunk/gladeui/glade-widget-adaptor.c
   trunk/gladeui/glade-widget.c
   trunk/gladeui/glade-widget.h
   trunk/gladeui/glade-xml-utils.c
   trunk/gladeui/glade-xml-utils.h
   trunk/plugins/gtk+/glade-gtk.c
   trunk/src/glade-window.c

Modified: trunk/gladeui/glade-project.c
==============================================================================
--- trunk/gladeui/glade-project.c	(original)
+++ trunk/gladeui/glade-project.c	Sun Apr  6 01:31:29 2008
@@ -846,6 +846,15 @@
 	return loadable;
 }
 
+static void
+glade_project_read_comment (GladeProject *project, GladeXmlDoc *doc)
+{
+	/* TODO Write me !! Find out how to extract root level comments 
+	 * with libxml2 !!! 
+	 */
+}
+
+
 gboolean
 glade_project_load_from_file (GladeProject *project, const gchar *path)
 {
@@ -865,7 +874,7 @@
 	if (!(context = 
 	      glade_xml_context_new_from_path (path,
 					       NULL, 
-					       GLADE_XML_TAG_PROJECT)))
+					       NULL)))
 	{
 		g_warning ("Couldn't open glade file [%s].", path);
 		return FALSE;
@@ -874,18 +883,22 @@
 	doc  = glade_xml_context_get_doc (context);
 	root = glade_xml_doc_get_root (doc);
 
-	/* XXX Need to load project->priv->comment ! */
-
-	if (loadable_interface (root, path) == FALSE)
+	if (glade_xml_node_verify_silent (root, GLADE_XML_TAG_LIBGLADE_PROJECT))
+		project->priv->format = GLADE_PROJECT_FORMAT_LIBGLADE;
+	else if (glade_xml_node_verify_silent (root, GLADE_XML_TAG_BUILDER_PROJECT))
+		project->priv->format = GLADE_PROJECT_FORMAT_GTKBUILDER;
+	else
 	{
+		g_warning ("Couldnt determine project format, skipping %s", path);
 		glade_xml_context_free (context);
 		return FALSE;
 	}
 
-	if (!glade_xml_node_verify (root, GLADE_XML_TAG_PROJECT)) 
+	/* XXX Need to load project->priv->comment ! */
+	glade_project_read_comment (project, doc);
+
+	if (loadable_interface (root, path) == FALSE)
 	{
-		g_warning ("Glade file root node is not '%s', skipping %s",
-			   GLADE_XML_TAG_PROJECT, path);
 		glade_xml_context_free (context);
 		return FALSE;
 	}
@@ -894,7 +907,8 @@
 	     node; node = glade_xml_node_next (node))
 	{
 		/* Skip "requires" tags */
-		if (!glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET))
+		if (!glade_xml_node_verify_silent
+		    (node, GLADE_XML_TAG_WIDGET (project->priv->format)))
 			continue;
 
 		if ((widget = glade_widget_read (project, NULL, node, NULL)) != NULL)
@@ -1658,7 +1672,7 @@
 
 	doc     = glade_xml_doc_new ();
 	context = glade_xml_context_new (doc, NULL);
-	root    = glade_xml_node_new (context, GLADE_XML_TAG_PROJECT);
+	root    = glade_xml_node_new (context, GLADE_XML_TAG_PROJECT (project->priv->format));
 	glade_xml_doc_set_root (doc, root);
 
 	glade_project_update_comment (project);

Modified: trunk/gladeui/glade-property.c
==============================================================================
--- trunk/gladeui/glade-property.c	(original)
+++ trunk/gladeui/glade-property.c	Sun Apr  6 01:31:29 2008
@@ -928,7 +928,8 @@
 
 	/* This code should work the same for <packing> and <widget> */
 	if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_PACKING) ||
-	      glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET)))
+	      glade_xml_node_verify_silent
+	      (node, GLADE_XML_TAG_WIDGET (glade_project_get_format (project)))))
 		return;
 
 	for (prop = glade_xml_node_get_children (node); 
@@ -1032,14 +1033,18 @@
 		      GladeXmlNode    *node)
 {
 	GladeXmlNode *prop_node;
+	GladeProject *project;
 	gchar *name, *value, *tmp;
 
 	g_return_if_fail (GLADE_IS_PROPERTY (property));
 	g_return_if_fail (node != NULL);
 
+	project = property->widget->project;
+
 	/* This code should work the same for <packing> and <widget> */
 	if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_PACKING) ||
-	      glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET)))
+	      glade_xml_node_verify_silent
+	      (node, GLADE_XML_TAG_WIDGET (glade_project_get_format(project)))))
 		return;
 
 	if (!property->klass->save || !property->enabled)

Modified: trunk/gladeui/glade-signal.c
==============================================================================
--- trunk/gladeui/glade-signal.c	(original)
+++ trunk/gladeui/glade-signal.c	Sun Apr  6 01:31:29 2008
@@ -133,8 +133,9 @@
 	GladeXmlNode *signal_node;
 	gchar        *name;
 
-	if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
-		return;
+	/*  Should assert GLADE_XML_TAG_WIDGET tag here, but no 
+	 * access to project, so not really seriosly needed 
+	 */
 
 	name = g_strdup (signal->name);
 	glade_util_replace (name, '-', '_');

Modified: trunk/gladeui/glade-widget-adaptor.c
==============================================================================
--- trunk/gladeui/glade-widget-adaptor.c	(original)
+++ trunk/gladeui/glade-widget-adaptor.c	Sun Apr  6 01:31:29 2008
@@ -877,7 +877,7 @@
 	
 	if ((widget_node = 
 	     glade_xml_search_child
-	     (node, GLADE_XML_TAG_WIDGET)) != NULL)
+	     (node, GLADE_XML_TAG_WIDGET(glade_project_get_format(widget->project)))) != NULL)
 	{
 		child_widget = 
 			glade_widget_read (widget->project, 
@@ -889,7 +889,7 @@
 		{
 			if (!internal_name) {
 				glade_widget_set_child_type_from_node 
-					(adaptor, child_widget->object, node);
+					(widget, child_widget->object, node);
 				glade_widget_add_child (widget, child_widget, FALSE);
 			}
 				
@@ -913,7 +913,7 @@
 	} else {
 		GObject *palaceholder = 
 			G_OBJECT (glade_placeholder_new ());
-		glade_widget_set_child_type_from_node (adaptor, palaceholder, node);
+		glade_widget_set_child_type_from_node (widget, palaceholder, node);
 		glade_widget_adaptor_add (adaptor, widget->object, palaceholder);
 		
 	}
@@ -952,7 +952,7 @@
 
 	glade_widget_write_special_child_prop (widget->parent,
 					       widget->object,
-					       context, packing_node);
+					       context, child_node);
 	
 	/* Default packing properties and such are not saved,
 	 * so lets check afterwords if there was anything saved

Modified: trunk/gladeui/glade-widget.c
==============================================================================
--- trunk/gladeui/glade-widget.c	(original)
+++ trunk/gladeui/glade-widget.c	Sun Apr  6 01:31:29 2008
@@ -3289,11 +3289,53 @@
 /*******************************************************************************
  *                           Xml Parsing code                                  *
  *******************************************************************************/
+/* XXX Doc me !*/
+void
+glade_widget_write_special_child_prop (GladeWidget     *parent, 
+				       GObject         *object,
+				       GladeXmlContext *context,
+				       GladeXmlNode    *node)
+{
+	GladeXmlNode *prop_node, *packing_node;
+	gchar        *buff, *special_child_type;
+
+	buff = g_object_get_data (object, "special-child-type");
+	g_object_get (parent->adaptor, "special-child-type", &special_child_type, NULL);
+
+	packing_node = glade_xml_search_child (node, GLADE_XML_TAG_PACKING);
+
+	if (special_child_type && buff)
+	{
+		switch (glade_project_get_format (parent->project))
+		{
+		case GLADE_PROJECT_FORMAT_LIBGLADE:	
+			prop_node = glade_xml_node_new (context, GLADE_XML_TAG_PROPERTY);
+			glade_xml_node_append_child (packing_node, prop_node);
+			
+			/* Name and value */
+			glade_xml_node_set_property_string (prop_node, 
+							    GLADE_XML_TAG_NAME, 
+							    special_child_type);
+			glade_xml_set_content (prop_node, buff);
+			break;
+		case GLADE_PROJECT_FORMAT_GTKBUILDER:
+			glade_xml_node_set_property_string (node, 
+							    GLADE_XML_TAG_TYPE, 
+							    buff);
+			break;
+		default:
+			g_assert_not_reached ();
+		}
+		
+	}
+	g_free (special_child_type);
+}
+
 /* XXX Doc me ! */
 void
-glade_widget_set_child_type_from_node (GladeWidgetAdaptor  *parent_adaptor,
-				       GObject             *child,
-				       GladeXmlNode        *node)
+glade_widget_set_child_type_from_node (GladeWidget   *parent,
+				       GObject       *child,
+				       GladeXmlNode  *node)
 {
 	GladeXmlNode *packing_node, *prop;
 	gchar        *special_child_type, *name, *value;
@@ -3301,42 +3343,59 @@
 	if (!glade_xml_node_verify (node, GLADE_XML_TAG_CHILD))
 		return;
 
-	g_object_get (parent_adaptor, "special-child-type", &special_child_type, NULL);
+	g_object_get (parent->adaptor, "special-child-type", &special_child_type, NULL);
 	if (!special_child_type)
 		return;
-
-	if ((packing_node = 
-	     glade_xml_search_child (node, GLADE_XML_TAG_PACKING)) != NULL)
+ 
+	switch (glade_project_get_format (parent->project))
 	{
-		for (prop = glade_xml_node_get_children (packing_node); 
-		     prop; prop = glade_xml_node_next (prop))
+	case GLADE_PROJECT_FORMAT_LIBGLADE:	
+		if ((packing_node = 
+		     glade_xml_search_child (node, GLADE_XML_TAG_PACKING)) != NULL)
 		{
-			if (!(name = 
-			      glade_xml_get_property_string_required (prop,
-								      GLADE_XML_TAG_NAME,
-								      NULL)))
-				continue;
-			
-			if (!(value = glade_xml_get_content (prop)))
+			for (prop = glade_xml_node_get_children (packing_node); 
+			     prop; prop = glade_xml_node_next (prop))
 			{
-				/* XXX should be glade_xml_get_content_required()... */
-				g_free (name);
-				continue;
-			}
+				if (!(name = 
+				      glade_xml_get_property_string_required
+				      (prop, GLADE_XML_TAG_NAME, NULL)))
+					continue;
 			
-			if (!strcmp (name, special_child_type))
-			{
-				g_object_set_data_full (child,
-							"special-child-type",
-							g_strdup (value),
-							g_free);
+				if (!(value = glade_xml_get_content (prop)))
+				{
+					/* XXX should be glade_xml_get_content_required()... */
+					g_free (name);
+					continue;
+				}
+			
+				if (!strcmp (name, special_child_type))
+				{
+					g_object_set_data_full (child,
+								"special-child-type",
+								g_strdup (value),
+								g_free);
+					g_free (name);
+					g_free (value);
+					break;
+				}
 				g_free (name);
 				g_free (value);
-				break;
 			}
-			g_free (name);
-			g_free (value);
 		}
+		break;
+	case GLADE_PROJECT_FORMAT_GTKBUILDER:
+		/* all child types here are depicted by the "type" property */
+		if ((value = 
+		     glade_xml_get_property_string (node, GLADE_XML_TAG_TYPE)))
+		{
+			g_object_set_data_full (child,
+						"special-child-type",
+						value,
+						g_free);
+		}
+		break;
+	default:
+		g_assert_not_reached ();
 	}
 	g_free (special_child_type);
 }
@@ -3376,7 +3435,8 @@
 
 	glade_widget_push_superuser ();
 
-	if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+	if (!glade_xml_node_verify
+	    (node, GLADE_XML_TAG_WIDGET (glade_project_get_format (project))))
 		return NULL;
 
 	if ((klass = 
@@ -3442,36 +3502,6 @@
 	return widget;
 }
 
-/* XXX Doc me !*/
-void
-glade_widget_write_special_child_prop (GladeWidget     *parent, 
-				       GObject         *object,
-				       GladeXmlContext *context,
-				       GladeXmlNode    *node)
-{
-	GladeXmlNode *prop_node;
-	gchar        *buff, *special_child_type;
-
-	buff = g_object_get_data (object, "special-child-type");
-	g_object_get (parent->adaptor, "special-child-type", &special_child_type, NULL);
-
-	if (special_child_type && buff)
-	{
-
-		prop_node = glade_xml_node_new (context, GLADE_XML_TAG_PROPERTY);
-		glade_xml_node_append_child (node, prop_node);
-
-		/* Name and value */
-		glade_xml_node_set_property_string (prop_node, 
-						    GLADE_XML_TAG_NAME, 
-						    special_child_type);
-		glade_xml_set_content (prop_node, buff);
-
-	}
-	g_free (special_child_type);
-}
-
-
 
 /**
  * glade_widget_write_child:
@@ -3520,7 +3550,7 @@
 	glade_xml_node_append_child (child_node, packing_node);
 
 	glade_widget_write_special_child_prop (parent, object,
-					       context, packing_node);
+					       context, child_node);
 
 	if (!glade_xml_node_get_children (packing_node))
 	{
@@ -3545,7 +3575,9 @@
 {
 	GladeXmlNode *widget_node;
 
-	widget_node = glade_xml_node_new (context, GLADE_XML_TAG_WIDGET);
+	widget_node = 
+		glade_xml_node_new
+		(context, GLADE_XML_TAG_WIDGET (glade_project_get_format (widget->project)));
 	glade_xml_node_append_child (node, widget_node);
 
 	/* Set class and id */

Modified: trunk/gladeui/glade-widget.h
==============================================================================
--- trunk/gladeui/glade-widget.h	(original)
+++ trunk/gladeui/glade-widget.h	Sun Apr  6 01:31:29 2008
@@ -239,7 +239,7 @@
 							       GladeXmlContext *context,
 							       GladeXmlNode    *node);
 
-void                  glade_widget_set_child_type_from_node (GladeWidgetAdaptor  *parent_adaptor,
+void                  glade_widget_set_child_type_from_node (GladeWidget         *parent,
 							     GObject             *child,
 							     GladeXmlNode        *node);
 

Modified: trunk/gladeui/glade-xml-utils.c
==============================================================================
--- trunk/gladeui/glade-xml-utils.c	(original)
+++ trunk/gladeui/glade-xml-utils.c	Sun Apr  6 01:31:29 2008
@@ -587,7 +587,8 @@
 	}
 
 	root = xmlDocGetRootElement(doc);
-	if ((root->name == NULL) || (xmlStrcmp (root->name, BAD_CAST(root_name)) !=0 ))
+	if (root_name != NULL &&
+	    ((root->name == NULL) || (xmlStrcmp (root->name, BAD_CAST(root_name)) != 0)))
 	{
 		g_warning ("The file did not contain the expected root name\n"
 			   "Expected \"%s\", actual : \"%s\" [%s]",
@@ -672,8 +673,10 @@
 	return context->doc;
 }
 
-static gboolean
-glade_libxml_node_is_comment (xmlNodePtr node) {
+gboolean
+glade_xml_node_is_comment (GladeXmlNode *node_in) 
+{
+	xmlNodePtr node = (xmlNodePtr) node_in;
 	if (node == NULL)
 		return FALSE;
 	if ((xmlStrcmp ( node->name, BAD_CAST("text")) == 0) ||
@@ -689,24 +692,41 @@
 	xmlNodePtr children;
 
 	children = node->children;
-	while (glade_libxml_node_is_comment (children))
+	while (glade_xml_node_is_comment ((GladeXmlNode *)children))
 		children = children->next;
 
 	return (GladeXmlNode *)children;
 }
 
 GladeXmlNode *
+glade_xml_node_get_children_with_comments (GladeXmlNode *node_in)
+{
+	xmlNodePtr node = (xmlNodePtr) node_in;
+
+	return (GladeXmlNode *)node->children;
+}
+
+GladeXmlNode *
 glade_xml_node_next (GladeXmlNode *node_in)
 {
 	xmlNodePtr node = (xmlNodePtr) node_in;
 
 	node = node->next;
-	while (glade_libxml_node_is_comment (node))
+	while (glade_xml_node_is_comment ((GladeXmlNode *)node))
 		node = node->next;
 
 	return (GladeXmlNode *)node;
 }
 
+GladeXmlNode *
+glade_xml_node_next_with_comments (GladeXmlNode *node_in)
+{
+	xmlNodePtr node = (xmlNodePtr) node_in;
+
+	return (GladeXmlNode *)node->next;
+}
+
+
 const gchar *
 glade_xml_node_get_name (GladeXmlNode *node_in)
 {

Modified: trunk/gladeui/glade-xml-utils.h
==============================================================================
--- trunk/gladeui/glade-xml-utils.h	(original)
+++ trunk/gladeui/glade-xml-utils.h	Sun Apr  6 01:31:29 2008
@@ -19,11 +19,23 @@
 typedef struct _GladeXmlNode    GladeXmlNode;
 typedef struct _GladeXmlDoc     GladeXmlDoc;
 
+
+#define GLADE_XML_TAG_PROJECT(type) \
+	((type == GLADE_PROJECT_FORMAT_LIBGLADE) ? \
+	 GLADE_XML_TAG_LIBGLADE_PROJECT : GLADE_XML_TAG_BUILDER_PROJECT)
+
+#define GLADE_XML_TAG_WIDGET(type) \
+	((type == GLADE_PROJECT_FORMAT_LIBGLADE) ? \
+	 GLADE_XML_TAG_LIBGLADE_WIDGET : GLADE_XML_TAG_BUILDER_WIDGET)
+
 /* Used for catalog tags and attributes */
-#define GLADE_XML_TAG_PROJECT                     "glade-interface"
+#define GLADE_XML_TAG_LIBGLADE_PROJECT            "glade-interface"
+#define GLADE_XML_TAG_BUILDER_PROJECT             "interface"
+#define GLADE_XML_TAG_LIBGLADE_WIDGET             "widget"
+#define GLADE_XML_TAG_BUILDER_WIDGET              "object"
+
 #define GLADE_XML_TAG_REQUIRES                    "requires"
 #define GLADE_XML_TAG_LIB                         "lib"
-#define GLADE_XML_TAG_WIDGET                      "widget"
 #define GLADE_XML_TAG_PROPERTY                    "property"
 #define GLADE_XML_TAG_CLASS                       "class"
 #define GLADE_XML_TAG_ID                          "id"
@@ -38,6 +50,7 @@
 #define GLADE_XML_TAG_INTERNAL_CHILD              "internal-child"
 #define GLADE_XML_TAG_I18N_TRUE                   "yes"
 #define GLADE_XML_TAG_SIGNAL_TRUE                 "yes"
+#define GLADE_XML_TAG_TYPE                        "type"
 
 #define GLADE_TAG_GLADE_CATALOG                   "glade-catalog"
 #define GLADE_TAG_GLADE_WIDGET_CLASSES            "glade-widget-classes"
@@ -179,6 +192,9 @@
 const gchar *  glade_xml_node_get_name (GladeXmlNode *node_in);
 void           glade_xml_node_append_child (GladeXmlNode * node, GladeXmlNode * child);
 void           glade_xml_node_remove (GladeXmlNode *node_in);
+gboolean       glade_xml_node_is_comment (GladeXmlNode *node_in);
+GladeXmlNode * glade_xml_node_next_with_comments (GladeXmlNode *node_in);
+GladeXmlNode * glade_xml_node_get_children_with_comments (GladeXmlNode *node);
 
 
 /* Document Operatons */

Modified: trunk/plugins/gtk+/glade-gtk.c
==============================================================================
--- trunk/plugins/gtk+/glade-gtk.c	(original)
+++ trunk/plugins/gtk+/glade-gtk.c	Sun Apr  6 01:31:29 2008
@@ -571,7 +571,8 @@
 			      GladeWidget        *widget,
 			      GladeXmlNode       *node)
 {
-	if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+	if (!glade_xml_node_verify 
+	    (node, GLADE_XML_TAG_WIDGET (glade_project_get_format (widget->project))))
 		return;
 
 	/* First chain up and read in all the normal properties.. */
@@ -889,7 +890,8 @@
 			       GladeXmlContext    *context,
 			       GladeXmlNode       *node)
 {
-	if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+	if (!glade_xml_node_verify
+	    (node, GLADE_XML_TAG_WIDGET (glade_project_get_format (widget->project))))
 		return;
 
 	/* First chain up and read in all the normal properties.. */

Modified: trunk/src/glade-window.c
==============================================================================
--- trunk/src/glade-window.c	(original)
+++ trunk/src/glade-window.c	Sun Apr  6 01:31:29 2008
@@ -1691,7 +1691,12 @@
 
 	refresh_title (window);
 	set_sensitivity_according_to_project (window, project);
-	
+
+	/* Set project format here */
+	action = gtk_action_group_get_action (window->priv->static_actions, "LibgladeFormat");
+	gtk_radio_action_set_current_value (GTK_RADIO_ACTION (action), 
+					    glade_project_get_format (project));
+
 	/* switch to the project's inspector */
 	gtk_notebook_set_current_page (GTK_NOTEBOOK (window->priv->inspectors_notebook), page_num);	
 	
@@ -1718,6 +1723,7 @@
 {
 	GladeProject *project;
 	GtkWidget    *inspector;
+	GtkAction    *action;
 
 	++window->priv->num_tabs;
 	
@@ -1768,6 +1774,7 @@
 {
 	GladeProject   *project;
 	GladeInspector *inspector;
+	GtkAction      *action;
 
 	--window->priv->num_tabs;
 
@@ -1797,9 +1804,24 @@
 	project_selection_changed_cb (glade_app_get_project (), window);
 		
 	if (window->priv->active_view)
-		set_sensitivity_according_to_project (window, glade_design_view_get_project (window->priv->active_view));
+	{
+		set_sensitivity_according_to_project
+			(window, glade_design_view_get_project (window->priv->active_view));
+		action = gtk_action_group_get_action
+			(window->priv->static_actions, "LibgladeFormat");
+		gtk_radio_action_set_current_value
+			(GTK_RADIO_ACTION (action), glade_project_get_format
+			 (glade_design_view_get_project (window->priv->active_view)));
+
+	}		
 	else
+	{
+		action = gtk_action_group_get_action
+			(window->priv->static_actions, "ProjectFormat");
+		gtk_action_set_sensitive (action, FALSE);
+
 		gtk_action_group_set_sensitive (window->priv->project_actions, FALSE);	
+	}
 
 }
 
@@ -1827,8 +1849,8 @@
 
 static void
 palette_appearance_change_cb (GtkRadioAction *action,
-				  GtkRadioAction *current,
-				  GladeWindow *window)
+			      GtkRadioAction *current,
+			      GladeWindow *window)
 {
 	gint value;
 
@@ -1838,6 +1860,24 @@
 
 }
 
+
+static void
+format_change_cb (GtkRadioAction *action,
+		  GtkRadioAction *current,
+		  GladeWindow *window)
+{
+	gint value;
+	GladeProject *project;
+
+	value = gtk_radio_action_get_current_value (action);
+
+	if (window->priv->active_view)
+	{
+		project = glade_design_view_get_project (window->priv->active_view);
+		glade_project_set_format (project, value);
+	}
+}
+
 static void
 palette_toggle_small_icons_cb (GtkAction *action, GladeWindow *window)
 {
@@ -2151,6 +2191,11 @@
 "      <menuitem action='Copy'/>"
 "      <menuitem action='Paste'/>"
 "      <menuitem action='Delete'/>"
+"      <separator/>"
+"      <menu action='ProjectFormat'>"
+"        <menuitem action='LibgladeFormat'/>"
+"        <menuitem action='BuilderFormat'/>"
+"      </menu>"
 "    </menu>"
 "    <menu action='ViewMenu'>"
 "      <menuitem action='Clipboard'/>"
@@ -2213,6 +2258,9 @@
 	{ "Quit", GTK_STOCK_QUIT, NULL, "<control>Q",
 	  N_("Quit the program"), G_CALLBACK (quit_cb) },
 
+	/* Edit Menu */
+	{ "ProjectFormat", NULL, N_("_Project Format") },
+
 	/* ViewMenu */
 	{ "PaletteAppearance", NULL, N_("Palette _Appearance") },
 	
@@ -2302,7 +2350,7 @@
 };
 static guint n_view_entries = G_N_ELEMENTS (view_entries);
 
-static GtkRadioActionEntry radio_entries[] = {
+static GtkRadioActionEntry palette_radio_entries[] = {
 
 	{ "IconsAndLabels", NULL, N_("Text beside icons"), NULL, 
 	  N_("Display items as text beside icons"), GLADE_ITEM_ICON_AND_LABEL },
@@ -2312,8 +2360,21 @@
 
 	{ "LabelsOnly", NULL, N_("_Text only"), NULL, 
 	  N_("Display items as text only"), GLADE_ITEM_LABEL_ONLY },
+
 };
-static guint n_radio_entries = G_N_ELEMENTS (radio_entries);
+static guint n_palette_radio_entries = G_N_ELEMENTS (palette_radio_entries);
+
+
+static GtkRadioActionEntry format_radio_entries[] = {
+
+	{ "LibgladeFormat", NULL, N_("Libglade"), NULL, 
+	  N_("Set libglade readable file format"), GLADE_PROJECT_FORMAT_LIBGLADE },
+
+	{ "BuilderFormat", NULL, N_("Gtk Builder"), NULL, 
+	  N_("Set Gtk Builder file format"), GLADE_PROJECT_FORMAT_GTKBUILDER },
+
+};
+static guint n_format_radio_entries = G_N_ELEMENTS (format_radio_entries);
 
 static void
 menu_item_selected_cb (GtkWidget *item, GladeWindow *window)
@@ -2384,10 +2445,16 @@
 					     view_entries,
 					     n_view_entries, 
 					     window);
-	gtk_action_group_add_radio_actions (window->priv->static_actions, radio_entries,
-					    n_radio_entries, GLADE_ITEM_ICON_ONLY,
+
+	gtk_action_group_add_radio_actions (window->priv->static_actions, palette_radio_entries,
+					    n_palette_radio_entries, GLADE_ITEM_ICON_ONLY,
 					    G_CALLBACK (palette_appearance_change_cb), window);
 
+	gtk_action_group_add_radio_actions (window->priv->static_actions, format_radio_entries,
+					    n_format_radio_entries, 
+					    GLADE_PROJECT_FORMAT_GTKBUILDER,
+					    G_CALLBACK (format_change_cb), window);
+
 	window->priv->project_actions = gtk_action_group_new (ACTION_GROUP_PROJECT);
 	gtk_action_group_set_translation_domain (window->priv->project_actions, GETTEXT_PACKAGE);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]