[balsa/gtk3] Use the capabilities of g_application_command_line
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Use the capabilities of g_application_command_line
- Date: Sun, 18 Dec 2011 01:21:50 +0000 (UTC)
commit f2a08b1df003dad556c8f9272fc674710c96cb7c
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sat Dec 17 20:20:56 2011 -0500
Use the capabilities of g_application_command_line
* src/main.c (handle_remote): use the capabilities of
g_application_command_line_print.
ChangeLog | 5 +++++
src/main.c | 16 ++++++++++------
2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3f3d261..5e8a9df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2011-12-17 Peter Bloomfield
+ * src/main.c (handle_remote): use the capabilities of
+ g_application_command_line_print.
+
+2011-12-17 Peter Bloomfield
+
* src/main.c (scan_mailboxes_idle_cb), (real_main),
(handle_remote), (command_line_cb): free option-handling resources
when no longer needed, instead of later; ignore other options
diff --git a/src/main.c b/src/main.c
index 916c443..2fd7a33 100644
--- a/src/main.c
+++ b/src/main.c
@@ -721,11 +721,14 @@ handle_remote(int argc, char **argv,
};
GError *error;
gint status = 0;
- gchar *text;
context = g_option_context_new(NULL);
- g_option_context_set_help_enabled(context, FALSE);
g_option_context_add_main_entries(context, option_entries, NULL);
+
+ /* Disable the built-in help-handling of GOptionContext, since it
+ * calls exit() after printing help, which is not what we want to
+ * happen in the primary instance. */
+ g_option_context_set_help_enabled(context, FALSE);
g_option_context_add_main_entries(context, help_entries, NULL);
error = NULL;
@@ -741,6 +744,8 @@ handle_remote(int argc, char **argv,
g_error_free(error);
status = 1;
} else if (help) {
+ gchar *text;
+
text = g_option_context_get_help(context, FALSE, NULL);
g_application_command_line_print(command_line, "%s", text);
g_free(text);
@@ -748,10 +753,9 @@ handle_remote(int argc, char **argv,
glong unread, unsent;
balsa_get_stats(&unread, &unsent);
- text =
- g_strdup_printf("Unread: %ld Unsent: %ld\n", unread, unsent);
- g_application_command_line_print(command_line, text);
- g_free(text);
+ g_application_command_line_print(command_line,
+ "Unread: %ld Unsent: %ld\n",
+ unread, unsent);
} else {
gdk_threads_enter();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]