aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2018-04-29 21:47:54 +0200
committerThomas White <taw@bitwiz.me.uk>2018-04-29 21:47:54 +0200
commit7604d35942733575e7314630fa54f70fd4849340 (patch)
treee1ebe6b558e1d002e7e042856166e6fc6e21a6f8
parent992cf2451ad3720466fb8957e1296d3468dab17e (diff)
Implement setting default fg colour
-rw-r--r--data/stylesheeteditor.ui1
-rw-r--r--src/stylesheet_editor.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/data/stylesheeteditor.ui b/data/stylesheeteditor.ui
index 5dd473d..dfff08a 100644
--- a/data/stylesheeteditor.ui
+++ b/data/stylesheeteditor.ui
@@ -122,6 +122,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <signal name="color-set" handler="default_colour_sig" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/stylesheet_editor.c b/src/stylesheet_editor.c
index bb65be7..b9a5945 100644
--- a/src/stylesheet_editor.c
+++ b/src/stylesheet_editor.c
@@ -90,6 +90,17 @@ static void default_font_sig(GtkFontButton *widget, StylesheetEditor *se)
}
+static void default_colour_sig(GtkColorButton *widget, StylesheetEditor *se)
+{
+ GdkRGBA rgba;
+ gchar *col;
+ gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget), &rgba);
+ col = gdk_rgba_to_string(&rgba);
+ set_ss(se->priv->p->stylesheet, "fgcol", col);
+ g_free(col);
+}
+
+
static void stylesheet_editor_init(StylesheetEditor *se)
{
se->priv = G_TYPE_INSTANCE_GET_PRIVATE(se, COLLOQUIUM_TYPE_STYLESHEET_EDITOR,
@@ -117,6 +128,7 @@ void stylesheet_editor_class_init(StylesheetEditorClass *klass)
gtk_widget_class_bind_template_callback(widget_class, revert_sig);
gtk_widget_class_bind_template_callback(widget_class, default_font_sig);
+ gtk_widget_class_bind_template_callback(widget_class, default_colour_sig);
}