[hackers] [surf] indicator is red when http and green when https || Enno Boland (tox)

From: <hg_AT_suckless.org>
Date: Mon, 7 Sep 2009 08:54:57 +0000 (UTC)

changeset: 65:386652c89c1b
tag: tip
user: Enno Boland (tox) <tox_AT_s01.de>
date: Mon Sep 07 10:56:27 2009 +0200
files: surf.c
description:
indicator is red when http and green when https

diff -r 103ea20c0504 -r 386652c89c1b surf.c
--- a/surf.c Mon Sep 07 10:31:50 2009 +0200
+++ b/surf.c Mon Sep 07 10:56:27 2009 +0200
@@ -179,17 +179,31 @@
 drawindicator(Client *c) {
         GtkWidget *w;
         gint width;
+ GdkGC *gc;
+ GdkColor red = { 65535,65535,0,0 };
+ GdkColor green = { 65535,0,65535,0 };
+ gchar *uri;
 
+
+ uri = geturi(c);
         w = c->indicator;
         width = c->progress * w->allocation.width / 100;
+
+ gc = gdk_gc_new(w->window);
+
+ if(strstr(uri, "https://") == uri)
+ gdk_gc_set_rgb_fg_color(gc, &green);
+ else
+ gdk_gc_set_rgb_fg_color(gc, &red);
         gdk_draw_rectangle(w->window,
                         w->style->bg_gc[GTK_WIDGET_STATE(w)],
                         TRUE,
                         0, 0, w->allocation.width, w->allocation.height);
         gdk_draw_rectangle(w->window,
- w->style->fg_gc[GTK_WIDGET_STATE(w)],
+ gc,
                         TRUE,
                         0, 0, width, w->allocation.height);
+ g_object_unref(gc);/*g_free(gc);*/
 }
 
 gboolean
Received on Mon Sep 07 2009 - 08:54:57 UTC

This archive was generated by hypermail 2.2.0 : Mon Sep 07 2009 - 09:00:06 UTC