aboutsummaryrefslogtreecommitdiff
path: root/src/stylesheet_editor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stylesheet_editor.c')
-rw-r--r--src/stylesheet_editor.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/stylesheet_editor.c b/src/stylesheet_editor.c
index 55ac3a9..0f5b908 100644
--- a/src/stylesheet_editor.c
+++ b/src/stylesheet_editor.c
@@ -44,6 +44,7 @@ G_DEFINE_TYPE_WITH_CODE(StylesheetEditor, stylesheet_editor,
struct _sspriv
{
struct presentation *p;
+ char *ssdata;
};
@@ -315,9 +316,12 @@ static void update_spacing(struct presentation *p, const char *style_name,
}
-static void revert_sig(GtkButton *button, StylesheetEditor *widget)
+static void revert_sig(GtkButton *button, StylesheetEditor *se)
{
- printf("click revert!\n");
+ stylesheet_set_data(se->priv->p->stylesheet,
+ se->priv->ssdata);
+ set_values_from_presentation(se);
+ g_signal_emit_by_name(se, "changed");
}
@@ -491,6 +495,14 @@ static void narrative_paraspace_sig(GtkSpinButton *widget, StylesheetEditor *se)
}
+static void stylesheet_editor_finalize(GObject *obj)
+{
+ StylesheetEditor *se = COLLOQUIUM_STYLESHEET_EDITOR(obj);
+ free(se->priv->ssdata);
+ G_OBJECT_CLASS(stylesheet_editor_parent_class)->finalize(obj);
+}
+
+
static void stylesheet_editor_init(StylesheetEditor *se)
{
se->priv = G_TYPE_INSTANCE_GET_PRIVATE(se, COLLOQUIUM_TYPE_STYLESHEET_EDITOR,
@@ -512,7 +524,7 @@ void stylesheet_editor_class_init(StylesheetEditorClass *klass)
"/uk/me/bitwiz/Colloquium/stylesheeteditor.ui");
g_type_class_add_private(gobject_class, sizeof(StylesheetEditorPrivate));
-
+ gobject_class->finalize = stylesheet_editor_finalize;
/* Narrative style */
SE_BIND_CHILD(narrative_style_font, narrative_font_sig);
@@ -570,6 +582,8 @@ StylesheetEditor *stylesheet_editor_new(struct presentation *p)
se->priv->p = p;
set_values_from_presentation(se);
+ se->priv->ssdata = stylesheet_data(p->stylesheet);
+
return se;
}