aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-04 14:08:48 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-04 14:08:48 +0200
commit631d57ac88a927c31435bc654f4d9bc68555e390 (patch)
treeec84b57090731b59a690ef814e07a6c69396d4d5
parent71b279783975e3542e172e23b37583583cb2482b (diff)
downloadgtk-vlc-player-631d57ac88a927c31435bc654f4d9bc68555e390.tar.gz
only save transcript widget font and colors if they have been changed (via keyfile or dialogs)
* so if they haven't been changed, the widget defaults are active (may depend on gtk theme and RC files) * currently it is not possible reset changed fonts/colors to the widget defaults (via the UI, the keyfile may be edited manually)
-rw-r--r--lib/gtk-experiment-widgets/gtk-experiment-transcript.c1
-rw-r--r--src/main.c28
2 files changed, 20 insertions, 9 deletions
diff --git a/lib/gtk-experiment-widgets/gtk-experiment-transcript.c b/lib/gtk-experiment-widgets/gtk-experiment-transcript.c
index 0c2b373..4d0fd46 100644
--- a/lib/gtk-experiment-widgets/gtk-experiment-transcript.c
+++ b/lib/gtk-experiment-widgets/gtk-experiment-transcript.c
@@ -110,6 +110,7 @@ gtk_experiment_transcript_init(GtkExperimentTranscript *klass)
klass->priv->interactive_format.regexp = NULL;
klass->priv->interactive_format.attribs = NULL;
+ /** @todo It should be possible to reset font and colors (to widget defaults) */
klass->priv->menu = gtk_menu_new();
gtk_menu_attach_to_widget(GTK_MENU(klass->priv->menu),
GTK_WIDGET(klass), NULL);
diff --git a/src/main.c b/src/main.c
index f036e5b..93233fa 100644
--- a/src/main.c
+++ b/src/main.c
@@ -257,6 +257,7 @@ main(int argc, char *argv[])
GtkAdjustment *adj;
PangoFontDescription *font_desc;
GdkColor color;
+ GtkRcStyle *modified_style;
/* FIXME: support internationalization instead of enforcing English */
#ifdef __WIN32__
@@ -370,13 +371,17 @@ main(int argc, char *argv[])
gtk_main();
gdk_threads_leave();
- /** @todo only modify style if it isn't the default widget style */
- config_set_transcript_font(SPEAKER_WIZARD,
- transcript_wizard_widget->style->font_desc);
+ modified_style = gtk_widget_get_modifier_style(transcript_wizard_widget);
+ config_set_transcript_font(SPEAKER_WIZARD, modified_style->font_desc);
config_set_transcript_text_color(SPEAKER_WIZARD,
- &transcript_wizard_widget->style->text[GTK_STATE_NORMAL]);
+ modified_style->color_flags[GTK_STATE_NORMAL] & GTK_RC_TEXT
+ ? &modified_style->text[GTK_STATE_NORMAL]
+ : NULL);
config_set_transcript_bg_color(SPEAKER_WIZARD,
- &transcript_wizard_widget->style->bg[GTK_STATE_NORMAL]);
+ modified_style->color_flags[GTK_STATE_NORMAL] & GTK_RC_BG
+ ? &modified_style->bg[GTK_STATE_NORMAL]
+ : NULL);
+ g_object_unref(modified_style);
config_set_transcript_default_format_font(SPEAKER_WIZARD,
transcript_wizard->interactive_format.default_font);
@@ -385,12 +390,17 @@ main(int argc, char *argv[])
config_set_transcript_default_format_bg_color(SPEAKER_WIZARD,
transcript_wizard->interactive_format.default_bg_color);
- config_set_transcript_font(SPEAKER_PROBAND,
- transcript_proband_widget->style->font_desc);
+ modified_style = gtk_widget_get_modifier_style(transcript_proband_widget);
+ config_set_transcript_font(SPEAKER_PROBAND, modified_style->font_desc);
config_set_transcript_text_color(SPEAKER_PROBAND,
- &transcript_proband_widget->style->text[GTK_STATE_NORMAL]);
+ modified_style->color_flags[GTK_STATE_NORMAL] & GTK_RC_TEXT
+ ? &modified_style->text[GTK_STATE_NORMAL]
+ : NULL);
config_set_transcript_bg_color(SPEAKER_PROBAND,
- &transcript_proband_widget->style->bg[GTK_STATE_NORMAL]);
+ modified_style->color_flags[GTK_STATE_NORMAL] & GTK_RC_BG
+ ? &modified_style->bg[GTK_STATE_NORMAL]
+ : NULL);
+ g_object_unref(modified_style);
config_set_transcript_default_format_font(SPEAKER_PROBAND,
transcript_proband->interactive_format.default_font);