diff options
-rw-r--r-- | src/callbacks.c | 13 | ||||
-rw-r--r-- | src/callbacks.h | 3 | ||||
-rw-r--r-- | src/uzbl-core.c | 20 |
3 files changed, 22 insertions, 14 deletions
diff --git a/src/callbacks.c b/src/callbacks.c index eb39a9d..6ad8e2c 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -46,6 +46,19 @@ set_authentication_handler() { } void +set_status_background() { + GdkColor color; + gdk_color_parse (uzbl.behave.status_background, &color); + /* labels and hboxes do not draw their own background. applying this + * on the vbox/main_window is ok as the statusbar is the only affected + * widget. (if not, we could also use GtkEventBox) */ + if (uzbl.gui.main_window) + gtk_widget_modify_bg (uzbl.gui.main_window, GTK_STATE_NORMAL, &color); + else if (uzbl.gui.plug) + gtk_widget_modify_bg (GTK_WIDGET(uzbl.gui.plug), GTK_STATE_NORMAL, &color); +} + +void set_icon() { if(file_exists(uzbl.gui.icon)) { if (uzbl.gui.main_window) diff --git a/src/callbacks.h b/src/callbacks.h index 0b89f96..1ba7e0b 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -16,6 +16,9 @@ void set_authentication_handler(); void +set_status_background(); + +void set_icon(); void diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 25583ca..275cccc 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -93,7 +93,7 @@ const struct var_name_to_ptr_t { { "show_status", PTR_V_INT(uzbl.behave.show_status, 1, cmd_set_status)}, { "status_top", PTR_V_INT(uzbl.behave.status_top, 1, move_statusbar)}, { "status_format", PTR_V_STR(uzbl.behave.status_format, 1, NULL)}, - { "status_background", PTR_V_STR(uzbl.behave.status_background, 1, NULL)}, + { "status_background", PTR_V_STR(uzbl.behave.status_background, 1, set_status_background)}, { "title_format_long", PTR_V_STR(uzbl.behave.title_format_long, 1, NULL)}, { "title_format_short", PTR_V_STR(uzbl.behave.title_format_short, 1, NULL)}, { "icon", PTR_V_STR(uzbl.gui.icon, 1, set_icon)}, @@ -1916,11 +1916,12 @@ void update_title (void) { Behaviour *b = &uzbl.behave; gchar *parsed; + const gchar *current_title = gtk_window_get_title (GTK_WINDOW(uzbl.gui.main_window)); if (b->show_status) { - if (b->title_format_short) { + if (b->title_format_short && uzbl.gui.main_window) { parsed = expand(b->title_format_short, 0); - if (uzbl.gui.main_window) + if(current_title && strcmp(current_title, parsed)) gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed); g_free(parsed); } @@ -1929,19 +1930,10 @@ update_title (void) { gtk_label_set_markup(GTK_LABEL(uzbl.gui.mainbar_label), parsed); g_free(parsed); } - if (b->status_background) { - GdkColor color; - gdk_color_parse (b->status_background, &color); - //labels and hboxes do not draw their own background. applying this on the vbox/main_window is ok as the statusbar is the only affected widget. (if not, we could also use GtkEventBox) - if (uzbl.gui.main_window) - gtk_widget_modify_bg (uzbl.gui.main_window, GTK_STATE_NORMAL, &color); - else if (uzbl.gui.plug) - gtk_widget_modify_bg (GTK_WIDGET(uzbl.gui.plug), GTK_STATE_NORMAL, &color); - } } else { - if (b->title_format_long) { + if (b->title_format_long && uzbl.gui.main_window) { parsed = expand(b->title_format_long, 0); - if (uzbl.gui.main_window) + if(current_title && strcmp(current_title, parsed)) gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed); g_free(parsed); } |