[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29270 - in gnunet-gtk/src: fs include lib
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29270 - in gnunet-gtk/src: fs include lib |
Date: |
Sun, 15 Sep 2013 21:04:38 +0200 |
Author: grothoff
Date: 2013-09-15 21:04:38 +0200 (Sun, 15 Sep 2013)
New Revision: 29270
Modified:
gnunet-gtk/src/fs/gnunet-fs-gtk.c
gnunet-gtk/src/fs/gnunet-fs-gtk_open-uri.c
gnunet-gtk/src/include/gnunet_gtk.h
gnunet-gtk/src/lib/eventloop.c
Log:
handle URI command line arguments also if window is not already open
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk.c 2013-09-15 18:45:13 UTC (rev 29269)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk.c 2013-09-15 19:04:38 UTC (rev 29270)
@@ -658,7 +658,7 @@
* Actual main function run right after GNUnet's scheduler
* is initialized. Initializes up GTK and Glade.
*
- * @param cls handle to the main loop ('struct GNUNET_GTK_MainLoop')
+ * @param cls handle to the main loop (`struct GNUNET_GTK_MainLoop`)
* @param tc scheduler context, unused
*/
static void
@@ -793,6 +793,26 @@
gtk_widget_show (main_context.main_window);
gtk_window_present (GTK_WINDOW (main_context.main_window));
}
+
+ {
+ char *const *argv;
+ int argc;
+ int i;
+
+ GNUNET_GTK_main_loop_get_args (ml, &argc, &argv);
+
+ for (i = 0; i < argc; i++)
+ {
+ if (GNUNET_OK !=
+ GNUNET_FS_GTK_handle_uri_string (argv[i],
+ 1 /* anonymity level */))
+ fprintf (stderr,
+ "Invalid URI `%s'\n",
+ argv[i]);
+ }
+ }
+
+
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task, NULL);
}
@@ -837,11 +857,15 @@
return (UNIQUE_RESPONSE_OK == response) ? 0 : 1;
}
+
#endif
if (GNUNET_OK !=
- GNUNET_GTK_main_loop_start ("gnunet-fs-gtk", "GTK GUI for GNUnet", argc,
- argv, options,
- "gnunet_fs_gtk_main_window.glade", &run))
+ GNUNET_GTK_main_loop_start ("gnunet-fs-gtk",
+ "GTK GUI for GNUnet",
+ argc, argv,
+ options,
+ "gnunet_fs_gtk_main_window.glade",
+ &run))
{
#if HAVE_LIBUNIQUE
g_object_unref (unique_app);
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_open-uri.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_open-uri.c 2013-09-15 18:45:13 UTC (rev
29269)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_open-uri.c 2013-09-15 19:04:38 UTC (rev
29270)
@@ -38,7 +38,7 @@
*
* @param uris string we got
* @param anonymity_level anonymity level to use
- * @return GNUNET_OK on success, GNUNET_NO if the URI type is not supported,
GNUNET_SYSERR if we failed to
+ * @return #GNUNET_OK on success, #GNUNET_NO if the URI type is not supported,
#GNUNET_SYSERR if we failed to
* parse the URI
*/
int
@@ -63,7 +63,7 @@
* User selected "execute" in the open-URI dialog.
*
* @param button the execute button
- * @param user_data the 'GtkBuilder' of the URI dialog
+ * @param user_data the `GtkBuilder` of the URI dialog
*/
void
GNUNET_GTK_open_url_dialog_execute_button_clicked_cb (GtkButton * button,
Modified: gnunet-gtk/src/include/gnunet_gtk.h
===================================================================
--- gnunet-gtk/src/include/gnunet_gtk.h 2013-09-15 18:45:13 UTC (rev 29269)
+++ gnunet-gtk/src/include/gnunet_gtk.h 2013-09-15 19:04:38 UTC (rev 29270)
@@ -231,8 +231,26 @@
GNUNET_GTK_main_loop_get_builder (struct GNUNET_GTK_MainLoop *ml);
+
/**
+ * Get remaining command line arguments.
+ *
+ * @param ml handle to the main loop
+ * @param argc set to argument count
+ * @param argv set to argument vector
+ */
+void
+GNUNET_GTK_main_loop_get_args (struct GNUNET_GTK_MainLoop * ml,
+ int *argc,
+ char *const**argv);
+
+
+/**
* FIXME!
+ *
+ * @param ml FIXME
+ * @param data FIXME
+ * @return FIXME
*/
int
GNUNET_GTK_main_loop_build_window (struct GNUNET_GTK_MainLoop *ml,
Modified: gnunet-gtk/src/lib/eventloop.c
===================================================================
--- gnunet-gtk/src/lib/eventloop.c 2013-09-15 18:45:13 UTC (rev 29269)
+++ gnunet-gtk/src/lib/eventloop.c 2013-09-15 19:04:38 UTC (rev 29270)
@@ -100,7 +100,16 @@
*/
GNUNET_SCHEDULER_TaskIdentifier dummy_task;
+ /**
+ * Remaining command-line arguments.
+ */
+ char *const*argv;
+ /**
+ * Number of remaining arguments.
+ */
+ int argc;
+
#if WINDOWS
/**
* Array to hold pipe handles during a select() call
@@ -203,8 +212,10 @@
return ml->builder;
}
+
int
-GNUNET_GTK_main_loop_build_window (struct GNUNET_GTK_MainLoop *ml, gpointer
data)
+GNUNET_GTK_main_loop_build_window (struct GNUNET_GTK_MainLoop *ml,
+ gpointer data)
{
ml->builder = GNUNET_GTK_get_new_builder (ml->main_window_file, data);
if (ml->builder == NULL)
@@ -245,6 +256,23 @@
/**
+ * Get remaining command line arguments.
+ *
+ * @param ml handle to the main loop
+ * @param argc set to argument count
+ * @param argv set to argument vector
+ */
+void
+GNUNET_GTK_main_loop_get_args (struct GNUNET_GTK_MainLoop * ml,
+ int *argc,
+ char *const**argv)
+{
+ *argc = ml->argc;
+ *argv = ml->argv;
+}
+
+
+/**
* Task to run Gtk events (within a GNUnet scheduler task).
*
* @param cls the main loop handle
@@ -816,7 +844,7 @@
* is initialized. Initializes up GTK and Glade and starts the
* combined event loop.
*
- * @param cls the 'struct GNUNET_GTK_MainLoop'
+ * @param cls the `struct GNUNET_GTK_MainLoop`
* @param args leftover command line arguments (go to gtk)
* @param cfgfile name of the configuration file
* @param cfg handle to the configuration
@@ -871,6 +899,8 @@
ml->gmc = g_main_loop_get_context (ml->gml);
ml->cfg = gcfg;
ml->cfgfile = GNUNET_strdup (cfgfile);
+ ml->argc = argc;
+ ml->argv = args;
#if WINDOWS
ml->hEventRead = CreateEvent (NULL, TRUE, FALSE, NULL);
ml->hEventReadReady = CreateEvent (NULL, TRUE, TRUE, NULL);
@@ -884,10 +914,6 @@
ml->read_array_length = 0;
#endif
- /* run main task of the application */
- GNUNET_SCHEDULER_add_continuation (ml->main_task, ml,
- GNUNET_SCHEDULER_REASON_STARTUP);
-
/* start the Gtk event loop */
GNUNET_assert (TRUE == g_main_context_acquire (ml->gmc));
GNUNET_SCHEDULER_set_select (&gnunet_gtk_select, ml);
@@ -897,6 +923,9 @@
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&keepalive_task, ml);
+ /* run main task of the application */
+ GNUNET_SCHEDULER_add_continuation (ml->main_task, ml,
+ GNUNET_SCHEDULER_REASON_STARTUP);
}
@@ -909,8 +938,8 @@
* @param argv command line options
* @param options allowed command line options
* @param main_window_file glade file for the main window
- * @param main_task first task to run, closure will be set to the 'struct
GNUNET_GTK_MainLoop'
- * @return GNUNET_OK on success, GNUNET_SYSERR on error (i.e. bad command-line
options, etc)
+ * @param main_task first task to run, closure will be set to the `struct
GNUNET_GTK_MainLoop`
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error (i.e. bad
command-line options, etc)
*/
int
GNUNET_GTK_main_loop_start (const char *binary_name, const char *binary_help,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29270 - in gnunet-gtk/src: fs include lib,
gnunet <=