Commit 3a7a2e02 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

folder tree: only use the root-uri property, make it construction only

parent 84d9d6a7
...@@ -67,7 +67,6 @@ enum { ...@@ -67,7 +67,6 @@ enum {
enum { enum {
PROP_0, PROP_0,
PROP_ROOT,
PROP_ROOT_URI PROP_ROOT_URI
}; };
...@@ -137,21 +136,19 @@ gth_folder_tree_set_property (GObject *object, ...@@ -137,21 +136,19 @@ gth_folder_tree_set_property (GObject *object,
self = GTH_FOLDER_TREE (object); self = GTH_FOLDER_TREE (object);
switch (property_id) { switch (property_id) {
case PROP_ROOT:
_g_object_unref (self->priv->root);
self->priv->root = _g_object_ref (g_value_get_object (value));
if (self->priv->root == NULL)
self->priv->root = g_file_new_for_uri (DEFAULT_URI);
break;
case PROP_ROOT_URI: case PROP_ROOT_URI:
_g_object_unref (self->priv->root);
self->priv->root = NULL;
uri = g_value_get_string (value); uri = g_value_get_string (value);
if (uri != NULL) if (uri != NULL) {
self->priv->root = g_file_new_for_uri (uri); GFile *new_root;
if (self->priv->root == NULL)
self->priv->root = g_file_new_for_uri (DEFAULT_URI); new_root = g_file_new_for_uri (uri);
if (new_root != NULL) {
_g_object_unref (self->priv->root);
self->priv->root = _g_object_ref (new_root);
}
_g_object_unref (new_root);
}
break; break;
default: default:
...@@ -172,10 +169,6 @@ gth_folder_tree_get_property (GObject *object, ...@@ -172,10 +169,6 @@ gth_folder_tree_get_property (GObject *object,
self = GTH_FOLDER_TREE (object); self = GTH_FOLDER_TREE (object);
switch (property_id) { switch (property_id) {
case PROP_ROOT:
g_value_set_object (value, self->priv->root);
break;
case PROP_ROOT_URI: case PROP_ROOT_URI:
uri = g_file_get_uri (self->priv->root); uri = g_file_get_uri (self->priv->root);
g_value_set_string (value, uri); g_value_set_string (value, uri);
...@@ -235,20 +228,13 @@ gth_folder_tree_class_init (GthFolderTreeClass *class) ...@@ -235,20 +228,13 @@ gth_folder_tree_class_init (GthFolderTreeClass *class)
/* properties */ /* properties */
g_object_class_install_property (object_class,
PROP_ROOT,
g_param_spec_object ("root",
"Root",
"The root of the folder tree",
G_TYPE_FILE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_ROOT_URI, PROP_ROOT_URI,
g_param_spec_string ("root-uri", g_param_spec_string ("root-uri",
"Root uri", "Root uri",
"The root of the folder tree as an uri", "The root of the folder tree as an uri",
NULL, NULL,
G_PARAM_READWRITE)); G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
/* signals */ /* signals */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment