summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2013-08-07 16:03:06 +0200
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2013-08-07 16:12:03 +0200
commite95245f5f1c93016489f137060ad79e25487f51e (patch)
treec4539b47ca8b8b4a5ffc84586d3978e0f57d7613
parentde8762fa8f914580deb9aa85256405768e2bafbf (diff)
downloadglade-e95245f5f1c93016489f137060ad79e25487f51e.tar.gz
GtkListBox support: Added action to add list box rows to a list box.
-rw-r--r--plugins/gtk+/glade-gtk-list-box.c23
-rw-r--r--plugins/gtk+/gtk+.xml.in6
2 files changed, 27 insertions, 2 deletions
diff --git a/plugins/gtk+/glade-gtk-list-box.c b/plugins/gtk+/glade-gtk-list-box.c
index 8b056995..78c2c6c9 100644
--- a/plugins/gtk+/glade-gtk-list-box.c
+++ b/plugins/gtk+/glade-gtk-list-box.c
@@ -189,8 +189,6 @@ glade_gtk_listbox_add_verify (GladeWidgetAdaptor *adaptor,
GtkWidget *child,
gboolean user_feedback)
{
- g_return_if_fail (GTK_IS_LIST_BOX (container));
-
if (!GTK_IS_LIST_BOX_ROW (child))
{
if (user_feedback)
@@ -271,6 +269,26 @@ glade_gtk_listbox_child_insert_action (GladeWidgetAdaptor *adaptor,
}
void
+glade_gtk_listbox_action_activate (GladeWidgetAdaptor * adaptor,
+ GObject * object,
+ const gchar * action_path)
+{
+ if (strcmp (action_path, "add_row") == 0)
+ {
+ GladeWidgetAdaptor *adaptor = glade_widget_adaptor_get_by_type (GTK_TYPE_LIST_BOX_ROW);
+ GladeWidget *gparent = glade_widget_get_from_gobject (object);
+ GladeProject *project = glade_widget_get_project (gparent);
+
+ glade_command_create (adaptor, gparent, NULL, project);
+
+ glade_project_selection_set (project, object, TRUE);
+ }
+ else
+ GWA_GET_CLASS (GTK_TYPE_CONTAINER)->action_activate (adaptor,
+ object, action_path);
+}
+
+void
glade_gtk_listbox_child_action_activate (GladeWidgetAdaptor *adaptor,
GObject *container,
GObject *object,
@@ -296,3 +314,4 @@ glade_gtk_listbox_child_action_activate (GladeWidgetAdaptor *adaptor,
action_path);
}
}
+
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index e0fb11b9..fbf656f4 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1990,6 +1990,8 @@ range of values</_tooltip>
<glade-widget-class name="GtkAspectFrame" generic-name="aspectframe" _title="Aspect Frame"/>
<glade-widget-class name="GtkListBox" generic-name="listbox" _title="List Box" use-placeholders="False">
+
+ <action-activate-function>glade_gtk_listbox_action_activate</action-activate-function>
<child-action-activate-function>glade_gtk_listbox_child_action_activate</child-action-activate-function>
<create-widget-function>glade_gtk_create_fixed_widget</create-widget-function>
<post-create-function>glade_gtk_listbox_post_create</post-create-function>
@@ -1999,6 +2001,10 @@ range of values</_tooltip>
<child-set-property-function>glade_gtk_listbox_set_child_property</child-set-property-function>
<child-get-property-function>glade_gtk_listbox_get_child_property</child-get-property-function>
+ <actions>
+ <action id="add_row" _name="Add Row" stock="gtk-add" important="True"/>
+ </actions>
+
<packing-actions>
<action id="insert_before" _name="Insert Before" stock="gtk-add"/>
<action id="insert_after" _name="Insert After" stock="gtk-add"/>