[glade/glade-3-20] Revert "Gtk+ plugin: fix GtkPopoverMenu support"
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/glade-3-20] Revert "Gtk+ plugin: fix GtkPopoverMenu support"
- Date: Thu, 1 Mar 2018 00:23:55 +0000 (UTC)
commit a861a469c396071e1a8cae28dc7880eb34e6415d
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Wed Feb 28 21:20:29 2018 -0300
Revert "Gtk+ plugin: fix GtkPopoverMenu support"
This reverts commit 9f1b36c9bd61dab87af34b3793408c3047ce5e33.
Revert "Gtk+ plugin: reworked popover adaptor to share class wrapper with derived types"
This reverts commit 72e2b9757252d85e5dd905b4fe029d5501d1257d.
Revert "GladeWidgetAdaptor: add GWA_GET_PARENT() macro"
This reverts commit bdd2925b8e81d0b59fd3ea8627cb5a3f2fb9bbda.
Revert "GladeWidgetAdaptor: fix glade_widget_adaptor_get_parent_adaptor()"
This reverts commit 2405795a80c95a4e1002b41e94265e4d9d23ed7a.
Revert "GtkPopover: rework support code to fix bugs and warnings"
This reverts commit 778a63da58e5acd8ad5a8614306733bcc33e8ed0.
gladeui/glade-widget-adaptor.c | 16 +-----
gladeui/glade-widget-adaptor.h | 10 ---
plugins/gtk+/Makefile.am | 1 -
plugins/gtk+/glade-gtk-popover-menu.c | 44 +++++++--------
plugins/gtk+/glade-gtk-popover.c | 98 ++++++++-------------------------
plugins/gtk+/glade-gtk-popover.h | 34 -----------
plugins/gtk+/gtk+.xml.in | 20 +-----
7 files changed, 48 insertions(+), 175 deletions(-)
---
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index a174480..d9ada45 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -309,7 +309,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
@@ -2711,21 +2711,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/gladeui/glade-widget-adaptor.h b/gladeui/glade-widget-adaptor.h
index b613472..7461c42 100644
--- a/gladeui/glade-widget-adaptor.h
+++ b/gladeui/glade-widget-adaptor.h
@@ -132,16 +132,6 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
GLADE_WIDGET_ADAPTOR_GET_CLASS (glade_widget_adaptor_get_by_type(type)))
/**
- * GWA_GET_PARENT:
- * @adaptor: A #GladeWidgetAdaptor
- *
- * Shorthand for referencing glade adaptor parent class from
- * the plugin eg. GWA_GET_PARENT (adaptor)->post_create (adaptor...
- */
-#define GWA_GET_PARENT(adaptor) \
- (GLADE_WIDGET_ADAPTOR_GET_CLASS (glade_widget_adaptor_get_parent_adaptor(adaptor)))
-
-/**
* GWA_GET_OCLASS:
* @type: A #GType.
*
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index a3fcbad..4390c7e 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -207,7 +207,6 @@ noinst_HEADERS = \
glade-gtk-dialog.h \
glade-gtk-frame.h \
glade-gtk-image.h \
- glade-gtk-popover.h \
glade-gtk-menu-shell.h \
glade-gtk-notebook.h \
glade-gtk-tree-view.h \
diff --git a/plugins/gtk+/glade-gtk-popover-menu.c b/plugins/gtk+/glade-gtk-popover-menu.c
index a1287f3..76e72d5 100644
--- a/plugins/gtk+/glade-gtk-popover-menu.c
+++ b/plugins/gtk+/glade-gtk-popover-menu.c
@@ -25,29 +25,25 @@
#include <glib/gi18n-lib.h>
#include <gladeui/glade.h>
-#include "glade-gtk-popover.h"
#include "glade-popover-menu-editor.h"
-#define GLADE_TYPE_GTK_POPOVER_MENU glade_gtk_popover_menu_get_type ()
-G_DECLARE_FINAL_TYPE (GladeGtkPopoverMenu, glade_gtk_popover_menu, GLADE, GTK_POPOVER_MENU, GtkPopoverMenu)
-
-struct _GladeGtkPopoverMenu
+GObject *
+glade_gtk_popover_menu_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam * construct_properties)
{
- GtkPopover parent_instance;
-};
+ GladeWidgetAdaptor *adaptor;
+ GObject *ret_obj;
-G_DEFINE_TYPE (GladeGtkPopoverMenu, glade_gtk_popover_menu, GTK_TYPE_POPOVER_MENU)
+ ret_obj = GWA_GET_OCLASS (GTK_TYPE_CONTAINER)->constructor
+ (type, n_construct_properties, construct_properties);
-static void
-glade_gtk_popover_menu_init (GladeGtkPopoverMenu *popover)
-{
- glade_gtk_popover_init_common (popover);
-}
+ adaptor = GLADE_WIDGET_ADAPTOR (ret_obj);
-static void
-glade_gtk_popover_menu_class_init (GladeGtkPopoverMenuClass *klass)
-{
- glade_gtk_popover_class_init_common (klass);
+ glade_widget_adaptor_action_remove (adaptor, "add_parent");
+ glade_widget_adaptor_action_remove (adaptor, "remove_parent");
+
+ return ret_obj;
}
static void
@@ -203,7 +199,7 @@ glade_gtk_popover_menu_post_create (GladeWidgetAdaptor *adaptor,
g_signal_connect (container, "notify::visible-submenu",
G_CALLBACK (glade_gtk_popover_menu_visible_submenu_changed), NULL);
- GWA_GET_PARENT (adaptor)->post_create (adaptor, container, reason);
+ GWA_GET_CLASS (GTK_TYPE_POPOVER)->post_create (adaptor, container, reason);
}
void
@@ -433,7 +429,7 @@ glade_gtk_popover_menu_set_property (GladeWidgetAdaptor * adaptor,
else if (!strcmp (id, "current"))
glade_gtk_popover_menu_set_current (object, value);
else
- GWA_GET_PARENT (adaptor)->set_property (adaptor, object, id, value);
+ GWA_GET_CLASS (GTK_TYPE_POPOVER)->set_property (adaptor, object, id, value);
}
void
@@ -453,7 +449,7 @@ glade_gtk_popover_menu_get_property (GladeWidgetAdaptor * adaptor,
g_value_set_int (value, get_visible_child (GTK_POPOVER_MENU (object), NULL));
}
else
- GWA_GET_PARENT (adaptor)->get_property (adaptor, object, id, value);
+ GWA_GET_CLASS (GTK_TYPE_POPOVER)->get_property (adaptor, object, id, value);
}
static gboolean
@@ -491,8 +487,8 @@ glade_gtk_popover_menu_verify_property (GladeWidgetAdaptor * adaptor,
return glade_gtk_popover_menu_verify_submenus (object, value);
else if (!strcmp (id, "current"))
return glade_gtk_popover_menu_verify_current (object, value);
- else if (GWA_GET_PARENT (adaptor)->verify_property)
- return GWA_GET_PARENT (adaptor)->verify_property (adaptor, object, id, value);
+ else if (GWA_GET_CLASS (GTK_TYPE_POPOVER)->verify_property)
+ return GWA_GET_CLASS (GTK_TYPE_POPOVER)->verify_property (adaptor, object, id, value);
return TRUE;
}
@@ -560,7 +556,7 @@ glade_gtk_popover_menu_set_child_property (GladeWidgetAdaptor * adaptor,
gtk_container_child_set_property (GTK_CONTAINER (container),
GTK_WIDGET (child), id, value);
else
- GWA_GET_PARENT (adaptor)->child_set_property (adaptor, container, child, id, value);
+ GWA_GET_CLASS (GTK_TYPE_POPOVER)->child_set_property (adaptor, container, child, id, value);
}
void
@@ -581,6 +577,6 @@ glade_gtk_popover_menu_create_editable (GladeWidgetAdaptor * adaptor,
if (type == GLADE_PAGE_GENERAL)
return (GladeEditable *) glade_popover_menu_editor_new ();
else
- return GWA_GET_PARENT (adaptor)->create_editable (adaptor, type);
+ return GWA_GET_CLASS (GTK_TYPE_POPOVER)->create_editable (adaptor, type);
}
diff --git a/plugins/gtk+/glade-gtk-popover.c b/plugins/gtk+/glade-gtk-popover.c
index a251307..82f0056 100644
--- a/plugins/gtk+/glade-gtk-popover.c
+++ b/plugins/gtk+/glade-gtk-popover.c
@@ -23,84 +23,10 @@
#include <config.h>
#include <glib/gi18n-lib.h>
+#include <gladeui/glade.h>
-#include "glade-gtk-popover.h"
#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)
-
-void
-glade_gtk_popover_init_common (gpointer popover)
-{
- gtk_popover_set_modal (GTK_POPOVER (popover), FALSE);
- gtk_popover_set_relative_to (GTK_POPOVER (popover), NULL);
-}
-
-static void
-glade_gtk_popover_init (GladeGtkPopover *popover)
-{
- glade_gtk_popover_init_common (popover);
-}
-
-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;
-}
-
-void
-glade_gtk_popover_class_init_common (gpointer 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;
-}
-
-static void
-glade_gtk_popover_class_init (GladeGtkPopoverClass *klass)
-{
- glade_gtk_popover_class_init_common (klass);
-}
-
-
GObject *
glade_gtk_popover_constructor (GType type,
guint n_construct_properties,
@@ -130,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 1894ab9..6ca5fca 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -3008,8 +3008,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>
@@ -3473,18 +3471,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 -->
@@ -3499,12 +3492,8 @@
</properties>
</glade-widget-class>
- <glade-widget-class name="GtkPopoverMenu"
- get-type-function="glade_gtk_popover_menu_get_type"
- generic-name="popovermenu"
- _title="Popover Menu"
- toplevel="True"
- since="3.16">
+ <glade-widget-class name="GtkPopoverMenu" generic-name="popovermenu" _title="Popover Menu"
toplevel="True" since="3.16">
+ <constructor-function>glade_gtk_popover_menu_constructor</constructor-function>
<create-editable-function>glade_gtk_popover_menu_create_editable</create-editable-function>
<post-create-function>glade_gtk_popover_menu_post_create</post-create-function>
<add-child-function>glade_gtk_popover_menu_add_child</add-child-function>
@@ -3519,7 +3508,6 @@
<properties>
<property id="visible" default="False"/>
<property id="visible-submenu" disabled="True"/>
- <property id="pointing-to" disabled="True"/>
<property id="submenus" _name="Number of submenus" save="False" default="1" custom-layout="True">
<parameter-spec>
<type>GParamInt</type>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]