glade3 r2010 - in trunk: . gladeui plugins/gtk+



Author: tvb
Date: Tue Oct 28 22:15:04 2008
New Revision: 2010
URL: http://svn.gnome.org/viewvc/glade3?rev=2010&view=rev

Log:

	* plugins/gtk+/glade-label-editor.[ch], plugins/gtk+/Makefile.am,
	plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c: Rewrote GtkLabel implementation from 
	top to bottom with custom editor (now all those conflicting properties are dummy proofed) 
	



Added:
   trunk/plugins/gtk+/glade-label-editor.c
   trunk/plugins/gtk+/glade-label-editor.h
Modified:
   trunk/ChangeLog
   trunk/gladeui/glade-widget.h
   trunk/plugins/gtk+/Makefile.am
   trunk/plugins/gtk+/glade-attributes.c
   trunk/plugins/gtk+/glade-gtk.c
   trunk/plugins/gtk+/gtk+.xml.in

Modified: trunk/gladeui/glade-widget.h
==============================================================================
--- trunk/gladeui/glade-widget.h	(original)
+++ trunk/gladeui/glade-widget.h	Tue Oct 28 22:15:04 2008
@@ -327,7 +327,7 @@
 							     const gchar      *id_property);
  
 gboolean                glade_widget_property_original_default (GladeWidget      *widget,
-							     const gchar      *id_property);
+								const gchar      *id_property);
  
 gboolean                glade_widget_pack_property_default  (GladeWidget      *widget,
 							     const gchar      *id_property);

Modified: trunk/plugins/gtk+/Makefile.am
==============================================================================
--- trunk/plugins/gtk+/Makefile.am	(original)
+++ trunk/plugins/gtk+/Makefile.am	Tue Oct 28 22:15:04 2008
@@ -26,7 +26,7 @@
 libgladegtk_la_SOURCES     = glade-gtk.c glade-accels.c glade-attributes.c glade-convert.c fixed-bg.xpm \
 	glade-column-types.c  glade-model-data.c glade-text-button.c glade-cell-renderer-button.c \
 	glade-icon-sources.c glade-button-editor.c glade-tool-button-editor.c glade-image-editor.c \
-	glade-image-item-editor.c glade-icon-factory-editor.c glade-store-editor.c
+	glade-image-item-editor.c glade-icon-factory-editor.c glade-store-editor.c glade-label-editor.c
 
 libgladegtk_la_LDFLAGS     = -module -avoid-version $(AM_LDFLAGS)
 libgladegtk_la_LIBADD      = $(libgladeui) $(GTK_LIBS)
@@ -35,7 +35,7 @@
 libgladegtkinclude_HEADERS = glade-gtk.h glade-accels.h glade-attributes.h glade-column-types.h glade-model-data.h \
 	glade-text-button.h glade-cell-renderer-button.h glade-icon-sources.h glade-button-editor.h \
 	glade-tool-button-editor.h glade-image-editor.h glade-image-item-editor.h glade-icon-factory-editor.h \
-	glade-store-editor.h
+	glade-store-editor.h glade-label-editor.h
 
 if PLATFORM_WIN32
 libgladegtk_la_LDFLAGS += -no-undefined

Modified: trunk/plugins/gtk+/glade-attributes.c
==============================================================================
--- trunk/plugins/gtk+/glade-attributes.c	(original)
+++ trunk/plugins/gtk+/glade-attributes.c	Tue Oct 28 22:15:04 2008
@@ -1195,6 +1195,9 @@
 	res = gtk_dialog_run (GTK_DIALOG (dialog));
 	if (res == GTK_RESPONSE_OK) 
 	{
+		/* XXX TODO FIXME !!! */
+
+
 /* 		gtk_tree_model_foreach */
 /* 			(gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)), */
 /* 			 (GtkTreeModelForeachFunc) */

Modified: trunk/plugins/gtk+/glade-gtk.c
==============================================================================
--- trunk/plugins/gtk+/glade-gtk.c	(original)
+++ trunk/plugins/gtk+/glade-gtk.c	Tue Oct 28 22:15:04 2008
@@ -37,6 +37,7 @@
 #include "glade-image-item-editor.h"
 #include "glade-icon-factory-editor.h"
 #include "glade-store-editor.h"
+#include "glade-label-editor.h"
 
 #include <gladeui/glade-editor-property.h>
 #include <gladeui/glade-base-editor.h>
@@ -6944,16 +6945,30 @@
 }
 
 /* ----------------------------- GtkLabel ------------------------------ */
+void
+glade_gtk_label_post_create (GladeWidgetAdaptor *adaptor,
+			     GObject            *object, 
+			     GladeCreateReason   reason)
+{
+	GladeWidget *glabel = glade_widget_get_from_gobject (object);
+
+	if (reason == GLADE_CREATE_USER)
+	{
+		/* Set default sensitive states... */
+		const gchar *insensitive_msg = _("This property does not apply unless Use Underline is set.");
+	
+		glade_widget_property_set_sensitive (glabel, "mnemonic-widget", FALSE, insensitive_msg);
+	}
+}
+
+
 static void
 glade_gtk_label_set_label (GObject *object, const GValue *value)
 {
 	GladeWidget *glabel;
 	gboolean use_markup = FALSE, use_underline = FALSE;
 
-	g_return_if_fail (GTK_IS_LABEL (object));
 	glabel = glade_widget_get_from_gobject (object);
-	g_return_if_fail (GLADE_IS_WIDGET (glabel));
-	
 	glade_widget_property_get (glabel, "use-markup", &use_markup);
 	
 	if (use_markup)
@@ -6967,53 +6982,6 @@
 }
 
 static void
-ensure_label_props (GObject            *label,
-		    GladeWidgetAdaptor *adaptor)
-{
-	GladeWidget   *gwidget = glade_widget_get_from_gobject (label);
-	GladeProperty *prop    = glade_widget_get_property (gwidget, "label");
-
-	glade_gtk_label_set_label (label, prop->value);
-}
-
-void
-glade_gtk_label_post_create (GladeWidgetAdaptor *adaptor, 
-			     GObject            *object, 
-			     GladeCreateReason   reason)
-{
-	/* For some reason labels dont show up with markup
-	 * and mnemonic underlines in the runtime at load time,
-	 * resetting them at realize time fixes this glitch.
-	 */
-	g_signal_connect_after (G_OBJECT (object), "realize",
-				G_CALLBACK (ensure_label_props), adaptor);
-}
-
-
-GladeEditorProperty *
-glade_gtk_label_create_eprop (GladeWidgetAdaptor *adaptor,
-			      GladePropertyClass *klass,
-			      gboolean            use_command)
-{
-	GladeEditorProperty *eprop;
-
-	/* chain up.. */
-	if (GLADE_IS_PARAM_SPEC_ATTRIBUTES (klass->pspec))
-	{
-		eprop = g_object_new (GLADE_TYPE_EPROP_ATTRS,
-				      "property-class", klass, 
-				      "use-command", use_command,
-				      NULL);
-	}
-	else
-		eprop = GWA_GET_CLASS 
-			(GTK_TYPE_WIDGET)->create_eprop (adaptor, 
-						       klass, 
-						       use_command);
-	return eprop;
-}
-
-static void
 glade_gtk_label_set_attributes (GObject *object, const GValue *value)
 {
 	GladeAttribute       *gattr;
@@ -7123,6 +7091,121 @@
 	gtk_label_set_attributes (GTK_LABEL (object), attrs);
 }
 
+
+static void
+glade_gtk_label_set_content_mode (GObject *object, const GValue *value)
+{
+	GladeLabelContentMode mode = g_value_get_int (value);
+	GladeWidget *glabel;
+	const gchar *insensitive_msg = _("Property not selected");
+	
+	glabel = glade_widget_get_from_gobject (object);
+
+	glade_widget_property_set_sensitive (glabel, "glade-attributes", FALSE, insensitive_msg);
+	glade_widget_property_set_sensitive (glabel, "use-markup", FALSE, insensitive_msg);
+	glade_widget_property_set_sensitive (glabel, "pattern", FALSE, insensitive_msg);
+
+	switch (mode)
+	{
+	case GLADE_LABEL_MODE_ATTRIBUTES:
+		glade_widget_property_set_sensitive (glabel, "glade-attributes", TRUE, NULL);
+		break;
+	case GLADE_LABEL_MODE_MARKUP:
+		glade_widget_property_set_sensitive (glabel, "use-markup", TRUE, NULL);
+		break;
+	case GLADE_LABEL_MODE_PATTERN:
+		glade_widget_property_set_sensitive (glabel, "pattern", TRUE, NULL);
+		break;
+	default:
+		break;
+	}
+}
+
+static void
+glade_gtk_label_set_use_max_width (GObject *object, const GValue *value)
+{
+	GladeWidget *glabel;
+	const gchar *insensitive_msg = _("Property not selected");
+	
+	glabel = glade_widget_get_from_gobject (object);
+
+	glade_widget_property_set_sensitive (glabel, "width-chars", FALSE, insensitive_msg);
+	glade_widget_property_set_sensitive (glabel, "max-width-chars", FALSE, insensitive_msg);
+
+	if (g_value_get_boolean (value))
+		glade_widget_property_set_sensitive (glabel, "max-width-chars", TRUE, NULL);
+	else
+		glade_widget_property_set_sensitive (glabel, "width-chars", TRUE, NULL);
+}
+
+
+static void
+glade_gtk_label_set_wrap_mode (GObject *object, const GValue *value)
+{
+	GladeLabelWrapMode mode = g_value_get_int (value);
+	GladeWidget *glabel;
+	const gchar *insensitive_msg = _("Property not selected");
+	
+	glabel = glade_widget_get_from_gobject (object);
+
+	glade_widget_property_set_sensitive (glabel, "single-line-mode", FALSE, insensitive_msg);
+	glade_widget_property_set_sensitive (glabel, "wrap-mode", FALSE, insensitive_msg);
+	
+	if (mode == GLADE_LABEL_SINGLE_LINE)
+		glade_widget_property_set_sensitive (glabel, "single-line-mode", TRUE, NULL);
+	else if (mode == GLADE_LABEL_WRAP_MODE)
+		glade_widget_property_set_sensitive (glabel, "wrap-mode", TRUE, NULL);
+}
+
+static void
+glade_gtk_label_set_use_underline (GObject *object, const GValue *value)
+{
+	GladeWidget *glabel;
+	const gchar *insensitive_msg = _("This property does not apply unless Use Underline is set.");
+	
+	glabel = glade_widget_get_from_gobject (object);
+
+	if (g_value_get_boolean (value))
+		glade_widget_property_set_sensitive (glabel, "mnemonic-widget", TRUE, NULL);
+	else
+		glade_widget_property_set_sensitive (glabel, "mnemonic-widget", FALSE, insensitive_msg);
+
+	gtk_label_set_use_underline (GTK_LABEL (object), g_value_get_boolean (value));
+}
+
+static void
+glade_gtk_label_set_ellipsize (GObject *object, const GValue *value)
+{
+	GladeWidget *glabel;
+	const gchar *insensitive_msg = _("This property does not apply when Ellipsize is set.");
+	
+	glabel = glade_widget_get_from_gobject (object);
+
+	if (!glade_widget_property_original_default (glabel, "ellipsize"))
+		glade_widget_property_set_sensitive (glabel, "angle", FALSE, insensitive_msg);
+	else
+		glade_widget_property_set_sensitive (glabel, "angle", TRUE, NULL);
+
+	gtk_label_set_ellipsize (GTK_LABEL (object), g_value_get_enum (value));
+}
+
+
+static void
+glade_gtk_label_set_angle (GObject *object, const GValue *value)
+{
+	GladeWidget *glabel;
+	const gchar *insensitive_msg = _("This property does not apply when Angle is set.");
+	
+	glabel = glade_widget_get_from_gobject (object);
+
+	if (!glade_widget_property_original_default (glabel, "angle"))
+		glade_widget_property_set_sensitive (glabel, "ellipsize", FALSE, insensitive_msg);
+	else
+		glade_widget_property_set_sensitive (glabel, "ellipsize", TRUE, NULL);
+
+	gtk_label_set_angle (GTK_LABEL (object), g_value_get_double (value));
+}
+
 void
 glade_gtk_label_set_property (GladeWidgetAdaptor *adaptor,
 			      GObject            *object, 
@@ -7133,10 +7216,20 @@
 		glade_gtk_label_set_label (object, value);
 	else if (!strcmp (id, "glade-attributes"))
 		glade_gtk_label_set_attributes (object, value);
+	else if (!strcmp (id, "label-content-mode"))
+		glade_gtk_label_set_content_mode (object, value);
+	else if (!strcmp (id, "use-max-width"))
+		glade_gtk_label_set_use_max_width (object, value);
+	else if (!strcmp (id, "label-wrap-mode"))
+		glade_gtk_label_set_wrap_mode (object, value);
+	else if (!strcmp (id, "use-underline"))
+		glade_gtk_label_set_use_underline (object, value);
+	else if (!strcmp (id, "ellipsize"))
+		glade_gtk_label_set_ellipsize (object, value);
+	else if (!strcmp (id, "angle"))
+		glade_gtk_label_set_angle (object, value);
 	else
-		GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor,
-							       object,
-							       id, value);
+		GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor, object, id, value);
 }
 
 static void
@@ -7202,6 +7295,7 @@
 			     GladeWidget        *widget,
 			     GladeXmlNode       *node)
 {
+	GladeProperty *prop;
 	if (!glade_xml_node_verify 
 	    (node, GLADE_XML_TAG_WIDGET (glade_project_get_format (widget->project))))
 		return;
@@ -7211,12 +7305,37 @@
 
 	glade_gtk_label_read_attributes (widget, node);
 
+	/* sync label property after a load... */
+	prop = glade_widget_get_property (widget, "label");
+	glade_gtk_label_set_label (widget->object, prop->value);
+
+	/* Resolve "label-content-mode" virtual control property  */
+	if (!glade_widget_property_original_default (widget, "use-markup"))
+		glade_widget_property_set (widget, "label-content-mode", GLADE_LABEL_MODE_MARKUP);
+	else if (!glade_widget_property_original_default (widget, "pattern"))
+		glade_widget_property_set (widget, "label-content-mode", GLADE_LABEL_MODE_PATTERN);
+	else 
+		glade_widget_property_set (widget, "label-content-mode", GLADE_LABEL_MODE_ATTRIBUTES);
+
+	/* Resolve "label-wrap-mode" virtual control property  */
+	if (!glade_widget_property_original_default (widget, "single-line-mode"))
+		glade_widget_property_set (widget, "label-wrap-mode", GLADE_LABEL_SINGLE_LINE);
+	else if (!glade_widget_property_original_default (widget, "wrap"))
+		glade_widget_property_set (widget, "label-wrap-mode", GLADE_LABEL_WRAP_MODE);
+	else 
+		glade_widget_property_set (widget, "label-wrap-mode", GLADE_LABEL_WRAP_FREE);
+
+	/* Resolve "use-max-width" virtual control property  */
+	if (!glade_widget_property_original_default (widget, "max-width-chars"))
+		glade_widget_property_set (widget, "use-max-width", TRUE);
+	else
+		glade_widget_property_set (widget, "use-max-width", TRUE);
 }
 
 static void
-glade_gtk_write_attributes (GladeWidget        *widget,
-			    GladeXmlContext    *context,
-			    GladeXmlNode       *node)
+glade_gtk_label_write_attributes (GladeWidget        *widget,
+				  GladeXmlContext    *context,
+				  GladeXmlNode       *node)
 {
 	GladeXmlNode       *attr_node;
 	GList              *attrs = NULL, *l;
@@ -7259,7 +7378,7 @@
 
 	attrs_node = glade_xml_node_new (context, GLADE_TAG_ATTRIBUTES);
 
-	glade_gtk_write_attributes (widget, context, attrs_node);
+	glade_gtk_label_write_attributes (widget, context, attrs_node);
 
 	if (!glade_xml_node_get_children (attrs_node))
 		glade_xml_node_delete (attrs_node);
@@ -7302,6 +7421,44 @@
 }
 
 
+GladeEditorProperty *
+glade_gtk_label_create_eprop (GladeWidgetAdaptor *adaptor,
+			      GladePropertyClass *klass,
+			      gboolean            use_command)
+{
+	GladeEditorProperty *eprop;
+
+	/* chain up.. */
+	if (GLADE_IS_PARAM_SPEC_ATTRIBUTES (klass->pspec))
+	{
+		eprop = g_object_new (GLADE_TYPE_EPROP_ATTRS,
+				      "property-class", klass, 
+				      "use-command", use_command,
+				      NULL);
+	}
+	else
+		eprop = GWA_GET_CLASS 
+			(GTK_TYPE_WIDGET)->create_eprop (adaptor, 
+						       klass, 
+						       use_command);
+	return eprop;
+}
+
+GladeEditable *
+glade_gtk_label_create_editable (GladeWidgetAdaptor  *adaptor,
+				 GladeEditorPageType  type)
+{
+	GladeEditable *editable;
+
+	/* Get base editable */
+	editable = GWA_GET_CLASS (G_TYPE_OBJECT)->create_editable (adaptor, type);
+
+	if (type == GLADE_PAGE_GENERAL)
+		return (GladeEditable *)glade_label_editor_new (adaptor, editable);
+
+	return editable;
+}
+
 /* ----------------------------- GtkTextView ------------------------------ */
 static void
 glade_gtk_text_view_changed (GtkTextBuffer *buffer, GladeWidget *gtext)
@@ -7339,9 +7496,7 @@
 	GtkTextBuffer *buffy = gtk_text_buffer_new (NULL);
 	GladeWidget *gtext;
 	
-	g_return_if_fail (GTK_IS_TEXT_VIEW (object));
 	gtext = glade_widget_get_from_gobject (object);
-	g_return_if_fail (GLADE_IS_WIDGET (gtext));
 	
 	/* This makes gtk_text_view_set_buffer() stop complaing */
 	gtk_drag_dest_set (GTK_WIDGET (object), 0, NULL, 0, 0);

Added: trunk/plugins/gtk+/glade-label-editor.c
==============================================================================
--- (empty file)
+++ trunk/plugins/gtk+/glade-label-editor.c	Tue Oct 28 22:15:04 2008
@@ -0,0 +1,742 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008 Tristan Van Berkom.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors:
+ *   Tristan Van Berkom <tvb gnome org>
+ */
+
+#include <config.h>
+#include <gladeui/glade.h>
+#include <glib/gi18n-lib.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "glade-label-editor.h"
+
+
+static void glade_label_editor_finalize        (GObject              *object);
+
+static void glade_label_editor_editable_init   (GladeEditableIface *iface);
+
+static void glade_label_editor_grab_focus      (GtkWidget            *widget);
+
+
+G_DEFINE_TYPE_WITH_CODE (GladeLabelEditor, glade_label_editor, GTK_TYPE_VBOX,
+                         G_IMPLEMENT_INTERFACE (GLADE_TYPE_EDITABLE,
+                                                glade_label_editor_editable_init));
+
+
+static void
+glade_label_editor_class_init (GladeLabelEditorClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+	object_class->finalize     = glade_label_editor_finalize;
+	widget_class->grab_focus   = glade_label_editor_grab_focus;
+}
+
+static void
+glade_label_editor_init (GladeLabelEditor *self)
+{
+}
+
+static void
+project_changed (GladeProject      *project,
+		 GladeCommand      *command,
+		 gboolean           execute,
+		 GladeLabelEditor *label_editor)
+{
+	if (label_editor->modifying ||
+	    !GTK_WIDGET_MAPPED (label_editor))
+		return;
+
+	/* Reload on all commands */
+	glade_editable_load (GLADE_EDITABLE (label_editor), label_editor->loaded_widget);
+}
+
+
+static void
+project_finalized (GladeLabelEditor *label_editor,
+		   GladeProject       *where_project_was)
+{
+	label_editor->loaded_widget = NULL;
+
+	glade_editable_load (GLADE_EDITABLE (label_editor), NULL);
+}
+
+static void
+glade_label_editor_load (GladeEditable *editable,
+			  GladeWidget   *widget)
+{
+	GladeLabelEditor    *label_editor = GLADE_LABEL_EDITOR (editable);
+	GList               *l;
+
+	label_editor->loading = TRUE;
+
+	/* Since we watch the project*/
+	if (label_editor->loaded_widget)
+	{
+		/* watch custom-child and use-stock properties here for reloads !!! */
+
+		g_signal_handlers_disconnect_by_func (G_OBJECT (label_editor->loaded_widget->project),
+						      G_CALLBACK (project_changed), label_editor);
+
+		/* The widget could die unexpectedly... */
+		g_object_weak_unref (G_OBJECT (label_editor->loaded_widget->project),
+				     (GWeakNotify)project_finalized,
+				     label_editor);
+	}
+
+	/* Mark our widget... */
+	label_editor->loaded_widget = widget;
+
+	if (label_editor->loaded_widget)
+	{
+		/* This fires for undo/redo */
+		g_signal_connect (G_OBJECT (label_editor->loaded_widget->project), "changed",
+				  G_CALLBACK (project_changed), label_editor);
+
+		/* The widget/project could die unexpectedly... */
+		g_object_weak_ref (G_OBJECT (label_editor->loaded_widget->project),
+				   (GWeakNotify)project_finalized,
+				   label_editor);
+	}
+
+	/* load the embedded editable... */
+	if (label_editor->embed)
+		glade_editable_load (GLADE_EDITABLE (label_editor->embed), widget);
+
+	for (l = label_editor->properties; l; l = l->next)
+		glade_editor_property_load_by_widget (GLADE_EDITOR_PROPERTY (l->data), widget);
+
+	if (widget)
+	{
+		GladeLabelContentMode content_mode;
+		GladeLabelWrapMode    wrap_mode;
+		static PangoAttrList *bold_attr_list;
+		gboolean              use_max_width;
+
+		if (!bold_attr_list)
+		{
+			PangoAttribute *attr;
+			bold_attr_list = pango_attr_list_new ();
+			attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
+			pango_attr_list_insert (bold_attr_list, attr);
+		}
+
+		glade_widget_property_get (widget, "label-content-mode", &content_mode);
+		glade_widget_property_get (widget, "label-wrap-mode", &wrap_mode);
+		glade_widget_property_get (widget, "use-max-width", &use_max_width);
+
+		switch (content_mode)
+		{
+		case GLADE_LABEL_MODE_ATTRIBUTES:
+			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (label_editor->attributes_radio), TRUE);
+			break;
+		case GLADE_LABEL_MODE_MARKUP:
+			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (label_editor->markup_radio), TRUE);
+			break;
+		case GLADE_LABEL_MODE_PATTERN:
+			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (label_editor->pattern_radio), TRUE);
+			break;
+		default:
+			break;
+		}
+
+		if (wrap_mode == GLADE_LABEL_WRAP_FREE)
+			gtk_label_set_attributes (GTK_LABEL (label_editor->wrap_free_label), bold_attr_list);
+		else
+			gtk_label_set_attributes (GTK_LABEL (label_editor->wrap_free_label), NULL);
+
+		switch (wrap_mode)
+		{
+		case GLADE_LABEL_WRAP_FREE:
+			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (label_editor->wrap_free_radio), TRUE);
+			break;
+		case GLADE_LABEL_SINGLE_LINE:
+			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (label_editor->single_radio), TRUE);
+			break;
+		case GLADE_LABEL_WRAP_MODE:
+			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (label_editor->wrap_mode_radio), TRUE);
+			break;
+		default:
+			break;
+		}
+
+		if (use_max_width)
+			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (label_editor->max_width_radio), TRUE);
+		else
+			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (label_editor->width_radio), TRUE);
+
+	}
+	label_editor->loading = FALSE;
+}
+
+static void
+glade_label_editor_set_show_name (GladeEditable *editable,
+				   gboolean       show_name)
+{
+	GladeLabelEditor *label_editor = GLADE_LABEL_EDITOR (editable);
+
+	glade_editable_set_show_name (GLADE_EDITABLE (label_editor->embed), show_name);
+}
+
+static void
+glade_label_editor_editable_init (GladeEditableIface *iface)
+{
+	iface->load = glade_label_editor_load;
+	iface->set_show_name = glade_label_editor_set_show_name;
+}
+
+static void
+glade_label_editor_finalize (GObject *object)
+{
+	GladeLabelEditor *label_editor = GLADE_LABEL_EDITOR (object);
+
+	if (label_editor->properties)
+		g_list_free (label_editor->properties);
+	label_editor->properties = NULL;
+	label_editor->embed      = NULL;
+
+	glade_editable_load (GLADE_EDITABLE (object), NULL);
+
+	G_OBJECT_CLASS (glade_label_editor_parent_class)->finalize (object);
+}
+
+static void
+glade_label_editor_grab_focus (GtkWidget *widget)
+{
+	GladeLabelEditor *label_editor = GLADE_LABEL_EDITOR (widget);
+
+	gtk_widget_grab_focus (label_editor->embed);
+}
+
+
+/**********************************************************************
+                    label-content-mode radios
+ **********************************************************************/
+static void
+attributes_toggled (GtkWidget        *widget,
+		    GladeLabelEditor *label_editor)
+{
+	GladeProperty     *property;
+
+	if (label_editor->loading || !label_editor->loaded_widget)
+		return;
+
+	if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (label_editor->attributes_radio)))
+		return;
+
+	label_editor->modifying = TRUE;
+
+	glade_command_push_group (_("Setting %s to use an attribute list"), label_editor->loaded_widget->name);
+
+	property = glade_widget_get_property (label_editor->loaded_widget, "use-markup");
+	glade_command_set_property (property, FALSE);
+	property = glade_widget_get_property (label_editor->loaded_widget, "pattern");
+	glade_command_set_property (property, NULL);
+	property = glade_widget_get_property (label_editor->loaded_widget, "label-content-mode");
+	glade_command_set_property (property, GLADE_LABEL_MODE_ATTRIBUTES);
+
+	glade_command_pop_group ();
+
+	label_editor->modifying = FALSE;
+
+	/* reload buttons and sensitivity and stuff... */
+	glade_editable_load (GLADE_EDITABLE (label_editor), 
+			     label_editor->loaded_widget);
+}
+
+static void
+markup_toggled (GtkWidget        *widget,
+		GladeLabelEditor *label_editor)
+{
+	GladeProperty     *property;
+
+	if (label_editor->loading || !label_editor->loaded_widget)
+		return;
+
+	if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (label_editor->markup_radio)))
+		return;
+
+	label_editor->modifying = TRUE;
+
+	glade_command_push_group (_("Setting %s to use a pango markup string"), label_editor->loaded_widget->name);
+
+	property = glade_widget_get_property (label_editor->loaded_widget, "pattern");
+	glade_command_set_property (property, NULL);
+	property = glade_widget_get_property (label_editor->loaded_widget, "glade-attributes");
+	glade_command_set_property (property, NULL);
+
+	property = glade_widget_get_property (label_editor->loaded_widget, "use-markup");
+	glade_command_set_property (property, TRUE);
+	property = glade_widget_get_property (label_editor->loaded_widget, "label-content-mode");
+	glade_command_set_property (property, GLADE_LABEL_MODE_MARKUP);
+
+	glade_command_pop_group ();
+
+	label_editor->modifying = FALSE;
+
+	/* reload buttons and sensitivity and stuff... */
+	glade_editable_load (GLADE_EDITABLE (label_editor), 
+			     label_editor->loaded_widget);
+}
+
+static void
+pattern_toggled (GtkWidget        *widget,
+		 GladeLabelEditor *label_editor)
+{
+	GladeProperty     *property;
+
+	if (label_editor->loading || !label_editor->loaded_widget)
+		return;
+
+	if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (label_editor->pattern_radio)))
+		return;
+
+	label_editor->modifying = TRUE;
+
+	glade_command_push_group (_("Setting %s to use a pattern string"), label_editor->loaded_widget->name);
+
+	property = glade_widget_get_property (label_editor->loaded_widget, "glade-attributes");
+	glade_command_set_property (property, NULL);
+	property = glade_widget_get_property (label_editor->loaded_widget, "use-markup");
+	glade_command_set_property (property, FALSE);
+	property = glade_widget_get_property (label_editor->loaded_widget, "label-content-mode");
+	glade_command_set_property (property, GLADE_LABEL_MODE_PATTERN);
+
+	glade_command_pop_group ();
+
+	label_editor->modifying = FALSE;
+
+	/* reload buttons and sensitivity and stuff... */
+	glade_editable_load (GLADE_EDITABLE (label_editor), 
+			     label_editor->loaded_widget);
+}
+
+/**********************************************************************
+                    use-max-width radios
+ **********************************************************************/
+
+static void
+width_toggled (GtkWidget        *widget,
+	       GladeLabelEditor *label_editor)
+{
+	GladeProperty     *property;
+
+	if (label_editor->loading || !label_editor->loaded_widget)
+		return;
+
+	if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (label_editor->width_radio)))
+		return;
+
+	label_editor->modifying = TRUE;
+
+	glade_command_push_group (_("Setting %s to set desired width in charachters"), 
+				  label_editor->loaded_widget->name);
+
+	property = glade_widget_get_property (label_editor->loaded_widget, "max-width-chars");
+	glade_command_set_property (property, -1);
+	property = glade_widget_get_property (label_editor->loaded_widget, "use-max-width");
+	glade_command_set_property (property, FALSE);
+
+	glade_command_pop_group ();
+
+	label_editor->modifying = FALSE;
+
+	/* reload buttons and sensitivity and stuff... */
+	glade_editable_load (GLADE_EDITABLE (label_editor), 
+			     label_editor->loaded_widget);
+}
+
+static void
+max_width_toggled (GtkWidget        *widget,
+		   GladeLabelEditor *label_editor)
+{
+	GladeProperty     *property;
+
+	if (label_editor->loading || !label_editor->loaded_widget)
+		return;
+
+	if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (label_editor->max_width_radio)))
+		return;
+
+	label_editor->modifying = TRUE;
+
+	glade_command_push_group (_("Setting %s to set maximum width in charachters"), 
+				  label_editor->loaded_widget->name);
+
+	property = glade_widget_get_property (label_editor->loaded_widget, "width-chars");
+	glade_command_set_property (property, -1);
+	property = glade_widget_get_property (label_editor->loaded_widget, "use-max-width");
+	glade_command_set_property (property, TRUE);
+
+	glade_command_pop_group ();
+
+	label_editor->modifying = FALSE;
+
+	/* reload buttons and sensitivity and stuff... */
+	glade_editable_load (GLADE_EDITABLE (label_editor), 
+			     label_editor->loaded_widget);
+}
+
+/**********************************************************************
+                    label-wrap-mode radios
+ **********************************************************************/
+static void
+wrap_free_toggled (GtkWidget        *widget,
+		   GladeLabelEditor *label_editor)
+{
+	GladeProperty     *property;
+
+	if (label_editor->loading || !label_editor->loaded_widget)
+		return;
+
+	if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (label_editor->wrap_free_radio)))
+		return;
+
+	label_editor->modifying = TRUE;
+
+	glade_command_push_group (_("Setting %s to use normal line wrapping"), label_editor->loaded_widget->name);
+
+	property = glade_widget_get_property (label_editor->loaded_widget, "single-line-mode");
+	glade_command_set_property (property, FALSE);
+	property = glade_widget_get_property (label_editor->loaded_widget, "wrap-mode");
+	glade_command_set_property (property, PANGO_WRAP_WORD);
+	property = glade_widget_get_property (label_editor->loaded_widget, "wrap");
+	glade_command_set_property (property, FALSE);
+
+	property = glade_widget_get_property (label_editor->loaded_widget, "label-wrap-mode");
+	glade_command_set_property (property, GLADE_LABEL_WRAP_FREE);
+
+	glade_command_pop_group ();
+
+	label_editor->modifying = FALSE;
+
+	/* reload buttons and sensitivity and stuff... */
+	glade_editable_load (GLADE_EDITABLE (label_editor), 
+			     label_editor->loaded_widget);
+}
+
+static void
+single_toggled (GtkWidget        *widget,
+		GladeLabelEditor *label_editor)
+{
+	GladeProperty     *property;
+
+	if (label_editor->loading || !label_editor->loaded_widget)
+		return;
+
+	if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (label_editor->single_radio)))
+		return;
+
+	label_editor->modifying = TRUE;
+
+	glade_command_push_group (_("Setting %s to use a single line"), label_editor->loaded_widget->name);
+
+	property = glade_widget_get_property (label_editor->loaded_widget, "wrap-mode");
+	glade_command_set_property (property, PANGO_WRAP_WORD);
+	property = glade_widget_get_property (label_editor->loaded_widget, "wrap");
+	glade_command_set_property (property, FALSE);
+
+	property = glade_widget_get_property (label_editor->loaded_widget, "single-line-mode");
+	glade_command_set_property (property, TRUE);
+	property = glade_widget_get_property (label_editor->loaded_widget, "label-wrap-mode");
+	glade_command_set_property (property, GLADE_LABEL_SINGLE_LINE);
+
+	glade_command_pop_group ();
+
+	label_editor->modifying = FALSE;
+
+	/* reload buttons and sensitivity and stuff... */
+	glade_editable_load (GLADE_EDITABLE (label_editor), 
+			     label_editor->loaded_widget);
+}
+
+static void
+wrap_mode_toggled (GtkWidget        *widget,
+		   GladeLabelEditor *label_editor)
+{
+	GladeProperty     *property;
+
+	if (label_editor->loading || !label_editor->loaded_widget)
+		return;
+
+	if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (label_editor->wrap_mode_radio)))
+		return;
+
+	label_editor->modifying = TRUE;
+
+	glade_command_push_group (_("Setting %s to use specific pango word wrapping"), 
+				  label_editor->loaded_widget->name);
+
+	property = glade_widget_get_property (label_editor->loaded_widget, "single-line-mode");
+	glade_command_set_property (property, FALSE);
+	property = glade_widget_get_property (label_editor->loaded_widget, "wrap");
+	glade_command_set_property (property, TRUE);
+
+	property = glade_widget_get_property (label_editor->loaded_widget, "label-wrap-mode");
+	glade_command_set_property (property, GLADE_LABEL_WRAP_MODE);
+
+	glade_command_pop_group ();
+
+	label_editor->modifying = FALSE;
+
+	/* reload buttons and sensitivity and stuff... */
+	glade_editable_load (GLADE_EDITABLE (label_editor), 
+			     label_editor->loaded_widget);
+}
+
+
+static void
+table_attach (GtkWidget *table, 
+	      GtkWidget *child, 
+	      gint pos, gint row)
+{
+	gtk_table_attach (GTK_TABLE (table), child,
+			  pos, pos+1, row, row +1,
+			  GTK_EXPAND | GTK_FILL,
+			  GTK_EXPAND | GTK_FILL,
+			  3, 1);
+}
+
+static void
+append_label_appearance (GladeLabelEditor   *label_editor,
+			 GladeWidgetAdaptor *adaptor)
+{
+	GladeEditorProperty *eprop, *markup_property;
+	GtkWidget           *table, *frame, *alignment, *label;
+	gchar               *str;
+
+	/* Label appearance... */
+	str = g_strdup_printf ("<b>%s</b>", _("Edit label appearance"));
+	label = gtk_label_new (str);
+	gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+	g_free (str);
+	frame = gtk_frame_new (NULL);
+	gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+	gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
+	gtk_box_pack_start (GTK_BOX (label_editor), frame, FALSE, FALSE, 8);
+
+	alignment = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
+	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
+	gtk_container_add (GTK_CONTAINER (frame), alignment);
+
+	table = gtk_table_new (0, 0, FALSE);
+	gtk_container_add (GTK_CONTAINER (alignment), table);
+
+	/* Edit the label itself... */
+	eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "label", FALSE, TRUE);
+	table_attach (table, eprop->item_label, 0, 0);
+	table_attach (table, GTK_WIDGET (eprop), 1, 0);
+	label_editor->properties = g_list_prepend (label_editor->properties, eprop);
+
+	/* Edit by attributes... */
+	eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "glade-attributes", FALSE, TRUE);
+	label_editor->attributes_radio = gtk_radio_button_new (NULL);
+	gtk_container_add (GTK_CONTAINER (label_editor->attributes_radio), eprop->item_label);
+	table_attach (table, label_editor->attributes_radio, 0, 1);
+	table_attach (table, GTK_WIDGET (eprop), 1, 1);
+	label_editor->properties = g_list_prepend (label_editor->properties, eprop);
+
+	/* Edit with label as pango markup strings... */
+	eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "use-markup", FALSE, TRUE);
+	label_editor->markup_radio = gtk_radio_button_new_from_widget
+		(GTK_RADIO_BUTTON (label_editor->attributes_radio));
+	gtk_container_add (GTK_CONTAINER (label_editor->markup_radio), eprop->item_label);
+	table_attach (table, label_editor->markup_radio, 0, 2);
+	label_editor->properties = g_list_prepend (label_editor->properties, eprop);
+	markup_property = eprop; /* Its getting into a hidden row on the bottom... */
+
+	/* Add underscores from pattern string... */
+	eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "pattern", FALSE, TRUE);
+	label_editor->pattern_radio = gtk_radio_button_new_from_widget
+		(GTK_RADIO_BUTTON (label_editor->attributes_radio));
+	gtk_container_add (GTK_CONTAINER (label_editor->pattern_radio), eprop->item_label);
+	table_attach (table, label_editor->pattern_radio, 0, 3);
+	table_attach (table, GTK_WIDGET (eprop), 1, 3);
+	label_editor->properties = g_list_prepend (label_editor->properties, eprop);
+
+	/* Add invisible eprops at the end of this table... */
+	gtk_widget_set_no_show_all (GTK_WIDGET (markup_property), TRUE);
+	gtk_widget_hide (GTK_WIDGET (markup_property));
+	table_attach (table, GTK_WIDGET (markup_property), 0, 4);
+}
+
+
+static void
+append_label_formatting (GladeLabelEditor   *label_editor,
+			 GladeWidgetAdaptor *adaptor)
+{
+	GladeEditorProperty *eprop;
+	GtkWidget           *table, *frame, *alignment, *label;
+	gchar               *str;
+	gint                 row = 0;
+
+	/* Label formatting... */
+	str = g_strdup_printf ("<b>%s</b>", _("Format label"));
+	label = gtk_label_new (str);
+	gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+	g_free (str);
+	frame = gtk_frame_new (NULL);
+	gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+	gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
+	gtk_box_pack_start (GTK_BOX (label_editor), frame, FALSE, FALSE, 0);
+
+	alignment = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
+	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
+	gtk_container_add (GTK_CONTAINER (frame), alignment);
+
+	table = gtk_table_new (0, 0, FALSE);
+	gtk_container_add (GTK_CONTAINER (alignment), table);
+
+	/* ellipsize... */
+	eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "ellipsize", FALSE, TRUE);
+	table_attach (table, eprop->item_label, 0, row);
+	table_attach (table, GTK_WIDGET (eprop), 1, row++);
+	label_editor->properties = g_list_prepend (label_editor->properties, eprop);
+
+	/* justify... */
+	eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "justify", FALSE, TRUE);
+	table_attach (table, eprop->item_label, 0, row);
+	table_attach (table, GTK_WIDGET (eprop), 1, row++);
+	label_editor->properties = g_list_prepend (label_editor->properties, eprop);
+
+	/* angle... */
+	eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "angle", FALSE, TRUE);
+	table_attach (table, eprop->item_label, 0, row);
+	table_attach (table, GTK_WIDGET (eprop), 1, row++);
+	label_editor->properties = g_list_prepend (label_editor->properties, eprop);
+
+	/* width-chars ... */
+	eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "width-chars", FALSE, TRUE);
+	label_editor->width_radio = gtk_radio_button_new (NULL);
+	gtk_container_add (GTK_CONTAINER (label_editor->width_radio), eprop->item_label);
+	table_attach (table, label_editor->width_radio, 0, row);
+	table_attach (table, GTK_WIDGET (eprop), 1, row++);
+	label_editor->properties = g_list_prepend (label_editor->properties, eprop);
+
+	/* max-width-chars ... */
+	eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "max-width-chars", FALSE, TRUE);
+	label_editor->max_width_radio = gtk_radio_button_new_from_widget
+		(GTK_RADIO_BUTTON (label_editor->width_radio));
+	gtk_container_add (GTK_CONTAINER (label_editor->max_width_radio), eprop->item_label);
+	table_attach (table, label_editor->max_width_radio, 0, row);
+	table_attach (table, GTK_WIDGET (eprop), 1, row++);
+	label_editor->properties = g_list_prepend (label_editor->properties, eprop);
+}
+
+static void
+append_label_wrapping (GladeLabelEditor   *label_editor,
+		       GladeWidgetAdaptor *adaptor)
+{
+	GladeEditorProperty *eprop, *single_line_eprop;
+	GtkWidget           *table, *frame, *alignment, *label;
+	gchar               *str;
+	gint                 row = 0;
+
+	/* Line Wrapping... */
+	str = g_strdup_printf ("<b>%s</b>", _("Text line wrapping"));
+	label = gtk_label_new (str);
+	gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+	g_free (str);
+	frame = gtk_frame_new (NULL);
+	gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+	gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
+	gtk_box_pack_start (GTK_BOX (label_editor), frame, FALSE, FALSE, 0);
+
+	alignment = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
+	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
+	gtk_container_add (GTK_CONTAINER (frame), alignment);
+
+	table = gtk_table_new (0, 0, FALSE);
+	gtk_container_add (GTK_CONTAINER (alignment), table);
+
+	/* Append defaut epropless radio... */
+	label_editor->wrap_free_radio = gtk_radio_button_new (NULL);
+	label_editor->wrap_free_label = gtk_label_new (_("Text wraps normally"));
+	gtk_container_add (GTK_CONTAINER (label_editor->wrap_free_radio), label_editor->wrap_free_label);
+	table_attach (table, label_editor->wrap_free_radio, 0, row++);
+
+	/* single-line-mode ... */
+	single_line_eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "single-line-mode", FALSE, TRUE);
+	label_editor->single_radio = gtk_radio_button_new_from_widget
+		(GTK_RADIO_BUTTON (label_editor->wrap_free_radio));
+	gtk_container_add (GTK_CONTAINER (label_editor->single_radio), single_line_eprop->item_label);
+	table_attach (table, label_editor->single_radio, 0, row++);
+	label_editor->properties = g_list_prepend (label_editor->properties, single_line_eprop);
+
+	/* wrap-mode ... */
+	eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "wrap-mode", FALSE, TRUE);
+	label_editor->wrap_mode_radio = gtk_radio_button_new_from_widget
+		(GTK_RADIO_BUTTON (label_editor->wrap_free_radio));
+	gtk_container_add (GTK_CONTAINER (label_editor->wrap_mode_radio), eprop->item_label);
+	table_attach (table, label_editor->wrap_mode_radio, 0, row);
+	table_attach (table, GTK_WIDGET (eprop), 1, row++);
+	label_editor->properties = g_list_prepend (label_editor->properties, eprop);
+
+	/* Add invisible eprops at the end of this table... */
+	gtk_widget_set_no_show_all (GTK_WIDGET (single_line_eprop), TRUE);
+	gtk_widget_hide (GTK_WIDGET (single_line_eprop));
+	table_attach (table, GTK_WIDGET (single_line_eprop), 0, row);
+}
+
+GtkWidget *
+glade_label_editor_new (GladeWidgetAdaptor *adaptor,
+			GladeEditable      *embed)
+{
+	GladeLabelEditor    *label_editor;
+
+	g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
+	g_return_val_if_fail (GLADE_IS_EDITABLE (embed), NULL);
+
+	label_editor = g_object_new (GLADE_TYPE_LABEL_EDITOR, NULL);
+	label_editor->embed = GTK_WIDGET (embed);
+
+	/* Pack the parent on top... */
+	gtk_box_pack_start (GTK_BOX (label_editor), GTK_WIDGET (embed), FALSE, FALSE, 0);
+
+	append_label_appearance (label_editor, adaptor);
+	append_label_formatting (label_editor, adaptor);
+	append_label_wrapping (label_editor, adaptor);
+
+	/* Connect to our radio buttons.... */
+	g_signal_connect (G_OBJECT (label_editor->attributes_radio), "toggled",
+			  G_CALLBACK (attributes_toggled), label_editor);
+	g_signal_connect (G_OBJECT (label_editor->markup_radio), "toggled",
+			  G_CALLBACK (markup_toggled), label_editor);
+	g_signal_connect (G_OBJECT (label_editor->pattern_radio), "toggled",
+			  G_CALLBACK (pattern_toggled), label_editor);
+
+	g_signal_connect (G_OBJECT (label_editor->width_radio), "toggled",
+			  G_CALLBACK (width_toggled), label_editor);
+	g_signal_connect (G_OBJECT (label_editor->max_width_radio), "toggled",
+			  G_CALLBACK (max_width_toggled), label_editor);
+
+	g_signal_connect (G_OBJECT (label_editor->wrap_free_radio), "toggled",
+			  G_CALLBACK (wrap_free_toggled), label_editor);
+	g_signal_connect (G_OBJECT (label_editor->single_radio), "toggled",
+			  G_CALLBACK (single_toggled), label_editor);
+	g_signal_connect (G_OBJECT (label_editor->wrap_mode_radio), "toggled",
+			  G_CALLBACK (wrap_mode_toggled), label_editor);
+
+
+	gtk_widget_show_all (GTK_WIDGET (label_editor));
+
+	return GTK_WIDGET (label_editor);
+}

Added: trunk/plugins/gtk+/glade-label-editor.h
==============================================================================
--- (empty file)
+++ trunk/plugins/gtk+/glade-label-editor.h	Tue Oct 28 22:15:04 2008
@@ -0,0 +1,91 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008 Tristan Van Berkom.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors:
+ *   Tristan Van Berkom <tvb gnome org>
+ */
+#ifndef _GLADE_LABEL_EDITOR_H_
+#define _GLADE_LABEL_EDITOR_H_
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_LABEL_EDITOR	            (glade_label_editor_get_type ())
+#define GLADE_LABEL_EDITOR(obj)		    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_LABEL_EDITOR, GladeLabelEditor))
+#define GLADE_LABEL_EDITOR_CLASS(klass)	    (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_LABEL_EDITOR, GladeLabelEditorClass))
+#define GLADE_IS_LABEL_EDITOR(obj)	    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_LABEL_EDITOR))
+#define GLADE_IS_LABEL_EDITOR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_LABEL_EDITOR))
+#define GLADE_LABEL_EDITOR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_LABEL_EDITOR, GladeLabelEditorClass))
+
+typedef struct _GladeLabelEditor        GladeLabelEditor;
+typedef struct _GladeLabelEditorClass   GladeLabelEditorClass;
+
+typedef enum {
+	GLADE_LABEL_MODE_ATTRIBUTES = 0, /* default */
+	GLADE_LABEL_MODE_MARKUP,
+	GLADE_LABEL_MODE_PATTERN
+} GladeLabelContentMode;
+
+typedef enum {
+	GLADE_LABEL_WRAP_FREE = 0, /* default */
+	GLADE_LABEL_SINGLE_LINE,
+	GLADE_LABEL_WRAP_MODE
+} GladeLabelWrapMode;
+
+struct _GladeLabelEditor
+{
+	GtkVBox  parent;
+
+	GladeWidget *loaded_widget; /* A handy pointer to the loaded widget ... */
+
+	GtkWidget *embed;
+
+	GtkWidget *attributes_radio;    /* Set pango attributes manually (attributes eprop embedded) */
+	GtkWidget *markup_radio;        /* Parse the label as a pango markup string (no showing eprop) */
+	GtkWidget *pattern_radio;       /* Use a pattern string to underline portions of the text
+					 * (pattern eprop embedded) */
+
+	/* These control whether to use max-width-chars or just width-chars */
+	GtkWidget *width_radio;
+	GtkWidget *max_width_radio;
+
+	/* These control whether to use single-line-mode, wrap & wrap-mode or niether */
+	GtkWidget *wrap_free_label; /* Set boldness on this label for a fake property */
+	GtkWidget *wrap_free_radio;
+	GtkWidget *single_radio;
+	GtkWidget *wrap_mode_radio;
+
+	GList *properties;         /* A list of eprops to update at load() time */
+
+	gboolean loading;          /* Loading flag for loading widgets in the editor */
+	gboolean modifying;        /* Flag for monitoring project changes */
+};
+
+struct _GladeLabelEditorClass
+{
+	GtkVBoxClass parent;
+};
+
+GType            glade_label_editor_get_type (void);
+GtkWidget       *glade_label_editor_new      (GladeWidgetAdaptor *adaptor,
+					      GladeEditable      *editable);
+
+G_END_DECLS
+
+#endif  /* _GLADE_LABEL_EDITOR_H_ */

Modified: trunk/plugins/gtk+/gtk+.xml.in
==============================================================================
--- trunk/plugins/gtk+/gtk+.xml.in	(original)
+++ trunk/plugins/gtk+/gtk+.xml.in	Tue Oct 28 22:15:04 2008
@@ -589,23 +589,44 @@
     <glade-widget-class name="GtkLabel" generic-name="label" _title="Label">
       <post-create-function>glade_gtk_label_post_create</post-create-function>
       <create-editor-property-function>glade_gtk_label_create_eprop</create-editor-property-function>
+      <create-editable-function>glade_gtk_label_create_editable</create-editable-function>
       <set-property-function>glade_gtk_label_set_property</set-property-function>
       <read-widget-function>glade_gtk_label_read_widget</read-widget-function>
       <write-widget-function>glade_gtk_label_write_widget</write-widget-function>
       <string-from-value-function>glade_gtk_label_string_from_value</string-from-value-function>
 
       <properties>
-	<property id="glade-attributes" _name="Attributes" save="False">
+	<!-- Virtual label content mode property -->
+        <property id="label-content-mode" visible="False" save="False">
+	  <spec>glade_standard_int_spec</spec>
+        </property>
+	<!-- Virtual label to control width-chars vs. max-width-chars -->
+        <property id="use-max-width" visible="False" save="False">
+	  <spec>glade_standard_boolean_spec</spec>
+        </property>
+	<!-- Virtual label content mode property -->
+        <property id="label-wrap-mode" visible="False" save="False">
+	  <spec>glade_standard_int_spec</spec>
+        </property>
+      	<property id="label" default="label" translatable="True" custom-layout="True">
+            <visible-lines>2</visible-lines>
+        </property>
+	<property id="glade-attributes" _name="Attributes" save="False" custom-layout="True">
 	  <spec>glade_gtk_attributes_spec</spec>
 	  <_tooltip>The pango attributes for this label</_tooltip>
 	</property>
+	<property id="pattern" custom-layout="True"/>
+	<property id="use-markup" custom-layout="True"/>
 
-        <property id="selectable" ignore="True"/>
-	<property id="pattern" default=""/>
-	<property id="max-width-chars" _name="Maximum Width"/>
-      	<property id="label" default="label" translatable="True">
-            <visible-lines>2</visible-lines>
-        </property>
+	<property id="ellipsize" custom-layout="True"/>
+	<property id="justify" custom-layout="True"/>
+	<property id="angle" custom-layout="True"/>
+	<property id="single-line-mode" custom-layout="True"/>
+	<property id="max-width-chars" custom-layout="True"/>
+	<property id="width-chars" custom-layout="True"/>
+	<property id="wrap" custom-layout="True"/>	
+	<property id="wrap-mode" custom-layout="True"/>
+        <property id="selectable" ignore="True" weight="0.5"/>
       	<property id="justify">
   	  <displayable-values>
 	    <value id="GTK_JUSTIFY_LEFT" _name="Left"/>



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