aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2019-04-26 22:26:19 +0200
committerThomas White <taw@bitwiz.me.uk>2019-04-26 22:26:19 +0200
commitc9155a34b2e233cff07afb7638a591577b7a767d (patch)
treed40c6660cb97b13e9bf9e5a9b042ca91372665a9 /src
parent18a7cd2f8adb5fd03750e10cb397805f29ed9417 (diff)
Populate stylesheet editor list
Diffstat (limited to 'src')
-rw-r--r--src/stylesheet_editor.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/stylesheet_editor.c b/src/stylesheet_editor.c
index e145dd2..a2987a7 100644
--- a/src/stylesheet_editor.c
+++ b/src/stylesheet_editor.c
@@ -198,24 +198,36 @@ static void set_bg_from_ss(Stylesheet *ss, const char *style_name,
}
-static void set_values_from_presentation(StylesheetEditor *se)
+static void add_style(Stylesheet *ss, const char *path,
+ GtkTreeStore *ts, GtkTreeIter *parent_iter)
{
- GtkTreeIter iter;
- GtkTreeIter iter2;
+ int i, n_substyles;
- gtk_tree_store_clear(se->element_tree);
+ n_substyles = stylesheet_get_num_substyles(ss, path);
+ for ( i=0; i<n_substyles; i++ ) {
+
+ GtkTreeIter iter;
+ const char *name = stylesheet_get_substyle_name(ss, path, i);
- gtk_tree_store_append(se->element_tree, &iter, NULL);
- gtk_tree_store_set(se->element_tree, &iter,
- 0, "Narrative", -1);
+ /* Add this style */
+ gtk_tree_store_append(ts, &iter, parent_iter);
+ gtk_tree_store_set(ts, &iter, 0, name, -1);
- gtk_tree_store_append(se->element_tree, &iter, NULL);
- gtk_tree_store_set(se->element_tree, &iter,
- 0, "Slide", -1);
+ /* Add all substyles */
+ size_t len = strlen(path) + strlen(name) + 2;
+ char *new_path = malloc(len);
+ strcat(new_path, path);
+ strcat(new_path, ".");
+ strcat(new_path, name);
+ add_style(ss, new_path, ts, &iter);
+ }
+}
- gtk_tree_store_append(se->element_tree, &iter2, &iter);
- gtk_tree_store_set(se->element_tree, &iter2,
- 0, "Slide title", -1);
+
+static void set_values_from_presentation(StylesheetEditor *se)
+{
+ gtk_tree_store_clear(se->element_tree);
+ add_style(se->priv->stylesheet, "", se->element_tree, NULL);
set_geom_from_ss(se->priv->stylesheet, se->priv->style_name,
se->w, se->h, se->x, se->y, se->w_units, se->h_units);