[glade3] * plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Add support for adding texttags to texttagta
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] * plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Add support for adding texttags to texttagta
- Date: Sun, 9 Jan 2011 05:16:06 +0000 (UTC)
commit 67a2e6941c7a18659719f70ed5a443b79525d058
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun Jan 9 14:22:57 2011 +0900
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Add support for adding texttags to
texttagtable.
ChangeLog | 3 +
plugins/gtk+/glade-gtk.c | 123 +++++++++++++++++++++++++++++++++++++++++++++-
plugins/gtk+/gtk+.xml.in | 15 +++++-
3 files changed, 138 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index eab2c90..6a59f03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,6 +30,9 @@
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Added replace-child-function to
gtkmenutoolbutton code (incase the child is rebuilt for construct-only purposes).
+ * plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Add support for adding texttags to
+ texttagtable.
+
2011-01-08 Tristan Van Berkom <tristanvb openismus com>
* gladeui/glade-utils.[ch], gladeui/glade-widget.c, gladeui/glade-builtins.c,
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index b4a66ff..efe0770 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -11414,7 +11414,7 @@ glade_gtk_action_group_add_child (GladeWidgetAdaptor * adaptor,
GList *actions = g_object_get_data (G_OBJECT (ggroup), "glade-actions");
actions = g_list_copy (actions);
- actions = g_list_prepend (actions, child);
+ actions = g_list_append (actions, child);
g_object_set_data_full (G_OBJECT (ggroup), "glade-actions", actions,
(GDestroyNotify) g_list_free);
@@ -11576,3 +11576,124 @@ glade_gtk_action_action_activate (GladeWidgetAdaptor *adaptor,
glade_gtk_action_launch_editor (object);
}
}
+
+
+/*--------------------------- GtkTextTagTable ---------------------------------*/
+void
+glade_gtk_text_tag_table_add_child (GladeWidgetAdaptor * adaptor,
+ GObject * container, GObject * child)
+{
+ if (GTK_IS_TEXT_TAG (child))
+ {
+ /* Dont really add/remove tags (because name conflicts inside tables)
+ */
+ GladeWidget *gtable = glade_widget_get_from_gobject (container);
+ GList *tags = g_object_get_data (G_OBJECT (gtable), "glade-tags");
+
+ tags = g_list_copy (tags);
+ tags = g_list_append (tags, child);
+
+ g_object_set_data (child, "special-child-type", "tag");
+
+ g_object_set_data_full (G_OBJECT (gtable), "glade-tags", tags,
+ (GDestroyNotify) g_list_free);
+ }
+}
+
+void
+glade_gtk_text_tag_table_remove_child (GladeWidgetAdaptor * adaptor,
+ GObject * container, GObject * child)
+{
+ if (GTK_IS_TEXT_TAG (child))
+ {
+ /* Dont really add/remove actions (because name conflicts inside groups)
+ */
+ GladeWidget *gtable = glade_widget_get_from_gobject (container);
+ GList *tags = g_object_get_data (G_OBJECT (gtable), "glade-tags");
+
+ tags = g_list_copy (tags);
+ tags = g_list_remove (tags, child);
+
+ g_object_set_data (child, "special-child-type", NULL);
+
+ g_object_set_data_full (G_OBJECT (gtable), "glade-tags", tags,
+ (GDestroyNotify) g_list_free);
+ }
+}
+
+void
+glade_gtk_text_tag_table_replace_child (GladeWidgetAdaptor * adaptor,
+ GObject * container,
+ GObject * current, GObject * new_tag)
+{
+ glade_gtk_text_tag_table_remove_child (adaptor, container, current);
+ glade_gtk_text_tag_table_add_child (adaptor, container, new_tag);
+}
+
+GList *
+glade_gtk_text_tag_table_get_children (GladeWidgetAdaptor * adaptor,
+ GObject * container)
+{
+ GladeWidget *gtable = glade_widget_get_from_gobject (container);
+ GList *tags = g_object_get_data (G_OBJECT (gtable), "glade-tags");
+
+ return g_list_copy (tags);
+}
+
+static void
+glade_gtk_text_tag_table_child_selected (GladeBaseEditor *editor,
+ GladeWidget *gchild,
+ gpointer data)
+{
+ glade_base_editor_add_label (editor, _("Tag"));
+
+ glade_base_editor_add_default_properties (editor, gchild);
+
+ glade_base_editor_add_label (editor, _("Properties"));
+ glade_base_editor_add_editable (editor, gchild, GLADE_PAGE_GENERAL);
+}
+
+static gboolean
+glade_gtk_text_tag_table_move_child (GladeBaseEditor *editor,
+ GladeWidget *gparent,
+ GladeWidget *gchild,
+ gpointer data)
+{
+ return FALSE;
+}
+
+static void
+glade_gtk_text_tag_table_launch_editor (GObject *table)
+{
+ GladeWidget *widget = glade_widget_get_from_gobject (table);
+ GladeWidgetAdaptor *adaptor = glade_widget_get_adaptor (widget);
+ GladeBaseEditor *editor;
+ GladeEditable *action_editor;
+ GtkWidget *window;
+
+ action_editor = glade_widget_adaptor_create_editable (adaptor, GLADE_PAGE_GENERAL);
+
+ /* Editor */
+ editor = glade_base_editor_new (glade_widget_get_object (widget), action_editor,
+ _("Tag"), GTK_TYPE_TEXT_TAG,
+ NULL);
+
+ g_signal_connect (editor, "child-selected", G_CALLBACK (glade_gtk_text_tag_table_child_selected), NULL);
+ g_signal_connect (editor, "move-child", G_CALLBACK (glade_gtk_text_tag_table_move_child), NULL);
+
+ gtk_widget_show (GTK_WIDGET (editor));
+
+ window = glade_base_editor_pack_new_window (editor, _("Text Tag Table Editor"), NULL);
+ gtk_widget_show (window);
+}
+
+void
+glade_gtk_text_tag_table_action_activate (GladeWidgetAdaptor *adaptor,
+ GObject *object,
+ const gchar *action_path)
+{
+ if (strcmp (action_path, "launch_editor") == 0)
+ {
+ glade_gtk_text_tag_table_launch_editor (object);
+ }
+}
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index fbf6484..b0cf6b3 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -3292,11 +3292,12 @@ embedded in another object</_tooltip>
</glade-widget-class>
- <glade-widget-class name="GtkTextTag" generic-name="texttag" _title="Text Tag" toplevel="True">
+ <glade-widget-class name="GtkTextTag" generic-name="texttag" _title="Text Tag" >
<properties>
<property id="background-gdk" default="White" optional="True" optional-default="False"/>
<property id="foreground-gdk" default="Black" optional="True" optional-default="False"/>
<property id="paragraph-background-gdk" default="White" optional="True" optional-default="False"/>
+ <property id="language" optional="True" optional-default="False"/>
<!-- Disabled state parameters -->
<property id="background-set" disabled="True"/>
@@ -3337,7 +3338,17 @@ embedded in another object</_tooltip>
</glade-widget-class>
<glade-widget-class name="GtkTextTagTable" generic-name="texttagtable" _title="Text Tag Table"
- toplevel="True"/>
+ toplevel="True">
+ <add-child-function>glade_gtk_text_tag_table_add_child</add-child-function>
+ <remove-child-function>glade_gtk_text_tag_table_remove_child</remove-child-function>
+ <get-children-function>glade_gtk_text_tag_table_get_children</get-children-function>
+ <action-activate-function>glade_gtk_text_tag_table_action_activate</action-activate-function>
+ <special-child-type>tag</special-child-type>
+
+ <actions>
+ <action id="launch_editor" _name="Edit…" stock="gtk-edit" important="True"/>
+ </actions>
+ </glade-widget-class>
<glade-widget-class name="GtkFileFilter" generic-name="filefilter" _title="File Filter"
toplevel="True"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]