diff options
author | Marco Peereboom <marco@conformal.com> | 2012-11-28 11:48:04 -0600 |
---|---|---|
committer | Marco Peereboom <marco@conformal.com> | 2012-11-28 11:48:04 -0600 |
commit | 374f8c06dd04fa1324181f575f12971f5d46eb5f (patch) | |
tree | ccfd7c601a3bbdbc8ec66e401ecb005346832211 | |
parent | 62e3b73bf508dfe5d5ca65f6dc9c50d6aa461d7d (diff) | |
download | xombrero-374f8c06dd04fa1324181f575f12971f5d46eb5f.tar.gz |
add tor icon toggle for proxy
requested by many
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | dragonfly/Makefile | 2 | ||||
-rw-r--r-- | freebsd/Makefile | 2 | ||||
-rw-r--r-- | linux/Makefile | 2 | ||||
-rw-r--r-- | netbsd/Makefile | 2 | ||||
-rw-r--r-- | settings.c | 7 | ||||
-rw-r--r-- | tordisabled.ico | bin | 0 -> 1150 bytes | |||
-rw-r--r-- | torenabled.ico | bin | 0 -> 1150 bytes | |||
-rw-r--r-- | xombrero.c | 22 | ||||
-rw-r--r-- | xombrero.h | 1 |
10 files changed, 34 insertions, 6 deletions
diff --git a/Makefile b/Makefile index ff7a81c..6ef1886 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,8 @@ beforeinstall: install -m 644 ${.CURDIR}/hsts-preload ${PREFIX}/share/xombrero install -m 644 ${.CURDIR}/user-agent-headers ${PREFIX}/share/xombrero install -m 644 ${.CURDIR}/http-accept-headers ${PREFIX}/share/xombrero + install -m 644 ${.CURDIR}/torenabled.ico ${PREFIX}/share/xombrero + install -m 644 ${.CURDIR}/tordisabled.ico ${PREFIX}/share/xombrero ${PROG} ${OBJS} beforedepend: javascript.h tooltip.h diff --git a/dragonfly/Makefile b/dragonfly/Makefile index f203f27..f438f1f 100644 --- a/dragonfly/Makefile +++ b/dragonfly/Makefile @@ -81,6 +81,8 @@ install: all install -m 644 ../tld-rules $(DESTDIR)$(RESDIR) install -m 644 ../style.css $(DESTDIR)$(RESDIR) install -m 644 ../hsts-preload $(DESTDIR)$(RESDIR) + install -m 644 ../torenabled.ico $(DESTDIR)$(RESDIR) + install -m 644 ../tordisabled.ico $(DESTDIR)$(RESDIR) clean: rm -f xombrero *.o diff --git a/freebsd/Makefile b/freebsd/Makefile index f6f27a0..8723232 100644 --- a/freebsd/Makefile +++ b/freebsd/Makefile @@ -79,6 +79,8 @@ install: all install -m 644 ../tld-rules $(DESTDIR)$(RESDIR) install -m 644 ../style.css $(DESTDIR)$(RESDIR) install -m 644 ../hsts-preload $(DESTDIR)$(RESDIR) + install -m 644 ../torenabled.ico $(DESTDIR)$(RESDIR) + install -m 644 ../tordisabled.ico $(DESTDIR)$(RESDIR) clean: rm -f xombrero *.o diff --git a/linux/Makefile b/linux/Makefile index d7ccf3b..3c9bcf5 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -73,6 +73,8 @@ install: all install -m 644 ../tld-rules $(DESTDIR)$(RESDIR) install -m 644 ../style.css $(DESTDIR)$(RESDIR) install -m 644 ../hsts-preload $(DESTDIR)$(RESDIR) + install -m 644 ../torenabled.ico $(DESTDIR)$(RESDIR) + install -m 644 ../tordisabled.ico $(DESTDIR)$(RESDIR) uninstall: rm -f $(DESTDIR)$(BINDIR)/xombrero diff --git a/netbsd/Makefile b/netbsd/Makefile index dc9f564..7118caa 100644 --- a/netbsd/Makefile +++ b/netbsd/Makefile @@ -81,6 +81,8 @@ install: all install -m 644 ../tld-rules $(DESTDIR)$(RESDIR) install -m 644 ../style.css $(DESTDIR)$(RESDIR) install -m 644 ../hsts-preload $(DESTDIR)$(RESDIR) + install -m 644 ../torenabled.ico $(DESTDIR)$(RESDIR) + install -m 644 ../tordisabled.ico $(DESTDIR)$(RESDIR) clean: rm -f xombrero *.o diff --git a/settings.c b/settings.c index 0fcc262..a43a117 100644 --- a/settings.c +++ b/settings.c @@ -3027,10 +3027,13 @@ setup_proxy(char *uri) gtk_label_set_text(GTK_LABEL(t->sbe.proxy), "proxy"); gtk_widget_show(t->proxy_toggle); - button_set_stockid(t->proxy_toggle, - GTK_STOCK_CONNECT); + button_set_file(t->proxy_toggle, + "torenabled.ico"); } } + } else { + TAILQ_FOREACH(t, &tabs, entry) + button_set_file(t->proxy_toggle, "tordisabled.ico"); } } diff --git a/tordisabled.ico b/tordisabled.ico new file mode 100644 index 0000000..5c3d739 --- /dev/null +++ b/tordisabled.ico Binary files differdiff --git a/torenabled.ico b/torenabled.ico new file mode 100644 index 0000000..48060b1 --- /dev/null +++ b/torenabled.ico Binary files differdiff --git a/xombrero.c b/xombrero.c index 7e3003a..97f458d 100644 --- a/xombrero.c +++ b/xombrero.c @@ -3325,14 +3325,12 @@ proxy_cmd(struct tab *t, struct karg *args) } if (http_proxy) { setup_proxy(NULL); + button_set_file(t->proxy_toggle, "tordisabled.ico"); show_oops(t, "http proxy disabled"); - button_set_stockid(t->proxy_toggle, - GTK_STOCK_DISCONNECT); } else { setup_proxy(http_proxy_save); + button_set_file(t->proxy_toggle, "torenabled.ico"); show_oops(t, "http_proxy = %s", http_proxy); - button_set_stockid(t->proxy_toggle, - GTK_STOCK_CONNECT); } } done: @@ -7262,6 +7260,11 @@ create_toolbar(struct tab *t) /* toggle proxy button */ t->proxy_toggle = create_button("Proxy-Toggle", proxy_uri ? GTK_STOCK_CONNECT : GTK_STOCK_DISCONNECT, 0); + /* override icons */ + if (proxy_uri) + button_set_file(t->proxy_toggle, "torenabled.ico"); + else + button_set_file(t->proxy_toggle, "tordisabled.ico"); gtk_widget_set_sensitive(t->proxy_toggle, TRUE); g_signal_connect(G_OBJECT(t->proxy_toggle), "clicked", G_CALLBACK(proxy_toggle_cb), t); @@ -8241,6 +8244,17 @@ create_button(char *name, char *stockid, int size) } void +button_set_file(GtkWidget *button, char *filename) +{ + GtkWidget *image; + char file[PATH_MAX]; + + snprintf(file, sizeof file, "%s" PS "%s", resource_dir, filename); + image = gtk_image_new_from_file(file); + gtk_button_set_image(GTK_BUTTON(button), image); +} + +void button_set_stockid(GtkWidget *button, char *stockid) { GtkWidget *image; diff --git a/xombrero.h b/xombrero.h index 1b36bf5..ce3b77c 100644 --- a/xombrero.h +++ b/xombrero.h @@ -418,6 +418,7 @@ void set_status(struct tab *t, gchar *fmt, ...); void load_webkit_string(struct tab *, const char *, gchar *, int); void button_set_stockid(GtkWidget *, char *); +void button_set_file(GtkWidget *, char *); void webview_progress_changed_cb(WebKitWebView *, GParamSpec *, struct tab *); /* cookies */ |