aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/save-calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-08-16 23:25:56 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-09-14 20:09:00 +0800
commit777c1cbd40eb63365f2c28e38f6a93beb2d1c9d1 (patch)
treedfab9ca8f30c7b1539f86dfe19b8bf761d6a899c /plugins/save-calendar
parent83675abbc2b3a3bc6421094a56651d021fc0cdcd (diff)
downloadgsoc2013-evolution-777c1cbd40eb63365f2c28e38f6a93beb2d1c9d1.tar
gsoc2013-evolution-777c1cbd40eb63365f2c28e38f6a93beb2d1c9d1.tar.gz
gsoc2013-evolution-777c1cbd40eb63365f2c28e38f6a93beb2d1c9d1.tar.bz2
gsoc2013-evolution-777c1cbd40eb63365f2c28e38f6a93beb2d1c9d1.tar.lz
gsoc2013-evolution-777c1cbd40eb63365f2c28e38f6a93beb2d1c9d1.tar.xz
gsoc2013-evolution-777c1cbd40eb63365f2c28e38f6a93beb2d1c9d1.tar.zst
gsoc2013-evolution-777c1cbd40eb63365f2c28e38f6a93beb2d1c9d1.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'plugins/save-calendar')
-rw-r--r--plugins/save-calendar/csv-format.c53
-rw-r--r--plugins/save-calendar/ical-format.c15
-rw-r--r--plugins/save-calendar/rdf-format.c36
-rw-r--r--plugins/save-calendar/save-calendar.c28
4 files changed, 86 insertions, 46 deletions
diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c
index b4e95bbef7..d80ee25753 100644
--- a/plugins/save-calendar/csv-format.c
+++ b/plugins/save-calendar/csv-format.c
@@ -53,7 +53,8 @@ struct _CsvPluginData
};
static void
-display_error_message (GtkWidget *parent, GError *error)
+display_error_message (GtkWidget *parent,
+ GError *error)
{
GtkWidget *dialog;
@@ -73,7 +74,10 @@ enum { /* CSV helper enum */
/* Some helpers for the csv stuff */
static GString *
-add_list_to_csv (GString *line, GSList *list_in, CsvConfig *config, gint type)
+add_list_to_csv (GString *line,
+ GSList *list_in,
+ CsvConfig *config,
+ gint type)
{
/*
@@ -87,7 +91,7 @@ add_list_to_csv (GString *line, GSList *list_in, CsvConfig *config, gint type)
gboolean needquotes = FALSE;
GSList *list = list_in;
GString *tmp = NULL;
- gint cnt=0;
+ gint cnt = 0;
while (list) {
const gchar *str = NULL;
if (cnt == 0)
@@ -96,10 +100,10 @@ add_list_to_csv (GString *line, GSList *list_in, CsvConfig *config, gint type)
needquotes = TRUE;
switch (type) {
case ECALCOMPONENTATTENDEE:
- str = ((ECalComponentAttendee*) list->data)->value;
+ str = ((ECalComponentAttendee *) list->data)->value;
break;
case ECALCOMPONENTTEXT:
- str = ((ECalComponentText*) list->data)->value;
+ str = ((ECalComponentText *) list->data)->value;
break;
case CONSTCHAR:
default:
@@ -128,7 +132,9 @@ add_list_to_csv (GString *line, GSList *list_in, CsvConfig *config, gint type)
}
static GString *
-add_nummeric_to_csv (GString *line, gint *nummeric, CsvConfig *config)
+add_nummeric_to_csv (GString *line,
+ gint *nummeric,
+ CsvConfig *config)
{
/*
@@ -146,7 +152,9 @@ add_nummeric_to_csv (GString *line, gint *nummeric, CsvConfig *config)
}
static GString *
-add_time_to_csv (GString *line, icaltimetype *time, CsvConfig *config)
+add_time_to_csv (GString *line,
+ icaltimetype *time,
+ CsvConfig *config)
{
if (time) {
@@ -179,7 +187,8 @@ add_time_to_csv (GString *line, icaltimetype *time, CsvConfig *config)
}
static gboolean
-string_needsquotes (const gchar *value, CsvConfig *config)
+string_needsquotes (const gchar *value,
+ CsvConfig *config)
{
/* This is the actual need for quotes-checker */
@@ -191,12 +200,12 @@ string_needsquotes (const gchar *value, CsvConfig *config)
* Will be written as {"Mom, can you please do that for me?"}
*/
- gboolean needquotes = strstr (value, config->delimiter) ? TRUE:FALSE;
+ gboolean needquotes = strstr (value, config->delimiter) ? TRUE : FALSE;
if (!needquotes) {
- needquotes = strstr (value, config->newline) ? TRUE:FALSE;
+ needquotes = strstr (value, config->newline) ? TRUE : FALSE;
if (!needquotes)
- needquotes = strstr (value, config->quote) ? TRUE:FALSE;
+ needquotes = strstr (value, config->quote) ? TRUE : FALSE;
}
/*
@@ -217,16 +226,16 @@ string_needsquotes (const gchar *value, CsvConfig *config)
if (!needquotes) {
gint len = strlen (config->delimiter);
if ((len == 2) && (config->delimiter[1] == ' ')) {
- needquotes = strchr (value, config->delimiter[0])?TRUE:FALSE;
+ needquotes = strchr (value, config->delimiter[0]) ? TRUE : FALSE;
if (!needquotes) {
len = strlen (config->newline);
if ((len == 2) && (config->newline[1] == ' ')) {
- needquotes = strchr (value, config->newline[0])?TRUE:FALSE;
+ needquotes = strchr (value, config->newline[0]) ? TRUE : FALSE;
if (!needquotes) {
len = strlen (config->quote);
if ((len == 2) && (config->quote[1] == ' ')) {
needquotes = strchr
- (value, config->quote[0])?TRUE:FALSE;
+ (value, config->quote[0]) ? TRUE : FALSE;
}
}
}
@@ -238,11 +247,13 @@ string_needsquotes (const gchar *value, CsvConfig *config)
}
static GString *
-add_string_to_csv (GString *line, const gchar *value, CsvConfig *config)
+add_string_to_csv (GString *line,
+ const gchar *value,
+ CsvConfig *config)
{
/* Will add a string to the record and will check for the need for quotes */
- if ((value) && (strlen (value)>0)) {
+ if ((value) && (strlen (value) > 0)) {
gboolean needquotes = string_needsquotes (value, config);
if (needquotes)
@@ -260,13 +271,13 @@ static gchar *
userstring_to_systemstring (const gchar *userstring)
{
const gchar *text = userstring;
- gint i=0, len = strlen (text);
+ gint i = 0, len = strlen (text);
GString *str = g_string_new ("");
gchar *retval = NULL;
while (i < len) {
if (text[i] == '\\') {
- switch (text[i+1]) {
+ switch (text[i + 1]) {
case 'n':
str = g_string_append_c (str, '\n');
i++;
@@ -365,7 +376,7 @@ do_save_calendar_csv (FormatHandler *handler,
if (config->header) {
- gint i=0;
+ gint i = 0;
static const gchar *labels[] = {
N_("UID"),
@@ -388,8 +399,8 @@ do_save_calendar_csv (FormatHandler *handler,
};
line = g_string_new ("");
- for (i=0;i<G_N_ELEMENTS (labels);i++) {
- if (i>0)
+ for (i = 0; i < G_N_ELEMENTS (labels); i++) {
+ if (i > 0)
g_string_append (line, config->delimiter);
g_string_append (line, _(labels[i]));
}
diff --git a/plugins/save-calendar/ical-format.c b/plugins/save-calendar/ical-format.c
index 039fdd8d55..f323fed99a 100644
--- a/plugins/save-calendar/ical-format.c
+++ b/plugins/save-calendar/ical-format.c
@@ -37,7 +37,8 @@
#include "format-handler.h"
static void
-display_error_message (GtkWidget *parent, const gchar *message)
+display_error_message (GtkWidget *parent,
+ const gchar *message)
{
GtkWidget *dialog;
@@ -52,7 +53,8 @@ typedef struct {
} CompTzData;
static void
-insert_tz_comps (icalparameter *param, gpointer cb_data)
+insert_tz_comps (icalparameter *param,
+ gpointer cb_data)
{
const gchar *tzid;
CompTzData *tdata = cb_data;
@@ -76,13 +78,18 @@ insert_tz_comps (icalparameter *param, gpointer cb_data)
}
static void
-append_tz_to_comp (gpointer key, gpointer value, icalcomponent *toplevel)
+append_tz_to_comp (gpointer key,
+ gpointer value,
+ icalcomponent *toplevel)
{
icalcomponent_add_component (toplevel, (icalcomponent *) value);
}
static void
-do_save_calendar_ical (FormatHandler *handler, ESourceSelector *selector, ECalClientSourceType type, gchar *dest_uri)
+do_save_calendar_ical (FormatHandler *handler,
+ ESourceSelector *selector,
+ ECalClientSourceType type,
+ gchar *dest_uri)
{
ESource *primary_source;
ECalClient *source_client;
diff --git a/plugins/save-calendar/rdf-format.c b/plugins/save-calendar/rdf-format.c
index 37a936c132..c93eb1fb59 100644
--- a/plugins/save-calendar/rdf-format.c
+++ b/plugins/save-calendar/rdf-format.c
@@ -41,8 +41,9 @@
#include "format-handler.h"
-static void
-add_string_to_rdf (xmlNodePtr node, const gchar *tag, const gchar *value);
+static void add_string_to_rdf (xmlNodePtr node,
+ const gchar *tag,
+ const gchar *value);
/* Use { */
@@ -79,7 +80,8 @@ enum { /* XML helper enum */
};
static void
-display_error_message (GtkWidget *parent, GError *error)
+display_error_message (GtkWidget *parent,
+ GError *error)
{
GtkWidget *dialog;
@@ -91,7 +93,10 @@ display_error_message (GtkWidget *parent, GError *error)
/* Some helpers for the xml stuff */
static void
-add_list_to_rdf (xmlNodePtr node, const gchar *tag, GSList *list_in, gint type)
+add_list_to_rdf (xmlNodePtr node,
+ const gchar *tag,
+ GSList *list_in,
+ gint type)
{
if (list_in) {
GSList *list = list_in;
@@ -101,10 +106,10 @@ add_list_to_rdf (xmlNodePtr node, const gchar *tag, GSList *list_in, gint type)
switch (type) {
case ECALCOMPONENTATTENDEE:
- str = ((ECalComponentAttendee*) list->data)->value;
+ str = ((ECalComponentAttendee *) list->data)->value;
break;
case ECALCOMPONENTTEXT:
- str = ((ECalComponentText*) list->data)->value;
+ str = ((ECalComponentText *) list->data)->value;
break;
case CONSTCHAR:
default:
@@ -120,7 +125,9 @@ add_list_to_rdf (xmlNodePtr node, const gchar *tag, GSList *list_in, gint type)
}
static void
-add_nummeric_to_rdf (xmlNodePtr node, const gchar *tag, gint *nummeric)
+add_nummeric_to_rdf (xmlNodePtr node,
+ const gchar *tag,
+ gint *nummeric)
{
if (nummeric) {
gchar *value = g_strdup_printf ("%d", *nummeric);
@@ -131,7 +138,9 @@ add_nummeric_to_rdf (xmlNodePtr node, const gchar *tag, gint *nummeric)
}
static void
-add_time_to_rdf (xmlNodePtr node, const gchar *tag, icaltimetype *time)
+add_time_to_rdf (xmlNodePtr node,
+ const gchar *tag,
+ icaltimetype *time)
{
if (time) {
xmlNodePtr cur_node = NULL;
@@ -159,7 +168,9 @@ add_time_to_rdf (xmlNodePtr node, const gchar *tag, icaltimetype *time)
}
static void
-add_string_to_rdf (xmlNodePtr node, const gchar *tag, const gchar *value)
+add_string_to_rdf (xmlNodePtr node,
+ const gchar *tag,
+ const gchar *value)
{
if (value) {
xmlNodePtr cur_node = NULL;
@@ -169,7 +180,10 @@ add_string_to_rdf (xmlNodePtr node, const gchar *tag, const gchar *value)
}
static void
-do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalClientSourceType type, gchar *dest_uri)
+do_save_calendar_rdf (FormatHandler *handler,
+ ESourceSelector *selector,
+ ECalClientSourceType type,
+ gchar *dest_uri)
{
/*
@@ -211,7 +225,7 @@ do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalCli
if (stream && e_cal_client_get_object_list_as_comps_sync (source_client, "#t", &objects, NULL, NULL)) {
GSList *iter;
- xmlBufferPtr buffer=xmlBufferCreate ();
+ xmlBufferPtr buffer = xmlBufferCreate ();
xmlDocPtr doc = xmlNewDoc((xmlChar *) "1.0");
xmlNodePtr fnode;
diff --git a/plugins/save-calendar/save-calendar.c b/plugins/save-calendar/save-calendar.c
index a1a48be7cf..40ec512131 100644
--- a/plugins/save-calendar/save-calendar.c
+++ b/plugins/save-calendar/save-calendar.c
@@ -54,7 +54,8 @@ gboolean task_list_save_as_init (GtkUIManager *ui_manager,
gint e_plugin_lib_enable (EPlugin *ep, gint enable);
gint
-e_plugin_lib_enable (EPlugin *ep, gint enable)
+e_plugin_lib_enable (EPlugin *ep,
+ gint enable)
{
return 0;
}
@@ -67,14 +68,16 @@ enum { /* GtkComboBox enum */
};
static void
-extra_widget_foreach_hide (GtkWidget *widget, gpointer data)
+extra_widget_foreach_hide (GtkWidget *widget,
+ gpointer data)
{
if (widget != data)
gtk_widget_hide (widget);
}
static void
-on_type_combobox_changed (GtkComboBox *combobox, gpointer data)
+on_type_combobox_changed (GtkComboBox *combobox,
+ gpointer data)
{
FormatHandler *handler = NULL;
GtkWidget *extra_widget = data;
@@ -99,7 +102,8 @@ on_type_combobox_changed (GtkComboBox *combobox, gpointer data)
}
static void
-format_handlers_foreach_free (gpointer data, gpointer user_data)
+format_handlers_foreach_free (gpointer data,
+ gpointer user_data)
{
FormatHandler *handler = data;
@@ -113,7 +117,8 @@ format_handlers_foreach_free (gpointer data, gpointer user_data)
}
static void
-ask_destination_and_save (ESourceSelector *selector, ECalClientSourceType type)
+ask_destination_and_save (ESourceSelector *selector,
+ ECalClientSourceType type)
{
FormatHandler *handler = NULL;
@@ -123,7 +128,7 @@ ask_destination_and_save (ESourceSelector *selector, ECalClientSourceType type)
GtkComboBox *combo = GTK_COMBO_BOX (gtk_combo_box_new ());
GtkTreeModel *model = GTK_TREE_MODEL (gtk_list_store_new
(N_DEST_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER));
- GtkCellRenderer *renderer=NULL;
+ GtkCellRenderer *renderer = NULL;
GtkListStore *store = GTK_LIST_STORE (model);
GtkTreeIter iter;
GtkWidget *dialog = NULL;
@@ -176,7 +181,8 @@ ask_destination_and_save (ESourceSelector *selector, ECalClientSourceType type)
format_handlers = g_list_next (format_handlers);
}
- g_signal_connect (G_OBJECT(combo), "changed",
+ g_signal_connect (
+ combo, "changed",
G_CALLBACK (on_type_combobox_changed), extra_widget);
g_object_set_data (G_OBJECT (combo), "format-box", hbox);
@@ -229,11 +235,13 @@ ask_destination_and_save (ESourceSelector *selector, ECalClientSourceType type)
}
/* Returns output stream for the uri, or NULL on any error.
- When done with the stream, just g_output_stream_close and g_object_unref it.
- It will ask for overwrite if file already exists.
+ * When done with the stream, just g_output_stream_close and g_object_unref it.
+ * It will ask for overwrite if file already exists.
*/
GOutputStream *
-open_for_writing (GtkWindow *parent, const gchar *uri, GError **error)
+open_for_writing (GtkWindow *parent,
+ const gchar *uri,
+ GError **error)
{
GFile *file;
GFileOutputStream *fostream;