add boolean "append" property which makes gimp_container_add() append to
2008-05-10 Michael Natterer <mitch@gimp.org> * app/core/gimplist.[ch]: add boolean "append" property which makes gimp_container_add() append to the list instead of the default prepend. * app/core/gimp.c: create the display list with append = TRUE so the images menu is in a proper order. svn path=/trunk/; revision=25627
This commit is contained in:
committed by
Michael Natterer
parent
6b0a5d8e5d
commit
71df1ab46d
@ -1,3 +1,12 @@
|
||||
2008-05-10 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimplist.[ch]: add boolean "append" property which
|
||||
makes gimp_container_add() append to the list instead of the
|
||||
default prepend.
|
||||
|
||||
* app/core/gimp.c: create the display list with append = TRUE so
|
||||
the images menu is in a proper order.
|
||||
|
||||
2008-05-10 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/actions/windows-actions.c: don't hide the empty images menu,
|
||||
|
||||
@ -210,7 +210,11 @@ gimp_init (Gimp *gimp)
|
||||
gimp->next_item_ID = 1;
|
||||
gimp->item_table = g_hash_table_new (g_direct_hash, NULL);
|
||||
|
||||
gimp->displays = gimp_list_new_weak (GIMP_TYPE_OBJECT, FALSE);
|
||||
gimp->displays = g_object_new (GIMP_TYPE_LIST,
|
||||
"children-type", GIMP_TYPE_OBJECT,
|
||||
"policy", GIMP_CONTAINER_POLICY_WEAK,
|
||||
"append", TRUE,
|
||||
NULL);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (gimp->displays), "displays");
|
||||
|
||||
gimp->next_display_ID = 1;
|
||||
|
||||
@ -35,7 +35,8 @@ enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_UNIQUE_NAMES,
|
||||
PROP_SORT_FUNC
|
||||
PROP_SORT_FUNC,
|
||||
PROP_APPEND
|
||||
};
|
||||
|
||||
|
||||
@ -116,6 +117,13 @@ gimp_list_class_init (GimpListClass *klass)
|
||||
NULL, NULL,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_APPEND,
|
||||
g_param_spec_boolean ("append",
|
||||
NULL, NULL,
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -124,6 +132,7 @@ gimp_list_init (GimpList *list)
|
||||
list->list = NULL;
|
||||
list->unique_names = FALSE;
|
||||
list->sort_func = NULL;
|
||||
list->append = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -142,6 +151,10 @@ gimp_list_set_property (GObject *object,
|
||||
case PROP_SORT_FUNC:
|
||||
gimp_list_set_sort_func (list, g_value_get_pointer (value));
|
||||
break;
|
||||
case PROP_APPEND:
|
||||
list->append = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@ -164,6 +177,10 @@ gimp_list_get_property (GObject *object,
|
||||
case PROP_SORT_FUNC:
|
||||
g_value_set_pointer (value, list->sort_func);
|
||||
break;
|
||||
case PROP_APPEND:
|
||||
g_value_set_boolean (value, list->append);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@ -209,6 +226,8 @@ gimp_list_add (GimpContainer *container,
|
||||
|
||||
if (list->sort_func)
|
||||
list->list = g_list_insert_sorted (list->list, object, list->sort_func);
|
||||
else if (list->append)
|
||||
list->list = g_list_append (list->list, object);
|
||||
else
|
||||
list->list = g_list_prepend (list->list, object);
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ struct _GimpList
|
||||
GList *list;
|
||||
gboolean unique_names;
|
||||
GCompareFunc sort_func;
|
||||
gboolean append;
|
||||
};
|
||||
|
||||
struct _GimpListClass
|
||||
|
||||
Reference in New Issue
Block a user