Hiding the loading indicator when it is not used. Based on a patch from
authorChristoph Lohmann <20h@r-36.net>
Sun, 28 Oct 2012 13:16:22 +0000 (14:16 +0100)
committerChristoph Lohmann <20h@r-36.net>
Sun, 28 Oct 2012 13:16:22 +0000 (14:16 +0100)
http://xteddy.org/surf.html#toc5. Thanks!

config.def.h
surf.c

index 79aa600..91006f0 100644 (file)
@@ -9,6 +9,8 @@ static char *cookiefile     = ".surf/cookies.txt";
 static time_t sessiontime   = 3600;
 static char *cafile         = "/etc/ssl/certs/ca-certificates.crt";
 static char *strictssl      = FALSE; /* Refuse untrusted SSL connections */
 static time_t sessiontime   = 3600;
 static char *cafile         = "/etc/ssl/certs/ca-certificates.crt";
 static char *strictssl      = FALSE; /* Refuse untrusted SSL connections */
+static int   indicator_thickness = 2;
+
 #define HIDE_BACKGROUND FALSE
 #define SPATIAL_BROWSING TRUE
 
 #define HIDE_BACKGROUND FALSE
 #define SPATIAL_BROWSING TRUE
 
diff --git a/surf.c b/surf.c
index bb9343b..ae1a935 100644 (file)
--- a/surf.c
+++ b/surf.c
@@ -341,11 +341,12 @@ drawindicator(Client *c) {
        w = c->indicator;
        width = c->progress * w->allocation.width / 100;
        gc = gdk_gc_new(w->window);
        w = c->indicator;
        width = c->progress * w->allocation.width / 100;
        gc = gdk_gc_new(w->window);
-       if(strstr(uri, "https://") == uri)
+       if(strstr(uri, "https://") == uri) {
                gdk_color_parse(c->sslfailed ?
                                progress_untrust : progress_trust, &fg);
                gdk_color_parse(c->sslfailed ?
                                progress_untrust : progress_trust, &fg);
-       else
+       } else {
                gdk_color_parse(progress, &fg);
                gdk_color_parse(progress, &fg);
+       }
        gdk_gc_set_rgb_fg_color(gc, &fg);
        gdk_draw_rectangle(w->window,
                        w->style->bg_gc[GTK_WIDGET_STATE(w)],
        gdk_gc_set_rgb_fg_color(gc, &fg);
        gdk_draw_rectangle(w->window,
                        w->style->bg_gc[GTK_WIDGET_STATE(w)],
@@ -554,7 +555,7 @@ newclient(void) {
 
        /* Indicator */
        c->indicator = gtk_drawing_area_new();
 
        /* Indicator */
        c->indicator = gtk_drawing_area_new();
-       gtk_widget_set_size_request(c->indicator, 0, 2);
+       gtk_widget_set_size_request(c->indicator, 0, indicator_thickness);
        g_signal_connect (G_OBJECT (c->indicator), "expose_event",
                        G_CALLBACK (exposeindicator), c);
 
        g_signal_connect (G_OBJECT (c->indicator), "expose_event",
                        G_CALLBACK (exposeindicator), c);
 
@@ -569,7 +570,6 @@ newclient(void) {
        gtk_box_set_child_packing(GTK_BOX(c->vbox), c->scroll, TRUE, TRUE, 0, GTK_PACK_START);
        gtk_widget_grab_focus(GTK_WIDGET(c->view));
        gtk_widget_show(c->vbox);
        gtk_box_set_child_packing(GTK_BOX(c->vbox), c->scroll, TRUE, TRUE, 0, GTK_PACK_START);
        gtk_widget_grab_focus(GTK_WIDGET(c->view));
        gtk_widget_show(c->vbox);
-       gtk_widget_show(c->indicator);
        gtk_widget_show(c->scroll);
        gtk_widget_show(GTK_WIDGET(c->view));
        gtk_widget_show(c->win);
        gtk_widget_show(c->scroll);
        gtk_widget_show(GTK_WIDGET(c->view));
        gtk_widget_show(c->win);