[glade3] * configure.ac, gladeui/glade-app.c: Added --enable-mac-bundle configure option to



commit 8dfa07101f94dd591b6722708478aea9270a6b76
Author: Tristan Van Berkom <vantr TheBully local>
Date:   Mon Jun 29 14:57:28 2009 -0400

    * configure.ac, gladeui/glade-app.c: Added --enable-mac-bundle configure option to
    special case runtime path lookups to bundling builds.
    
    * gladeui/glade-popup.[ch]: Added glade_popup_is_popup_event () to check the correct
    GdkEventButton state for a context menu (in a platform independant way).
    
    * gladeui/glade-base-editor.c, gladeui/glade-editor-property.c, gladeui/glade-palette-item.c,
    gladeui/glade-placeholder.c, gladeui/glade-widget.c, gladeui/glade-inspector.c: Use new
    popup function to detect whether to show a context menu or not (bug 587128).
    
    * gladeui/glade-base-editor.c: Fixed crashes with editable treeview column types (bug 586715).

 ChangeLog                       |   14 ++++++++++++++
 gladeui/Makefile.am             |    2 +-
 gladeui/glade-app.c             |    5 +++--
 gladeui/glade-base-editor.c     |   26 +++++++++++++-------------
 gladeui/glade-editor-property.c |    2 +-
 gladeui/glade-inspector.c       |    6 +-----
 gladeui/glade-palette-item.c    |    9 ++-------
 gladeui/glade-placeholder.c     |    8 +-------
 gladeui/glade-popup.c           |   13 +++++++++++++
 gladeui/glade-popup.h           |    3 +++
 gladeui/glade-widget-adaptor.c  |    1 -
 gladeui/glade-widget.c          |    7 +------
 12 files changed, 53 insertions(+), 43 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8824400..308ae75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2009-06-29  Tristan Van Berkom <tvb gnome org>
+
+	* configure.ac, gladeui/glade-app.c: Added --enable-mac-bundle configure option to
+	special case runtime path lookups to bundling builds.
+
+	* gladeui/glade-popup.[ch]: Added glade_popup_is_popup_event () to check the correct
+	GdkEventButton state for a context menu (in a platform independant way).
+
+	* gladeui/glade-base-editor.c, gladeui/glade-editor-property.c, gladeui/glade-palette-item.c,
+	gladeui/glade-placeholder.c, gladeui/glade-widget.c, gladeui/glade-inspector.c: Use new
+	popup function to detect whether to show a context menu or not (bug 587128).
+
+	* gladeui/glade-base-editor.c: Fixed crashes with editable treeview column types (bug 586715).
+
 2009-06-27  Tristan Van Berkom <tvb gnome org>
 
 	* plugins/gtk+/gtk+.xml.in, glade/gtk+/glade-gtk.c: Fixed GtkTextView crashes when
diff --git a/gladeui/Makefile.am b/gladeui/Makefile.am
index 007e2e5..6dff150 100644
--- a/gladeui/Makefile.am
+++ b/gladeui/Makefile.am
@@ -1,7 +1,6 @@
 
 common_defines = \
 	-DG_LOG_DOMAIN=\"GladeUI\"                      \
-	-DGLADE_PREFIX="\"$(prefix)\""			\
 	-DGLADE_DATADIR="\"$(pkgdatadir)\""		\
 	-DGLADE_LIBDIR="\"$(pkglibdir)\""		\
 	-DGLADE_CATALOGSDIR="\"$(pkgdatadir)/catalogs\""\
@@ -76,6 +75,7 @@ libgladeui_1_la_CPPFLAGS =  \
 
 libgladeui_1_la_CFLAGS =    \
 	$(GTK_CFLAGS)       \
+	$(IGE_MAC_BUNDLE_FLAG) \
 	$(IGE_MAC_CFLAGS)  \
 	$(WARN_CFLAGS)      \
 	$(AM_CFLAGS)
diff --git a/gladeui/glade-app.c b/gladeui/glade-app.c
index 53fbc6e..1295a11 100644
--- a/gladeui/glade-app.c
+++ b/gladeui/glade-app.c
@@ -366,12 +366,13 @@ glade_app_get_locale_dir (void)
 static void
 build_package_paths (void)
 {
-#if defined (MAC_INTEGRATION) || defined (G_OS_WIN32)
+#if defined (G_OS_WIN32) || (defined (MAC_INTEGRATION) && defined (MAC_BUNDLE))
 	gchar *prefix;
 
 # ifdef G_OS_WIN32
 	prefix = g_win32_get_package_installation_directory_of_module (NULL);
-# else /* MAC_INTEGRATION */	
+
+# else // defined (MAC_INTEGRATION) && defined (MAC_BUNDLE)
 	IgeMacBundle *bundle = ige_mac_bundle_get_default ();
 
 	prefix = g_build_filename (ige_mac_bundle_get_path (bundle), "Contents", "Resources", NULL);
diff --git a/gladeui/glade-base-editor.c b/gladeui/glade-base-editor.c
index 84b027a..c797a0d 100644
--- a/gladeui/glade-base-editor.c
+++ b/gladeui/glade-base-editor.c
@@ -34,6 +34,7 @@
 #include "glade-editor-property.h"
 #include "glade-base-editor.h"
 #include "glade-app.h"
+#include "glade-popup.h"
 #include "glade-accumulators.h"
 
 #include <string.h>
@@ -737,13 +738,13 @@ glade_base_editor_popup (GladeBaseEditor *editor,
 	gchar        *label;
 	gchar        *class_name;
 
+	if ((model = get_children_model_for_type (editor, G_OBJECT_TYPE (widget->parent->object))) == NULL)
+		model = get_children_model_for_type (editor, G_OBJECT_TYPE (editor->priv->gcontainer->object));
 
-	if ((model = get_children_model_for_child_type (editor, G_OBJECT_TYPE (widget->object))) == NULL)
-		return NULL;
-
+	g_assert (model);
+		
 	popup = gtk_menu_new ();
 
-
 	if (gtk_tree_model_get_iter_first (model, &iter))
 		do
 		{
@@ -813,11 +814,7 @@ glade_base_editor_popup_handler (GtkWidget *treeview,
 	GtkTreePath *path;
 	GtkWidget *popup;
 
-	if (event->button == 3 || 
-	    (event->button == 1 && 
-	     ((event->state & GDK_MOD1_MASK) != 0 ||
-	      (event->state & GDK_MOD2_MASK) != 0 ||
-	      (event->state & GDK_MOD2_MASK) != 0)))
+	if (glade_popup_is_popup_event (event))
 	{
 		if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (treeview),
 			(gint) event->x, (gint) event->y, &path, NULL, NULL, NULL))
@@ -1963,13 +1960,16 @@ glade_base_editor_add_default_properties (GladeBaseEditor *editor,
 	GtkWidget *label, *entry;
 	GtkTreeModel *child_class;
 	GtkCellRenderer *renderer;
-	GObject *child = glade_widget_get_object (gchild);
-	
+	GObject *parent, *child;
+
 	g_return_if_fail (GLADE_IS_BASE_EDITOR (editor));
 	g_return_if_fail (GLADE_IS_WIDGET (gchild));
 	g_return_if_fail (GLADE_IS_WIDGET (gchild->parent));
 
-	child_class = get_children_model_for_type (editor, G_OBJECT_TYPE (child));
+	child  = glade_widget_get_object (gchild);
+	parent = glade_widget_get_object (gchild->parent);
+
+	child_class = get_children_model_for_type (editor, G_OBJECT_TYPE (parent));
 	
 	/* Name */
 	label = gtk_label_new (_("Name :"));
@@ -1981,7 +1981,7 @@ glade_base_editor_add_default_properties (GladeBaseEditor *editor,
 	g_signal_connect (entry, "focus-out-event", G_CALLBACK (glade_base_editor_name_focus_out), gchild);
 	glade_base_editor_table_attach (editor, label, entry);
 
-	if (child_class)
+	if (child_class && gtk_tree_model_iter_n_children (child_class, NULL) > 1)
 	{
 		/* Type */
 		label = gtk_label_new (_("Type :"));
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index d51d999..55e6aa4 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -234,7 +234,7 @@ glade_editor_property_button_pressed (GtkWidget           *widget,
 				      GdkEventButton      *event,
 				      GladeEditorProperty *eprop)
 {
-	if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
+	if (glade_popup_is_popup_event (event))
 	{
 		glade_popup_property_pop (eprop->property, event);
 		return TRUE;
diff --git a/gladeui/glade-inspector.c b/gladeui/glade-inspector.c
index 11be2bf..05f63d3 100644
--- a/gladeui/glade-inspector.c
+++ b/gladeui/glade-inspector.c
@@ -920,11 +920,7 @@ button_press_cb (GtkWidget      *widget,
 
 	/* Give some kind of access in case of missing right button */
 	if (event->window == gtk_tree_view_get_bin_window (view) &&
-	    (event->button == 3 || 
-	     (event->button == 1 && 
-	      ((event->state & GDK_MOD1_MASK) != 0 ||
-	       (event->state & GDK_MOD2_MASK) != 0 ||
-	       (event->state & GDK_MOD2_MASK) != 0))))
+	    glade_popup_is_popup_event (event))
        	{
 		if (gtk_tree_view_get_path_at_pos (view, (gint) event->x, (gint) event->y,
 					   &path, NULL, 
diff --git a/gladeui/glade-palette-item.c b/gladeui/glade-palette-item.c
index 13eb7ff..56e21ca 100644
--- a/gladeui/glade-palette-item.c
+++ b/gladeui/glade-palette-item.c
@@ -337,17 +337,12 @@ static gboolean
 glade_palette_item_button_press (GtkWidget      *widget,
 				 GdkEventButton *event)
 {
-	/* Give some kind of access in case of missing right button */
-	if (!event->type == GDK_BUTTON_PRESS &&
-	    (event->button == 3 || 
-	     (event->button == 1 && 
-	      ((event->state & GDK_MOD1_MASK) != 0 ||
-	       (event->state & GDK_MOD2_MASK) != 0 ||
-	       (event->state & GDK_MOD2_MASK) != 0))))
+	if (glade_popup_is_popup_event (event))
 	{
 		GladePaletteItemPrivate *priv = GLADE_PALETTE_ITEM_GET_PRIVATE (widget);
 
 		glade_popup_palette_pop (priv->adaptor, event);
+		return TRUE;
 	}
 
 	return GTK_WIDGET_CLASS (glade_palette_item_parent_class)->button_press_event (widget, event);
diff --git a/gladeui/glade-placeholder.c b/gladeui/glade-placeholder.c
index fa7f26a..893a954 100644
--- a/gladeui/glade-placeholder.c
+++ b/gladeui/glade-placeholder.c
@@ -357,13 +357,7 @@ glade_placeholder_button_press (GtkWidget *widget, GdkEventButton *event)
 		}
 	}
 
-	/* Give some kind of access in case of missing right button */
-	if (!handled && event->type == GDK_BUTTON_PRESS &&
-	    (event->button == 3 || 
-	     (event->button == 1 && 
-	      ((event->state & GDK_MOD1_MASK) != 0 ||
-	       (event->state & GDK_MOD2_MASK) != 0 ||
-	       (event->state & GDK_MOD2_MASK) != 0))))
+	if (!handled && glade_popup_is_popup_event (event))
 	{
 		glade_popup_placeholder_pop (placeholder, event);
 		handled = TRUE;
diff --git a/gladeui/glade-popup.c b/gladeui/glade-popup.c
index ddbe12a..67ba7f4 100644
--- a/gladeui/glade-popup.c
+++ b/gladeui/glade-popup.c
@@ -18,6 +18,7 @@
  *
  * Authors:
  *   Chema Celorio <chema celorio com>
+ *   Tristan Van Berkom <tvb gnome org>
  */
 
 #ifdef HAVE_CONFIG_H
@@ -797,3 +798,15 @@ glade_popup_simple_pop (GdkEventButton *event)
 		NULL, NULL, button, event_time);
 }
 
+gboolean
+glade_popup_is_popup_event (GdkEventButton *event)
+{
+	g_return_val_if_fail (event, FALSE);
+
+#ifdef MAC_INTEGRATION
+	return (event->type == GDK_BUTTON_PRESS && event->button == 1 && ((event->state & GDK_MOD1_MASK) != 0));
+#else
+	return (event->type == GDK_BUTTON_PRESS && event->button == 3);
+#endif
+}
+
diff --git a/gladeui/glade-popup.h b/gladeui/glade-popup.h
index 82f59e7..77fdb03 100644
--- a/gladeui/glade-popup.h
+++ b/gladeui/glade-popup.h
@@ -27,6 +27,9 @@ void glade_popup_simple_pop           (GdkEventButton *event);
 void glade_popup_property_pop         (GladeProperty  *property,
 				       GdkEventButton *event);
 
+
+gboolean glade_popup_is_popup_event   (GdkEventButton *event);
+
 G_END_DECLS
 
 #endif /* __GLADE_POPUP_H__ */
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index a47bd04..9daa6bf 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -905,7 +905,6 @@ glade_widget_adaptor_object_read_widget (GladeWidgetAdaptor *adaptor,
 	}
 	g_list_free (read_properties);
 
-	
 	/* Read in the signals */
 	for (iter_node = glade_xml_node_get_children (node); 
 	     iter_node; iter_node = glade_xml_node_next (iter_node))
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 2e216db..7d31616 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -335,12 +335,7 @@ glade_widget_button_press_event_impl (GladeWidget    *gwidget,
 	}
 
 	/* Give some kind of access in case of missing right button */
-	if (!handled &&
-	    (event->button == 3 || 
-	     (event->button == 1 && 
-	      ((event->state & GDK_MOD1_MASK) != 0 ||
-	       (event->state & GDK_MOD2_MASK) != 0 ||
-	       (event->state & GDK_MOD2_MASK) != 0))))
+	if (!handled && glade_popup_is_popup_event (event))
        	{
 			glade_popup_widget_pop (gwidget, event, TRUE);
 			handled = TRUE;



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