[Xfce4-commits] <xfce4-weather-plugin:master> Reformat source code: weather-icon
Harald Judt
noreply at xfce.org
Thu Jul 26 16:12:05 CEST 2012
Updating branch refs/heads/master
to 5ed1aac89d5d2f3ef808d099f359e27c58c7d16f (commit)
from ca951c6c6aae40fd81f5232b4870bb277c758dec (commit)
commit 5ed1aac89d5d2f3ef808d099f359e27c58c7d16f
Author: Harald Judt <h.judt at gmx.at>
Date: Thu Jul 26 16:09:19 2012 +0200
Reformat source code: weather-icon
panel-plugin/weather-icon.c | 85 +++++++++++++++++++++++--------------------
panel-plugin/weather-icon.h | 6 ++-
2 files changed, 49 insertions(+), 42 deletions(-)
diff --git a/panel-plugin/weather-icon.c b/panel-plugin/weather-icon.c
index 47b888c..1d0a78b 100644
--- a/panel-plugin/weather-icon.c
+++ b/panel-plugin/weather-icon.c
@@ -28,59 +28,64 @@
#define DEFAULT_W_THEME "liquid"
#define NODATA "NODATA"
+
const gchar *night_symbols[] = {
- "CLOUD",
- "LIGHTCLOUD",
- "LIGHTRAINSUN",
- "LIGHTRAINTHUNDERSUN",
- "PARTLYCLOUD",
- "SNOWSUN",
- "SUN",
- NULL
+ "CLOUD",
+ "LIGHTCLOUD",
+ "LIGHTRAINSUN",
+ "LIGHTRAINTHUNDERSUN",
+ "PARTLYCLOUD",
+ "SNOWSUN",
+ "SUN",
+ NULL
};
+
GdkPixbuf *
-get_icon (const gchar *number,
- gint size,
- gboolean night)
+get_icon(const gchar *number,
+ gint size,
+ gboolean night)
{
- GdkPixbuf *image = NULL;
- gchar *filename, *night_suffix = "";
- gint number_len, night_symbol_len;
- guint i;
+ GdkPixbuf *image = NULL;
+ gchar *filename, *night_suffix = "";
+ gint number_len, night_symbol_len;
+ guint i;
- if (number == NULL || strlen(number) == 0)
- number = NODATA;
- else if (night)
- {
- number_len = strlen(number);
- for (i = 0; night_symbols[i] != NULL; i++)
- {
- night_symbol_len = strlen(night_symbols[i]);
- if (number_len != night_symbol_len)
- continue;
+ if (number == NULL || strlen(number) == 0)
+ number = NODATA;
+ else if (night) {
+ number_len = strlen(number);
+ for (i = 0; night_symbols[i] != NULL; i++) {
+ night_symbol_len = strlen(night_symbols[i]);
+ if (number_len != night_symbol_len)
+ continue;
- if (number[0] != night_symbols[i][0])
- continue;
+ if (number[0] != night_symbols[i][0])
+ continue;
- if (!g_ascii_strncasecmp (night_symbols[i], number, number_len))
- night_suffix = "-night";
+ if (!g_ascii_strncasecmp(night_symbols[i], number, number_len))
+ night_suffix = "-night";
}
}
- filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s" G_DIR_SEPARATOR_S "%s%s.png",
- THEMESDIR, DEFAULT_W_THEME, number, night_suffix);
+ filename = g_strdup_printf("%s" G_DIR_SEPARATOR_S
+ "%s" G_DIR_SEPARATOR_S
+ "%s%s.png",
+ THEMESDIR,
+ DEFAULT_W_THEME,
+ number,
+ night_suffix);
- image = gdk_pixbuf_new_from_file_at_scale (filename, size, size, TRUE, NULL);
+ image = gdk_pixbuf_new_from_file_at_scale(filename, size, size, TRUE, NULL);
- if (G_UNLIKELY (!image)) {
- g_warning ("Unable to open image: %s", filename);
- if (number && strcmp(number, NODATA)) {
- g_free(filename);
- return get_icon(NULL, size, FALSE);
+ if (G_UNLIKELY(!image)) {
+ g_warning("Unable to open image: %s", filename);
+ if (number && strcmp(number, NODATA)) {
+ g_free(filename);
+ return get_icon(NULL, size, FALSE);
+ }
}
- }
- g_free (filename);
+ g_free(filename);
- return image;
+ return image;
}
diff --git a/panel-plugin/weather-icon.h b/panel-plugin/weather-icon.h
index cee80ef..3e5e0a8 100644
--- a/panel-plugin/weather-icon.h
+++ b/panel-plugin/weather-icon.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2003-2007 Xfce Development Team
- *
+ *
* This program 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
@@ -20,7 +20,9 @@
G_BEGIN_DECLS
-GdkPixbuf *get_icon (const gchar * icon, gint size, gboolean night);
+GdkPixbuf *get_icon(const gchar *icon,
+ gint size,
+ gboolean night);
G_END_DECLS
More information about the Xfce4-commits
mailing list