gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-gtk] branch master updated: revise API for anastasis-gtk compati


From: gnunet
Subject: [gnunet-gtk] branch master updated: revise API for anastasis-gtk compatibility
Date: Fri, 15 Nov 2024 11:48:42 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet-gtk.

The following commit(s) were added to refs/heads/master by this push:
     new b267b9d2 revise API for anastasis-gtk compatibility
b267b9d2 is described below

commit b267b9d2da0271841a30205bfbba6e440efda16f
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Nov 15 11:48:39 2024 +0100

    revise API for anastasis-gtk compatibility
---
 src/conversation/gnunet-conversation-gtk.c | 32 +++++++++---------
 src/fs/gnunet-fs-gtk.c                     | 11 ++++---
 src/include/gnunet_gtk.h                   | 21 +++++++-----
 src/lib/eventloop.c                        | 53 ++++++++++++++----------------
 src/lib/os_installation.c                  |  2 +-
 src/namestore/gnunet-namestore-gtk.c       |  9 +++--
 src/setup/gnunet-setup.c                   |  3 +-
 src/statistics/gnunet-statistics-gtk.c     |  3 +-
 8 files changed, 70 insertions(+), 64 deletions(-)

diff --git a/src/conversation/gnunet-conversation-gtk.c 
b/src/conversation/gnunet-conversation-gtk.c
index 5eba8377..e55fc9bc 100644
--- a/src/conversation/gnunet-conversation-gtk.c
+++ b/src/conversation/gnunet-conversation-gtk.c
@@ -128,7 +128,7 @@ run (void *cls)
   if (GNUNET_OK != GNUNET_GTK_main_loop_build_window (ml, NULL))
     return;
   cfg = GNUNET_CONFIGURATION_dup (
-    GNUNET_GTK_main_loop_get_gnunet_gtk_configuration (ml));
+    GNUNET_GTK_main_loop_get_gtk_configuration (ml));
   if (0 != line)
     GNUNET_CONFIGURATION_set_value_number (cfg,
                                            "CONVERSATION",
@@ -168,23 +168,25 @@ run (void *cls)
 int
 main (int argc, char *const *argv)
 {
-  struct GNUNET_GETOPT_CommandLineOption options[] =
-  {GNUNET_GETOPT_option_uint ('p',
-                              "phone",
-                              "LINE",
-                              gettext_noop (
-                                "sets the LINE to use for the phone"),
-                              &line),
-   GNUNET_GETOPT_option_string ('e',
-                                "ego",
-                                "EGO",
-                                gettext_noop ("select ego to use"),
-                                &ego_name),
-   GNUNET_GETOPT_OPTION_END};
+  struct GNUNET_GETOPT_CommandLineOption options[] = {
+    GNUNET_GETOPT_option_uint ('p',
+                               "phone",
+                               "LINE",
+                               gettext_noop (
+                                 "sets the LINE to use for the phone"),
+                               &line),
+    GNUNET_GETOPT_option_string ('e',
+                                 "ego",
+                                 "EGO",
+                                 gettext_noop ("select ego to use"),
+                                 &ego_name),
+    GNUNET_GETOPT_OPTION_END
+  };
   int ret;
 
   if (GNUNET_OK !=
-      GNUNET_GTK_main_loop_start ("gnunet-conversation-gtk",
+      GNUNET_GTK_main_loop_start (GNUNET_GTK_project_data (),
+                                  "gnunet-conversation-gtk",
                                   "GTK GUI for conversation",
                                   argc,
                                   argv,
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index 35cab218..a4b61e67 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -191,7 +191,7 @@ GNUNET_FS_GTK_get_gnunet_configuration ()
 const struct GNUNET_CONFIGURATION_Handle *
 GNUNET_FS_GTK_get_gnunet_gtk_configuration ()
 {
-  return GNUNET_GTK_main_loop_get_gnunet_gtk_configuration (ml);
+  return GNUNET_GTK_main_loop_get_gtk_configuration (ml);
 }
 
 
@@ -253,7 +253,7 @@ main_window_save_position (GtkWidget *main_window)
   gtk_window_get_size (GTK_WINDOW (main_window), &window_width, 
&window_height);
 
   cfg = (struct GNUNET_CONFIGURATION_Handle *)
-        GNUNET_GTK_main_loop_get_gnunet_gtk_configuration (ml);
+        GNUNET_GTK_main_loop_get_gtk_configuration (ml);
   GNUNET_CONFIGURATION_set_value_number (cfg,
                                          "gnunet-fs-gtk",
                                          "MAIN_WINDOW_X",
@@ -282,7 +282,7 @@ main_window_save_position (GtkWidget *main_window)
   GNUNET_CONFIGURATION_write_diffs (
     cfgDefault,
     cfg,
-    GNUNET_GTK_main_loop_get_gnunet_gtk_configuration_file (ml));
+    GNUNET_GTK_main_loop_get_gtk_configuration_file (ml));
   GNUNET_CONFIGURATION_destroy (cfgDefault);
 }
 
@@ -908,7 +908,7 @@ run (void *cls)
     return;
   main_context.builder = GNUNET_GTK_main_loop_get_builder (ml);
   main_context.gnunet_gtk_cfg
-    = GNUNET_GTK_main_loop_get_gnunet_gtk_configuration (ml);
+    = GNUNET_GTK_main_loop_get_gtk_configuration (ml);
   main_context.gnunet_cfg
     = GNUNET_GTK_main_loop_get_gnunet_configuration (ml);
   main_context.search_ns_treestore =
@@ -1141,7 +1141,8 @@ main (int argc, char **argv)
 
 #endif
   if (GNUNET_OK !=
-      GNUNET_GTK_main_loop_start ("gnunet-fs-gtk",
+      GNUNET_GTK_main_loop_start (GNUNET_GTK_project_data (),
+                                  "gnunet-fs-gtk",
                                   "GTK GUI for GNUnet",
                                   argc,
                                   argv,
diff --git a/src/include/gnunet_gtk.h b/src/include/gnunet_gtk.h
index 9ef7b2d2..c282a6d0 100644
--- a/src/include/gnunet_gtk.h
+++ b/src/include/gnunet_gtk.h
@@ -187,6 +187,7 @@ GNUNET_FS_GTK_remove_treestore_subtree (GtkTreeStore *ts,
 /**
  * Initialize the main loop.
  *
+ * @param pd project data of the program we are launching
  * @param binary_name binary name
  * @param binary_help help text for the binary
  * @param argc number of command line options
@@ -199,13 +200,15 @@ GNUNET_FS_GTK_remove_treestore_subtree (GtkTreeStore *ts,
  * options, etc)
  */
 int
-GNUNET_GTK_main_loop_start (const char *binary_name,
-                            const char *binary_help,
-                            int argc,
-                            char *const *argv,
-                            struct GNUNET_GETOPT_CommandLineOption *options,
-                            const char *main_window_file,
-                            GNUNET_SCHEDULER_TaskCallback main_task);
+GNUNET_GTK_main_loop_start (
+  const struct GNUNET_OS_ProjectData *pd,
+  const char *binary_name,
+  const char *binary_help,
+  int argc,
+  char *const *argv,
+  struct GNUNET_GETOPT_CommandLineOption *options,
+  const char *main_window_file,
+  GNUNET_SCHEDULER_TaskCallback main_task);
 
 
 /**
@@ -263,7 +266,7 @@ GNUNET_GTK_main_loop_build_window (struct 
GNUNET_GTK_MainLoop *ml,
  * @return name of configuration file
  */
 const char *
-GNUNET_GTK_main_loop_get_gnunet_gtk_configuration_file (
+GNUNET_GTK_main_loop_get_gtk_configuration_file (
   struct GNUNET_GTK_MainLoop *ml);
 
 /**
@@ -285,7 +288,7 @@ GNUNET_GTK_main_loop_get_gnunet_configuration_file (
  * @return handle to the configuration, never NULL
  */
 const struct GNUNET_CONFIGURATION_Handle *
-GNUNET_GTK_main_loop_get_gnunet_gtk_configuration (
+GNUNET_GTK_main_loop_get_gtk_configuration (
   struct GNUNET_GTK_MainLoop *ml);
 
 
diff --git a/src/lib/eventloop.c b/src/lib/eventloop.c
index 7febf52a..5ce20b3c 100644
--- a/src/lib/eventloop.c
+++ b/src/lib/eventloop.c
@@ -147,7 +147,7 @@ GNUNET_GTK_main_loop_get_gnunet_configuration (struct 
GNUNET_GTK_MainLoop *ml)
  * @return handle to the configuration, never NULL
  */
 const struct GNUNET_CONFIGURATION_Handle *
-GNUNET_GTK_main_loop_get_gnunet_gtk_configuration (
+GNUNET_GTK_main_loop_get_gtk_configuration (
   struct GNUNET_GTK_MainLoop *ml)
 {
   return ml->gnunet_gtk_cfg;
@@ -220,7 +220,7 @@ GNUNET_GTK_main_loop_get_gnunet_configuration_file (
  * @return name of configuration file
  */
 const char *
-GNUNET_GTK_main_loop_get_gnunet_gtk_configuration_file (
+GNUNET_GTK_main_loop_get_gtk_configuration_file (
   struct GNUNET_GTK_MainLoop *ml)
 {
   return ml->gnunet_gtk_cfgfile;
@@ -493,6 +493,7 @@ run_main_loop (void *cls,
                const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   struct GNUNET_GTK_MainLoop *ml = cls;
+  const struct GNUNET_OS_ProjectData *pd;
   struct GNUNET_CONFIGURATION_Handle *gcfg;
   char *baseconfig;
   char *ipath2;
@@ -500,14 +501,15 @@ run_main_loop (void *cls,
   int argc;
 
   /* command-line processing for Gtk arguments */
+  pd = GNUNET_CONFIGURATION_get_project_data (cfg);
   argc = 0;
   while (args[argc] != NULL)
     argc++;
   gtk_init (&argc, (char ***) &args);
-  gcfg = GNUNET_CONFIGURATION_create (GNUNET_GTK_project_data ());
+  gcfg = GNUNET_CONFIGURATION_create (pd);
 
   if (NULL == (ipath = GNUNET_OS_installation_get_path (
-                 GNUNET_GTK_project_data (),
+                 pd,
                  GNUNET_OS_IPK_DATADIR)))
   {
     GNUNET_break (0);
@@ -520,9 +522,8 @@ run_main_loop (void *cls,
   (void) GNUNET_CONFIGURATION_load_from (gcfg,
                                          baseconfig);
   GNUNET_free (baseconfig);
-  /* FIXME: this was supposed to search the GTK-IPK, so the logic here is 
badly broken now */
   if (NULL ==
-      (ipath2 = GNUNET_OS_installation_get_path (GNUNET_GTK_project_data (),
+      (ipath2 = GNUNET_OS_installation_get_path (pd,
                                                  GNUNET_OS_IPK_DATADIR)))
   {
     GNUNET_break (0);
@@ -530,7 +531,10 @@ run_main_loop (void *cls,
   }
   if (0 != strcmp (ipath, ipath2))
   {
-    GNUNET_asprintf (&baseconfig, "%s%s", ipath2, "config.d");
+    GNUNET_asprintf (&baseconfig,
+                     "%s%s",
+                     ipath2,
+                     "config.d");
     if (GNUNET_YES ==
         GNUNET_DISK_directory_test (baseconfig,
                                     GNUNET_YES))
@@ -584,8 +588,9 @@ run_main_loop (void *cls,
   ml->argv = args;
 
   /* start the Gtk event loop */
-  GNUNET_assert (TRUE == g_main_context_acquire (ml->gmc));
-  GNUNET_SCHEDULER_set_select (&gnunet_gtk_select, ml);
+  GNUNET_assert (g_main_context_acquire (ml->gmc));
+  GNUNET_SCHEDULER_set_select (&gnunet_gtk_select,
+                               ml);
 
   /* keep Gtk event loop running even if there are no GNUnet tasks */
   ml->dummy_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
@@ -600,26 +605,16 @@ run_main_loop (void *cls,
 }
 
 
-/**
- * Initialize the main loop.
- *
- * @param binary_name binary name
- * @param binary_help help text for the binary
- * @param argc number of command line options
- * @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)
- */
 int
-GNUNET_GTK_main_loop_start (const char *binary_name,
-                            const char *binary_help,
-                            int argc,
-                            char *const *argv,
-                            struct GNUNET_GETOPT_CommandLineOption *options,
-                            const char *main_window_file,
-                            GNUNET_SCHEDULER_TaskCallback main_task)
+GNUNET_GTK_main_loop_start (
+  const struct GNUNET_OS_ProjectData *pd,
+  const char *binary_name,
+  const char *binary_help,
+  int argc,
+  char *const *argv,
+  struct GNUNET_GETOPT_CommandLineOption *options,
+  const char *main_window_file,
+  GNUNET_SCHEDULER_TaskCallback main_task)
 {
   struct GNUNET_GTK_MainLoop ml;
   int ret;
@@ -648,7 +643,7 @@ GNUNET_GTK_main_loop_start (const char *binary_name,
     memcpy (&o2[1],
             options,
             sizeof (struct GNUNET_GETOPT_CommandLineOption) * olen);
-    ret = GNUNET_PROGRAM_run (GNUNET_GTK_project_data (),
+    ret = GNUNET_PROGRAM_run (pd,
                               argc,
                               argv,
                               binary_name,
diff --git a/src/lib/os_installation.c b/src/lib/os_installation.c
index 8dd9ae99..18f1cf4a 100644
--- a/src/lib/os_installation.c
+++ b/src/lib/os_installation.c
@@ -23,8 +23,8 @@
  * @brief initialize GNUNET_OS for gnunet-gtk
  * @author Christian Grothoff
  */
-#include "gnunet_gtk.h"
 #include "gnunet_gtk_config.h"
+#include "gnunet_gtk.h"
 
 /**
  * Default project data used for installation path detection
diff --git a/src/namestore/gnunet-namestore-gtk.c 
b/src/namestore/gnunet-namestore-gtk.c
index 204a9c30..450f3bff 100644
--- a/src/namestore/gnunet-namestore-gtk.c
+++ b/src/namestore/gnunet-namestore-gtk.c
@@ -3311,7 +3311,7 @@ run (void *cls)
                                                NULL);
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_time (
-        GNUNET_GTK_main_loop_get_gnunet_gtk_configuration (ml),
+        GNUNET_GTK_main_loop_get_gtk_configuration (ml),
         "gnunet-namestore-gtk",
         "NICK_EXPIRATION",
         &nick_expiration_time))
@@ -3370,11 +3370,14 @@ run (void *cls)
 int
 main (int argc, char *const *argv)
 {
-  struct GNUNET_GETOPT_CommandLineOption options[] = 
{GNUNET_GETOPT_OPTION_END};
+  struct GNUNET_GETOPT_CommandLineOption options[] = {
+    GNUNET_GETOPT_OPTION_END
+  };
   int ret;
 
   if (GNUNET_OK ==
-      GNUNET_GTK_main_loop_start ("gnunet-namestore-gtk",
+      GNUNET_GTK_main_loop_start (GNUNET_GTK_project_data (),
+                                  "gnunet-namestore-gtk",
                                   "gnunet-namestore-gtk",
                                   argc,
                                   argv,
diff --git a/src/setup/gnunet-setup.c b/src/setup/gnunet-setup.c
index 2db64d04..90f2066a 100644
--- a/src/setup/gnunet-setup.c
+++ b/src/setup/gnunet-setup.c
@@ -557,7 +557,8 @@ main (int argc,
   int ret;
 
   if (GNUNET_OK ==
-      GNUNET_GTK_main_loop_start ("gnunet-setup",
+      GNUNET_GTK_main_loop_start (GNUNET_GTK_project_data (),
+                                  "gnunet-setup",
                                   "gnunet-setup",
                                   argc,
                                   argv,
diff --git a/src/statistics/gnunet-statistics-gtk.c 
b/src/statistics/gnunet-statistics-gtk.c
index 8bd17812..2482573b 100644
--- a/src/statistics/gnunet-statistics-gtk.c
+++ b/src/statistics/gnunet-statistics-gtk.c
@@ -278,7 +278,8 @@ main (int argc, char *const *argv)
 
   start_time = GNUNET_TIME_absolute_get ();
   if (GNUNET_OK !=
-      GNUNET_GTK_main_loop_start ("gnunet-statistics-gtk",
+      GNUNET_GTK_main_loop_start (GNUNET_GTK_project_data (),
+                                  "gnunet-statistics-gtk",
                                   "GTK GUI for viewing GNUnet statistics",
                                   argc,
                                   argv,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]