summaryrefslogtreecommitdiff
path: root/ccss-gtk
diff options
context:
space:
mode:
authorRobert Staudinger <robsta@gnome.org>2009-08-07 14:25:31 +0200
committerRobert Staudinger <robsta@gnome.org>2009-08-07 14:25:31 +0200
commit1f1120f727d79b6c5d16281c58e86846c3b703ec (patch)
tree8ac9b31fd8294d2e0ec5dd11af097b8b3eb4fb8b /ccss-gtk
parent270ddc8d6d72b358998c5e329ee8205f0be73cf3 (diff)
[coding style] Consistently use 'true' and 'false' from stdbool.h
Diffstat (limited to 'ccss-gtk')
-rw-r--r--ccss-gtk/ccss-gtk-color.c11
-rw-r--r--ccss-gtk/ccss-gtk-functions.c84
-rw-r--r--ccss-gtk/ccss-gtk-stylesheet.c8
-rw-r--r--ccss-gtk/ccss-stylesheet-to-gtkrc.c7
4 files changed, 56 insertions, 54 deletions
diff --git a/ccss-gtk/ccss-gtk-color.c b/ccss-gtk/ccss-gtk-color.c
index 6e7e3ce..3a3688e 100644
--- a/ccss-gtk/ccss-gtk-color.c
+++ b/ccss-gtk/ccss-gtk-color.c
@@ -24,6 +24,7 @@
* MA 02110-1301, USA.
*/
+#include <stdbool.h>
#include <gtk/gtk.h>
#include "ccss-gtk-color.h"
#include "config.h"
@@ -36,19 +37,19 @@ ccss_gtk_color_lookup (char const *spec,
GHashTable *colors;
GdkColor *system_color;
- g_return_val_if_fail (spec, FALSE);
+ g_return_val_if_fail (spec, false);
settings = gtk_settings_get_default ();
colors = NULL;
g_object_get (G_OBJECT (settings), "color-hash", &colors, NULL);
- g_return_val_if_fail (colors, FALSE);
+ g_return_val_if_fail (colors, false);
system_color = (GdkColor *) g_hash_table_lookup (colors, spec);
if (system_color) {
color->red = system_color->red;
color->green = system_color->green;
color->blue = system_color->blue;
- return TRUE;
+ return true;
}
/* Try to parse the color. */
@@ -215,7 +216,7 @@ ccss_gtk_color_mix (double factor,
result->green = factor * color1->green + (1.0 - factor) * color2->green;
result->blue = factor * color1->blue + (1.0 - factor) * color2->blue;
- return TRUE;
+ return true;
}
bool
@@ -250,6 +251,6 @@ ccss_gtk_color_shade (double factor,
color->green = (guint16) (green * 65535.0);
color->blue = (guint16) (blue * 65535.0);
- return TRUE;
+ return true;
}
diff --git a/ccss-gtk/ccss-gtk-functions.c b/ccss-gtk/ccss-gtk-functions.c
index 138ebf7..3192892 100644
--- a/ccss-gtk/ccss-gtk-functions.c
+++ b/ccss-gtk/ccss-gtk-functions.c
@@ -52,7 +52,7 @@ url (GSList const *args,
soup_uri_set_path (uri, resolved_path);
g_free (resolved_path), resolved_path = NULL;
- ret = soup_uri_to_string (uri, FALSE);
+ ret = soup_uri_to_string (uri, false);
soup_uri_free (uri), uri = NULL;
#else
char const *given_path;
@@ -77,7 +77,7 @@ color_walk_r (GdkColor *color,
char const *token;
gboolean ret;
- g_return_val_if_fail (*args && (*args)->data, FALSE);
+ g_return_val_if_fail (*args && (*args)->data, false);
if (function)
token = function;
@@ -88,50 +88,50 @@ color_walk_r (GdkColor *color,
double red, green, blue;
- if (!function) { *args = (*args)->next; if (!*args) return FALSE; }
+ if (!function) { *args = (*args)->next; if (!*args) return false; }
/* red */
red = g_ascii_strtod ((char const *) (*args)->data, NULL);
- *args = (*args)->next; if (!*args) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
/* "," */
- if (0 != g_strcmp0(",", (char const *) (*args)->data)) return FALSE;
- *args = (*args)->next; if (!*args) return FALSE;
+ if (0 != g_strcmp0(",", (char const *) (*args)->data)) return false;
+ *args = (*args)->next; if (!*args) return false;
/* green */
green = g_ascii_strtod ((char const *) (*args)->data, NULL);
- *args = (*args)->next; if (!*args) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
/* "," */
- if (0 != g_strcmp0(",", (char const *) (*args)->data)) return FALSE;
- *args = (*args)->next; if (!*args) return FALSE;
+ if (0 != g_strcmp0(",", (char const *) (*args)->data)) return false;
+ *args = (*args)->next; if (!*args) return false;
/* blue */
blue = g_ascii_strtod ((char const *) (*args)->data, NULL);
if (!function) {
/* ")" */
- *args = (*args)->next; if (!*args) return FALSE;
- if (0 != g_strcmp0(")", (char const *) (*args)->data)) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
+ if (0 != g_strcmp0(")", (char const *) (*args)->data)) return false;
}
color->red = (guint16) (red * 65535.0);
color->green = (guint16) (green * 65535.0);
color->blue = (guint16) (blue * 65535.0);
- return TRUE;
+ return true;
} else if (0 == g_strcmp0 ("gtk-color(", token)) {
- if (!function) { *args = (*args)->next; if (!*args) return FALSE; }
+ if (!function) { *args = (*args)->next; if (!*args) return false; }
/* color */
ret = ccss_gtk_color_lookup ((char const *) (*args)->data, color);
if (!function) {
/* ")" */
- *args = (*args)->next; if (!*args) return FALSE;
- if (0 != g_strcmp0(")", (char const *) (*args)->data)) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
+ if (0 != g_strcmp0(")", (char const *) (*args)->data)) return false;
}
return ret;
@@ -141,83 +141,83 @@ color_walk_r (GdkColor *color,
GdkColor color1;
GdkColor color2;
- if (!function) { *args = (*args)->next; if (!*args) return FALSE; }
+ if (!function) { *args = (*args)->next; if (!*args) return false; }
/* factor */
factor = g_ascii_strtod ((char const *) (*args)->data, NULL);
- *args = (*args)->next; if (!*args) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
/* "," */
- if (0 != g_strcmp0(",", (char const *) (*args)->data)) return FALSE;
- *args = (*args)->next; if (!*args) return FALSE;
+ if (0 != g_strcmp0(",", (char const *) (*args)->data)) return false;
+ *args = (*args)->next; if (!*args) return false;
/* color1 */
- if (!color_walk_r (&color1, args, NULL)) return FALSE;
+ if (!color_walk_r (&color1, args, NULL)) return false;
/* "," */
- if (0 != g_strcmp0(",", (char const *) (*args)->data)) return FALSE;
- *args = (*args)->next; if (!*args) return FALSE;
+ if (0 != g_strcmp0(",", (char const *) (*args)->data)) return false;
+ *args = (*args)->next; if (!*args) return false;
/* color2 */
- if (!color_walk_r (&color2, args, NULL)) return FALSE;
+ if (!color_walk_r (&color2, args, NULL)) return false;
if (!function) {
/* ")" */
- *args = (*args)->next; if (!*args) return FALSE;
- if (0 != g_strcmp0(")", (char const *) (*args)->data)) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
+ if (0 != g_strcmp0(")", (char const *) (*args)->data)) return false;
}
return ccss_gtk_color_mix (factor, &color1, &color2, color);
} else if (0 == g_strcmp0 ("gtk-shade(", token)) {
- if (!function) { *args = (*args)->next; if (!*args) return FALSE; }
+ if (!function) { *args = (*args)->next; if (!*args) return false; }
/* factor */
factor = g_ascii_strtod ((char const *) (*args)->data, NULL);
- *args = (*args)->next; if (!*args) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
/* "," */
- if (0 != g_strcmp0(",", (char const *) (*args)->data)) return FALSE;
- *args = (*args)->next; if (!*args) return FALSE;
+ if (0 != g_strcmp0(",", (char const *) (*args)->data)) return false;
+ *args = (*args)->next; if (!*args) return false;
/* color */
- if (!color_walk_r (color, args, NULL)) return FALSE;
+ if (!color_walk_r (color, args, NULL)) return false;
if (!function) {
/* ")" */
- *args = (*args)->next; if (!*args) return FALSE;
- if (0 != g_strcmp0(")", (char const *) (*args)->data)) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
+ if (0 != g_strcmp0(")", (char const *) (*args)->data)) return false;
}
return ccss_gtk_color_shade (factor, color);
} else if (0 == g_strcmp0 ("gtk-darker(", token)) {
- if (!function) { *args = (*args)->next; if (!*args) return FALSE; }
+ if (!function) { *args = (*args)->next; if (!*args) return false; }
/* color */
- if (!color_walk_r (color, args, NULL)) return FALSE;
+ if (!color_walk_r (color, args, NULL)) return false;
if (!function) {
/* ")" */
- *args = (*args)->next; if (!*args) return FALSE;
- if (0 != g_strcmp0(")", (char const *) (*args)->data)) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
+ if (0 != g_strcmp0(")", (char const *) (*args)->data)) return false;
}
return ccss_gtk_color_shade (0.7, color);
} else if (0 == g_strcmp0 ("gtk-lighter(", token)) {
- if (!function) { *args = (*args)->next; if (!*args) return FALSE; }
+ if (!function) { *args = (*args)->next; if (!*args) return false; }
/* color */
- if (!color_walk_r (color, args, NULL)) return FALSE;
+ if (!color_walk_r (color, args, NULL)) return false;
if (!function) {
/* ")" */
- *args = (*args)->next; if (!*args) return FALSE;
- if (0 != g_strcmp0(")", (char const *) (*args)->data)) return FALSE;
+ *args = (*args)->next; if (!*args) return false;
+ if (0 != g_strcmp0(")", (char const *) (*args)->data)) return false;
}
return ccss_gtk_color_shade (1.3, color);
@@ -230,7 +230,7 @@ color_walk_r (GdkColor *color,
return ret;
}
- return FALSE;
+ return false;
}
static char *
@@ -245,7 +245,7 @@ dump (GSList const *args)
g_string_append (str, (char const *) iter->data);
}
- return g_string_free (str, FALSE);
+ return g_string_free (str, false);
}
static char *
diff --git a/ccss-gtk/ccss-gtk-stylesheet.c b/ccss-gtk/ccss-gtk-stylesheet.c
index a70c36e..a76105d 100644
--- a/ccss-gtk/ccss-gtk-stylesheet.c
+++ b/ccss-gtk/ccss-gtk-stylesheet.c
@@ -393,7 +393,7 @@ serialize (struct RcBlock const *block,
} else if (0 == strcmp ("*", block->type_name)) {
style = g_strdup ("default");
} else {
- return FALSE;
+ return false;
}
style_name = g_strdup_printf ("gce-%s", style);
@@ -449,10 +449,10 @@ serialize (struct RcBlock const *block,
g_string_append_printf (rc_string, "%s style \"%s\"\n\n", rc_selector, style_name);
}
- g_string_free (colors, TRUE);
+ g_string_free (colors, true);
g_free (style_name), style_name = NULL;
- return TRUE;
+ return true;
}
static void
@@ -499,7 +499,7 @@ ccss_gtk_stylesheet_to_gtkrc (ccss_stylesheet_t *self)
rc_string);
str = rc_string->str;
- g_string_free (rc_string, FALSE), rc_string = NULL;
+ g_string_free (rc_string, false), rc_string = NULL;
return str;
}
diff --git a/ccss-gtk/ccss-stylesheet-to-gtkrc.c b/ccss-gtk/ccss-stylesheet-to-gtkrc.c
index b5db3f1..04e665b 100644
--- a/ccss-gtk/ccss-stylesheet-to-gtkrc.c
+++ b/ccss-gtk/ccss-stylesheet-to-gtkrc.c
@@ -20,13 +20,14 @@
*/
#include <glib.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <ccss-gtk/ccss-gtk.h>
#include <gtk/gtk.h>
#include "config.h"
-static bool _dump = FALSE;
+static bool _dump = false;
static char const *_user_agent_file = NULL;
static char const *_user_file = NULL;
static char const *_author_file = NULL;
@@ -53,14 +54,14 @@ main (int argc,
context = g_option_context_new (" - CSS to GTKRC converter");
g_option_context_add_main_entries (context, _options, NULL);
- g_option_context_add_group (context, gtk_get_option_group (TRUE));
+ g_option_context_add_group (context, gtk_get_option_group (true));
if (!g_option_context_parse (context, &argc, &argv, &error)) {
g_critical ("%s : %s", G_STRLOC, error->message);
g_clear_error (&error);
return EXIT_FAILURE;
}
if (!(_user_agent_file || _user_file || _author_file || _files)) {
- char *help = g_option_context_get_help (context, TRUE, NULL);
+ char *help = g_option_context_get_help (context, true, NULL);
fputs (help, stderr);
g_free (help), help = NULL;
return EXIT_SUCCESS;