summaryrefslogtreecommitdiff
path: root/services/evolution-user-prompter
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-01-12 10:54:47 -0500
committerMatthew Barnes <mbarnes@redhat.com>2013-01-12 12:26:22 -0500
commit69d5f406435fef06a3b8a13536562743f74250da (patch)
tree1833ca097a0fa2851621dc3d9d40b68d350598db /services/evolution-user-prompter
parent3dc749555b28922dc3f8bcb14317cdd920b2cf23 (diff)
downloadevolution-data-server-69d5f406435fef06a3b8a13536562743f74250da.tar.gz
Coding style and whitespace cleanups.
Diffstat (limited to 'services/evolution-user-prompter')
-rw-r--r--services/evolution-user-prompter/evolution-user-prompter.c4
-rw-r--r--services/evolution-user-prompter/prompt-user-gtk.c66
-rw-r--r--services/evolution-user-prompter/prompt-user.h2
3 files changed, 45 insertions, 27 deletions
diff --git a/services/evolution-user-prompter/evolution-user-prompter.c b/services/evolution-user-prompter/evolution-user-prompter.c
index 8a35c3dd6..64c64b86c 100644
--- a/services/evolution-user-prompter/evolution-user-prompter.c
+++ b/services/evolution-user-prompter/evolution-user-prompter.c
@@ -40,7 +40,9 @@ main (gint argc,
e_gdbus_templates_init_main_thread ();
server = e_user_prompter_server_new ();
- g_signal_connect (server, "prompt", G_CALLBACK (prompt_user_show), NULL);
+ g_signal_connect (
+ server, "prompt",
+ G_CALLBACK (prompt_user_show), NULL);
g_print ("Prompter is up and running...\n");
diff --git a/services/evolution-user-prompter/prompt-user-gtk.c b/services/evolution-user-prompter/prompt-user-gtk.c
index 257a73b0f..7094731c8 100644
--- a/services/evolution-user-prompter/prompt-user-gtk.c
+++ b/services/evolution-user-prompter/prompt-user-gtk.c
@@ -31,19 +31,20 @@
void
prompt_user_init (gint *argc,
- gchar ***argv)
+ gchar ***argv)
{
gtk_init (argc, argv);
}
static void
message_response_cb (GtkWidget *dialog,
- gint button,
- EUserPrompterServer *server)
+ gint button,
+ EUserPrompterServer *server)
{
gint prompt_id;
- prompt_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dialog), E_USER_PROMPTER_ID_KEY));
+ prompt_id = GPOINTER_TO_INT (g_object_get_data (
+ G_OBJECT (dialog), E_USER_PROMPTER_ID_KEY));
gtk_widget_destroy (dialog);
@@ -54,20 +55,23 @@ message_response_cb (GtkWidget *dialog,
void
prompt_user_show (EUserPrompterServer *server,
- gint id,
- const gchar *type,
- const gchar *title,
- const gchar *primary_text,
- const gchar *secondary_text,
- gboolean use_markup,
- const GSList *button_captions)
+ gint id,
+ const gchar *type,
+ const gchar *title,
+ const gchar *primary_text,
+ const gchar *secondary_text,
+ gboolean use_markup,
+ const GSList *button_captions)
{
GtkMessageType ntype = GTK_MESSAGE_OTHER;
GtkWidget *message;
- gint index;
+ gint index = 0;
const GSList *iter;
- g_return_if_fail (server != NULL);
+ g_return_if_fail (E_IS_USER_PROMPTER_SERVER (server));
+
+ if (primary_text == NULL)
+ primary_text = "";
if (type) {
if (g_ascii_strcasecmp (type, "info") == 0)
@@ -81,11 +85,14 @@ prompt_user_show (EUserPrompterServer *server,
}
if (use_markup) {
- message = gtk_message_dialog_new_with_markup (NULL, 0, ntype, GTK_BUTTONS_NONE, "%s", "");
- gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (message), primary_text ? primary_text : "");
- } else
- message = gtk_message_dialog_new (NULL, 0, ntype, GTK_BUTTONS_NONE,
- "%s", primary_text ? primary_text : "");
+ message = gtk_message_dialog_new_with_markup (
+ NULL, 0, ntype, GTK_BUTTONS_NONE, "%s", "");
+ gtk_message_dialog_set_markup (
+ GTK_MESSAGE_DIALOG (message), primary_text);
+ } else {
+ message = gtk_message_dialog_new (
+ NULL, 0, ntype, GTK_BUTTONS_NONE, "%s", primary_text);
+ }
/* To show dialog on a taskbar */
gtk_window_set_skip_taskbar_hint (GTK_WINDOW (message), FALSE);
@@ -94,25 +101,34 @@ prompt_user_show (EUserPrompterServer *server,
if (secondary_text && *secondary_text) {
if (use_markup)
- gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (message),
+ gtk_message_dialog_format_secondary_markup (
+ GTK_MESSAGE_DIALOG (message),
"%s", secondary_text);
else
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
+ gtk_message_dialog_format_secondary_text (
+ GTK_MESSAGE_DIALOG (message),
"%s", secondary_text);
}
g_object_set (message, "resizable", TRUE, NULL);
- for (index = 0, iter = button_captions; iter; index++, iter = iter->next) {
- gtk_dialog_add_button (GTK_DIALOG (message), iter->data, index);
+ for (iter = button_captions; iter != NULL; iter = iter->next) {
+ gtk_dialog_add_button (
+ GTK_DIALOG (message), iter->data, index++);
}
if (index == 0)
- gtk_dialog_add_button (GTK_DIALOG (message), _("_Dismiss"), index);
+ gtk_dialog_add_button (
+ GTK_DIALOG (message), _("_Dismiss"), index);
- g_object_set_data (G_OBJECT (message), E_USER_PROMPTER_ID_KEY, GINT_TO_POINTER (id));
+ g_object_set_data (
+ G_OBJECT (message),
+ E_USER_PROMPTER_ID_KEY,
+ GINT_TO_POINTER (id));
- g_signal_connect (message, "response", G_CALLBACK (message_response_cb), server);
+ g_signal_connect (
+ message, "response",
+ G_CALLBACK (message_response_cb), server);
gtk_widget_show (message);
}
diff --git a/services/evolution-user-prompter/prompt-user.h b/services/evolution-user-prompter/prompt-user.h
index 23a840d0a..c0c58fd4b 100644
--- a/services/evolution-user-prompter/prompt-user.h
+++ b/services/evolution-user-prompter/prompt-user.h
@@ -27,7 +27,7 @@ prompt_user_init (gint *argc,
gchar ***argv);
/* This is called when a request is initiated. The callback should not block,
- and when a user responds, the e_user_prompter_server_response() should be called.
+ * and when a user responds, the e_user_prompter_server_response() should be called.
*/
void