glade3 r1978 - in trunk: . gladeui plugins/gtk+
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r1978 - in trunk: . gladeui plugins/gtk+
- Date: Fri, 17 Oct 2008 21:32:35 +0000 (UTC)
Author: tvb
Date: Fri Oct 17 21:32:35 2008
New Revision: 1978
URL: http://svn.gnome.org/viewvc/glade3?rev=1978&view=rev
Log:
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-model-data.c:
- Added lots of actions on the treeview column
- Marked GtkNotebook::pages as invisible
* gladeui/glade-editor.c: Allow query dialogs on invisible properties
if requested.
Modified:
trunk/ChangeLog
trunk/gladeui/glade-editor.c
trunk/gladeui/glade-inspector.c
trunk/plugins/gtk+/glade-gtk.c
trunk/plugins/gtk+/gtk+.xml.in
Modified: trunk/gladeui/glade-editor.c
==============================================================================
--- trunk/gladeui/glade-editor.c (original)
+++ trunk/gladeui/glade-editor.c Fri Oct 17 21:32:35 2008
@@ -645,7 +645,7 @@
{
property_class = (GladePropertyClass *) list->data;
- if (!glade_property_class_is_visible (property_class))
+ if (!glade_property_class_is_visible (property_class) && type != TABLE_TYPE_QUERY)
continue;
if (type == TABLE_TYPE_QUERY && !property_class->query)
continue;
Modified: trunk/gladeui/glade-inspector.c
==============================================================================
--- trunk/gladeui/glade-inspector.c (original)
+++ trunk/gladeui/glade-inspector.c Fri Oct 17 21:32:35 2008
@@ -559,14 +559,15 @@
/* now we can obtain the widget from the iter.
*/
gtk_tree_model_get (GTK_TREE_MODEL (inspector->priv->model), &iter,
- WIDGET_COLUMN, &widget, -1);
- if (widget != NULL)
- glade_popup_widget_pop (widget, event, FALSE);
- else
- glade_popup_simple_pop (event);
-
- handled = TRUE;
+ WIDGET_COLUMN, &widget, -1);
+ if (widget != NULL)
+ glade_popup_widget_pop (widget, event, TRUE);
+ else
+ glade_popup_simple_pop (event);
+
+ handled = TRUE;
+
gtk_tree_path_free (path);
}
}
Modified: trunk/plugins/gtk+/glade-gtk.c
==============================================================================
--- trunk/plugins/gtk+/glade-gtk.c (original)
+++ trunk/plugins/gtk+/glade-gtk.c Fri Oct 17 21:32:35 2008
@@ -9068,6 +9068,213 @@
/*--------------------------- GtkTreeView ---------------------------------*/
+static void
+glade_gtk_treeview_move_column (GtkTreeView *view,
+ GtkTreeViewColumn *child,
+ gboolean right)
+{
+ GladeWidget *gview = glade_widget_get_from_gobject (view);
+ GladeWidget *gcolumn = glade_widget_get_from_gobject (child), *giter;
+ GList *children, *l;
+ gint child_pos, pos, columns, new_pos;
+
+ glade_widget_pack_property_get (gcolumn, "position", &child_pos);
+
+ /* resolve where were gonna put the new child */
+ columns = 0;
+ while (gtk_tree_view_get_column (view, columns)) columns++;
+
+ if (right)
+ new_pos = CLAMP (child_pos + 1, 0, columns -1);
+ else
+ new_pos = CLAMP (child_pos - 1, 0, columns -1);
+
+ if (new_pos == child_pos)
+ return;
+
+ glade_command_push_group (right ? _("Moving %s right inside %s") : _("Moving %s left inside %s"),
+ gcolumn->name, gview->name);
+
+ /* Set new position on this child */
+ glade_command_set_property (glade_widget_get_pack_property (gcolumn, "position"), new_pos);
+
+ /* Swap position of other child to this childs original position */
+ children = gtk_tree_view_get_columns (view);
+ for (l = children; l; l = l->next)
+ {
+ giter = glade_widget_get_from_gobject (l->data);
+
+ glade_widget_pack_property_get (giter, "position", &pos);
+
+ if (pos == new_pos && giter != gcolumn)
+ {
+ glade_command_set_property (glade_widget_get_pack_property (giter, "position"), child_pos);
+ break;
+ }
+ }
+ g_list_free (children);
+
+ glade_command_pop_group ();
+}
+
+
+static void
+glade_gtk_treeview_add_column (GtkTreeView *view,
+ GtkTreeViewColumn *child,
+ gboolean after)
+{
+ GladeWidget *gview = glade_widget_get_from_gobject (view);
+ GladeWidget *gcolumn, *gchild;
+ gint child_pos, pos, columns;
+ GList *children, *l;
+
+ gchild = child ? glade_widget_get_from_gobject (child) : NULL;
+
+ /* Resolve command name */
+ if (child)
+ glade_command_push_group (after ? _("Inserting column after %s in %s") :
+ _("Inserting column before %s in %s"),
+ gchild->name, gview->name);
+ else
+ glade_command_push_group (after ? _("Appending column to %s") :
+ _("Prepending column to %s"),
+ gview->name);
+
+ if ((gcolumn = glade_command_create (glade_widget_adaptor_get_by_type (GTK_TYPE_TREE_VIEW_COLUMN),
+ gview, NULL, glade_widget_get_project (gview))) == NULL)
+ {
+ glade_command_pop_group ();
+ return;
+ }
+
+ /* resolve where were gonna put the new child */
+ columns = 0;
+ while (gtk_tree_view_get_column (view, columns)) columns++;
+
+ if (gchild)
+ glade_widget_pack_property_get (gchild, "position", &child_pos);
+ else
+ child_pos = after ? columns - 1 : 0;
+
+ if (after)
+ child_pos = CLAMP (child_pos + 1, 0, columns - 1);
+
+ /* Reoder children */
+ children = gtk_tree_view_get_columns (view);
+ for (l = children; l; l = l->next)
+ {
+ gchild = glade_widget_get_from_gobject (l->data);
+
+ glade_widget_pack_property_get (gchild, "position", &pos);
+
+ if (gchild == gcolumn)
+ glade_command_set_property (glade_widget_get_pack_property (gchild, "position"), child_pos);
+ else if ((after && pos > child_pos) ||
+ (!after && pos >= child_pos))
+ glade_command_set_property (glade_widget_get_pack_property (gchild, "position"), pos + 1);
+ }
+ g_list_free (children);
+
+ glade_command_pop_group ();
+}
+
+void
+glade_gtk_treeview_action_activate (GladeWidgetAdaptor *adaptor,
+ GObject *object,
+ const gchar *action_path)
+{
+ if (strcmp (action_path, "append_column") == 0)
+ glade_gtk_treeview_add_column (GTK_TREE_VIEW (object), NULL, TRUE);
+ else if (strcmp (action_path, "prepend_column") == 0)
+ glade_gtk_treeview_add_column (GTK_TREE_VIEW (object), NULL, FALSE);
+ else
+ GWA_GET_CLASS (GTK_TYPE_CONTAINER)->action_activate (adaptor,
+ object,
+ action_path);
+}
+
+void
+glade_gtk_treeview_child_action_activate (GladeWidgetAdaptor *adaptor,
+ GObject *container,
+ GObject *object,
+ const gchar *action_path)
+{
+ if (strcmp (action_path, "insert_column/after") == 0)
+ glade_gtk_treeview_add_column (GTK_TREE_VIEW (container),
+ GTK_TREE_VIEW_COLUMN (object), TRUE);
+ else if (strcmp (action_path, "insert_column/before") == 0)
+ glade_gtk_treeview_add_column (GTK_TREE_VIEW (container),
+ GTK_TREE_VIEW_COLUMN (object), FALSE);
+ else if (strcmp (action_path, "move_column/left") == 0)
+ glade_gtk_treeview_move_column (GTK_TREE_VIEW (container),
+ GTK_TREE_VIEW_COLUMN (object), FALSE);
+ else if (strcmp (action_path, "move_column/right") == 0)
+ glade_gtk_treeview_move_column (GTK_TREE_VIEW (container),
+ GTK_TREE_VIEW_COLUMN (object), TRUE);
+ else
+ GWA_GET_CLASS (GTK_TYPE_CONTAINER)->child_action_activate (adaptor,
+ container,
+ object,
+ action_path);
+}
+
+static gint
+glade_gtk_treeview_get_column_index (GtkTreeView *view,
+ GtkTreeViewColumn *column)
+{
+ GtkTreeViewColumn *iter;
+ gint i;
+
+ for (i = 0; (iter = gtk_tree_view_get_column (view, i)) != NULL; i++)
+ if (iter == column)
+ return i;
+
+ return -1;
+}
+
+void
+glade_gtk_treeview_get_child_property (GladeWidgetAdaptor *adaptor,
+ GObject *container,
+ GObject *child,
+ const gchar *property_name,
+ GValue *value)
+{
+ if (strcmp (property_name, "position") == 0)
+ g_value_set_int (value,
+ glade_gtk_treeview_get_column_index (GTK_TREE_VIEW (container),
+ GTK_TREE_VIEW_COLUMN (child)));
+ else
+ /* Chain Up */
+ GWA_GET_CLASS
+ (GTK_TYPE_CONTAINER)->child_get_property (adaptor,
+ container, child,
+ property_name, value);
+}
+
+void
+glade_gtk_treeview_set_child_property (GladeWidgetAdaptor *adaptor,
+ GObject *container,
+ GObject *child,
+ const gchar *property_name,
+ const GValue *value)
+{
+ if (strcmp (property_name, "position") == 0)
+ {
+
+ gtk_tree_view_remove_column (GTK_TREE_VIEW (container),
+ GTK_TREE_VIEW_COLUMN (child));
+ gtk_tree_view_insert_column (GTK_TREE_VIEW (container),
+ GTK_TREE_VIEW_COLUMN (child),
+ g_value_get_int (value));
+ }
+ else
+ /* Chain Up */
+ GWA_GET_CLASS
+ (GTK_TYPE_CONTAINER)->child_set_property (adaptor,
+ container, child,
+ property_name, value);
+}
+
GList *
glade_gtk_treeview_get_children (GladeWidgetAdaptor *adaptor,
GtkTreeView *view)
Modified: trunk/plugins/gtk+/gtk+.xml.in
==============================================================================
--- trunk/plugins/gtk+/gtk+.xml.in (original)
+++ trunk/plugins/gtk+/gtk+.xml.in Fri Oct 17 21:32:35 2008
@@ -926,49 +926,6 @@
<get-internal-child-function>glade_gtk_combo_box_entry_get_internal_child</get-internal-child-function>
</glade-widget-class>
- <glade-widget-class name="GtkTreeView" generic-name="treeview" _title="Tree View">
- <post-create-function>empty</post-create-function>
- <get-children-function>glade_gtk_treeview_get_children</get-children-function>
- <add-child-function>glade_gtk_treeview_add_child</add-child-function>
- <remove-child-function>glade_gtk_treeview_remove_child</remove-child-function>
-
- <properties>
- <property id="level-indentation" since="2.12"/>
- <property id="show-expanders" since="2.12"/>
- <property id="enable-grid-lines" ignore="True">
- <displayable-values>
- <value id="GTK_TREE_VIEW_GRID_LINES_NONE" _name="None"/>
- <value id="GTK_TREE_VIEW_GRID_LINES_HORIZONTAL" _name="Horizontal"/>
- <value id="GTK_TREE_VIEW_GRID_LINES_VERTICAL" _name="Vertical"/>
- <value id="GTK_TREE_VIEW_GRID_LINES_BOTH" _name="Horizontal and Vertical"/>
- </displayable-values>
- </property>
- <property id="hadjustment" libglade-unsupported="True"/>
- <property id="vadjustment" libglade-unsupported="True"/>
- <property id="model" libglade-unsupported="True"/>
- </properties>
- </glade-widget-class>
-
- <glade-widget-class name="GtkIconView" generic-name="iconview" _title="Icon View">
- <properties>
- <property id="selection-mode">
- <displayable-values>
- <value id="GTK_SELECTION_NONE" _name="None"/>
- <value id="GTK_SELECTION_SINGLE" _name="Single"/>
- <value id="GTK_SELECTION_BROWSE" _name="Browse"/>
- <value id="GTK_SELECTION_MULTIPLE" _name="Multiple"/>
- <value id="GTK_SELECTION_EXTENDED" _name="Extended"/>
- </displayable-values>
- </property>
- <property id="orientation">
- <displayable-values>
- <value id="GTK_ORIENTATION_HORIZONTAL" _name="Horizontal"/>
- <value id="GTK_ORIENTATION_VERTICAL" _name="Vertical"/>
- </displayable-values>
- </property>
- </properties>
- </glade-widget-class>
-
<glade-widget-class name="GtkProgressBar" generic-name="progressbar" _title="Progress Bar">
<properties>
<property id="text" translatable="True"/>
@@ -1149,7 +1106,7 @@
<_tooltip>Set the current page (strictly for editing purposes)</_tooltip>
</property>
- <property id="pages" _name="Number of pages" save="False" default="3" query="True">
+ <property id="pages" _name="Number of pages" visible="False" save="False" default="3" query="True">
<spec>glade_standard_int_spec</spec>
<_tooltip>The number of pages in the notebook</_tooltip>
</property>
@@ -1791,6 +1748,77 @@
<glade-widget-class name="GtkUIManager" generic-name="uimanager" _title="UI Manager"
libglade-unsupported="True" toplevel="True"/>
+ <glade-widget-class name="GtkTreeView" generic-name="treeview" _title="Tree View">
+ <post-create-function>empty</post-create-function>
+ <child-set-property-function>glade_gtk_treeview_set_child_property</child-set-property-function>
+ <child-get-property-function>glade_gtk_treeview_get_child_property</child-get-property-function>
+ <get-children-function>glade_gtk_treeview_get_children</get-children-function>
+ <add-child-function>glade_gtk_treeview_add_child</add-child-function>
+ <remove-child-function>glade_gtk_treeview_remove_child</remove-child-function>
+ <action-activate-function>glade_gtk_treeview_action_activate</action-activate-function>
+ <child-action-activate-function>glade_gtk_treeview_child_action_activate</child-action-activate-function>
+
+ <actions>
+ <action id="append_column" _name="Append Column" stock="gtk-add" important="True"/>
+ <action id="prepend_column" _name="Prepend Column" stock="gtk-add" important="True"/>
+ </actions>
+
+ <packing-actions>
+ <action id="move_column" _name="Move Column">
+ <action id="left" _name="Left"/>
+ <action id="right" _name="Right"/>
+ </action>
+ <action id="insert_column" _name="Insert Column">
+ <action id="before" _name="Before"/>
+ <action id="after" _name="After"/>
+ </action>
+ </packing-actions>
+
+ <properties>
+ <property id="level-indentation" since="2.12"/>
+ <property id="show-expanders" since="2.12"/>
+ <property id="enable-grid-lines" ignore="True">
+ <displayable-values>
+ <value id="GTK_TREE_VIEW_GRID_LINES_NONE" _name="None"/>
+ <value id="GTK_TREE_VIEW_GRID_LINES_HORIZONTAL" _name="Horizontal"/>
+ <value id="GTK_TREE_VIEW_GRID_LINES_VERTICAL" _name="Vertical"/>
+ <value id="GTK_TREE_VIEW_GRID_LINES_BOTH" _name="Horizontal and Vertical"/>
+ </displayable-values>
+ </property>
+ <property id="hadjustment" libglade-unsupported="True"/>
+ <property id="vadjustment" libglade-unsupported="True"/>
+ <property id="model" libglade-unsupported="True"/>
+ </properties>
+
+ <packing-properties>
+ <property save="False" id="position" name="Position" visible="False">
+ <spec>glade_standard_int_spec</spec>
+ <_tooltip>The column position in the Tree View</_tooltip>
+ </property>
+ </packing-properties>
+ </glade-widget-class>
+
+ <glade-widget-class name="GtkIconView" generic-name="iconview" _title="Icon View">
+ <properties>
+ <property id="selection-mode">
+ <displayable-values>
+ <value id="GTK_SELECTION_NONE" _name="None"/>
+ <value id="GTK_SELECTION_SINGLE" _name="Single"/>
+ <value id="GTK_SELECTION_BROWSE" _name="Browse"/>
+ <value id="GTK_SELECTION_MULTIPLE" _name="Multiple"/>
+ <value id="GTK_SELECTION_EXTENDED" _name="Extended"/>
+ </displayable-values>
+ </property>
+ <property id="orientation">
+ <displayable-values>
+ <value id="GTK_ORIENTATION_HORIZONTAL" _name="Horizontal"/>
+ <value id="GTK_ORIENTATION_VERTICAL" _name="Vertical"/>
+ </displayable-values>
+ </property>
+ </properties>
+ </glade-widget-class>
+
+
<glade-widget-class name="GtkListStore" generic-name="liststore" _title="List Store"
libglade-unsupported="True" toplevel="True">
<set-property-function>glade_gtk_store_set_property</set-property-function>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]