gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3025 - in gnunet-gtk: . src/common src/include src/plugins


From: moon
Subject: [GNUnet-SVN] r3025 - in gnunet-gtk: . src/common src/include src/plugins/daemon
Date: Thu, 22 Jun 2006 11:45:47 -0700 (PDT)

Author: moon
Date: 2006-06-22 11:45:40 -0700 (Thu, 22 Jun 2006)
New Revision: 3025

Modified:
   gnunet-gtk/gnunet-gtk.glade
   gnunet-gtk/src/common/helper.c
   gnunet-gtk/src/include/gnunetgtk_common.h
   gnunet-gtk/src/plugins/daemon/daemon.c
Log:
libgksu2 support for Linux to start gnunet-setup (win32 port missing)



Modified: gnunet-gtk/gnunet-gtk.glade
===================================================================
--- gnunet-gtk/gnunet-gtk.glade 2006-06-22 17:50:56 UTC (rev 3024)
+++ gnunet-gtk/gnunet-gtk.glade 2006-06-22 18:45:40 UTC (rev 3025)
@@ -626,7 +626,7 @@
                                                  <child>
                                                    <widget class="GtkLabel" 
id="label139">
                                                      <property 
name="visible">True</property>
-                                                     <property name="label" 
translatable="yes">Start the _configuration wizard</property>
+                                                     <property name="label" 
translatable="yes">Start the configuration _wizard</property>
                                                      <property 
name="use_underline">True</property>
                                                      <property 
name="use_markup">False</property>
                                                      <property 
name="justify">GTK_JUSTIFY_LEFT</property>
@@ -660,7 +660,82 @@
                                      </child>
 
                                      <child>
-                                       <placeholder/>
+                                       <widget class="GtkButton" 
id="startDaemonConfTool">
+                                         <property 
name="visible">True</property>
+                                         <property 
name="can_focus">True</property>
+                                         <property 
name="relief">GTK_RELIEF_NORMAL</property>
+                                         <property 
name="focus_on_click">True</property>
+                                         <signal name="clicked" 
handler="on_startDaemonConfTool_clicked" last_modification_time="Thu, 22 Jun 
2006 17:05:35 GMT"/>
+
+                                         <child>
+                                           <widget class="GtkAlignment" 
id="alignment23">
+                                             <property 
name="visible">True</property>
+                                             <property 
name="xalign">0.5</property>
+                                             <property 
name="yalign">0.5</property>
+                                             <property 
name="xscale">0</property>
+                                             <property 
name="yscale">0</property>
+                                             <property 
name="top_padding">0</property>
+                                             <property 
name="bottom_padding">0</property>
+                                             <property 
name="left_padding">0</property>
+                                             <property 
name="right_padding">0</property>
+
+                                             <child>
+                                               <widget class="GtkHBox" 
id="hbox59">
+                                                 <property 
name="visible">True</property>
+                                                 <property 
name="homogeneous">False</property>
+                                                 <property 
name="spacing">2</property>
+
+                                                 <child>
+                                                   <widget class="GtkImage" 
id="image45">
+                                                     <property 
name="visible">True</property>
+                                                     <property 
name="stock">gtk-edit</property>
+                                                     <property 
name="icon_size">4</property>
+                                                     <property 
name="xalign">0.5</property>
+                                                     <property 
name="yalign">0.5</property>
+                                                     <property 
name="xpad">0</property>
+                                                     <property 
name="ypad">0</property>
+                                                   </widget>
+                                                   <packing>
+                                                     <property 
name="padding">0</property>
+                                                     <property 
name="expand">False</property>
+                                                     <property 
name="fill">False</property>
+                                                   </packing>
+                                                 </child>
+
+                                                 <child>
+                                                   <widget class="GtkLabel" 
id="label142">
+                                                     <property 
name="visible">True</property>
+                                                     <property name="label" 
translatable="yes">_Advanced configuration</property>
+                                                     <property 
name="use_underline">True</property>
+                                                     <property 
name="use_markup">False</property>
+                                                     <property 
name="justify">GTK_JUSTIFY_LEFT</property>
+                                                     <property 
name="wrap">False</property>
+                                                     <property 
name="selectable">False</property>
+                                                     <property 
name="xalign">0.5</property>
+                                                     <property 
name="yalign">0.5</property>
+                                                     <property 
name="xpad">0</property>
+                                                     <property 
name="ypad">0</property>
+                                                     <property 
name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                                     <property 
name="width_chars">-1</property>
+                                                     <property 
name="single_line_mode">False</property>
+                                                     <property 
name="angle">0</property>
+                                                   </widget>
+                                                   <packing>
+                                                     <property 
name="padding">0</property>
+                                                     <property 
name="expand">False</property>
+                                                     <property 
name="fill">False</property>
+                                                   </packing>
+                                                 </child>
+                                               </widget>
+                                             </child>
+                                           </widget>
+                                         </child>
+                                       </widget>
+                                       <packing>
+                                         <property name="padding">0</property>
+                                         <property 
name="expand">False</property>
+                                         <property name="fill">False</property>
+                                       </packing>
                                      </child>
                                    </widget>
                                  </child>
@@ -2524,9 +2599,9 @@
                          <property name="spacing">12</property>
 
                          <child>
-                           <widget class="GtkLabel" id="label55">
+                           <widget class="GtkLabel" id="label141">
                              <property name="visible">True</property>
-                             <property name="label" 
translatable="yes">&lt;b&gt;Available Content&lt;/b&gt;</property>
+                             <property name="label" 
translatable="yes">&lt;b&gt;Available content&lt;/b&gt;</property>
                              <property name="use_underline">False</property>
                              <property name="use_markup">True</property>
                              <property 
name="justify">GTK_JUSTIFY_LEFT</property>

Modified: gnunet-gtk/src/common/helper.c
===================================================================
--- gnunet-gtk/src/common/helper.c      2006-06-22 17:50:56 UTC (rev 3024)
+++ gnunet-gtk/src/common/helper.c      2006-06-22 18:45:40 UTC (rev 3025)
@@ -26,6 +26,7 @@
 
 #include "platform.h"
 #include "gnunetgtk_common.h"
+#include <glib.h>
 
 #define HELPER_DEBUG NO
 
@@ -33,6 +34,12 @@
 #include <libnotify/notify.h>
 #endif
 
+#ifdef WITH_LIBGKSU2
+/*#include <libgksu/libgksu.h>
+* commented because support is broken in Debian,
+* and these headers are not really useful for us */
+#endif
+
 typedef struct {
   Semaphore * sem;
   void * args;
@@ -613,18 +620,40 @@
 * Start gnunet-setup, asking for a password if needed
 */
 gboolean startGNUnetSetup (gboolean run_wizard) {
-#ifdef HAVE_LIBGKSU2
-  if(gnunetsetup_mode) {
-    gksu_run("gnunet-setup -d wizard-gtk", NULL); }
+  int code;
+#ifdef WITH_LIBGKSU2
+  GError *gerror = NULL;
+  char *error_message;
+  if(run_wizard) {
+    code = gksu_run("gnunet-setup -d wizard-gtk", &gerror); }
   else {
-    gksu_run("gnunet-setup -d", NULL); }
+    code = gksu_run("gnunet-setup -d", &gerror); }
+  if(code && !gerror) {
+    error_message = STRDUP("GKSu encountered an unknown error running the 
configuration tool (gnunet-setup)."); }
+  else if(code && gerror) {
+    error_message = g_strdup_printf("GKSu returned:\n%s", gerror->message);
+    g_error_free(gerror); }
+  else {
+     error_message = NULL; }
+#elif defined(WINDOWS)
+/* FIXME: run gnunet-setup, assuming we can get the needed rights */
+  error_message = STRDUP("Not implemented yet !");
   return TRUE;
-#elif WINDOWS
-/* FIXME: run gnunet-setup, assuming we can have the needed rights */
+#else
+  error_message = STRDUP(_("GKSu support is not enabled, impossible to get the 
needed rights. You should build gnunet-gtk with the --enable-libgksu2 option, 
or get the right binary package. Note you can still start the configuration 
tool (gnunet-setup) manually."));
   return TRUE;
-#else
-  return FALSE;
 #endif
+  GtkWidget *mainWindow, *messageDialog;
+  mainWindow = glade_xml_get_widget(getMainXML(), "mainWindow");
+  messageDialog = gtk_message_dialog_new (GTK_WINDOW(mainWindow),
+                                            GTK_DIALOG_MODAL | 
GTK_DIALOG_DESTROY_WITH_PARENT,
+                                            GTK_MESSAGE_WARNING, 
GTK_BUTTONS_CLOSE,
+                                           _("Failed to run the configuration 
wizard: %s"),
+                                            error_message);
+  gtk_dialog_run(GTK_DIALOG(messageDialog));
+  gtk_widget_destroy (messageDialog);
+  FREE(error_message);
+  return code;
 }
 
 /* end of helper.c */

Modified: gnunet-gtk/src/include/gnunetgtk_common.h
===================================================================
--- gnunet-gtk/src/include/gnunetgtk_common.h   2006-06-22 17:50:56 UTC (rev 
3024)
+++ gnunet-gtk/src/include/gnunetgtk_common.h   2006-06-22 18:45:40 UTC (rev 
3025)
@@ -39,6 +39,9 @@
 #define DEBUG_END()
 #endif
 
+#ifndef DATADIR
+#include "datadir.h"
+#endif
 
 void initGNUnetGTKCommon(void * callback);
 
@@ -137,8 +140,8 @@
 
 /**
 * Start gnunet-setup, asking for a password if needed
-* @param gnunetsetup_mode TRUE to run the wizard, FALSE to run the complete 
tool
-* @returns TRUE if gksu is enabled or we run on Windows, FALSE else
+* @param run_wizard TRUE to run the wizard, FALSE to run the complete tool
+* @returns FALSE if gnunet-setup was run, TRUE else
 */
 gboolean startGNUnetSetup (gboolean run_wizard);
 

Modified: gnunet-gtk/src/plugins/daemon/daemon.c
===================================================================
--- gnunet-gtk/src/plugins/daemon/daemon.c      2006-06-22 17:50:56 UTC (rev 
3024)
+++ gnunet-gtk/src/plugins/daemon/daemon.c      2006-06-22 18:45:40 UTC (rev 
3025)
@@ -273,18 +273,18 @@
 }
 
 /**
-* Launch gnunet-setup -d wizard-gtk with needed rights
+* Launch 'gnunet-setup -d wizard-gtk' with needed rights
 */
 void on_startDaemonConfWizard_clicked(GtkWidget * widget,
                                      gpointer data) {
-  if (!startGNUnetSetup(TRUE)) {
-    GtkWidget *mainWindow, *messageDialog;
-    mainWindow = glade_xml_get_widget(getMainXML(), "mainWindow");
-    messageDialog = gtk_message_dialog_new (GTK_WINDOW(mainWindow),
-                                            GTK_DIALOG_MODAL | 
GTK_DIALOG_DESTROY_WITH_PARENT,
-                                            GTK_MESSAGE_INFO, 
GTK_BUTTONS_CLOSE,
-                                             _("Gksu support is not enabled, 
impossible to get the needed rights. You should build gnunet-gtk with the 
--enable-libgksu2 option, or get the right binary package."));
-    gtk_dialog_run(GTK_DIALOG(messageDialog)); }
+  startGNUnetSetup(TRUE);
 }
 
+/**
+* Launch 'gnunet-setup -d gconfig' with needed rights
+*/
+void on_startDaemonConfTool_clicked(GtkWidget * widget,
+                                   gpointer data) {
+  startGNUnetSetup(FALSE);
+}
 /* end of daemon.c */





reply via email to

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