diff options
author | Tristan Van Berkom <tvb@src.gnome.org> | 2008-11-22 20:17:17 +0000 |
---|---|---|
committer | Tristan Van Berkom <tvb@src.gnome.org> | 2008-11-22 20:17:17 +0000 |
commit | 735576a9c2eac9b2756f5c8c5fc732e4c220cdcf (patch) | |
tree | 70ef33c3aaf9756ad4369a382689adda20f5d6c7 | |
parent | d4a36f7c56e4634510d7c8ceb50c6eeb7cf6f3ec (diff) | |
download | glade-735576a9c2eac9b2756f5c8c5fc732e4c220cdcf.tar.gz |
Fixed a warning hiding a never built label
* gladeui/glade-editor-table.c: Fixed a warning hiding a never built label
* plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c:
- First itteration on the treeview editor, removed annoying actions for column/cell
hierarchy and do it all in the editor, added position packing property to treeview
column for this (treeview column still implemented generically as a cell layout).
svn path=/trunk/; revision=2040
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | gladeui/glade-base-editor.c | 38 | ||||
-rw-r--r-- | gladeui/glade-base-editor.h | 5 | ||||
-rw-r--r-- | gladeui/glade-editor-table.c | 19 | ||||
-rw-r--r-- | plugins/gtk+/glade-gtk.c | 356 | ||||
-rw-r--r-- | plugins/gtk+/gtk+.xml.in | 48 |
6 files changed, 244 insertions, 234 deletions
@@ -6,9 +6,15 @@ only adds types supported by the container object, use _append_types() to define hierarcic type relations for children. - * plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c: Now the toolbar editor - can add menus and edit menus inside the gtkmenutoolbutton (fixed bug 429438). - + * gladeui/glade-editor-table.c: Fixed a warning hiding a never built label + + * plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c: + - Now the toolbar editor can add menus and edit menus inside the gtkmenutoolbutton + (fixed bug 429438). + - First itteration on the treeview editor, removed annoying actions for column/cell + hierarchy and do it all in the editor, added position packing property to treeview + column for this (treeview column still implemented generically as a cell layout). + 2008-11-20 Tristan Van Berkom <tvb@gnome.org> * plugins/gtk+/gtk+.xml.in: Added all remaining metadatas for cell renderers diff --git a/gladeui/glade-base-editor.c b/gladeui/glade-base-editor.c index 4b016bb5..e13da0e4 100644 --- a/gladeui/glade-base-editor.c +++ b/gladeui/glade-base-editor.c @@ -220,7 +220,7 @@ glade_base_editor_fill_store_real (GladeBaseEditor *e, GladeWidget *gwidget, GtkTreeIter *parent) { - GtkWidget *widget = GTK_WIDGET (glade_widget_get_object (gwidget)); + GObject *object = glade_widget_get_object (gwidget); GList *children, *l; GladeWidget *gparent = NULL; GtkTreeIter iter; @@ -231,8 +231,7 @@ glade_base_editor_fill_store_real (GladeBaseEditor *e, -1); - children = glade_widget_adaptor_get_children (gwidget->adaptor, - G_OBJECT (widget)); + children = glade_widget_adaptor_get_children (gwidget->adaptor, object); for (l = children; l; l = l->next) { @@ -1941,14 +1940,16 @@ glade_base_editor_add_properties (GladeBaseEditor *editor, * glade_base_editor_add_editable: * @editor: a #GladeBaseEditor * @gchild: the #GladeWidget + * @page: the #GladeEditorPageType of the desired page for @gchild * - * Add @gchild general page editor + * Add @gchild editor of type @page to the base editor * * NOTE: This function is intended to be used in "child-selected" callbacks */ void -glade_base_editor_add_editable (GladeBaseEditor *editor, - GladeWidget *gchild) +glade_base_editor_add_editable (GladeBaseEditor *editor, + GladeWidget *gchild, + GladeEditorPageType page) { GladeEditable *editable; gint row; @@ -1956,7 +1957,7 @@ glade_base_editor_add_editable (GladeBaseEditor *editor, g_return_if_fail (GLADE_IS_BASE_EDITOR (editor)); g_return_if_fail (GLADE_IS_WIDGET (gchild)); - editable = glade_widget_adaptor_create_editable (gchild->adaptor, GLADE_PAGE_GENERAL); + editable = glade_widget_adaptor_create_editable (gchild->adaptor, page); glade_editable_set_show_name (editable, FALSE); glade_editable_load (editable, gchild); gtk_widget_show (GTK_WIDGET (editable)); @@ -2083,21 +2084,18 @@ glade_base_editor_pack_new_window (GladeBaseEditor *editor, gtk_box_set_spacing (GTK_BOX (buttonbox), 8); gtk_box_pack_start (GTK_BOX (editor), buttonbox, FALSE, TRUE, 0); - button = gtk_button_new_from_stock (GTK_STOCK_CLOSE); + button = gtk_button_new_from_stock (GTK_STOCK_HELP); gtk_widget_show (button); - g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window); + g_signal_connect (button, "clicked", + G_CALLBACK (glade_base_editor_help), + help_markup ? help_markup : + _("<big><b>Tips:</b></big>\n" + " * Right click over the treeview to add items.\n" + " * Press Delete to remove the selected item.\n" + " * Drag & Drop to reorder.\n" + " * Type column is editable.")); gtk_container_add (GTK_CONTAINER (buttonbox), button); - - if (help_markup) - { - button = gtk_button_new_from_stock (GTK_STOCK_HELP); - gtk_widget_show (button); - g_signal_connect (button, "clicked", - G_CALLBACK (glade_base_editor_help), - help_markup); - gtk_container_add (GTK_CONTAINER (buttonbox), button); - gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (buttonbox), button, TRUE); - } + gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (buttonbox), button, TRUE); if (glade_app_get_accel_group ()) { diff --git a/gladeui/glade-base-editor.h b/gladeui/glade-base-editor.h index e56e968e..387e582a 100644 --- a/gladeui/glade-base-editor.h +++ b/gladeui/glade-base-editor.h @@ -68,8 +68,9 @@ void glade_base_editor_append_types (GladeBaseEditor * GType parent_type, ...); -void glade_base_editor_add_editable (GladeBaseEditor *editor, - GladeWidget *gchild); +void glade_base_editor_add_editable (GladeBaseEditor *editor, + GladeWidget *gchild, + GladeEditorPageType page); void glade_base_editor_add_default_properties (GladeBaseEditor *editor, GladeWidget *gchild); diff --git a/gladeui/glade-editor-table.c b/gladeui/glade-editor-table.c index 5fb181bb..e74bdc01 100644 --- a/gladeui/glade-editor-table.c +++ b/gladeui/glade-editor-table.c @@ -171,15 +171,18 @@ glade_editor_table_set_show_name (GladeEditable *editable, { GladeEditorTable *table = GLADE_EDITOR_TABLE (editable); - if (show_name) + if (table->name_label) { - gtk_widget_show (table->name_label); - gtk_widget_show (table->name_entry); - } - else - { - gtk_widget_hide (table->name_label); - gtk_widget_hide (table->name_entry); + if (show_name) + { + gtk_widget_show (table->name_label); + gtk_widget_show (table->name_entry); + } + else + { + gtk_widget_hide (table->name_label); + gtk_widget_hide (table->name_entry); + } } } diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c index 0bc5cc5a..93e63fcb 100644 --- a/plugins/gtk+/glade-gtk.c +++ b/plugins/gtk+/glade-gtk.c @@ -5909,8 +5909,6 @@ glade_gtk_menu_shell_change_type (GladeBaseEditor *editor, gtk_menu_tool_button_get_menu (GTK_MENU_TOOL_BUTTON (child)))) return TRUE; - g_print ("Changing type of %s to %s\n", gchild->name, g_type_name (type)); - /* Delete the internal image of an image menu item before going ahead and changing types. */ if (GTK_IS_IMAGE_MENU_ITEM (child)) { @@ -5937,16 +5935,16 @@ glade_gtk_toolbar_child_selected (GladeBaseEditor *editor, GObject *child = glade_widget_get_object (gchild); GType type = G_OBJECT_TYPE (child); - glade_base_editor_add_label (editor, "Tool Item"); + glade_base_editor_add_label (editor, _("Tool Item")); glade_base_editor_add_default_properties (editor, gchild); - glade_base_editor_add_label (editor, "Properties"); - glade_base_editor_add_editable (editor, gchild); + glade_base_editor_add_label (editor, _("Properties")); + glade_base_editor_add_editable (editor, gchild, GLADE_PAGE_GENERAL); if (type == GTK_TYPE_SEPARATOR_TOOL_ITEM) return; - glade_base_editor_add_label (editor, "Packing"); + glade_base_editor_add_label (editor, _("Packing")); glade_base_editor_add_properties (editor, gchild, TRUE, "expand", "homogeneous", NULL); @@ -5965,13 +5963,13 @@ glade_gtk_menu_shell_tool_item_child_selected (GladeBaseEditor *editor, glade_gtk_toolbar_child_selected (editor, gchild, data); return; } - glade_base_editor_add_label (editor, "Menu Item"); + glade_base_editor_add_label (editor, _("Menu Item")); glade_base_editor_add_default_properties (editor, gchild); if (GTK_IS_SEPARATOR_MENU_ITEM (child)) return; - glade_base_editor_add_label (editor, "Properties"); + glade_base_editor_add_label (editor, _("Properties")); if (glade_project_get_format (gchild->project) == GLADE_PROJECT_FORMAT_LIBGLADE) glade_base_editor_add_properties (editor, gchild, FALSE, "tooltip", NULL); @@ -5983,7 +5981,7 @@ glade_gtk_menu_shell_tool_item_child_selected (GladeBaseEditor *editor, glade_base_editor_add_properties (editor, gchild, FALSE, "label", "tooltip", NULL); if (type == GTK_TYPE_IMAGE_MENU_ITEM) - glade_base_editor_add_editable (editor, gchild); + glade_base_editor_add_editable (editor, gchild, GLADE_PAGE_GENERAL); else if (type == GTK_TYPE_CHECK_MENU_ITEM) glade_base_editor_add_properties (editor, gchild, FALSE, "active", "draw-as-radio", @@ -6001,19 +5999,19 @@ glade_gtk_menu_shell_launch_editor (GObject *object, gchar *title) /* Editor */ editor = glade_base_editor_new (object, - _("Normal"), GTK_TYPE_MENU_ITEM, - _("Image"), GTK_TYPE_IMAGE_MENU_ITEM, - _("Check"), GTK_TYPE_CHECK_MENU_ITEM, - _("Radio"), GTK_TYPE_RADIO_MENU_ITEM, - _("Separator"), GTK_TYPE_SEPARATOR_MENU_ITEM, + _("Normal item"), GTK_TYPE_MENU_ITEM, + _("Image item"), GTK_TYPE_IMAGE_MENU_ITEM, + _("Check item"), GTK_TYPE_CHECK_MENU_ITEM, + _("Radio item"), GTK_TYPE_RADIO_MENU_ITEM, + _("Separator item"), GTK_TYPE_SEPARATOR_MENU_ITEM, NULL); glade_base_editor_append_types (editor, GTK_TYPE_MENU_ITEM, - _("Normal"), GTK_TYPE_MENU_ITEM, - _("Image"), GTK_TYPE_IMAGE_MENU_ITEM, - _("Check"), GTK_TYPE_CHECK_MENU_ITEM, - _("Radio"), GTK_TYPE_RADIO_MENU_ITEM, - _("Separator"), GTK_TYPE_SEPARATOR_MENU_ITEM, + _("Normal item"), GTK_TYPE_MENU_ITEM, + _("Image item"), GTK_TYPE_IMAGE_MENU_ITEM, + _("Check item"), GTK_TYPE_CHECK_MENU_ITEM, + _("Radio item"), GTK_TYPE_RADIO_MENU_ITEM, + _("Separator item"), GTK_TYPE_SEPARATOR_MENU_ITEM, NULL); g_signal_connect (editor, "get-display-name", G_CALLBACK (glade_gtk_menu_shell_tool_item_get_display_name), NULL); @@ -6025,12 +6023,7 @@ glade_gtk_menu_shell_launch_editor (GObject *object, gchar *title) gtk_widget_show (GTK_WIDGET (editor)); - window = glade_base_editor_pack_new_window (editor, title, - _("<big><b>Tips:</b></big>\n" - " * Right click over the treeview to add items.\n" - " * Press Delete to remove the selected item.\n" - " * Drag & Drop to reorder.\n" - " * Type column is editable.")); + window = glade_base_editor_pack_new_window (editor, title, NULL); gtk_widget_show (window); } @@ -6981,7 +6974,6 @@ glade_gtk_toolbar_launch_editor (GladeWidgetAdaptor *adaptor, _("Separator"), GTK_TYPE_SEPARATOR_MENU_ITEM, NULL); - glade_base_editor_append_types (editor, GTK_TYPE_MENU_ITEM, _("Normal"), GTK_TYPE_MENU_ITEM, _("Image"), GTK_TYPE_IMAGE_MENU_ITEM, @@ -6990,7 +6982,6 @@ glade_gtk_toolbar_launch_editor (GladeWidgetAdaptor *adaptor, _("Separator"), GTK_TYPE_SEPARATOR_MENU_ITEM, NULL); - g_signal_connect (editor, "get-display-name", G_CALLBACK (glade_gtk_menu_shell_tool_item_get_display_name), NULL); g_signal_connect (editor, "child-selected", G_CALLBACK (glade_gtk_menu_shell_tool_item_child_selected), NULL); g_signal_connect (editor, "change-type", G_CALLBACK (glade_gtk_menu_shell_change_type), NULL); @@ -9393,115 +9384,100 @@ glade_gtk_store_read_widget (GladeWidgetAdaptor *adaptor, /*--------------------------- 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; +static gchar * +glade_gtk_treeview_get_display_name (GladeBaseEditor *editor, + GladeWidget *gchild, + gpointer user_data) +{ + GObject *child = glade_widget_get_object (gchild); + gchar *name; - 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); + if (GTK_IS_TREE_VIEW_COLUMN (child)) + glade_widget_property_get (gchild, "title", &name); 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); + name = gchild->name; + + return g_strdup (name); +} - /* Set new position on this child */ - glade_command_set_property (glade_widget_get_pack_property (gcolumn, "position"), new_pos); +static void +glade_gtk_treeview_child_selected (GladeBaseEditor *editor, + GladeWidget *gchild, + gpointer data) +{ + GObject *child = glade_widget_get_object (gchild); + + glade_base_editor_add_label (editor, GTK_IS_TREE_VIEW_COLUMN (child) ? + _("Tree View Column") : _("Cell Renderer")); + + glade_base_editor_add_default_properties (editor, gchild); + + glade_base_editor_add_label (editor, GTK_IS_TREE_VIEW_COLUMN (child) ? + _("Properties") : _("Properties and Attributes")); + glade_base_editor_add_editable (editor, gchild, GLADE_PAGE_GENERAL); - /* Swap position of other child to this childs original position */ - children = gtk_tree_view_get_columns (view); - for (l = children; l; l = l->next) + if (GTK_IS_CELL_RENDERER (child)) { - 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; - } + glade_base_editor_add_label (editor, _("Common Properties and Attributes")); + glade_base_editor_add_editable (editor, gchild, GLADE_PAGE_COMMON); } - g_list_free (children); - - glade_command_pop_group (); } +static gboolean +glade_gtk_treeview_move_child (GladeBaseEditor *editor, + GladeWidget *gparent, + GladeWidget *gchild, + gpointer data) +{ + GObject *parent = glade_widget_get_object (gparent); + GObject *child = glade_widget_get_object (gchild); + GList list = { 0, }; -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) + if (GTK_IS_TREE_VIEW (parent) && !GTK_IS_TREE_VIEW_COLUMN (child)) + return FALSE; + if (GTK_IS_TREE_VIEW_COLUMN (parent) && !GTK_IS_CELL_RENDERER (child)) + return FALSE; + if (GTK_IS_CELL_RENDERER (parent)) + return FALSE; + + if (gparent != glade_widget_get_parent (gchild)) { - glade_command_pop_group (); - return; + list.data = gchild; + glade_command_dnd (&list, gparent, NULL); } - /* 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; + return TRUE; +} - if (after) - child_pos = CLAMP (child_pos + 1, 0, columns - 1); +static void +glade_gtk_treeview_launch_editor (GObject *treeview) +{ + GladeBaseEditor *editor; + GtkWidget *window; - /* Reoder children */ - children = gtk_tree_view_get_columns (view); - for (l = children; l; l = l->next) - { - gchild = glade_widget_get_from_gobject (l->data); + /* Editor */ + editor = glade_base_editor_new (treeview, + _("Column"), GTK_TYPE_TREE_VIEW_COLUMN, + NULL); - glade_widget_pack_property_get (gchild, "position", &pos); + glade_base_editor_append_types (editor, GTK_TYPE_TREE_VIEW_COLUMN, + _("Text"), GTK_TYPE_CELL_RENDERER_TEXT, + _("Accelerator"), GTK_TYPE_CELL_RENDERER_ACCEL, + _("Combo"), GTK_TYPE_CELL_RENDERER_COMBO, + _("Spin"), GTK_TYPE_CELL_RENDERER_SPIN, + _("Pixbuf"), GTK_TYPE_CELL_RENDERER_PIXBUF, + _("Progress"), GTK_TYPE_CELL_RENDERER_PROGRESS, + _("Toggle"), GTK_TYPE_CELL_RENDERER_TOGGLE, + NULL); - 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); + g_signal_connect (editor, "get-display-name", G_CALLBACK (glade_gtk_treeview_get_display_name), NULL); + g_signal_connect (editor, "child-selected", G_CALLBACK (glade_gtk_treeview_child_selected), NULL); + g_signal_connect (editor, "move-child", G_CALLBACK (glade_gtk_treeview_move_child), NULL); - glade_command_pop_group (); + gtk_widget_show (GTK_WIDGET (editor)); + + window = glade_base_editor_pack_new_window (editor, _("Tree View Editor"), NULL); + gtk_widget_show (window); } void @@ -9509,41 +9485,16 @@ 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); + if (strcmp (action_path, "launch_editor") == 0) + { + glade_gtk_treeview_launch_editor (object); + } 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) @@ -10087,21 +10038,51 @@ glade_gtk_cell_layout_get_children (GladeWidgetAdaptor *adaptor, return gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (container)); } -static void -glade_gtk_cell_layout_add_renderer (GObject *cell, GType type) -{ - GladeWidget *gcell = glade_widget_get_from_gobject (cell); - glade_command_push_group (_("Appending %s to %s"), - g_type_name (type), - gcell->name); +void +glade_gtk_cell_layout_get_child_property (GladeWidgetAdaptor *adaptor, + GObject *container, + GObject *child, + const gchar *property_name, + GValue *value) +{ + if (strcmp (property_name, "position") == 0) + { + GList *cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (container)); + + /* We have to fake it, assume we are loading and always return the last item */ + g_value_set_int (value, g_list_length (cells) - 1); - glade_command_create (glade_widget_adaptor_get_by_type (type), - gcell, NULL, glade_widget_get_project (gcell)); - - glade_command_pop_group (); + g_list_free (cells); + } + else + /* Chain Up */ + GWA_GET_CLASS + (GTK_TYPE_CONTAINER)->child_get_property (adaptor, + container, child, + property_name, value); } +void +glade_gtk_cell_layout_set_child_property (GladeWidgetAdaptor *adaptor, + GObject *container, + GObject *child, + const gchar *property_name, + const GValue *value) +{ + if (strcmp (property_name, "position") == 0) + { + /* Need verify on position property !!! XXX */ + gtk_cell_layout_reorder (GTK_CELL_LAYOUT (container), child, + g_value_get_int (value)); + } + else + /* Chain Up */ + GWA_GET_CLASS + (GTK_TYPE_CONTAINER)->child_set_property (adaptor, + container, child, + property_name, value); +} static void glade_gtk_cell_renderer_read_attributes (GladeWidget *widget, GladeXmlNode *node) @@ -10243,28 +10224,51 @@ glade_gtk_treeview_column_action_activate (GladeWidgetAdaptor *adaptor, GObject *object, const gchar *action_path) { - if (strcmp (action_path, "append_renderer/accel") == 0) - glade_gtk_cell_layout_add_renderer (object, GTK_TYPE_CELL_RENDERER_ACCEL); - else if (strcmp (action_path, "append_renderer/combo") == 0) - glade_gtk_cell_layout_add_renderer (object, GTK_TYPE_CELL_RENDERER_COMBO); - else if (strcmp (action_path, "append_renderer/pixbuf") == 0) - glade_gtk_cell_layout_add_renderer (object, GTK_TYPE_CELL_RENDERER_PIXBUF); - else if (strcmp (action_path, "append_renderer/progress") == 0) - glade_gtk_cell_layout_add_renderer (object, GTK_TYPE_CELL_RENDERER_PROGRESS); - else if (strcmp (action_path, "append_renderer/spin") == 0) - glade_gtk_cell_layout_add_renderer (object, GTK_TYPE_CELL_RENDERER_SPIN); - else if (strcmp (action_path, "append_renderer/text") == 0) - glade_gtk_cell_layout_add_renderer (object, GTK_TYPE_CELL_RENDERER_TEXT); - else if (strcmp (action_path, "append_renderer/toggle") == 0) - glade_gtk_cell_layout_add_renderer (object, GTK_TYPE_CELL_RENDERER_TOGGLE); + if (strcmp (action_path, "launch_editor") == 0) + { + GladeWidget *w = glade_widget_get_from_gobject (object); + + while ((w = glade_widget_get_parent (w))) + { + if (GTK_IS_TREE_VIEW (w->object)) + { + glade_gtk_treeview_launch_editor (w->object); + break; + } + } + } else - GWA_GET_CLASS (GTK_TYPE_CONTAINER)->action_activate (adaptor, - object, - action_path); + GWA_GET_CLASS (G_TYPE_OBJECT)->action_activate (adaptor, + object, + action_path); } /*--------------------------- GtkCellRenderer ---------------------------------*/ void +glade_gtk_cell_renderer_action_activate (GladeWidgetAdaptor *adaptor, + GObject *object, + const gchar *action_path) +{ + if (strcmp (action_path, "launch_editor") == 0) + { + GladeWidget *w = glade_widget_get_from_gobject (object); + + while ((w = glade_widget_get_parent (w))) + { + if (GTK_IS_TREE_VIEW (w->object)) + { + glade_gtk_treeview_launch_editor (w->object); + break; + } + } + } + else + GWA_GET_CLASS (G_TYPE_OBJECT)->action_activate (adaptor, + object, + action_path); +} + +void glade_gtk_cell_renderer_post_create (GladeWidgetAdaptor *adaptor, GObject *object, GladeCreateReason reason) diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in index b0ccea01..03799660 100644 --- a/plugins/gtk+/gtk+.xml.in +++ b/plugins/gtk+/gtk+.xml.in @@ -1795,25 +1795,12 @@ embedded in another object</_tooltip> <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> <depends-function>glade_gtk_treeview_depends</depends-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"/> + <action id="launch_editor" _name="Edit…" stock="gtk-edit" 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"/> @@ -1909,20 +1896,26 @@ embedded in another object</_tooltip> <get-children-function>glade_gtk_cell_layout_get_children</get-children-function> <read-child-function>glade_gtk_cell_layout_read_child</read-child-function> <write-child-function>glade_gtk_cell_layout_write_child</write-child-function> - - <action-activate-function>glade_gtk_treeview_column_action_activate</action-activate-function> + <action-activate-function>glade_gtk_cell_layout_action_activate</action-activate-function> + <child-set-property-function>glade_gtk_cell_layout_set_child_property</child-set-property-function> + <child-get-property-function>glade_gtk_cell_layout_get_child_property</child-get-property-function> <actions> - <action id="append_renderer" _name="Append Cell Renderer" stock="gtk-add"> - <action id="accel" _name="Accel"/> - <action id="combo" _name="Combo"/> - <action id="pixbuf" _name="Pixbuf"/> - <action id="progress" _name="Progress"/> - <action id="spin" _name="Spin"/> - <action id="text" _name="Text"/> - <action id="toggle" _name="Toggle"/> - </action> + <action id="launch_editor" _name="Edit…" stock="gtk-edit" important="True"/> </actions> + + <properties> + <property id="title" default="column"/> + </properties> + + <packing-properties> + <property save="False" id="position" name="Position" visible="False"> + <parameter-spec> + <type>GParamInt</type> + </parameter-spec> + <_tooltip>The Cell Renderer position in the Tree View Column</_tooltip> + </property> + </packing-properties> </glade-widget-class> <glade-widget-class name="GtkCellRenderer" _title="Cell Renderer"> @@ -1931,6 +1924,11 @@ embedded in another object</_tooltip> <create-editable-function>glade_gtk_cell_renderer_create_editable</create-editable-function> <set-property-function>glade_gtk_cell_renderer_set_property</set-property-function> <write-widget-function>glade_gtk_cell_renderer_write_widget</write-widget-function> + <action-activate-function>glade_gtk_cell_renderer_action_activate</action-activate-function> + + <actions> + <action id="launch_editor" _name="Edit…" stock="gtk-edit" important="True"/> + </actions> <properties> <property id="cell-background-set" disabled="True"/> |