[glade] Removed the new GladePropertyEditor iface
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] Removed the new GladePropertyEditor iface
- Date: Sat, 13 Apr 2013 17:50:48 +0000 (UTC)
commit e13581f60c133c20156c06c623b6e06718eae2fc
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sat Apr 13 19:41:49 2013 +0900
Removed the new GladePropertyEditor iface
Now just use GladeEditable everywhere (for property labels, editors and shells).
gladeui/Makefile.am | 2 --
gladeui/glade-editable.c | 24 +--------------
gladeui/glade-editor-property.c | 34 ++++++++++++++-------
gladeui/glade-editor-skeleton.c | 19 ++++++------
gladeui/glade-editor-skeleton.h | 4 +--
gladeui/glade-property-editor.c | 66 -----------------------------------------
gladeui/glade-property-editor.h | 34 ---------------------
gladeui/glade-property-label.c | 35 +++++++++++++++-------
gladeui/glade-property-shell.c | 39 ++++++++++++++++--------
9 files changed, 86 insertions(+), 171 deletions(-)
---
diff --git a/gladeui/Makefile.am b/gladeui/Makefile.am
index eef3ff3..543206c 100644
--- a/gladeui/Makefile.am
+++ b/gladeui/Makefile.am
@@ -103,7 +103,6 @@ libgladeui_2_la_SOURCES = \
glade-project.c \
glade-property.c \
glade-property-class.c \
- glade-property-editor.c \
glade-property-label.c \
glade-property-shell.c \
glade-signal.c \
@@ -158,7 +157,6 @@ libgladeuiinclude_HEADERS = \
glade-project.h \
glade-property.h \
glade-property-class.h \
- glade-property-editor.h \
glade-property-label.h \
glade-property-shell.h \
glade-signal.h \
diff --git a/gladeui/glade-editable.c b/gladeui/glade-editable.c
index 2adc96d..d205c39 100644
--- a/gladeui/glade-editable.c
+++ b/gladeui/glade-editable.c
@@ -33,30 +33,8 @@
#include "glade-project.h"
#include "glade-widget.h"
#include "glade-editable.h"
-#include "glade-property-editor.h"
-
-static void glade_editable_property_editor_init (GladePropertyEditorInterface *iface);
-
-G_DEFINE_INTERFACE_WITH_CODE (GladeEditable, glade_editable, GTK_TYPE_WIDGET,
- G_IMPLEMENT_INTERFACE (GLADE_TYPE_PROPERTY_EDITOR,
- glade_editable_property_editor_init));
-
-/*******************************************************************************
- * GladePropertyEditorInterface *
- *******************************************************************************/
-static void
-glade_editable_property_editor_load (GladePropertyEditor *editor,
- GladeWidget *widget)
-{
- glade_editable_load (GLADE_EDITABLE (editor), widget);
-}
-
-static void
-glade_editable_property_editor_init (GladePropertyEditorInterface *iface)
-{
- iface->load = glade_editable_property_editor_load;
-}
+G_DEFINE_INTERFACE (GladeEditable, glade_editable, GTK_TYPE_WIDGET);
static GQuark glade_editable_project_quark = 0;
static GQuark glade_editable_widget_quark = 0;
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index 4b7ad3b..19c41fa 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -40,7 +40,7 @@
#include "glade.h"
#include "glade-widget.h"
-#include "glade-property-editor.h"
+#include "glade-editable.h"
#include "glade-editor-property.h"
#include "glade-property-label.h"
#include "glade-property.h"
@@ -106,26 +106,40 @@ struct _GladeEditorPropertyPrivate
guint disable_check : 1; /* Whether to explicitly disable the optional check button */
};
-static void glade_editor_property_property_editor_init (GladePropertyEditorInterface *iface);
+static void glade_editor_property_editable_init (GladeEditableIface *iface);
+
+static GladeEditableIface *parent_editable_iface;
G_DEFINE_TYPE_WITH_CODE (GladeEditorProperty, glade_editor_property, GTK_TYPE_BOX,
- G_IMPLEMENT_INTERFACE (GLADE_TYPE_PROPERTY_EDITOR,
- glade_editor_property_property_editor_init));
+ G_IMPLEMENT_INTERFACE (GLADE_TYPE_EDITABLE,
+ glade_editor_property_editable_init));
+
/*******************************************************************************
- * GladePropertyEditorInterface *
+ * GladeEditableIface *
*******************************************************************************/
static void
-glade_editor_property_property_editor_load (GladePropertyEditor *editor,
- GladeWidget *widget)
+glade_editor_property_editable_load (GladeEditable *editable,
+ GladeWidget *widget)
+{
+ /* Chain up to default implementation */
+ parent_editable_iface->load (editable, widget);
+
+ glade_editor_property_load_by_widget (GLADE_EDITOR_PROPERTY (editable), widget);
+}
+
+static void
+glade_editor_property_set_show_name (GladeEditable * editable, gboolean show_name)
{
- glade_editor_property_load_by_widget (GLADE_EDITOR_PROPERTY (editor), widget);
}
static void
-glade_editor_property_property_editor_init (GladePropertyEditorInterface *iface)
+glade_editor_property_editable_init (GladeEditableIface * iface)
{
- iface->load = glade_editor_property_property_editor_load;
+ parent_editable_iface = g_type_default_interface_peek (GLADE_TYPE_EDITABLE);
+
+ iface->load = glade_editor_property_editable_load;
+ iface->set_show_name = glade_editor_property_set_show_name;
}
/*******************************************************************************
diff --git a/gladeui/glade-editor-skeleton.c b/gladeui/glade-editor-skeleton.c
index 20c8578..4897142 100644
--- a/gladeui/glade-editor-skeleton.c
+++ b/gladeui/glade-editor-skeleton.c
@@ -107,9 +107,9 @@ glade_editor_skeleton_load (GladeEditable *editable,
for (l = priv->editors; l; l = l->next)
{
- GladePropertyEditor *editor = l->data;
+ GladeEditable *editor = l->data;
- glade_property_editor_load (editor, widget);
+ glade_editable_load (editor, widget);
}
}
@@ -122,10 +122,9 @@ glade_editor_skeleton_set_show_name (GladeEditable * editable, gboolean show_nam
for (l = priv->editors; l; l = l->next)
{
- GladePropertyEditor *editor = l->data;
+ GladeEditable *editor = l->data;
- if (GLADE_IS_EDITABLE (editor))
- glade_editable_set_show_name (GLADE_EDITABLE (editor), show_name);
+ glade_editable_set_show_name (editor, show_name);
}
}
@@ -229,12 +228,12 @@ glade_editor_skeleton_custom_finished (GtkBuildable *buildable,
object = gtk_builder_get_object (builder, id);
- if (!GLADE_IS_PROPERTY_EDITOR (object))
- g_warning ("Object '%s' is not a property editor\n",
+ if (!GLADE_EDITABLE (object))
+ g_warning ("Object '%s' is not a GladeEditable\n",
object ? G_OBJECT_TYPE_NAME (object) : "(null)");
else
glade_editor_skeleton_add_editor (GLADE_EDITOR_SKELETON (buildable),
- GLADE_PROPERTY_EDITOR (object));
+ GLADE_EDITABLE (object));
}
g_slist_free_full (editor_data->editors, g_free);
@@ -260,12 +259,12 @@ glade_editor_skeleton_new (void)
void
glade_editor_skeleton_add_editor (GladeEditorSkeleton *skeleton,
- GladePropertyEditor *editor)
+ GladeEditable *editor)
{
GladeEditorSkeletonPrivate *priv;
g_return_if_fail (GLADE_IS_EDITOR_SKELETON (skeleton));
- g_return_if_fail (GLADE_IS_PROPERTY_EDITOR (editor));
+ g_return_if_fail (GLADE_IS_EDITABLE (editor));
priv = skeleton->priv;
diff --git a/gladeui/glade-editor-skeleton.h b/gladeui/glade-editor-skeleton.h
index fb478f4..7ab1ef7 100644
--- a/gladeui/glade-editor-skeleton.h
+++ b/gladeui/glade-editor-skeleton.h
@@ -23,7 +23,7 @@
#include <gtk/gtk.h>
#include <gladeui/glade-xml-utils.h>
-#include <gladeui/glade-property-editor.h>
+#include <gladeui/glade-editable.h>
G_BEGIN_DECLS
@@ -55,7 +55,7 @@ GType glade_editor_skeleton_get_type (void) G_GNUC_CONST;
GtkWidget *glade_editor_skeleton_new (void);
void glade_editor_skeleton_add_editor (GladeEditorSkeleton *skeleton,
- GladePropertyEditor *editor);
+ GladeEditable *editor);
G_END_DECLS
diff --git a/gladeui/glade-property-label.c b/gladeui/glade-property-label.c
index 0b57557..f6a6f01 100644
--- a/gladeui/glade-property-label.c
+++ b/gladeui/glade-property-label.c
@@ -28,7 +28,7 @@
#include "glade.h"
#include "glade-widget.h"
#include "glade-popup.h"
-#include "glade-property-editor.h"
+#include "glade-editable.h"
#include "glade-property-label.h"
/* GObjectClass */
@@ -47,8 +47,8 @@ static void glade_property_label_get_real_property (GObject *object
static gint glade_property_label_button_press (GtkWidget *widget,
GdkEventButton *event);
-/* GladePropertyEditorInterface */
-static void glade_property_label_property_editor_init (GladePropertyEditorInterface *iface);
+/* GladeEditableIface */
+static void glade_property_label_editable_init (GladeEditableIface *iface);
struct _GladePropertyLabelPrivate
{
@@ -79,9 +79,11 @@ enum {
PROP_CUSTOM_TOOLTIP,
};
+static GladeEditableIface *parent_editable_iface;
+
G_DEFINE_TYPE_WITH_CODE (GladePropertyLabel, glade_property_label, GTK_TYPE_EVENT_BOX,
- G_IMPLEMENT_INTERFACE (GLADE_TYPE_PROPERTY_EDITOR,
- glade_property_label_property_editor_init));
+ G_IMPLEMENT_INTERFACE (GLADE_TYPE_EDITABLE,
+ glade_property_label_editable_init));
static void
glade_property_label_init (GladePropertyLabel *label)
@@ -236,16 +238,19 @@ glade_property_label_get_real_property (GObject *object,
}
/*******************************************************************************
- * GladePropertyEditorInterface *
+ * GladeEditableIface *
*******************************************************************************/
static void
-glade_property_label_property_editor_load (GladePropertyEditor *editor,
- GladeWidget *widget)
+glade_property_label_load (GladeEditable *editable,
+ GladeWidget *widget)
{
- GladePropertyLabel *label = GLADE_PROPERTY_LABEL (editor);
+ GladePropertyLabel *label = GLADE_PROPERTY_LABEL (editable);
GladePropertyLabelPrivate *priv;
GladeProperty *property;
+ /* Chain up to default implementation */
+ parent_editable_iface->load (editable, widget);
+
g_return_if_fail (label->priv->property_name != NULL);
priv = label->priv;
@@ -264,9 +269,17 @@ glade_property_label_property_editor_load (GladePropertyEditor *editor,
}
static void
-glade_property_label_property_editor_init (GladePropertyEditorInterface *iface)
+glade_property_label_set_show_name (GladeEditable * editable, gboolean show_name)
{
- iface->load = glade_property_label_property_editor_load;
+}
+
+static void
+glade_property_label_editable_init (GladeEditableIface * iface)
+{
+ parent_editable_iface = g_type_default_interface_peek (GLADE_TYPE_EDITABLE);
+
+ iface->load = glade_property_label_load;
+ iface->set_show_name = glade_property_label_set_show_name;
}
/***********************************************************
diff --git a/gladeui/glade-property-shell.c b/gladeui/glade-property-shell.c
index 5a73de4..768e0a8 100644
--- a/gladeui/glade-property-shell.c
+++ b/gladeui/glade-property-shell.c
@@ -28,7 +28,7 @@
#include "glade.h"
#include "glade-widget.h"
#include "glade-popup.h"
-#include "glade-property-editor.h"
+#include "glade-editable.h"
#include "glade-property-shell.h"
/* GObjectClass */
@@ -42,8 +42,8 @@ static void glade_property_shell_get_real_property (GObject *object
GValue *value,
GParamSpec *pspec);
-/* GladePropertyEditorInterface */
-static void glade_property_shell_property_editor_init (GladePropertyEditorInterface *iface);
+/* GladeEditableIface */
+static void glade_property_shell_editable_init (GladeEditableIface *iface);
struct _GladePropertyShellPrivate
{
@@ -64,9 +64,11 @@ enum {
PROP_USE_COMMAND,
};
+static GladeEditableIface *parent_editable_iface;
+
G_DEFINE_TYPE_WITH_CODE (GladePropertyShell, glade_property_shell, GTK_TYPE_BOX,
- G_IMPLEMENT_INTERFACE (GLADE_TYPE_PROPERTY_EDITOR,
- glade_property_shell_property_editor_init));
+ G_IMPLEMENT_INTERFACE (GLADE_TYPE_EDITABLE,
+ glade_property_shell_editable_init));
static void
glade_property_shell_init (GladePropertyShell *shell)
@@ -175,15 +177,18 @@ glade_property_shell_get_real_property (GObject *object,
}
/*******************************************************************************
- * GladePropertyEditorInterface *
+ * GladeEditableIface *
*******************************************************************************/
static void
-glade_property_shell_property_editor_load (GladePropertyEditor *editor,
- GladeWidget *widget)
+glade_property_shell_load (GladeEditable *editable,
+ GladeWidget *widget)
{
- GladePropertyShell *shell = GLADE_PROPERTY_SHELL (editor);
+ GladePropertyShell *shell = GLADE_PROPERTY_SHELL (editable);
GladePropertyShellPrivate *priv;
+ /* Chain up to default implementation */
+ parent_editable_iface->load (editable, widget);
+
g_return_if_fail (shell->priv->property_name != NULL);
priv = shell->priv;
@@ -212,16 +217,24 @@ glade_property_shell_property_editor_load (GladePropertyEditor *editor,
/* If we have an editor for the right adaptor, load it */
if (priv->property_editor)
- glade_property_editor_load (GLADE_PROPERTY_EDITOR (priv->property_editor), widget);
+ glade_editable_load (GLADE_EDITABLE (priv->property_editor), widget);
}
else if (priv->property_editor)
- glade_property_editor_load (GLADE_PROPERTY_EDITOR (priv->property_editor), NULL);
+ glade_editable_load (GLADE_EDITABLE (priv->property_editor), NULL);
}
static void
-glade_property_shell_property_editor_init (GladePropertyEditorInterface *iface)
+glade_property_shell_set_show_name (GladeEditable * editable, gboolean show_name)
{
- iface->load = glade_property_shell_property_editor_load;
+}
+
+static void
+glade_property_shell_editable_init (GladeEditableIface * iface)
+{
+ parent_editable_iface = g_type_default_interface_peek (GLADE_TYPE_EDITABLE);
+
+ iface->load = glade_property_shell_load;
+ iface->set_show_name = glade_property_shell_set_show_name;
}
/***********************************************************
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]