diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2018-02-28 21:19:01 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2018-02-28 21:23:16 -0300 |
commit | 667f255a53820815117358e7e96641d49f4522dd (patch) | |
tree | c80949a8bd00014350bea349332728b624955e48 | |
parent | ebd3634c85465ee27f345cd904704ce5379d6d4a (diff) | |
download | glade-667f255a53820815117358e7e96641d49f4522dd.tar.gz |
Revert "GladeWidgetAdaptor: fix glade_widget_adaptor_get_parent_adaptor()"
This reverts commit b9763bfada7c9ecc2532563a97c387f8c20962b5.
Revert "GtkPopover: rework support code to fix bugs and warnings"
This reverts commit d2bedbab24c64198b373345e973d00e1f9fdc33c.
-rw-r--r-- | gladeui/glade-widget-adaptor.c | 16 | ||||
-rw-r--r-- | plugins/gtk+/glade-gtk-popover.c | 84 | ||||
-rw-r--r-- | plugins/gtk+/gtk+.xml.in | 11 |
3 files changed, 25 insertions, 86 deletions
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c index afa5749e..f7854989 100644 --- a/gladeui/glade-widget-adaptor.c +++ b/gladeui/glade-widget-adaptor.c @@ -297,7 +297,7 @@ glade_widget_adaptor_get_parent_adaptor (GladeWidgetAdaptor *adaptor) { g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL); - return glade_widget_adaptor_get_parent_adaptor_by_type (adaptor->priv->real_type); + return glade_widget_adaptor_get_parent_adaptor_by_type (adaptor->priv->type); } gboolean @@ -2709,21 +2709,7 @@ glade_widget_adaptor_from_catalog (GladeCatalog *catalog, glade_xml_get_property_string (class_node, GLADE_TAG_GET_TYPE_FUNCTION)) != NULL) { - GType real_type; - object_type = glade_util_get_type_from_name (func_name, TRUE); - real_type = g_type_from_name (name); - - if (object_type != G_TYPE_INVALID && !g_type_is_a (object_type, real_type)) - { - g_warning ("Trying to define class '%s' with %s() function. " - "But it returns a non derived class %s", - name, func_name, g_type_name (object_type)); - g_free (name); - g_free (func_name); - return NULL; - } - g_free (func_name); } else diff --git a/plugins/gtk+/glade-gtk-popover.c b/plugins/gtk+/glade-gtk-popover.c index 8a88f8ee..82f00563 100644 --- a/plugins/gtk+/glade-gtk-popover.c +++ b/plugins/gtk+/glade-gtk-popover.c @@ -27,68 +27,6 @@ #include "glade-popover-editor.h" -#define GLADE_TYPE_GTK_POPOVER glade_gtk_popover_get_type () -G_DECLARE_FINAL_TYPE (GladeGtkPopover, glade_gtk_popover, GLADE, GTK_POPOVER, GtkPopover) - -struct _GladeGtkPopover -{ - GtkPopover parent_instance; -}; - -G_DEFINE_TYPE (GladeGtkPopover, glade_gtk_popover, GTK_TYPE_POPOVER) - -static void -glade_gtk_popover_init (GladeGtkPopover *popover) -{ - gtk_popover_set_modal (GTK_POPOVER (popover), FALSE); - gtk_popover_set_relative_to (GTK_POPOVER (popover), NULL); -} - -static void -glade_gtk_popover_map (GtkWidget *widget) -{ - GtkWidgetClass *klass = g_type_class_peek_parent (glade_gtk_popover_parent_class); - klass->map (widget); -} - -static void -glade_gtk_popover_unmap (GtkWidget *widget) -{ - GtkWidgetClass *klass = g_type_class_peek_parent (glade_gtk_popover_parent_class); - klass->unmap (widget); -} - -static gboolean -glade_gtk_popover_button_event (GtkWidget *widget, GdkEventButton *event) -{ - return TRUE; -} - -static gint -glade_gtk_popover_key_press_event (GtkWidget *popover, GdkEventKey *event) -{ - if (event->keyval == GDK_KEY_Escape) - return TRUE; - - return FALSE; -} - -static void -glade_gtk_popover_class_init (GladeGtkPopoverClass *klass) -{ - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - /* Ignore some events causing the popover to disappear from the workspace */ - widget_class->key_press_event = glade_gtk_popover_key_press_event; - widget_class->button_press_event = glade_gtk_popover_button_event; - widget_class->button_release_event = glade_gtk_popover_button_event; - - /* Make some warning go away */ - widget_class->map = glade_gtk_popover_map; - widget_class->unmap = glade_gtk_popover_unmap; -} - - GObject * glade_gtk_popover_constructor (GType type, guint n_construct_properties, @@ -118,3 +56,25 @@ glade_gtk_popover_create_editable (GladeWidgetAdaptor * adaptor, return GWA_GET_CLASS (GTK_TYPE_CONTAINER)->create_editable (adaptor, type); } +static gint +popover_key_press (GtkWidget *popover, + GdkEventKey *event, + gpointer user_data) +{ + if (event->keyval == GDK_KEY_Escape) + return TRUE; + + return FALSE; +} + +void +glade_gtk_popover_post_create (GladeWidgetAdaptor * adaptor, + GObject *popover, GladeCreateReason reason) +{ + /* Ignore some events causing the popover to disappear from the workspace + */ + g_signal_connect (popover, "key-press-event", + G_CALLBACK (popover_key_press), NULL); + + GWA_GET_CLASS (GTK_TYPE_CONTAINER)->post_create (adaptor, popover, reason); +} diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in index 80030e1f..29d72515 100644 --- a/plugins/gtk+/gtk+.xml.in +++ b/plugins/gtk+/gtk+.xml.in @@ -3042,8 +3042,6 @@ <property id="menu-model" disabled="True"/> <property id="popup" ignore="True"/> <property id="align-widget" ignore="True"/> - <property id="popover" ignore="True" since="3.12"/> - <property id="use-popover" ignore="True" since="3.12"/> </properties> </glade-widget-class> @@ -3509,18 +3507,13 @@ </packing-properties> </glade-widget-class> - <glade-widget-class name="GtkPopover" - get-type-function="glade_gtk_popover_get_type" - generic-name="popover" - _title="Popover" - toplevel="True" - since="3.12"> + <glade-widget-class name="GtkPopover" generic-name="popover" _title="Popover" toplevel="True" since="3.12"> <constructor-function>glade_gtk_popover_constructor</constructor-function> <create-editable-function>glade_gtk_popover_create_editable</create-editable-function> + <post-create-function>glade_gtk_popover_post_create</post-create-function> <properties> <property id="visible" default="False"/> <property id="relative-to" ignore="True" custom-layout="True"/> - <property id="pointing-to" disabled="True"/> <property id="constrain-to" ignore="True" custom-layout="True" since="3.20"> <displayable-values> <!-- GtkPopoverConstraint enumeration value --> |