[evolution-rss] codingstyle and whitespace cleanup
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-rss] codingstyle and whitespace cleanup
- Date: Thu, 18 Mar 2010 11:55:49 +0000 (UTC)
commit 550b9f5d47ae123bb5b7884eecc3a8b3bb5374de
Author: Lucian Langa <lucilanga gnome org>
Date: Sat Mar 13 11:31:32 2010 +0200
codingstyle and whitespace cleanup
src/rss-config-factory.c | 55 +++++++++++++++-------
src/rss-icon-factory.c | 39 ++++++++-------
src/rss.c | 118 ++++++++++++++++++++++++++++++++++------------
3 files changed, 147 insertions(+), 65 deletions(-)
---
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index 17295e5..7aec104 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -179,7 +179,8 @@ render_engine_changed (GtkComboBox *dropdown, GCallback *user_data)
static void
start_check_cb(GtkWidget *widget, gpointer data)
{
- gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ gboolean active = gtk_toggle_button_get_active (
+ GTK_TOGGLE_BUTTON (widget));
/* Save the new setting to gconf */
gconf_client_set_bool (rss_gconf, data, active, NULL);
}
@@ -187,9 +188,12 @@ start_check_cb(GtkWidget *widget, gpointer data)
void
accept_cookies_cb(GtkWidget *widget, GtkWidget *data)
{
- gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ gboolean active = gtk_toggle_button_get_active (
+ GTK_TOGGLE_BUTTON (widget));
/* Save the new setting to gconf */
- gconf_client_set_bool (rss_gconf, GCONF_KEY_ACCEPT_COOKIES, active, NULL);
+ gconf_client_set_bool (
+ rss_gconf,
+ GCONF_KEY_ACCEPT_COOKIES, active, NULL);
gtk_widget_set_sensitive(data, active);
}
@@ -740,11 +744,12 @@ build_dialog_add(gchar *url, gchar *feed_text)
void
actions_dialog_add(add_feed *feed, gchar *url)
{
- GtkWidget *entry1 = GTK_WIDGET (gtk_builder_get_object(feed->gui, "url_entry"));
+ GtkWidget *entry1 = GTK_WIDGET (
+ gtk_builder_get_object(feed->gui, "url_entry"));
GtkWidget *checkbutton1 = GTK_WIDGET (
- gtk_builder_get_object(feed->gui, "html_check"));
+ gtk_builder_get_object(feed->gui, "html_check"));
GtkWidget *checkbutton2 = GTK_WIDGET (
- gtk_builder_get_object (feed->gui, "enabled_check"));
+ gtk_builder_get_object(feed->gui, "enabled_check"));
GtkWidget *checkbutton3 = GTK_WIDGET (gtk_builder_get_object (feed->gui, "validate_check"));
GtkWidget *checkbutton4 = GTK_WIDGET (gtk_builder_get_object (feed->gui, "storage_unread"));
GtkWidget *radiobutton1 = GTK_WIDGET (gtk_builder_get_object (feed->gui, "storage_rb1"));
@@ -765,7 +770,8 @@ actions_dialog_add(add_feed *feed, gchar *url)
case GTK_RESPONSE_OK:
//grey out while were processing
gtk_widget_set_sensitive(feed->dialog, FALSE);
- feed->feed_url = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry1)));
+ feed->feed_url = g_strdup(
+ gtk_entry_get_text(GTK_ENTRY(entry1)));
fhtml = gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (checkbutton1));
fhtml ^= 1;
@@ -985,7 +991,8 @@ rss_delete_rec (CamelStore *store, CamelFolderInfo *fi, CamelException *ex)
}
void
-rss_delete_folders (CamelStore *store, const char *full_name, CamelException *ex)
+rss_delete_folders (
+ CamelStore *store, const char *full_name, CamelException *ex)
{
guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE
| CAMEL_STORE_FOLDER_INFO_FAST
@@ -1212,7 +1219,8 @@ feeds_dialog_disable(GtkDialog *d, gpointer data)
g_hash_table_replace(
rf->hre,
g_strdup(key),
- GINT_TO_POINTER(!g_hash_table_lookup(rf->hre, key)));
+ GINT_TO_POINTER(
+ !g_hash_table_lookup(rf->hre, key)));
gtk_button_set_label(
data,
g_hash_table_lookup(rf->hre, key) ? _("Disable") : _("Enable"));
@@ -1257,7 +1265,8 @@ remove_feed_dialog(gchar *msg)
GTK_CONTAINER (vbox1),
10);
- checkbutton1 = gtk_check_button_new_with_mnemonic (_("Remove folder contents"));
+ checkbutton1 = gtk_check_button_new_with_mnemonic (
+ _("Remove folder contents"));
gtk_widget_show (checkbutton1);
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (checkbutton1),
@@ -1421,14 +1430,18 @@ process_dialog_edit(add_feed *feed, gchar *url, gchar *feed_name)
lookup_feed_folder(feed_name),
NULL);
gchar *dir = g_path_get_dirname(a);
- gchar *b = g_build_path("/", dir, feed->feed_name, NULL);
+ gchar *b = g_build_path(
+ "/",
+ dir, feed->feed_name, NULL);
camel_exception_init (&ex);
camel_store_rename_folder (store, a, b, &ex);
if (camel_exception_is_set (&ex)) {
#if EVOLUTION_VERSION < 22904
- e_error_run(GTK_WINDOW(rf->preferences),
+ e_error_run(GTK_WINDOW(
+ rf->preferences),
#else
- e_alert_run_dialog_for_args(GTK_WINDOW(rf->preferences),
+ e_alert_run_dialog_for_args(
+ GTK_WINDOW(rf->preferences),
#endif
"mail:no-rename-folder",
a,
@@ -3432,7 +3445,9 @@ rss_config_control_new (void)
GtkWidget *label_webkit = GTK_WIDGET (gtk_builder_get_object(sf->gui, "label_webkits"));
gtk_label_set_text(
GTK_LABEL(label_webkit),
- _("Note: In order to be able to use Mozilla (Firefox) or Apple Webkit \nas renders you need firefox or webkit devel package \ninstalled and evolution-rss should be recompiled to see those packages."));
+ _("Note: In order to be able to use Mozilla (Firefox) or Apple Webkit \n\
+ as renders you need firefox or webkit devel package \n\
+ installed and evolution-rss should be recompiled to see those packages."));
gtk_widget_show(label_webkit);
#endif
g_signal_connect (combo, "changed", G_CALLBACK (render_engine_changed), NULL);
@@ -3453,7 +3468,9 @@ rss_config_control_new (void)
sf->host_proxy = GTK_WIDGET (gtk_builder_get_object(sf->gui, "host_proxy"));
sf->port_proxy = GTK_WIDGET (gtk_builder_get_object(sf->gui, "port_proxy"));
sf->details = GTK_WIDGET (gtk_builder_get_object(sf->gui, "details"));
- sf->proxy_details = GTK_WIDGET (gtk_builder_get_object(sf->gui, "http-proxy-details"));
+ sf->proxy_details = GTK_WIDGET (
+ gtk_builder_get_object(
+ sf->gui, "http-proxy-details"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sf->use_proxy),
gconf_client_get_bool(rss_gconf, GCONF_KEY_USE_PROXY, NULL));
@@ -3484,7 +3501,10 @@ rss_config_control_new (void)
G_CALLBACK(export_cb),
sf->export);
- control_widget = GTK_WIDGET (gtk_builder_get_object(sf->gui, "feeds-notebook"));
+ control_widget = GTK_WIDGET (
+ gtk_builder_get_object(
+ sf->gui,
+ "feeds-notebook"));
g_object_ref (control_widget);
gtk_container_remove (
@@ -3517,7 +3537,8 @@ factory (BonoboGenericFactory *factory,
return NULL;
}
-BONOBO_ACTIVATION_SHLIB_FACTORY (FACTORY_ID, "Evolution RSS component factory", factory, NULL)
+BONOBO_ACTIVATION_SHLIB_FACTORY (
+ FACTORY_ID, "Evolution RSS component factory", factory, NULL)
#endif
#if EVOLUTION_VERSION >= 22900
diff --git a/src/rss-icon-factory.c b/src/rss-icon-factory.c
index dde9231..e8636f7 100644
--- a/src/rss-icon-factory.c
+++ b/src/rss-icon-factory.c
@@ -22,14 +22,14 @@
#include <rss.h>
typedef struct {
- const char *stock_id;
- const char *icon;
+ const char *stock_id;
+ const char *icon;
} RssStockIcon;
static RssStockIcon stock_icons [] = {
- { RSS_TEXT_HTML, RSS_TEXT_HTML_FILE },
- { RSS_TEXT_GENERIC, RSS_TEXT_GENERIC_FILE },
- { RSS_MAIN, RSS_MAIN_FILE }
+ { RSS_TEXT_HTML, RSS_TEXT_HTML_FILE },
+ { RSS_TEXT_GENERIC, RSS_TEXT_GENERIC_FILE },
+ { RSS_MAIN, RSS_MAIN_FILE }
};
//behaviour of e_icon_factory_get_icon() has changed
@@ -40,13 +40,14 @@ rss_build_icon(const gchar *icon_name,
{
GdkPixbuf *pixbuf, *unscaled;
gint size, width, height;
- g_return_val_if_fail (icon_name != NULL, NULL);
+ g_return_val_if_fail (icon_name != NULL, NULL);
if (!gtk_icon_size_lookup (icon_size, &width, &height))
return NULL;
size = height;
unscaled = gdk_pixbuf_new_from_file(icon_name, NULL);
- if (gdk_pixbuf_get_width(unscaled) != size || gdk_pixbuf_get_height(unscaled) != size) {
+ if (gdk_pixbuf_get_width(unscaled) != size
+ || gdk_pixbuf_get_height(unscaled) != size) {
pixbuf = e_icon_factory_pixbuf_scale (unscaled, size, size);
g_object_unref (unscaled);
} else
@@ -58,19 +59,20 @@ rss_build_icon(const gchar *icon_name,
void
rss_build_stock_images(void)
{
- GtkIconFactory *factory;
- GtkIconSource *source;
+ GtkIconFactory *factory;
+ GtkIconSource *source;
int i;
- source = gtk_icon_source_new();
- factory = gtk_icon_factory_new();
- gtk_icon_factory_add_default(factory);
+ source = gtk_icon_source_new();
+ factory = gtk_icon_factory_new();
+ gtk_icon_factory_add_default(factory);
for (i = 0; i < G_N_ELEMENTS (stock_icons); i++) {
GtkIconSet *set;
- gchar *iconfile = g_build_filename (EVOLUTION_ICONDIR,
- stock_icons[i].icon,
- NULL);
+ gchar *iconfile = g_build_filename (
+ EVOLUTION_ICONDIR,
+ stock_icons[i].icon,
+ NULL);
gtk_icon_source_set_filename(source, iconfile);
g_free(iconfile);
@@ -80,9 +82,10 @@ rss_build_stock_images(void)
gtk_icon_factory_add(factory, stock_icons[i].stock_id, set);
gtk_icon_set_unref(set);
}
- gtk_icon_source_free(source);
- gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
- EVOLUTION_ICONDIR);
+ gtk_icon_source_free(source);
+ gtk_icon_theme_append_search_path (
+ gtk_icon_theme_get_default (),
+ EVOLUTION_ICONDIR);
}
void
diff --git a/src/rss.c b/src/rss.c
index 4fdde86..22f7d49 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -208,7 +208,7 @@ gboolean single_pending = FALSE;
//#endif
rssfeed *rf = NULL;
-guint upgrade = 0; // set to 2 when initailization successfull
+guint upgrade = 0; // set to 2 when initailization successfull
guint count = 0;
gchar *buffer = NULL;
GSList *rss_list = NULL;
@@ -225,7 +225,8 @@ guint32 content_colour;
guint32 text_colour;
gboolean gecko_ready = FALSE;
-gboolean browser_fetching = 0; //mycall event could be triggered many times in first step (fetching)
+gboolean browser_fetching = 0; //mycall event could be triggered
+ //many times in first step (fetching)
gint browser_fill = 0; //how much data currently written to browser
gchar *process_feed(RDF *r);
@@ -240,13 +241,15 @@ static void
#if LIBSOUP_VERSION < 2003000
finish_image (SoupMessage *msg, CamelStream *user_data);
#else
-finish_image (SoupSession *soup_sess, SoupMessage *msg, CamelStream *user_data);
+finish_image (SoupSession *soup_sess,
+ SoupMessage *msg, CamelStream *user_data);
#endif
void
#if LIBSOUP_VERSION < 2003000
finish_create_image (SoupMessage *msg, gchar *user_data);
#else
-finish_create_image (SoupSession *soup_sess, SoupMessage *msg, gchar *user_data);
+finish_create_image (SoupSession *soup_sess,
+ SoupMessage *msg, gchar *user_data);
#endif
gboolean fetch_one_feed(gpointer key, gpointer value, gpointer user_data);
gboolean fetch_feed(gpointer key, gpointer value, gpointer user_data);
@@ -273,13 +276,15 @@ static void
#if LIBSOUP_VERSION < 2003000
finish_create_icon (SoupMessage *msg, FEED_IMAGE *user_data);
#else
-finish_create_icon (SoupSession *soup_sess, SoupMessage *msg, FEED_IMAGE *user_data);
+finish_create_icon (SoupSession *soup_sess,
+ SoupMessage *msg, FEED_IMAGE *user_data);
#endif
static void
#if LIBSOUP_VERSION < 2003000
finish_create_icon_stream (SoupMessage *msg, FEED_IMAGE *user_data);
#else
-finish_create_icon_stream (SoupSession *soup_sess, SoupMessage *msg, FEED_IMAGE *user_data);
+finish_create_icon_stream (SoupSession *soup_sess,
+ SoupMessage *msg, FEED_IMAGE *user_data);
#endif
gboolean show_webkit(GtkWidget *webkit);
void sync_folders(void);
@@ -596,7 +601,9 @@ create_user_pass_dialog(RSS_AUTH *auth)
widget = gtk_label_new (NULL);
gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
- markup = g_markup_printf_escaped (_("Enter your username and password for:\n '%s'"), auth->url);
+ markup = g_markup_printf_escaped (
+ _("Enter your username and password for:\n '%s'"),
+ auth->url);
gtk_label_set_markup (GTK_LABEL (widget), markup);
g_free (markup);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
@@ -697,9 +704,11 @@ web_auth_dialog(RSS_AUTH *auth_info)
gint response;
if (!rf->hruser)
- rf->hruser = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
+ rf->hruser = g_hash_table_new_full(
+ g_str_hash, g_str_equal, NULL, g_free);
if (!rf->hrpass)
- rf->hrpass = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
+ rf->hrpass = g_hash_table_new_full(
+ g_str_hash, g_str_equal, NULL, g_free);
auth_info->user = g_hash_table_lookup(rf->hruser, auth_info->url);
auth_info->pass = g_hash_table_lookup(rf->hrpass, auth_info->url);
@@ -745,7 +754,8 @@ network_timeout(void)
if (nettime_id)
g_source_remove(nettime_id);
- timeout = gconf_client_get_float(rss_gconf, GCONF_KEY_NETWORK_TIMEOUT, NULL);
+ timeout = gconf_client_get_float(
+ rss_gconf, GCONF_KEY_NETWORK_TIMEOUT, NULL);
if (!timeout)
timeout = NETWORK_MIN_TIMEOUT;
@@ -816,17 +826,36 @@ feed_to_xml(gchar *key)
lookup_key(key)) ? "true" : "false"));
xmlNewTextChild (root, NULL, (xmlChar *)"name", (xmlChar *)key);
- xmlNewTextChild (root, NULL, (xmlChar *)"url", (xmlChar *)g_hash_table_lookup(rf->hr, lookup_key(key)));
- xmlNewTextChild (root, NULL, (xmlChar *)"type", (xmlChar *)g_hash_table_lookup(rf->hrt, lookup_key(key)));
+ xmlNewTextChild (
+ root, NULL, (xmlChar *)"url",
+ (xmlChar *)g_hash_table_lookup(rf->hr, lookup_key(key)));
+ xmlNewTextChild (
+ root, NULL, (xmlChar *)"type",
+ (xmlChar *)g_hash_table_lookup(rf->hrt, lookup_key(key)));
src = xmlNewTextChild (root, NULL, (xmlChar *)"delete", NULL);
- ctmp = g_strdup_printf("%d", GPOINTER_TO_INT(g_hash_table_lookup(rf->hrdel_feed, lookup_key(key))));
+ ctmp = g_strdup_printf(
+ "%d",
+ GPOINTER_TO_INT(
+ g_hash_table_lookup(
+ rf->hrdel_feed,
+ lookup_key(key))));
xmlSetProp (src, (xmlChar *)"option", (xmlChar *)ctmp);
g_free(ctmp);
- ctmp = g_strdup_printf("%d", GPOINTER_TO_INT(g_hash_table_lookup(rf->hrdel_days, lookup_key(key))));
+ ctmp = g_strdup_printf(
+ "%d",
+ GPOINTER_TO_INT(
+ g_hash_table_lookup(
+ rf->hrdel_days,
+ lookup_key(key))));
xmlSetProp (src, (xmlChar *)"days", (xmlChar *)ctmp);
g_free(ctmp);
- ctmp = g_strdup_printf("%d", GPOINTER_TO_INT(g_hash_table_lookup(rf->hrdel_messages, lookup_key(key))));
+ ctmp = g_strdup_printf(
+ "%d",
+ GPOINTER_TO_INT(
+ g_hash_table_lookup(
+ rf->hrdel_messages,
+ lookup_key(key))));
xmlSetProp (src, (xmlChar *)"messages", (xmlChar *)ctmp);
g_free(ctmp);
xmlSetProp (
@@ -850,10 +879,20 @@ feed_to_xml(gchar *key)
lookup_key(key))));
xmlSetProp (src, (xmlChar *)"option", (xmlChar *)ctmp);
g_free(ctmp);
- ctmp = g_strdup_printf("%d", GPOINTER_TO_INT(g_hash_table_lookup(rf->hrttl, lookup_key(key))));
+ ctmp = g_strdup_printf(
+ "%d",
+ GPOINTER_TO_INT(
+ g_hash_table_lookup(
+ rf->hrttl,
+ lookup_key(key))));
xmlSetProp (src, (xmlChar *)"value", (xmlChar *)ctmp);
g_free(ctmp);
- ctmp = g_strdup_printf("%d", GPOINTER_TO_INT(g_hash_table_lookup(rf->hrttl_multiply, lookup_key(key))));
+ ctmp = g_strdup_printf(
+ "%d",
+ GPOINTER_TO_INT(
+ g_hash_table_lookup(
+ rf->hrttl_multiply,
+ lookup_key(key))));
xmlSetProp (src, (xmlChar *)"factor", (xmlChar *)ctmp);
g_free(ctmp);
@@ -1409,7 +1448,9 @@ mycall (GtkWidget *widget, GtkAllocation *event, gpointer data)
#endif
&& height > 0) {
if (!browser_fetching) {
- gchar *msg = g_strdup_printf("<h5>%s</h5>", _("Formatting Message..."));
+ gchar *msg = g_strdup_printf(
+ "<h5>%s</h5>",
+ _("Formatting Message..."));
browser_write(msg, strlen(msg), (gchar *)"file:///");
g_free(msg);
browser_fetching=1;
@@ -5455,9 +5496,11 @@ finish_create_icon (SoupSession *soup_sess, SoupMessage *msg, FEED_IMAGE *user_d
static void
#if LIBSOUP_VERSION < 2003000
-finish_create_icon_stream (SoupMessage *msg, FEED_IMAGE *user_data)
+finish_create_icon_stream (
+ SoupMessage *msg, FEED_IMAGE *user_data)
#else
-finish_create_icon_stream (SoupSession *soup_sess, SoupMessage *msg, FEED_IMAGE *user_data)
+finish_create_icon_stream (
+ SoupSession *soup_sess, SoupMessage *msg, FEED_IMAGE *user_data)
#endif
{
finish_image(soup_sess, msg, user_data->feed_fs);
@@ -5490,9 +5533,13 @@ display_folder_icon(GtkTreeStore *tree_store, gchar *key)
if (pixbuf) {
gchar *name = g_hash_table_lookup(rf->hrname_r, key);
- gchar *full_name = g_strdup_printf("%s/%s", get_main_folder(),
- lookup_feed_folder(name));
- rss_folder = camel_store_get_folder (store, full_name, 0, NULL);
+ gchar *full_name = g_strdup_printf(
+ "%s/%s",
+ get_main_folder(),
+ lookup_feed_folder(name));
+ rss_folder = camel_store_get_folder (
+ store,
+ full_name, 0, NULL);
if (!rss_folder) {
g_free(full_name);
result = FALSE;
@@ -5500,8 +5547,10 @@ display_folder_icon(GtkTreeStore *tree_store, gchar *key)
}
icon = rss_build_icon (img_file, GTK_ICON_SIZE_MENU);
d("icon:%p\n", icon);
- g_hash_table_insert(icons, g_strdup(key), GINT_TO_POINTER(1));
- sizes = gtk_icon_theme_get_icon_sizes(gtk_icon_theme_get_default(),
+ g_hash_table_insert(icons,
+ g_strdup(key), GINT_TO_POINTER(1));
+ sizes = gtk_icon_theme_get_icon_sizes(
+ gtk_icon_theme_get_default(),
"mail-read"); //will mail-read always be there?
for (i=0; 0 != (size = sizes[i]); i++)
d("icon set size:%d\n", size);
@@ -5519,7 +5568,8 @@ display_folder_icon(GtkTreeStore *tree_store, gchar *key)
row = g_hash_table_lookup (si->full_hash, full_name);
if (!row) goto out;
path = gtk_tree_row_reference_get_path (row);
- gtk_tree_model_get_iter ((GtkTreeModel *)tree_store, &iter, path);
+ gtk_tree_model_get_iter (
+ (GtkTreeModel *)tree_store, &iter, path);
gtk_tree_path_free (path);
gtk_tree_store_set(
@@ -5541,7 +5591,8 @@ out: g_free(img_file);
#define CAMEL_DATA_CACHE_MASK ((1<<CAMEL_DATA_CACHE_BITS)-1)
static char *
-data_cache_path(CamelDataCache *cdc, int create, const char *path, const char *key)
+data_cache_path(
+ CamelDataCache *cdc, int create, const char *path, const char *key)
{
char *dir, *real;
char *tmp = NULL;
@@ -5714,12 +5765,19 @@ fetch_image(gchar *url, gchar *link)
if (strstr(url, "://") == NULL) {
if (*url == '.') //test case when url begins with ".."
- tmpurl = g_strconcat(g_path_get_dirname(link), "/", url, NULL);
+ tmpurl = g_strconcat(
+ g_path_get_dirname(link),
+ "/", url, NULL);
else {
if (*url == '/')
- tmpurl = g_strconcat(get_server_from_uri(link), "/", url, NULL);
+ tmpurl = g_strconcat(
+ get_server_from_uri(link),
+ "/",
+ url, NULL);
else //url is relative (does not begin with / or .)
- tmpurl = g_strconcat(g_path_get_dirname(link), "/", url, NULL);
+ tmpurl = g_strconcat(
+ g_path_get_dirname(link),
+ "/", url, NULL);
}
} else {
tmpurl = g_strdup(url);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]