Revert "Bug 616416: hidden layer groups appear again after an image change"

This reverts commit 359c9c22d9.
This commit is contained in:
Massimo Valentini 2011-09-25 21:49:36 +02:00
parent 359c9c22d9
commit a67bb11cf5
7 changed files with 14 additions and 186 deletions

View File

@ -52,7 +52,6 @@ struct _GimpGroupLayerPrivate
GeglNode *graph;
GeglNode *offset_node;
gint suspend_resize;
gboolean expanded;
/* hackish temp states to make the projection/tiles stuff work */
gboolean reallocate_projection;
@ -85,9 +84,6 @@ static gboolean gimp_group_layer_get_size (GimpViewable *viewable,
gint *width,
gint *height);
static GimpContainer * gimp_group_layer_get_children (GimpViewable *viewable);
static gboolean gimp_group_layer_get_expanded (GimpViewable *viewable);
static void gimp_group_layer_set_expanded (GimpViewable *viewable,
gboolean expanded);
static GimpItem * gimp_group_layer_duplicate (GimpItem *item,
GType new_type);
@ -204,8 +200,6 @@ gimp_group_layer_class_init (GimpGroupLayerClass *klass)
viewable_class->default_stock_id = "gtk-directory";
viewable_class->get_size = gimp_group_layer_get_size;
viewable_class->get_children = gimp_group_layer_get_children;
viewable_class->set_expanded = gimp_group_layer_set_expanded;
viewable_class->get_expanded = gimp_group_layer_get_expanded;
item_class->duplicate = gimp_group_layer_duplicate;
item_class->convert = gimp_group_layer_convert;
@ -256,7 +250,6 @@ gimp_group_layer_init (GimpGroupLayer *group)
GimpGroupLayerPrivate *private = GET_PRIVATE (group);
private->children = gimp_drawable_stack_new (GIMP_TYPE_LAYER);
private->expanded = TRUE;
g_signal_connect (private->children, "add",
G_CALLBACK (gimp_group_layer_child_add),
@ -389,23 +382,6 @@ gimp_group_layer_get_children (GimpViewable *viewable)
return GET_PRIVATE (viewable)->children;
}
static gboolean
gimp_group_layer_get_expanded (GimpViewable *viewable)
{
GimpGroupLayer *group = GIMP_GROUP_LAYER (viewable);
return GET_PRIVATE (group)->expanded;
}
static void
gimp_group_layer_set_expanded (GimpViewable *viewable,
gboolean expanded)
{
GimpGroupLayer *group = GIMP_GROUP_LAYER (viewable);
GET_PRIVATE (group)->expanded = expanded;
}
static GimpItem *
gimp_group_layer_duplicate (GimpItem *item,
GType new_type)

View File

@ -169,8 +169,6 @@ gimp_viewable_class_init (GimpViewableClass *klass)
klass->get_new_pixbuf = gimp_viewable_real_get_new_pixbuf;
klass->get_description = gimp_viewable_real_get_description;
klass->get_children = gimp_viewable_real_get_children;
klass->set_expanded = NULL;
klass->get_expanded = NULL;
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_STOCK_ID, "stock-id",
NULL, NULL,
@ -1179,27 +1177,6 @@ gimp_viewable_get_children (GimpViewable *viewable)
return GIMP_VIEWABLE_GET_CLASS (viewable)->get_children (viewable);
}
gboolean
gimp_viewable_get_expanded (GimpViewable *viewable)
{
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), FALSE);
if (GIMP_VIEWABLE_GET_CLASS (viewable)->get_expanded)
return GIMP_VIEWABLE_GET_CLASS (viewable)->get_expanded (viewable);
return FALSE;
}
void
gimp_viewable_set_expanded (GimpViewable *viewable,
gboolean expanded)
{
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
if (GIMP_VIEWABLE_GET_CLASS (viewable)->set_expanded)
GIMP_VIEWABLE_GET_CLASS (viewable)->set_expanded (viewable, expanded);
}
gboolean
gimp_viewable_is_ancestor (GimpViewable *ancestor,
GimpViewable *descendant)

View File

@ -97,10 +97,6 @@ struct _GimpViewableClass
gchar **tooltip);
GimpContainer * (* get_children) (GimpViewable *viewable);
void (* set_expanded) (GimpViewable *viewable,
gboolean expand);
gboolean (* get_expanded) (GimpViewable *viewable);
};
@ -180,9 +176,6 @@ void gimp_viewable_set_parent (GimpViewable *viewable,
GimpViewable *parent);
GimpContainer * gimp_viewable_get_children (GimpViewable *viewable);
gboolean gimp_viewable_get_expanded (GimpViewable *viewable);
void gimp_viewable_set_expanded (GimpViewable *viewable,
gboolean expanded);
gboolean gimp_viewable_is_ancestor (GimpViewable *ancestor,
GimpViewable *descendant);

View File

@ -114,13 +114,6 @@ static gboolean gimp_container_tree_view_get_selected_single (GimpContainer
GtkTreeIter *iter);
static gint gimp_container_tree_view_get_selected (GimpContainerView *view,
GList **items);
static void gimp_container_tree_view_row_expanded (GtkTreeView *tree_view,
GtkTreeIter *iter,
GtkTreePath *path,
GimpContainerTreeView *view);
static void gimp_container_tree_view_expand_rows (GtkTreeModel *model,
GtkTreeView *view,
GtkTreeIter *parent);
G_DEFINE_TYPE_WITH_CODE (GimpContainerTreeView, gimp_container_tree_view,
@ -515,9 +508,6 @@ gimp_container_tree_view_set_container (GimpContainerView *view,
if (old_container)
{
g_signal_handlers_disconnect_by_func (tree_view->view,
gimp_container_tree_view_row_expanded,
tree_view);
if (! container)
{
if (gimp_dnd_viewable_source_remove (GTK_WIDGET (tree_view->view),
@ -562,22 +552,6 @@ gimp_container_tree_view_set_container (GimpContainerView *view,
parent_view_iface->set_container (view, container);
if (container)
{
gimp_container_tree_view_expand_rows (tree_view->model,
tree_view->view,
NULL);
g_signal_connect (tree_view->view,
"row-collapsed",
G_CALLBACK (gimp_container_tree_view_row_expanded),
tree_view);
g_signal_connect (tree_view->view,
"row-expanded",
G_CALLBACK (gimp_container_tree_view_row_expanded),
tree_view);
}
gtk_tree_view_columns_autosize (tree_view->view);
}
@ -618,6 +592,16 @@ gimp_container_tree_view_insert_item (GimpContainerView *view,
viewable,
parent_insert_data,
index);
if (parent_insert_data)
{
GtkTreePath *path = gtk_tree_model_get_path (tree_view->model, iter);
gtk_tree_view_expand_to_path (tree_view->view, path);
gtk_tree_path_free (path);
}
return iter;
}
@ -1327,71 +1311,3 @@ gimp_container_tree_view_get_selected (GimpContainerView *view,
return selected_count;
}
static void
gimp_container_tree_view_row_expanded (GtkTreeView *tree_view,
GtkTreeIter *iter,
GtkTreePath *path,
GimpContainerTreeView *view)
{
GimpViewRenderer *renderer;
gtk_tree_model_get (view->model, iter,
GIMP_CONTAINER_TREE_STORE_COLUMN_RENDERER, &renderer,
-1);
if (renderer)
{
gboolean expanded = gtk_tree_view_row_expanded (tree_view, path);
gimp_viewable_set_expanded (renderer->viewable,
expanded);
if (expanded)
{
g_signal_handlers_block_by_func (tree_view,
gimp_container_tree_view_row_expanded,
view);
gimp_container_tree_view_expand_rows (view->model, tree_view, iter);
g_signal_handlers_unblock_by_func (tree_view,
gimp_container_tree_view_row_expanded,
view);
}
g_object_unref (renderer);
}
}
static void
gimp_container_tree_view_expand_rows (GtkTreeModel *model,
GtkTreeView *view,
GtkTreeIter *parent)
{
GtkTreeIter iter;
if (gtk_tree_model_iter_children (model, &iter, parent))
do
if (gtk_tree_model_iter_has_child (model, &iter))
{
GimpViewRenderer *renderer;
gtk_tree_model_get (model, &iter,
GIMP_CONTAINER_TREE_STORE_COLUMN_RENDERER, &renderer,
-1);
if (renderer)
{
GtkTreePath *path = gtk_tree_model_get_path (model, &iter);
if (gimp_viewable_get_expanded (renderer->viewable))
gtk_tree_view_expand_row (view, path, FALSE);
else
gtk_tree_view_collapse_row (view, path);
gtk_tree_path_free (path);
g_object_unref (renderer);
}
gimp_container_tree_view_expand_rows (model, view, &iter);
}
while (gtk_tree_model_iter_next (model, &iter));
}

View File

@ -83,8 +83,7 @@ static gboolean xcf_load_layer_props (XcfInfo *info,
gboolean *apply_mask,
gboolean *edit_mask,
gboolean *show_mask,
guint32 *text_layer_flags,
guint32 *group_layer_flags);
guint32 *text_layer_flags);
static gboolean xcf_load_channel_props (XcfInfo *info,
GimpImage *image,
GimpChannel **channel);
@ -694,8 +693,7 @@ xcf_load_layer_props (XcfInfo *info,
gboolean *apply_mask,
gboolean *edit_mask,
gboolean *show_mask,
guint32 *text_layer_flags,
guint32 *group_layer_flags)
guint32 *text_layer_flags)
{
PropType prop_type;
guint32 prop_size;
@ -872,10 +870,6 @@ xcf_load_layer_props (XcfInfo *info,
}
break;
case PROP_GROUP_ITEM_FLAGS:
info->cp += xcf_read_int32 (info->fp, group_layer_flags, 1);
break;
default:
#ifdef GIMP_UNSTABLE
g_printerr ("unexpected/unknown layer property: %d (skipping)\n",
@ -1067,7 +1061,6 @@ xcf_load_layer (XcfInfo *info,
gboolean show_mask = FALSE;
gboolean active;
gboolean floating;
guint32 group_layer_flags = 0;
guint32 text_layer_flags = 0;
gint width;
gint height;
@ -1096,7 +1089,7 @@ xcf_load_layer (XcfInfo *info,
/* read in the layer properties */
if (! xcf_load_layer_props (info, image, &layer, item_path,
&apply_mask, &edit_mask, &show_mask,
&text_layer_flags, &group_layer_flags))
&text_layer_flags))
goto error;
xcf_progress_update (info);
@ -1135,10 +1128,6 @@ xcf_load_layer (XcfInfo *info,
xcf_progress_update (info);
}
else
{
gimp_viewable_set_expanded (GIMP_VIEWABLE (layer), group_layer_flags != 0);
}
/* read in the layer mask */
if (layer_mask_offset != 0)

View File

@ -51,8 +51,7 @@ typedef enum
PROP_SAMPLE_POINTS = 27,
PROP_LOCK_CONTENT = 28,
PROP_GROUP_ITEM = 29,
PROP_ITEM_PATH = 30,
PROP_GROUP_ITEM_FLAGS = 31
PROP_ITEM_PATH = 30
} PropType;
typedef enum

View File

@ -537,15 +537,6 @@ xcf_save_layer_props (XcfInfo *info,
flags));
}
if (gimp_viewable_get_children (GIMP_VIEWABLE (layer)))
{
gint32 flags = gimp_viewable_get_expanded (GIMP_VIEWABLE (layer));
xcf_check_error (xcf_save_prop (info,
image, PROP_GROUP_ITEM_FLAGS, error,
flags));
}
parasites = gimp_item_get_parasites (GIMP_ITEM (layer));
if (gimp_parasite_list_length (parasites) > 0)
@ -1122,19 +1113,6 @@ xcf_save_prop (XcfInfo *info,
}
}
break;
case PROP_GROUP_ITEM_FLAGS:
{
guint32 flags;
flags = va_arg (args, guint32);
size = 4;
xcf_write_prop_type_check_error (info, prop_type);
xcf_write_int32_check_error (info, &size, 1);
xcf_write_int32_check_error (info, &flags, 1);
}
break;
}
va_end (args);