antiright-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Antiright-devel] antiright/gtkshell color.c color.h


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright/gtkshell color.c color.h
Date: Mon, 10 Dec 2007 15:14:05 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/12/10 15:14:05

Added files:
        gtkshell       : color.c color.h 

Log message:
        Split out color functions.  

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/color.c?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/color.h?cvsroot=antiright&rev=1.1

Patches:
Index: color.c
===================================================================
RCS file: color.c
diff -N color.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ color.c     10 Dec 2007 15:14:05 -0000      1.1
@@ -0,0 +1,31 @@
+
+#include "gtkshell.h"
+
+static GdkColor
+get_color_for_string(const gchar * color_string, const gboolean is_fg)
+{
+       GdkColor color;
+
+       if(!gdk_color_parse(color_string, &color))
+               gdk_color_parse(is_fg 
+                       ? GSH_FALLBACK_FGCOLOR
+                       : GSH_FALLBACK_BGCOLOR, &color);
+
+       return color;
+}
+
+
+void
+gsh_widget_set_color(GtkWidget * widget, 
+       const gchar * color_string, gboolean is_fg_color)
+{
+       GdkColor color;
+
+       color=get_color_for_string(color_string, is_fg_color);
+
+       if(is_fg_color)
+               gtk_widget_modify_fg(widget, GTK_STATE_NORMAL, &color);
+       else
+               gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &color);
+}
+

Index: color.h
===================================================================
RCS file: color.h
diff -N color.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ color.h     10 Dec 2007 15:14:05 -0000      1.1
@@ -0,0 +1,35 @@
+/*
+  AntiRight
+  (c) 2002-2007 Jeffrey Bedard
+  address@hidden
+
+  This file is part of AntiRight.
+
+  AntiRight is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  AntiRight is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with AntiRight; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+*/
+
+#ifndef GSH_COLOR_H
+#define GSH_COLOR_H
+
+#define GSH_FALLBACK_COLOR "black"
+#define GSH_FALLBACK_BGCOLOR "#aeb2c3"
+#define GSH_FALLBACK_FGCOLOR GSH_FALLBACK_COLOR
+
+void
+gsh_widget_set_color(GtkWidget * widget, 
+       const gchar * color_string, gboolean is_fg_color);
+
+#endif /* ! GSH_COLOR_H */
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]