From 374f8c06dd04fa1324181f575f12971f5d46eb5f Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Wed, 28 Nov 2012 11:48:04 -0600 Subject: [PATCH] add tor icon toggle for proxy requested by many --- Makefile | 2 ++ dragonfly/Makefile | 2 ++ freebsd/Makefile | 2 ++ linux/Makefile | 2 ++ netbsd/Makefile | 2 ++ settings.c | 7 +++++-- tordisabled.ico | Bin 0 -> 1150 bytes torenabled.ico | Bin 0 -> 1150 bytes xombrero.c | 22 ++++++++++++++++++---- xombrero.h | 1 + 10 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 tordisabled.ico create mode 100644 torenabled.ico 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 0000000000000000000000000000000000000000..5c3d7390c2a0f7937e3f17ed860f74f15fffd84a GIT binary patch literal 1150 zcwSwTX-HII6o%i)#%)FnY?MT%albQWR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y@A@-{Gcw2BD?Q3O z3(tmzg;+t&5Y rc7S8Sm>I~#n=S*!ZmQPq1G8bk7x`Ld1;0h^(*b|-1RX1I8Lsjd^Za98 literal 0 HcwPel00001 diff --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 */ -- 2.11.4.GIT