[glade3] * gladeui/glade-editor-property.[ch]: - Give object dialogs a bigger default size and hide the c



commit 845366bc4eb9c9b83467ebd587f10329575bd0cf
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Mon Mar 29 16:03:54 2010 -0400

    	* gladeui/glade-editor-property.[ch]:
    	  - Give object dialogs a bigger default size and hide the column headers
    
    	* gladeui/glade-signal-editor.c:
    	  - Now show an icon and tooltip in rows for signals that are only
    	    supported in the future, refresh them when support changes.
    
    	* gladeui/glade-widget-adaptor.h, gladeui/glade-property-class.h: Added some version checking macros.
    
    	* gladeui/glade-signal.[ch]: Add support warning meta data to signals
    
    	* gladeui/glade-project.c:
    	  - Simplify code with new version checking macros
    	  - Do the verify on signals for widgets as well as project warnings
    	    (update the signals a verify time).
    
    	* gladeui/glade-widget.c: GladeWidget takes a new "support-changed" to broadcast support changes
    	  on the widget.
    
    	* gladeui/glade-signal-editor.c:

 ChangeLog                       |   20 +++++++-
 gladeui/glade-editor-property.c |    9 +++-
 gladeui/glade-project.c         |  113 +++++++++++++++++++++++----------------
 gladeui/glade-project.h         |    3 +
 gladeui/glade-property-class.h  |   22 +++++++-
 gladeui/glade-signal-editor.c   |   90 +++++++++++++++++++++++++++----
 gladeui/glade-signal-editor.h   |    5 ++
 gladeui/glade-signal.c          |   39 ++++++++++---
 gladeui/glade-signal.h          |    6 ++
 gladeui/glade-widget-adaptor.h  |   48 ++++++++++++++++
 gladeui/glade-widget.c          |   35 ++++++++++++
 gladeui/glade-widget.h          |    2 +
 12 files changed, 320 insertions(+), 72 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bbdda03..7fc7ea8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,29 @@
 2010-03-29  Tristan Van Berkom <tvb gnome org>
 
-	* gladeui/glade-editor-property.[ch]: Added glade_editor_property_show_object_dialog()
+	* gladeui/glade-editor-property.[ch]: 
+	  - Added glade_editor_property_show_object_dialog()
+	  - Give object dialogs a bigger default size and hide the column headers
 
 	* gladeui/glade-signal-editor.c: 
 	  - Use glade_editor_property_show_object_dialog() to select project objects for signal user data.
 	  - Added tooltips for the column headers
+	  - Now show an icon and tooltip in rows for signals that are only
+	    supported in the future, refresh them when support changes.
 
+	* gladeui/glade-widget-adaptor.h, gladeui/glade-property-class.h: Added some version checking macros.
+
+	* gladeui/glade-signal.[ch]: Add support warning meta data to signals
+	
+	* gladeui/glade-project.c: 
+	  - Simplify code with new version checking macros
+	  - Do the verify on signals for widgets as well as project warnings
+	    (update the signals a verify time).
+
+	* gladeui/glade-widget.c: GladeWidget takes a new "support-changed" to broadcast support changes
+	  on the widget.
+
+	* gladeui/glade-signal-editor.c: 
+	
 2010-03-28  Tristan Van Berkom <tvb gnome org>
 
 	* gladeui/Makefile.am, gladeui/glade-cell-renderer-icon.[ch]: Added activatable pixbuf renderer
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index 89a33ba..d9045af 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -1106,7 +1106,7 @@ glade_eprop_flags_show_dialog (GtkWidget           *button,
 					      GTK_STOCK_CLOSE,
 					      GTK_RESPONSE_CLOSE,
 					      NULL);
-					      
+
 	gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 400);
 	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
 	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
@@ -2645,6 +2645,7 @@ glade_eprop_object_view (gboolean             radio)
 	g_object_set_data (G_OBJECT (model), "radio-list", GINT_TO_POINTER (radio));
 
 	view_widget = gtk_tree_view_new_with_model (model);
+	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view_widget), FALSE);
 
 	/* Pass ownership to the view */
 	g_object_unref (G_OBJECT (model));
@@ -2766,6 +2767,8 @@ glade_editor_property_show_object_dialog (GladeProject       *project,
 						 GTK_RESPONSE_CANCEL,
 						 GLADE_RESPONSE_CLEAR,
 						 -1);
+
+	gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 500);
 	
 	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
 	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
@@ -2908,7 +2911,7 @@ glade_eprop_object_show_dialog (GtkWidget           *dialog_button,
 							 -1);
 	}
 		
-	
+	gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 500);
 	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
 	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
 
@@ -3212,6 +3215,8 @@ glade_eprop_objects_show_dialog (GtkWidget           *dialog_button,
 					      GTK_STOCK_OK, GTK_RESPONSE_OK,
 					      NULL);
 	g_free (title);
+
+	gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 500);
 	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
 
 	vbox = gtk_vbox_new (FALSE, 6);
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index 98cd437..3e97d6a 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -1229,10 +1229,7 @@ glade_project_introspect_gtk_version (GladeProject *project)
 		g_free (catalog);
 
 		/* Check widget class version */
-		if (is_gtk_adaptor &&
-		    (target_major < GWA_VERSION_SINCE_MAJOR (widget->adaptor) ||
-		     (target_major == GWA_VERSION_SINCE_MAJOR (widget->adaptor) &&
-		      target_minor < GWA_VERSION_SINCE_MINOR (widget->adaptor))))
+		if (is_gtk_adaptor && !GWA_VERSION_CHECK (widget->adaptor, target_major, target_minor))
        		{
 			target_major = GWA_VERSION_SINCE_MAJOR (widget->adaptor);
 			target_minor = GWA_VERSION_SINCE_MINOR (widget->adaptor);
@@ -1261,9 +1258,7 @@ glade_project_introspect_gtk_version (GladeProject *project)
 
 			/* Check GTK+ property class versions */
 			if (is_gtk_adaptor &&
-			    (target_major < property->klass->version_since_major ||
-			     (target_major == property->klass->version_since_major &&
-			      target_minor < property->klass->version_since_minor)))
+			    !GPC_VERSION_CHECK (property->klass, target_major, target_minor))
 			{
 				target_major = property->klass->version_since_major;
 				target_minor = property->klass->version_since_minor;
@@ -1774,6 +1769,10 @@ glade_project_save (GladeProject *project, const gchar *path, GError **error)
 /* translators: reffers to a signal '%s' of widget '[%s]' in toolkit version '%s %d.%d' */
 #define SIGNAL_VERSION_CONFLICT_FMT            _("[%s] Signal '%s' of object class '%s' was introduced in %s %d.%d\n")
 
+/* translators: reffers to a signal in toolkit version '%s %d.%d' 
+ * and a project targeting toolkit version '%s %d.%d' */
+#define SIGNAL_VERSION_CONFLICT_MSGFMT         _("This signal was introduced in %s %d.%d while project targets %s %d.%d")
+
 static void
 glade_project_verify_property (GladeProject   *project,
 			       GladeProperty  *property, 
@@ -1826,9 +1825,7 @@ glade_project_verify_property (GladeProject   *project,
 						property->klass->name, 
 						adaptor->title);
 	} 
-	else if (target_major < property->klass->version_since_major ||
-		 (target_major == property->klass->version_since_major &&
-		  target_minor < property->klass->version_since_minor))
+	else if (!GPC_VERSION_CHECK (property->klass, target_major, target_minor))
 	{
 		if (forwidget)
 		{
@@ -1854,9 +1851,7 @@ glade_project_verify_property (GladeProject   *project,
 						property->klass->version_since_minor);
 	} 
 	else if (project->priv->format == GLADE_PROJECT_FORMAT_GTKBUILDER &&
-		 (target_major < property->klass->builder_since_major ||
-		  (target_major == property->klass->builder_since_major &&
-		   target_minor < property->klass->builder_since_minor)))
+		 !GPC_BUILDER_VERSION_CHECK (property->klass, target_major, target_minor))
 	{
 		if (forwidget)
 		{
@@ -1887,7 +1882,6 @@ glade_project_verify_property (GladeProject   *project,
 	g_free (catalog);
 }
 
-
 static void
 glade_project_verify_properties_internal (GladeWidget  *widget, 
 					  const gchar  *path_name,
@@ -1914,26 +1908,12 @@ glade_project_verify_properties_internal (GladeWidget  *widget,
 	}
 }
 
-
-/**
- * glade_project_verify_properties:
- * @widget: A #GladeWidget
- *
- * Synchonizes @widget with user visible information
- * about version compatability
- */
-void
-glade_project_verify_properties (GladeWidget *widget)
-{
-	g_return_if_fail (GLADE_IS_WIDGET (widget));
-	glade_project_verify_properties_internal (widget, NULL, NULL, TRUE);
-}
-
 static void
 glade_project_verify_signal (GladeWidget  *widget,
 			     GladeSignal  *signal,
 			     const gchar  *path_name,
-			     GString      *string)
+			     GString      *string,
+			     gboolean      forwidget)
 {
 	GladeSignalClass *signal_class;
 	gint target_major, target_minor;
@@ -1953,26 +1933,48 @@ glade_project_verify_signal (GladeWidget  *widget,
 						  &target_major,
 						  &target_minor);
 
-	if (target_major < signal_class->version_since_major ||
-	    (target_major == signal_class->version_since_major &&
-	     target_minor < signal_class->version_since_minor))
-		g_string_append_printf (string, 
-					SIGNAL_VERSION_CONFLICT_FMT,
-					path_name,
-					signal->name,
-					signal_class->adaptor->title, 
-					catalog,
-					signal_class->version_since_major,
-					signal_class->version_since_minor);
+	if (!GSC_VERSION_CHECK (signal_class, target_major, target_minor))
+	{
+		if (forwidget)
+		{
+			gchar *warning;
+
+			warning = g_strdup_printf (SIGNAL_VERSION_CONFLICT_MSGFMT,
+						   catalog,
+						   signal_class->version_since_major,
+						   signal_class->version_since_minor,
+						   catalog, target_major, target_minor);
+			glade_signal_set_support_warning (signal, warning);
+			g_free (warning);
+		}
+		else
+			g_string_append_printf (string, 
+						SIGNAL_VERSION_CONFLICT_FMT,
+						path_name,
+						signal->name,
+						signal_class->adaptor->title, 
+						catalog,
+						signal_class->version_since_major,
+						signal_class->version_since_minor);
+	}
+	else if (forwidget)
+		glade_signal_set_support_warning (signal, NULL);
 
 	g_free (catalog);
 }
 
+void
+glade_project_update_signal_support_warning (GladeWidget  *widget,
+					     GladeSignal  *signal)
+{
+	glade_project_verify_signal (widget, signal, NULL, NULL, TRUE);
+}
 
 static void
 glade_project_verify_signals (GladeWidget  *widget, 
 			      const gchar  *path_name,
-			      GString      *string)
+			      GString      *string,
+			      gboolean      forwidget)
 {
 	GladeSignal      *signal;
 	GList *signals, *list;
@@ -1982,12 +1984,31 @@ glade_project_verify_signals (GladeWidget  *widget,
 		for (list = signals; list; list = list->next)
 		{
 			signal = list->data;
-			glade_project_verify_signal (widget, signal, path_name, string);
+			glade_project_verify_signal (widget, signal, path_name, string, forwidget);
 		}
 		g_list_free (signals);
 	}	
 }
 
+
+/**
+ * glade_project_verify_properties:
+ * @widget: A #GladeWidget
+ *
+ * Synchonizes @widget with user visible information
+ * about version compatability and notifies the UI
+ * it should update.
+ */
+void
+glade_project_verify_properties (GladeWidget *widget)
+{
+	g_return_if_fail (GLADE_IS_WIDGET (widget));
+	glade_project_verify_properties_internal (widget, NULL, NULL, TRUE);
+	glade_project_verify_signals (widget, NULL, NULL, TRUE);
+
+	glade_widget_support_changed (widget);
+}
+
 static gboolean
 glade_project_verify_dialog (GladeProject *project,
 			     GString      *string,
@@ -2047,7 +2068,7 @@ glade_project_verify (GladeProject *project,
 		glade_project_verify_adaptor (project, widget->adaptor, 
 					      path_name, string, saving, FALSE, NULL);
 		glade_project_verify_properties_internal (widget, path_name, string, FALSE);
-		glade_project_verify_signals (widget, path_name, string);
+		glade_project_verify_signals (widget, path_name, string, FALSE);
 
 		g_free (path_name);
 	}
@@ -2103,9 +2124,7 @@ glade_project_verify_adaptor (GladeProject       *project,
 
 		/* Only one versioning message (builder or otherwise)...
 		 */
-		if (target_major < GWA_VERSION_SINCE_MAJOR (adaptor_iter) ||
-		    (target_major == GWA_VERSION_SINCE_MAJOR (adaptor_iter) &&
-		     target_minor < GWA_VERSION_SINCE_MINOR (adaptor_iter)))
+		if (!GWA_VERSION_CHECK (adaptor_iter, target_major, target_minor))
 		{
 			if (forwidget)
 				g_string_append_printf (string, 
diff --git a/gladeui/glade-project.h b/gladeui/glade-project.h
index 91e2ac5..f389465 100644
--- a/gladeui/glade-project.h
+++ b/gladeui/glade-project.h
@@ -190,6 +190,9 @@ void          glade_project_get_target_version     (GladeProject       *project,
 						    gint               *major,
 						    gint               *minor);
 
+void          glade_project_update_signal_support_warning (GladeWidget  *widget,
+							   GladeSignal  *signal);
+
 G_END_DECLS
 
 #endif /* __GLADE_PROJECT_H__ */
diff --git a/gladeui/glade-property-class.h b/gladeui/glade-property-class.h
index f2f0323..b2ec3ef 100644
--- a/gladeui/glade-property-class.h
+++ b/gladeui/glade-property-class.h
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
 
 
 /**
- * GPC_CHECK_RUNTIME:
+ * GPC_VERSION_CHECK:
  * @klass: A #GladePropertyClass
  * @major_version: The major version to check
  * @minor_version: The minor version to check
@@ -44,8 +44,24 @@ G_BEGIN_DECLS
  *
  */
 #define GPC_VERSION_CHECK(klass, major_version, minor_version)		\
-	(GLADE_PROPERTY_CLASS (klass)->version_since_major <= major_version && \
-	 GLADE_PROPERTY_CLASS (klass)->version_since_minor <= (minor_version))
+	((GLADE_PROPERTY_CLASS (klass)->version_since_major == major_version) ? \
+	 (GLADE_PROPERTY_CLASS (klass)->version_since_minor <= minor_version) : \
+	 (GLADE_PROPERTY_CLASS (klass)->version_since_major <= major_version))
+
+/**
+ * GPC_BUILDER_VERSION_CHECK:
+ * @klass: A #GladePropertyClass
+ * @major_version: The major version to check
+ * @minor_version: The minor version to check
+ *
+ * Evaluates to %TRUE if @klass is available for use with GtkBuilder in its 
+ * owning library version- major_verion @minor_version.
+ *
+ */
+#define GPC_BUILDER_VERSION_CHECK(klass, major_version, minor_version)	\
+	((GLADE_PROPERTY_CLASS (klass)->builder_since_major == major_version) ? \
+	 (GLADE_PROPERTY_CLASS (klass)->builder_since_minor <= minor_version) : \
+	 (GLADE_PROPERTY_CLASS (klass)->builder_since_major <= major_version))
 
 
 #define GPC_OBJECT_DELIMITER ", "
diff --git a/gladeui/glade-signal-editor.c b/gladeui/glade-signal-editor.c
index a5dd04e..2a18473 100644
--- a/gladeui/glade-signal-editor.c
+++ b/gladeui/glade-signal-editor.c
@@ -191,7 +191,7 @@ static void
 move_row (GtkTreeModel *model, GtkTreeIter *from, GtkTreeIter *to)
 {
 	gchar *handler;
-	gchar *userdata;
+	gchar *userdata, *support_warning;
 	gboolean after;
 	gboolean slot;
 	gboolean visible;
@@ -200,7 +200,7 @@ move_row (GtkTreeModel *model, GtkTreeIter *from, GtkTreeIter *to)
 	gboolean userdata_editable;
 	gboolean swapped;
 	gboolean swapped_visible;
-	gboolean bold, content;
+	gboolean bold, content, warn;
 
 	gtk_tree_model_get (model,                        from,
 			    GSE_COLUMN_HANDLER,           &handler,
@@ -215,6 +215,8 @@ move_row (GtkTreeModel *model, GtkTreeIter *from, GtkTreeIter *to)
 			    GSE_COLUMN_SWAPPED_VISIBLE,   &swapped_visible,
 			    GSE_COLUMN_BOLD,              &bold,
 			    GSE_COLUMN_CONTENT,           &content,
+			    GSE_COLUMN_WARN,              &warn,
+			    GSE_COLUMN_TOOLTIP,           &support_warning,
 			    -1);
 
 	gtk_tree_store_set (GTK_TREE_STORE (model),       to,
@@ -230,7 +232,11 @@ move_row (GtkTreeModel *model, GtkTreeIter *from, GtkTreeIter *to)
 			    GSE_COLUMN_SWAPPED_VISIBLE,   swapped_visible,
 			    GSE_COLUMN_BOLD,              bold,
 			    GSE_COLUMN_CONTENT,           content,
+			    GSE_COLUMN_WARN,              warn,
+			    GSE_COLUMN_TOOLTIP,           support_warning,
 			    -1);
+
+	g_free (support_warning);
 	g_free (handler);
 	g_free (userdata);
 }
@@ -789,7 +795,9 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
 		 G_TYPE_BOOLEAN,  /* Userdata editable  */
 		 G_TYPE_BOOLEAN,  /* New slot           */
 		 G_TYPE_BOOLEAN,  /* Mark with bold     */
-		 G_TYPE_BOOLEAN); /* Not a class title slot */ 
+		 G_TYPE_BOOLEAN,  /* Not a class title slot */ 
+		 G_TYPE_BOOLEAN,  /* Show a warning icon for the signal */ 
+		 G_TYPE_STRING);  /* A tooltip for the signal row */ 
 
 	model = GTK_TREE_MODEL (editor->model);
 
@@ -798,19 +806,35 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
 
 	view = GTK_TREE_VIEW (view_widget);
 
+	gtk_tree_view_set_tooltip_column (view, GSE_COLUMN_TOOLTIP);
+
 	/* the view now holds a reference, we can get rid of our own */
 	g_object_unref (G_OBJECT (editor->model));
 
 	/************************ signal column ************************/
+	column = gtk_tree_view_column_new ();
+	column_header_widget (column, _("Signal"), _("The name of the signal to connect to"));
+
  	renderer = gtk_cell_renderer_text_new ();
-	column = gtk_tree_view_column_new_with_attributes
-		(NULL, renderer, "text", GSE_COLUMN_SIGNAL, NULL);
+	gtk_tree_view_column_pack_start (column, renderer, FALSE);
+	gtk_tree_view_column_set_attributes (column, renderer, 
+					     "text", GSE_COLUMN_SIGNAL, 
+					     NULL);
 
-	column_header_widget (column, _("Signal"), _("The name of the signal to connect to"));
 
 	gtk_tree_view_column_set_cell_data_func (column, renderer,
 						 glade_signal_editor_signal_cell_data_func,
 						 NULL, NULL);
+
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	g_object_set (G_OBJECT (renderer), "icon-name", GTK_STOCK_DIALOG_WARNING, NULL);
+
+	gtk_tree_view_column_pack_end (column, renderer, FALSE);
+	gtk_tree_view_column_set_attributes (column, renderer, 
+					     "visible", GSE_COLUMN_WARN, 
+					     NULL);
+
  	gtk_tree_view_append_column (view, column);
 
 	/************************ handler column ************************/
@@ -823,6 +847,8 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
 		g_object_set (G_OBJECT (editor->handler_renderer),
 			      "model", editor->handler_store,
 			      "text-column", 0,
+			      "ellipsize", PANGO_ELLIPSIZE_END,
+			      "width-chars", 14,
 			      NULL);
 	}
 
@@ -848,6 +874,7 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
 							 NULL, NULL);
 	}
 
+ 	gtk_tree_view_column_set_resizable (editor->handler_column, TRUE);
  	gtk_tree_view_column_set_expand (editor->handler_column, TRUE);
  	gtk_tree_view_append_column (view, editor->handler_column);
 
@@ -899,6 +926,7 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
 						     NULL);
 	}
 
+ 	gtk_tree_view_column_set_resizable (editor->userdata_column, TRUE);
  	gtk_tree_view_column_set_expand (editor->userdata_column, TRUE);
  	gtk_tree_view_append_column (view, editor->userdata_column);
 
@@ -1040,6 +1068,14 @@ glade_signal_editor_new (gpointer *editor)
 	return signal_editor;
 }
 
+static void
+glade_signal_editor_refresh_support (GladeWidget *widget,
+				     GladeSignalEditor *editor)
+{
+	g_assert (editor->widget == widget);
+	glade_signal_editor_load_widget (editor, editor->widget);
+}
+
 /**
  * glade_signal_editor_load_widget:
  * @editor: a #GladeSignalEditor
@@ -1064,9 +1100,27 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
 
 	gtk_tree_store_clear (editor->model);
 
-	editor->widget = widget;
-	editor->adaptor = widget ? widget->adaptor : NULL;
-
+	if (editor->widget != widget)
+	{
+		if (editor->widget)
+		{
+			g_signal_handler_disconnect (editor->widget, editor->refresh_id);
+			editor->refresh_id = 0;
+			g_object_unref (editor->widget);
+		}
+		
+		editor->widget = widget;
+		editor->adaptor = widget ? widget->adaptor : NULL;
+		
+		if (editor->widget)
+		{
+			g_object_ref (editor->widget);
+			editor->refresh_id =
+				g_signal_connect (G_OBJECT (editor->widget), "support-changed",
+						  G_CALLBACK (glade_signal_editor_refresh_support), editor);
+		}
+	}
+	
 	if (!widget)
 		return;
 
@@ -1075,6 +1129,10 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
 	for (list = editor->adaptor->signals; list; list = list->next)
 	{
 		GladeSignalClass *signal = (GladeSignalClass *) list->data;
+		GladeSignal *sig = glade_signal_new (signal->name, NULL, NULL, FALSE, FALSE);
+
+		/* Check versioning here with a virtual signal */
+		glade_project_update_signal_support_warning (editor->widget, sig);
 
 		/* Add class name that this signal belongs to.
 		 */
@@ -1098,8 +1156,9 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
 
 		if (!signals || signals->len == 0)
 		{
+
 			gtk_tree_store_set
-				(editor->model,          &parent_signal,
+				(editor->model,              &parent_signal,
 				 GSE_COLUMN_SIGNAL,           signal->name,
 				 GSE_COLUMN_HANDLER,          HANDLER_DEFAULT,
 				 GSE_COLUMN_AFTER,            FALSE,
@@ -1112,6 +1171,8 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
 				 GSE_COLUMN_SLOT,             TRUE,
 				 GSE_COLUMN_USERDATA_SLOT,    TRUE,
 				 GSE_COLUMN_CONTENT,          TRUE,
+				 GSE_COLUMN_WARN,             sig->support_warning != NULL,
+				 GSE_COLUMN_TOOLTIP,          sig->support_warning,	
 				 -1);
 		}
 		else
@@ -1150,6 +1211,8 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
 				 widget_signal->userdata  ? FALSE : TRUE,
 				 GSE_COLUMN_BOLD,               TRUE, 
 				 GSE_COLUMN_CONTENT,            TRUE,
+				 GSE_COLUMN_WARN,               widget_signal->support_warning != NULL,
+				 GSE_COLUMN_TOOLTIP,            widget_signal->support_warning,
 				 -1);
 
 			for (i = 1; i < signals->len; i++)
@@ -1174,6 +1237,8 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
 					 GSE_COLUMN_USERDATA_SLOT,
 					 widget_signal->userdata  ? FALSE : TRUE,
 					 GSE_COLUMN_CONTENT,            TRUE,
+					 GSE_COLUMN_WARN,               widget_signal->support_warning != NULL,
+					 GSE_COLUMN_TOOLTIP,            widget_signal->support_warning,
 					 -1);
 			}
 
@@ -1192,8 +1257,13 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
 				 GSE_COLUMN_SLOT,             TRUE,
 				 GSE_COLUMN_USERDATA_SLOT,    TRUE,
 				 GSE_COLUMN_CONTENT,          TRUE,
+				 GSE_COLUMN_WARN,             sig->support_warning != NULL,
+				 GSE_COLUMN_TOOLTIP,          sig->support_warning,
 				 -1);
 		}
+
+		glade_signal_free (sig);
+
 	}
 
 	path_first = gtk_tree_path_new_first ();
diff --git a/gladeui/glade-signal-editor.h b/gladeui/glade-signal-editor.h
index 2278056..865da17 100644
--- a/gladeui/glade-signal-editor.h
+++ b/gladeui/glade-signal-editor.h
@@ -34,6 +34,9 @@ enum
 	GSE_COLUMN_SLOT, /* if this row contains a "<Type...>" label */
 	GSE_COLUMN_BOLD,
 	GSE_COLUMN_CONTENT,
+
+	GSE_COLUMN_WARN,
+	GSE_COLUMN_TOOLTIP,
 	GSE_NUM_COLUMNS
 };
 
@@ -59,6 +62,8 @@ struct _GladeSignalEditor
 	GtkCellRenderer *handler_renderer, *userdata_renderer;
 	GtkTreeViewColumn *handler_column, *userdata_column;
 	IsVoidFunc is_void_handler, is_void_userdata;
+
+	gulong refresh_id;
 };
 
 struct _GladeSignalEditorClass
diff --git a/gladeui/glade-signal.c b/gladeui/glade-signal.c
index 30d758e..d3849f6 100644
--- a/gladeui/glade-signal.c
+++ b/gladeui/glade-signal.c
@@ -48,7 +48,7 @@ GladeSignal *glade_signal_new (const gchar *name,
 			       gboolean     after,
 			       gboolean     swapped)
 {
-	GladeSignal *signal = g_new0 (GladeSignal, 1);
+	GladeSignal *signal = g_slice_new0 (GladeSignal);
 
 	signal->name     = g_strdup (name);
 	signal->handler  = g_strdup (handler);
@@ -73,7 +73,8 @@ glade_signal_free (GladeSignal *signal)
 	g_free (signal->name);
 	g_free (signal->handler);
 	g_free (signal->userdata);
-	g_free (signal);
+	g_free (signal->support_warning);
+	g_slice_free (GladeSignal, signal);
 }
 
 /**
@@ -89,7 +90,8 @@ glade_signal_equal (GladeSignal *sig1, GladeSignal *sig2)
 	gboolean ret = FALSE;
 	g_return_val_if_fail (GLADE_IS_SIGNAL (sig1), FALSE);
 	g_return_val_if_fail (GLADE_IS_SIGNAL (sig2), FALSE);
-	
+
+	/* Intentionally ignore support_warning */
 	if (!strcmp (sig1->name, sig2->name)        &&
 	    !strcmp (sig1->handler, sig2->handler)  &&
 	    sig1->after   == sig2->after            &&
@@ -113,14 +115,19 @@ glade_signal_equal (GladeSignal *sig1, GladeSignal *sig2)
 GladeSignal *
 glade_signal_clone (const GladeSignal *signal)
 {
-	g_return_val_if_fail (signal != NULL, NULL);
+	GladeSignal *dup;
+
+	g_return_val_if_fail (GLADE_IS_SIGNAL (signal), NULL);
 
-	return glade_signal_new (signal->name,
-				 signal->handler,
-				 signal->userdata,
-				 signal->after,
-				 signal->swapped);
+	dup = glade_signal_new (signal->name,
+				signal->handler,
+				signal->userdata,
+				signal->after,
+				signal->swapped);
 
+	glade_signal_set_support_warning (dup, signal->support_warning);
+	
+	return dup;
 }
 
 /**
@@ -220,3 +227,17 @@ glade_signal_read (GladeXmlNode *node)
 
 	return signal;
 }
+
+void
+glade_signal_set_support_warning (GladeSignal *signal,
+				  const gchar *support_warning)
+{
+	g_return_if_fail (GLADE_IS_SIGNAL (signal));
+
+	if (g_strcmp0 (signal->support_warning, support_warning))
+	{
+		g_free (signal->support_warning);
+		signal->support_warning = 
+			support_warning ? g_strdup (support_warning) : NULL;
+	}
+}
diff --git a/gladeui/glade-signal.h b/gladeui/glade-signal.h
index 42dd5eb..a60a463 100644
--- a/gladeui/glade-signal.h
+++ b/gladeui/glade-signal.h
@@ -17,6 +17,9 @@ struct _GladeSignal
 	gchar    *name;         /* Signal name eg "clicked"            */
 	gchar    *handler;      /* Handler function eg "gtk_main_quit" */
 	gchar    *userdata;     /* User data signal handler argument   */
+
+	gchar    *support_warning;/* Message to inform the user about signals introduced in future versions */
+	
 	guint8    after : 1;    /* Connect after TRUE or FALSE         */
 	guint8    swapped : 1;  /* Connect swapped TRUE or FALSE (GtkBuilder only) */
 };
@@ -39,6 +42,9 @@ void         glade_signal_write (GladeSignal        *signal,
 				 GladeXmlContext    *context,
 				 GladeXmlNode       *node);
 
+void         glade_signal_set_support_warning (GladeSignal *signal,
+					       const gchar *support_warning);
+
 G_END_DECLS
 
 #endif /* __GLADE_SIGNAL_H__ */
diff --git a/gladeui/glade-widget-adaptor.h b/gladeui/glade-widget-adaptor.h
index f4be4ba..fa7bc92 100644
--- a/gladeui/glade-widget-adaptor.h
+++ b/gladeui/glade-widget-adaptor.h
@@ -99,6 +99,37 @@ typedef struct _GladeWidgetAdaptorClass   GladeWidgetAdaptorClass;
 
 
 /**
+ * GWA_VERSION_CHECK:
+ * @adaptor: A #GladeWidgetAdaptor
+ * @major_version: The major version to check
+ * @minor_version: The minor version to check
+ *
+ * Evaluates to %TRUE if @adaptor is available in its owning library version- major_verion @minor_version.
+ *
+ */
+#define GWA_VERSION_CHECK(adaptor, major_version, minor_version)	\
+	((GWA_VERSION_SINCE_MAJOR (adaptor) == major_version) ? \
+	 (GWA_VERSION_SINCE_MINOR (adaptor) <= minor_version) : \
+	 (GWA_VERSION_SINCE_MAJOR (adaptor) <= major_version))
+
+
+
+/**
+ * GWA_BUILDER_VERSION_CHECK:
+ * @adaptor: A #GladeWidgetAdaptor
+ * @major_version: The major version to check
+ * @minor_version: The minor version to check
+ *
+ * Evaluates to %TRUE if @adaptor is available for use with GtkBuilder in its 
+ * owning library version- major_verion @minor_version.
+ *
+ */
+#define GWA_BUILDER_VERSION_CHECK(adaptor, major_version, minor_version) \
+	((GWA_BUILDER_SINCE_MAJOR (adaptor) == major_version) ? \
+	 (GWA_BUILDER_SINCE_MINOR (adaptor) <= minor_version) : \
+	 (GWA_BUILDER_SINCE_MAJOR (adaptor) <= major_version))
+
+/**
  * GWA_IS_TOPLEVEL:
  * @obj: A #GladeWidgetAdaptor
  *
@@ -172,6 +203,23 @@ typedef struct _GladeWidgetAdaptorClass   GladeWidgetAdaptorClass;
 #define GWA_GET_OCLASS(type) ((GObjectClass*)GWA_GET_CLASS(type))
 
 
+#define GLADE_SIGNAL_CLASS(klass) ((GladeSignalClass *)(klass))
+
+/**
+ * GSC_VERSION_CHECK:
+ * @klass: A #GladeSignalClass
+ * @major_version: The major version to check
+ * @minor_version: The minor version to check
+ *
+ * Evaluates to %TRUE if @klass is available in its owning library version- major_verion @minor_version.
+ *
+ */
+#define GSC_VERSION_CHECK(klass, major_version, minor_version)	\
+	((GLADE_SIGNAL_CLASS (klass)->version_since_major == major_version) ? \
+	 (GLADE_SIGNAL_CLASS (klass)->version_since_minor <= minor_version) : \
+	 (GLADE_SIGNAL_CLASS (klass)->version_since_major <= major_version))
+
+
 #define GLADE_VALID_CREATE_REASON(reason) (reason >= 0 && reason < GLADE_CREATE_REASONS)
 
 /**
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 61b8e77..24278e8 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -74,6 +74,7 @@ enum
 	BUTTON_PRESS_EVENT,
 	BUTTON_RELEASE_EVENT,
 	MOTION_NOTIFY_EVENT,
+	SUPPORT_CHANGED,
 	LAST_SIGNAL
 };
 
@@ -1257,6 +1258,24 @@ glade_widget_class_init (GladeWidgetClass *klass)
 			      glade_marshal_BOOLEAN__BOXED,
 			      G_TYPE_BOOLEAN, 1,
 			      GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+
+	/**
+	 * GladeWidget::support-changed:
+	 * @gladewidget: the #GladeWidget which received the signal.
+	 *
+	 * Emitted when property and signal support metadatas and messages
+	 * have been updated.
+	 */
+	glade_widget_signals[SUPPORT_CHANGED] =
+		g_signal_new ("support-changed",
+			      G_TYPE_FROM_CLASS (object_class),
+			      G_SIGNAL_RUN_LAST,
+			      0, NULL, NULL,
+			      g_cclosure_marshal_VOID__VOID,
+			      G_TYPE_NONE, 0);
+
+
 }
 
 /*******************************************************************************
@@ -4426,3 +4445,19 @@ glade_widget_unlock (GladeWidget    *widget)
 		g_list_remove (widget->lock->locked_widgets, widget);
 	widget->lock = NULL;
 }
+
+
+/**
+ * glade_widget_support_changed:
+ * @widget: A #GladeWidget
+ *
+ * Notifies that support metadata has changed on the widget.
+ *
+ */
+void
+glade_widget_support_changed (GladeWidget *widget)
+{
+	g_return_if_fail (GLADE_IS_WIDGET (widget));
+
+	g_signal_emit (widget, glade_widget_signals[SUPPORT_CHANGED], 0);
+}
diff --git a/gladeui/glade-widget.h b/gladeui/glade-widget.h
index 3a485e3..7cddce3 100644
--- a/gladeui/glade-widget.h
+++ b/gladeui/glade-widget.h
@@ -427,6 +427,8 @@ void                    glade_widget_lock                   (GladeWidget      *w
 							     GladeWidget      *locked);
 void                    glade_widget_unlock                 (GladeWidget      *widget);
 
+void                    glade_widget_support_changed        (GladeWidget      *widget);
+
 G_END_DECLS
 
 #endif /* __GLADE_WIDGET_H__ */



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