Add different progress colors when using proxy.
This commit is contained in:
parent
25ba840e4d
commit
0b885f18e3
|
@ -1,8 +1,11 @@
|
||||||
/* modifier 0 means no modifier */
|
/* modifier 0 means no modifier */
|
||||||
static char *useragent = "Surf/"VERSION" (X11; U; Unix; en-US) AppleWebKit/531.2+ Compatible (Safari)";
|
static char *useragent = "Surf/"VERSION" (X11; U; Unix; en-US) AppleWebKit/531.2+ Compatible (Safari)";
|
||||||
static char *progress = "#0066FF";
|
static char *progress = "#0000FF";
|
||||||
static char *progress_untrust = "#FF6600";
|
static char *progress_untrust = "#FF0000";
|
||||||
static char *progress_trust = "#00FF00";
|
static char *progress_trust = "#00FF00";
|
||||||
|
static char *progress_proxy = "#FFFF00";
|
||||||
|
static char *progress_proxy_trust = "#66FF00";
|
||||||
|
static char *progress_proxy_untrust = "#FF6600";
|
||||||
static char *stylefile = ".surf/style.css";
|
static char *stylefile = ".surf/style.css";
|
||||||
static char *scriptfile = ".surf/script.js";
|
static char *scriptfile = ".surf/script.js";
|
||||||
static char *cookiefile = ".surf/cookies.txt";
|
static char *cookiefile = ".surf/cookies.txt";
|
||||||
|
@ -50,3 +53,4 @@ static Key keys[] = {
|
||||||
{ MODKEY, GDK_n, find, { .b = TRUE } },
|
{ MODKEY, GDK_n, find, { .b = TRUE } },
|
||||||
{ MODKEY|GDK_SHIFT_MASK,GDK_n, find, { .b = FALSE } },
|
{ MODKEY|GDK_SHIFT_MASK,GDK_n, find, { .b = FALSE } },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
19
surf.c
19
surf.c
|
@ -75,7 +75,7 @@ static GdkNativeWindow embed = 0;
|
||||||
static gboolean showxid = FALSE;
|
static gboolean showxid = FALSE;
|
||||||
static char winid[64];
|
static char winid[64];
|
||||||
static char *progname;
|
static char *progname;
|
||||||
static gboolean loadimage = 1, plugin = 1, script = 1;
|
static gboolean loadimage = 1, plugin = 1, script = 1, using_proxy = 0;
|
||||||
|
|
||||||
static char *buildpath(const char *path);
|
static char *buildpath(const char *path);
|
||||||
static gboolean buttonrelease(WebKitWebView *web, GdkEventButton *e, GList *gl);
|
static gboolean buttonrelease(WebKitWebView *web, GdkEventButton *e, GList *gl);
|
||||||
|
@ -333,6 +333,7 @@ void
|
||||||
drawindicator(Client *c) {
|
drawindicator(Client *c) {
|
||||||
gint width;
|
gint width;
|
||||||
const char *uri;
|
const char *uri;
|
||||||
|
char *colorname;
|
||||||
GtkWidget *w;
|
GtkWidget *w;
|
||||||
GdkGC *gc;
|
GdkGC *gc;
|
||||||
GdkColor fg;
|
GdkColor fg;
|
||||||
|
@ -342,11 +343,20 @@ drawindicator(Client *c) {
|
||||||
width = c->progress * w->allocation.width / 100;
|
width = c->progress * w->allocation.width / 100;
|
||||||
gc = gdk_gc_new(w->window);
|
gc = gdk_gc_new(w->window);
|
||||||
if(strstr(uri, "https://") == uri) {
|
if(strstr(uri, "https://") == uri) {
|
||||||
gdk_color_parse(c->sslfailed ?
|
if(using_proxy) {
|
||||||
progress_untrust : progress_trust, &fg);
|
colorname = c->sslfailed? progress_proxy_untrust : progress_proxy_trust;
|
||||||
|
} else {
|
||||||
|
colorname = c->sslfailed? progress_untrust : progress_trust;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
gdk_color_parse(progress, &fg);
|
if(using_proxy) {
|
||||||
|
colorname = progress_proxy;
|
||||||
|
} else {
|
||||||
|
colorname = progress;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gdk_color_parse(colorname, &fg);
|
||||||
gdk_gc_set_rgb_fg_color(gc, &fg);
|
gdk_gc_set_rgb_fg_color(gc, &fg);
|
||||||
gdk_draw_rectangle(w->window,
|
gdk_draw_rectangle(w->window,
|
||||||
w->style->bg_gc[GTK_WIDGET_STATE(w)],
|
w->style->bg_gc[GTK_WIDGET_STATE(w)],
|
||||||
|
@ -816,6 +826,7 @@ setup(void) {
|
||||||
g_object_set(G_OBJECT(s), "proxy-uri", puri, NULL);
|
g_object_set(G_OBJECT(s), "proxy-uri", puri, NULL);
|
||||||
soup_uri_free(puri);
|
soup_uri_free(puri);
|
||||||
g_free(new_proxy);
|
g_free(new_proxy);
|
||||||
|
using_proxy = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user