Commit 309d7377 authored by Tim Janik's avatar Tim Janik Committed by Tim Janik

applied gtk-bolliet-980310-0.patch.gz which adds more checks and

Wed Mar 11 04:35:06 1998  Tim Janik  <timj@gimp.org>

        * gtk/gtklist.c:
        * gtk/gtktree.h:
        * gtk/gtktree.c:
        * gtk/gtktreeitem.h:
        * gtk/gtktreeitem.c: applied gtk-bolliet-980310-0.patch.gz which adds
        more checks and implements gtk_tree_clear_items. made a bunch of style
        and indentation fixes.
parent 2ff460a6
Wed Mar 11 04:35:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtklist.c:
* gtk/gtktree.h:
* gtk/gtktree.c:
* gtk/gtktreeitem.h:
* gtk/gtktreeitem.c: applied gtk-bolliet-980310-0.patch.gz which adds
more checks and implements gtk_tree_clear_items. made a bunch of style
and indentation fixes.
Wed Mar 11 03:35:17 1998 Tim Janik <timj@gimp.org>
* gtk/gtktooltips.h:
......
Wed Mar 11 04:35:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtklist.c:
* gtk/gtktree.h:
* gtk/gtktree.c:
* gtk/gtktreeitem.h:
* gtk/gtktreeitem.c: applied gtk-bolliet-980310-0.patch.gz which adds
more checks and implements gtk_tree_clear_items. made a bunch of style
and indentation fixes.
Wed Mar 11 03:35:17 1998 Tim Janik <timj@gimp.org>
* gtk/gtktooltips.h:
......
Wed Mar 11 04:35:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtklist.c:
* gtk/gtktree.h:
* gtk/gtktree.c:
* gtk/gtktreeitem.h:
* gtk/gtktreeitem.c: applied gtk-bolliet-980310-0.patch.gz which adds
more checks and implements gtk_tree_clear_items. made a bunch of style
and indentation fixes.
Wed Mar 11 03:35:17 1998 Tim Janik <timj@gimp.org>
* gtk/gtktooltips.h:
......
Wed Mar 11 04:35:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtklist.c:
* gtk/gtktree.h:
* gtk/gtktree.c:
* gtk/gtktreeitem.h:
* gtk/gtktreeitem.c: applied gtk-bolliet-980310-0.patch.gz which adds
more checks and implements gtk_tree_clear_items. made a bunch of style
and indentation fixes.
Wed Mar 11 03:35:17 1998 Tim Janik <timj@gimp.org>
* gtk/gtktooltips.h:
......
Wed Mar 11 04:35:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtklist.c:
* gtk/gtktree.h:
* gtk/gtktree.c:
* gtk/gtktreeitem.h:
* gtk/gtktreeitem.c: applied gtk-bolliet-980310-0.patch.gz which adds
more checks and implements gtk_tree_clear_items. made a bunch of style
and indentation fixes.
Wed Mar 11 03:35:17 1998 Tim Janik <timj@gimp.org>
* gtk/gtktooltips.h:
......
Wed Mar 11 04:35:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtklist.c:
* gtk/gtktree.h:
* gtk/gtktree.c:
* gtk/gtktreeitem.h:
* gtk/gtktreeitem.c: applied gtk-bolliet-980310-0.patch.gz which adds
more checks and implements gtk_tree_clear_items. made a bunch of style
and indentation fixes.
Wed Mar 11 03:35:17 1998 Tim Janik <timj@gimp.org>
* gtk/gtktooltips.h:
......
Wed Mar 11 04:35:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtklist.c:
* gtk/gtktree.h:
* gtk/gtktree.c:
* gtk/gtktreeitem.h:
* gtk/gtktreeitem.c: applied gtk-bolliet-980310-0.patch.gz which adds
more checks and implements gtk_tree_clear_items. made a bunch of style
and indentation fixes.
Wed Mar 11 03:35:17 1998 Tim Janik <timj@gimp.org>
* gtk/gtktooltips.h:
......
......@@ -40,7 +40,7 @@ static gint navailable_depths;
static GdkVisualType available_types[6];
static gint navailable_types;
static char* visual_names[] =
static gchar* visual_names[] =
{
"static gray",
"grayscale",
......
......@@ -40,7 +40,7 @@ static gint navailable_depths;
static GdkVisualType available_types[6];
static gint navailable_types;
static char* visual_names[] =
static gchar* visual_names[] =
{
"static gray",
"grayscale",
......
......@@ -28,9 +28,9 @@ extern "C" {
#endif /* __cplusplus */
#define GTK_BUTTON(obj) GTK_CHECK_CAST (obj, gtk_button_get_type (), GtkButton)
#define GTK_BUTTON_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_button_get_type (), GtkButtonClass)
#define GTK_IS_BUTTON(obj) GTK_CHECK_TYPE (obj, gtk_button_get_type ())
#define GTK_BUTTON(obj) (GTK_CHECK_CAST ((obj), gtk_button_get_type (), GtkButton))
#define GTK_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gtk_button_get_type (), GtkButtonClass))
#define GTK_IS_BUTTON(obj) (GTK_CHECK_TYPE ((obj), gtk_button_get_type ()))
typedef struct _GtkButton GtkButton;
......
......@@ -308,6 +308,11 @@ void
gtk_container_add (GtkContainer *container,
GtkWidget *widget)
{
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
gtk_signal_emit (GTK_OBJECT (container), container_signals[ADD], widget);
}
......@@ -317,7 +322,10 @@ gtk_container_remove (GtkContainer *container,
{
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GTK_CONTAINER (widget->parent) == container);
if (container->focus_child == widget)
container->focus_child = NULL;
......
......@@ -1832,10 +1832,3 @@ gtk_entry_select_region (GtkEntry *entry,
{
gtk_editable_select_region (GTK_EDITABLE(entry), start, end);
}
void
gtk_entry_set_max_length (GtkEntry *entry,
guint16 max)
{
entry->text_max_length = max;
}
......@@ -398,8 +398,8 @@ gtk_list_clear_items (GtkList *list,
GList *start_list;
GList *end_list;
GList *tmp_list;
gint nchildren;
gint selection_changed;
guint nchildren;
gboolean selection_changed;
g_return_if_fail (list != NULL);
g_return_if_fail (GTK_IS_LIST (list));
......@@ -819,6 +819,7 @@ gtk_list_add (GtkContainer *container,
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_LIST (container));
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_LIST_ITEM (widget));
list = GTK_LIST (container);
......
......@@ -822,9 +822,9 @@ gtk_text_forward_delete (GtkText *text,
}
static gchar *
gtk_text_get_chars (GtkEditable *editable,
gint start_pos,
gint end_pos)
gtk_text_get_chars (GtkEditable *editable,
gint start_pos,
gint end_pos)
{
GtkText *text;
......
......@@ -181,48 +181,52 @@ gtk_tree_new ()
void
gtk_tree_append (GtkTree *tree,
GtkWidget *child)
GtkWidget *tree_item)
{
g_return_if_fail (tree != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (child));
g_return_if_fail (GTK_IS_TREE (tree));
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
gtk_tree_insert(tree, child, -1);
gtk_tree_insert(tree, tree_item, -1);
}
void
gtk_tree_prepend (GtkTree *tree,
GtkWidget *child)
GtkWidget *tree_item)
{
g_return_if_fail (tree != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (child));
gtk_tree_insert(tree, child, 0);
g_return_if_fail (GTK_IS_TREE (tree));
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
gtk_tree_insert(tree, tree_item, 0);
}
void
gtk_tree_insert (GtkTree *tree,
GtkWidget *child,
GtkWidget *tree_item,
gint position)
{
gint nchildren;
g_return_if_fail (tree != NULL || child != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM(child));
g_return_if_fail (tree != NULL);
g_return_if_fail (GTK_IS_TREE (tree));
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
/* set parent widget to item */
gtk_widget_set_parent (child, GTK_WIDGET (tree));
gtk_widget_set_parent (tree_item, GTK_WIDGET (tree));
if (GTK_WIDGET_VISIBLE (child->parent))
if (GTK_WIDGET_VISIBLE (tree_item->parent))
{
if (GTK_WIDGET_REALIZED (child->parent) &&
!GTK_WIDGET_REALIZED (child))
gtk_widget_realize (child);
if (GTK_WIDGET_REALIZED (tree_item->parent) &&
!GTK_WIDGET_REALIZED (tree_item))
gtk_widget_realize (tree_item);
if (GTK_WIDGET_MAPPED (child->parent) &&
!GTK_WIDGET_MAPPED (child))
gtk_widget_map (child);
if (GTK_WIDGET_MAPPED (tree_item->parent) &&
!GTK_WIDGET_MAPPED (tree_item))
gtk_widget_map (tree_item);
}
nchildren = g_list_length (tree->children);
......@@ -232,11 +236,11 @@ gtk_tree_insert (GtkTree *tree,
if (position == nchildren)
{
tree->children = g_list_append(tree->children, child);
tree->children = g_list_append(tree->children, tree_item);
}
else
{
tree->children = g_list_insert(tree->children, child, position);
tree->children = g_list_insert(tree->children, tree_item, position);
}
if (GTK_WIDGET_VISIBLE (tree))
......@@ -253,6 +257,7 @@ gtk_tree_add (GtkContainer *container,
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_TREE (container));
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (widget));
tree = GTK_TREE (container);
......@@ -363,9 +368,39 @@ gtk_tree_clear_items (GtkTree *tree,
gint start,
gint end)
{
GtkWidget *widget;
GList *clear_list;
GList *tmp_list;
guint nchildren;
guint index;
g_return_if_fail (tree != NULL);
g_return_if_fail (GTK_IS_TREE (tree));
nchildren = g_list_length (tree->children);
if (nchildren > 0)
{
if ((end < 0) || (end > nchildren))
end = nchildren;
if (start >= end)
return;
tmp_list = g_list_nth (tree->children, start);
clear_list = NULL;
index = start;
while (tmp_list && index <= end)
{
widget = tmp_list->data;
tmp_list = tmp_list->next;
index++;
clear_list = g_list_prepend (clear_list, widget);
}
gtk_tree_remove_items (tree, clear_list);
}
}
static void
......@@ -616,7 +651,6 @@ gtk_tree_realize (GtkWidget *widget)
widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_background (widget->window,
&widget->style->base[GTK_STATE_NORMAL]);
}
void
......@@ -630,8 +664,7 @@ gtk_tree_remove_item (GtkTree *container,
g_return_if_fail (widget != NULL);
g_return_if_fail (container == GTK_TREE (widget->parent));
item_list = g_list_alloc ();
item_list->data = widget;
item_list = g_list_append (NULL, widget);
gtk_tree_remove_items (GTK_TREE (container), item_list);
......@@ -679,8 +712,10 @@ gtk_tree_remove_items (GtkTree *tree,
#ifdef TREE_DEBUG
g_print("* sort list by depth\n");
#endif /* TREE_DEBUG */
while(tmp_list)
while (tmp_list)
{
#ifdef TREE_DEBUG
g_print("* item [%#x] depth [%d]\n",
(int)tmp_list->data,
......@@ -709,6 +744,7 @@ gtk_tree_remove_items (GtkTree *tree,
#ifdef TREE_DEBUG
g_print("* scan sorted list\n");
#endif /* TREE_DEBUG */
tmp_list = sorted_list;
while (tmp_list)
{
......@@ -835,20 +871,22 @@ gtk_tree_remove_items (GtkTree *tree,
void
gtk_tree_select_child (GtkTree *tree,
GtkWidget *child)
GtkWidget *tree_item)
{
gtk_signal_emit (GTK_OBJECT (tree), tree_signals[SELECT_CHILD], child);
g_return_if_fail (tree != NULL);
g_return_if_fail (GTK_IS_TREE (tree));
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
gtk_signal_emit (GTK_OBJECT (tree), tree_signals[SELECT_CHILD], tree_item);
}
void
gtk_tree_select_item (GtkTree *tree,
gint item)
gint item)
{
GList *tmp_list;
g_return_if_fail (tree != NULL);
g_return_if_fail (GTK_IS_TREE (tree));
......@@ -979,9 +1017,14 @@ gtk_tree_unmap (GtkWidget *widget)
void
gtk_tree_unselect_child (GtkTree *tree,
GtkWidget *child)
GtkWidget *tree_item)
{
gtk_signal_emit (GTK_OBJECT (tree), tree_signals[UNSELECT_CHILD], child);
g_return_if_fail (tree != NULL);
g_return_if_fail (GTK_IS_TREE (tree));
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
gtk_signal_emit (GTK_OBJECT (tree), tree_signals[UNSELECT_CHILD], tree_item);
}
void
......@@ -990,7 +1033,6 @@ gtk_tree_unselect_item (GtkTree *tree,
{
GList *tmp_list;
g_return_if_fail (tree != NULL);
g_return_if_fail (GTK_IS_TREE (tree));
......@@ -1008,7 +1050,6 @@ gtk_real_tree_select_child (GtkTree *tree,
GList *tmp_list;
GtkWidget *tmp_item;
g_return_if_fail (tree != NULL);
g_return_if_fail (GTK_IS_TREE (tree));
g_return_if_fail (child != NULL);
......@@ -1129,7 +1170,6 @@ static void
gtk_real_tree_unselect_child (GtkTree *tree,
GtkWidget *child)
{
g_return_if_fail (tree != NULL);
g_return_if_fail (GTK_IS_TREE (tree));
g_return_if_fail (child != NULL);
......
......@@ -79,11 +79,11 @@ struct _GtkTreeClass
guint gtk_tree_get_type (void);
GtkWidget* gtk_tree_new (void);
void gtk_tree_append (GtkTree *tree,
GtkWidget *child);
GtkWidget *tree_item);
void gtk_tree_prepend (GtkTree *tree,
GtkWidget *child);
GtkWidget *tree_item);
void gtk_tree_insert (GtkTree *tree,
GtkWidget *child,
GtkWidget *tree_item,
gint position);
void gtk_tree_remove_items (GtkTree *tree,
GList *items);
......@@ -95,9 +95,9 @@ void gtk_tree_select_item (GtkTree *tree,
void gtk_tree_unselect_item (GtkTree *tree,
gint item);
void gtk_tree_select_child (GtkTree *tree,
GtkWidget *child);
GtkWidget *tree_item);
void gtk_tree_unselect_child (GtkTree *tree,
GtkWidget *child);
GtkWidget *tree_item);
gint gtk_tree_child_position (GtkTree *tree,
GtkWidget *child);
void gtk_tree_set_selection_mode (GtkTree *tree,
......
......@@ -175,32 +175,39 @@ static void
gtk_tree_item_subtree_button_click (GtkWidget *widget)
{
GtkTreeItem* item;
item = (GtkTreeItem*) gtk_object_get_user_data(GTK_OBJECT(widget));
if(!GTK_WIDGET_IS_SENSITIVE(item))
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_EVENT_BOX (widget));
item = (GtkTreeItem*) gtk_object_get_user_data (GTK_OBJECT (widget));
if (!GTK_WIDGET_IS_SENSITIVE (item))
return;
if(item->expanded)
gtk_tree_item_collapse(item);
if (item->expanded)
gtk_tree_item_collapse (item);
else
gtk_tree_item_expand(item);
gtk_tree_item_expand (item);
}
/* callback for event box state changed */
static void
gtk_tree_item_subtree_button_changed_state(GtkWidget *w)
gtk_tree_item_subtree_button_changed_state (GtkWidget *widget)
{
if(GTK_WIDGET_VISIBLE (w)) {
if (w->state == GTK_STATE_NORMAL)
gdk_window_set_background (w->window, &w->style->base[w->state]);
else
gdk_window_set_background (w->window, &w->style->bg[w->state]);
if (GTK_WIDGET_DRAWABLE(w))
gdk_window_clear_area (w->window, 0, 0,
w->allocation.width, w->allocation.height);
}
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_EVENT_BOX (widget));
if (GTK_WIDGET_VISIBLE (widget))
{
if (widget->state == GTK_STATE_NORMAL)
gdk_window_set_background (widget->window, &widget->style->base[widget->state]);
else
gdk_window_set_background (widget->window, &widget->style->bg[widget->state]);
if (GTK_WIDGET_DRAWABLE (widget))
gdk_window_clear_area (widget->window, 0, 0,
widget->allocation.width, widget->allocation.height);
}
}
static void
......@@ -208,6 +215,9 @@ gtk_tree_item_init (GtkTreeItem *tree_item)
{
GtkWidget *eventbox, *pixmapwid;
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
tree_item->expanded = FALSE;
tree_item->subtree = NULL;
GTK_WIDGET_SET_FLAGS (tree_item, GTK_CAN_FOCUS);
......@@ -265,7 +275,6 @@ gtk_tree_item_new_with_label (gchar *label)
GtkWidget *tree_item;
GtkWidget *label_widget;
tree_item = gtk_tree_item_new ();
label_widget = gtk_label_new (label);
gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
......@@ -283,6 +292,8 @@ gtk_tree_item_set_subtree (GtkTreeItem *tree_item,
{
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
g_return_if_fail (subtree != NULL);
g_return_if_fail (GTK_IS_TREE (subtree));
if(tree_item->subtree) {
g_warning("there is already a subtree for this tree item\n");
......@@ -326,33 +337,37 @@ gtk_tree_item_set_subtree (GtkTreeItem *tree_item,
void
gtk_tree_item_select (GtkTreeItem *tree_item)
{
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
gtk_item_select (GTK_ITEM (tree_item));
}
void
gtk_tree_item_deselect (GtkTreeItem *tree_item)
{
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
gtk_item_deselect (GTK_ITEM (tree_item));
}
void
gtk_tree_item_expand (GtkTreeItem *tree_item)
{
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
gtk_signal_emit (GTK_OBJECT (tree_item), tree_item_signals[EXPAND_TREE], NULL);
}
void
gtk_tree_item_collapse (GtkTreeItem *tree_item)
{
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
gtk_signal_emit (GTK_OBJECT (tree_item), tree_item_signals[COLLAPSE_TREE], NULL);
}
static void
......@@ -362,6 +377,9 @@ gtk_tree_item_add_pixmaps (GtkTreeItem *tree_item)
GdkColormap *colormap;
GtkTreePixmaps *pixmap_node = NULL;
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
if (tree_item->pixmaps)
return;
......@@ -418,6 +436,9 @@ gtk_tree_item_add_pixmaps (GtkTreeItem *tree_item)
static void
gtk_tree_item_remove_pixmaps (GtkTreeItem *tree_item)
{
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
if (tree_item->pixmaps)
{
GtkTreePixmaps *pixmap_node = (GtkTreePixmaps *)tree_item->pixmaps->data;
......@@ -521,16 +542,6 @@ gtk_tree_item_size_allocate (GtkWidget *widget,
child_allocation.x = border_width + GTK_TREE(widget->parent)->current_indent;
child_allocation.y = GTK_CONTAINER (widget)->border_width;
#if 0
child_allocation.height = allocation->height - child_allocation.y * 2;
child_allocation.width = item->pixmaps_box->requisition.width;
child_allocation.y += 1;
child_allocation.height -= 2;
gtk_widget_size_allocate (item->pixmaps_box, &child_allocation);
child_allocation.height += 2;
#else
child_allocation.width = item->pixmaps_box->requisition.width;
child_allocation.height = item->pixmaps_box->requisition.height;
......@@ -541,7 +552,6 @@ gtk_tree_item_size_allocate (GtkWidget *widget,
child_allocation.y = GTK_CONTAINER (widget)->border_width;
child_allocation.height = allocation->height - child_allocation.y * 2;
#endif
child_allocation.x += item->pixmaps_box->requisition.width+DEFAULT_DELTA;
child_allocation.width =
......@@ -549,7 +559,6 @@ gtk_tree_item_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (bin->child, &child_allocation);
}
}
static void
......@@ -559,6 +568,9 @@ gtk_tree_item_draw_lines(GtkWidget *widget)
GtkTree* tree;
guint lx1, ly1, lx2, ly2;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (widget));
item = GTK_TREE_ITEM(widget);
tree = GTK_TREE(widget->parent);
......@@ -758,7 +770,6 @@ static gint
gtk_tree_item_focus_in (GtkWidget *widget,
GdkEventFocus *event)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_ITEM (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
......@@ -774,7 +785,6 @@ static gint
gtk_tree_item_focus_out (GtkWidget *widget,
GdkEventFocus *event)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_ITEM (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
......@@ -788,8 +798,7 @@ gtk_tree_item_focus_out (GtkWidget *widget,
static void
gtk_real_tree_item_select (GtkItem *item)
{
{
g_return_if_fail (item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (item));
......@@ -808,7 +817,6 @@ gtk_real_tree_item_select (GtkItem *item)
static void
gtk_real_tree_item_deselect (GtkItem *item)
{
g_return_if_fail (item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (item));
......@@ -829,7 +837,6 @@ gtk_real_tree_item_deselect (GtkItem *item)
static void
gtk_real_tree_item_toggle (GtkItem *item)
{
g_return_if_fail (item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (item));
......@@ -861,24 +868,24 @@ gtk_real_tree_item_expand (GtkTreeItem *tree_item)
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
g_return_if_fail (tree_item->subtree != NULL);
if(!tree_item->expanded)
if (tree_item->subtree && !tree_item->expanded)
{
tree = GTK_TREE(GTK_WIDGET(tree_item)->parent);
tree = GTK_TREE (GTK_WIDGET (tree_item)->parent);
/* hide subtree widget */
gtk_widget_show(tree_item->subtree);
gtk_widget_show (tree_item->subtree);
/* hide button '+' and show button '-' */
if(tree_item->pixmaps_box) {
gtk_container_remove(GTK_CONTAINER(tree_item->pixmaps_box),
tree_item->plus_pix_widget);
gtk_container_add(GTK_CONTAINER(tree_item->pixmaps_box),
tree_item->minus_pix_widget);
}
if(tree->root_tree) gtk_widget_queue_resize(GTK_WIDGET(tree->root_tree));
if (tree_item->pixmaps_box)
{
gtk_container_remove (GTK_CONTAINER (tree_item->pixmaps_box),
tree_item->plus_pix_widget);
gtk_container_add (GTK_CONTAINER (tree_item->pixmaps_box),
tree_item->minus_pix_widget);
}
if (tree->root_tree)
gtk_widget_queue_resize (GTK_WIDGET (tree->root_tree));
tree_item->expanded = TRUE;
}
}
......@@ -887,29 +894,29 @@ static void
gtk_real_tree_item_collapse (GtkTreeItem *tree_item)
{
GtkTree* tree;
g_return_if_fail (tree_item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
g_return_if_fail (tree_item->subtree != NULL);
if(tree_item->expanded)
if (tree_item->subtree && tree_item->expanded)
{
tree = GTK_TREE(GTK_WIDGET(tree_item)->parent);
tree = GTK_TREE (GTK_WIDGET (tree_item)->parent);
/* hide subtree widget */
gtk_widget_hide(tree_item->subtree);
gtk_widget_hide (tree_item->subtree);
/* hide button '-' and show button '+' */
if(tree_item->pixmaps_box) {
gtk_container_remove(GTK_CONTAINER(tree_item->pixmaps_box),
tree_item->minus_pix_widget);
gtk_container_add(GTK_CONTAINER