[anjal] Handle commandline options.



commit dc7e4b0f4dcd70bfdd2fb0dc2f344b772ba54303
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Fri May 29 23:42:17 2009 +0530

    Handle commandline options.
---
 src/main.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/main.c b/src/main.c
index 3cf27f3..3a5cf67 100644
--- a/src/main.c
+++ b/src/main.c
@@ -38,15 +38,30 @@
 #include "mail-shell.h"
 #include <libgnome/gnome-sound.h>
 
+gboolean windowed = FALSE;
+static gchar **remaining_args;
+
 /* For testing propose use the local (not installed) glade file */
 /* #define GLADE_FILE PACKAGE_DATA_DIR"/anjal/glade/anjal.glade" */
 #define GLADE_FILE "anjal.glade"
-	
+
+static gboolean
+idle_cb (MailShell *shell)
+{
+	mail_shell_handle_cmdline (shell);
+	return FALSE;
+}
+
 int
 main (int argc, char *argv[])
 {
  	GtkWidget *window;
-
+	static GOptionEntry entries[] = {
+    		{ "windowed", 'w', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_NONE, &windowed,
+		N_("Run Anjal in a window"), NULL },
+		{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining_args, NULL, NULL },
+		{ NULL }
+ 	 	};
 
 #ifdef ENABLE_NLS
 	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
@@ -56,7 +71,7 @@ main (int argc, char *argv[])
 
 	
 	gtk_set_locale ();
-	gtk_init (&argc, &argv);
+	gtk_init_with_args (&argc, &argv, _("Anjal email client"), entries, NULL, NULL);
 	glade_init ();
 	e_cursors_init ();
 	e_icon_factory_init ();
@@ -68,6 +83,8 @@ main (int argc, char *argv[])
 
 	window = (GtkWidget *)mail_shell_new ();
 	gtk_widget_show (window);
+	mail_shell_set_cmdline_args ((MailShell *)window, remaining_args);
+	g_idle_add ((GSourceFunc) idle_cb, window);
 
 	gtk_main ();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]