From: Daniel Carl <danielcarl@gmx.de>
Date: Mon, 5 Nov 2012 20:07:51 +0000 (+0100)
Subject: Set status colors and fonts direct to the widgets.
X-Git-Url: https://git.owens.tech/wrapped.html/wrapped.html/git?a=commitdiff_plain;h=d9c09eea0f1b6372ddfac616dca6d2f2acfea96c;p=vimb.git

Set status colors and fonts direct to the widgets.

Do not save the color and font strings and set them every time via markup.
---

diff --git a/src/main.c b/src/main.c
index 0acf590..9eed0b4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -306,17 +306,12 @@ gboolean vp_set_mode(const Arg* arg)
 
 void vp_update_urlbar(const gchar* uri)
 {
-    gchar* markup;
-
-    markup = g_markup_printf_escaped("<span font=\"%s\">%s</span>", vp.config.status_font, uri);
-    gtk_label_set_markup(GTK_LABEL(vp.gui.statusbar.left), markup);
-    g_free(markup);
+    gtk_label_set_text(GTK_LABEL(vp.gui.statusbar.left), uri);
 }
 
 void vp_update_statusbar(void)
 {
     GString* status = g_string_new("");
-    gchar*   markup;
 
     /* show current count */
     g_string_append_printf(status, "%.0d", vp.state.count);
@@ -339,9 +334,7 @@ void vp_update_statusbar(void)
         g_string_append_printf(status, " %d%%", val);
     }
 
-    markup = g_markup_printf_escaped("<span font=\"%s\">%s</span>", vp.config.status_font, status->str);
-    gtk_label_set_markup(GTK_LABEL(vp.gui.statusbar.right), markup);
-    g_free(markup);
+    gtk_label_set_text(GTK_LABEL(vp.gui.statusbar.right), status->str);
     g_string_free(status, TRUE);
 }
 
diff --git a/src/main.h b/src/main.h
index 735e2a4..65bd8c9 100644
--- a/src/main.h
+++ b/src/main.h
@@ -160,9 +160,6 @@ typedef struct {
     time_t cookie_timeout;
 #endif
     gint   scrollstep;
-    gchar* status_color_bg;
-    gchar* status_color_fg;
-    gchar* status_font;
 } Config;
 
 typedef struct {
diff --git a/src/setting.c b/src/setting.c
index 738a085..68fbf27 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -216,14 +216,14 @@ static gboolean setting_status_color_fg(const Setting* s)
 
 static gboolean setting_status_font(const Setting* s)
 {
-    if (vp.config.status_font) {
-        g_free(vp.config.status_font);
-    }
-    vp.config.status_font = g_strdup(s->arg.s);
+    PangoFontDescription* font;
+    font = pango_font_description_from_string(s->arg.s);
+
+    gtk_widget_modify_font(vp.gui.eventbox, font);
+    gtk_widget_modify_font(GTK_WIDGET(vp.gui.statusbar.left), font);
+    gtk_widget_modify_font(GTK_WIDGET(vp.gui.statusbar.right), font);
 
-    /* update status bar to apply changed settings */
-    vp_update_statusbar();
-    vp_update_urlbar(webkit_web_view_get_uri(vp.gui.webview));
+    pango_font_description_free(font);
 
     return TRUE;
 }
@@ -235,13 +235,10 @@ static gboolean setting_style(const Setting* s)
     MessageType type = g_str_has_suffix(s->name, "error") ? VP_MSG_ERROR : VP_MSG_NORMAL;
 
     if (g_str_has_prefix(s->name, "input-bg")) {
-        PRINT_DEBUG("Set style %s -> %s", s->name, s->arg.s);
         gdk_color_parse(s->arg.s, &style->input_bg[type]);
     } else if (g_str_has_prefix(s->name, "input-fg")) {
-        PRINT_DEBUG("Set style %s -> %s", s->name, s->arg.s);
         gdk_color_parse(s->name, &style->input_fg[type]);
     } else if (g_str_has_prefix(s->arg.s, "input-font")) {
-        PRINT_DEBUG("Set style %s -> %s", s->name, s->arg.s);
         if (style->input_font[type]) {
             pango_font_description_free(style->input_font[type]);
         }