[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5962 - in gnunet-gtk: . src/common src/include src/plugins
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5962 - in gnunet-gtk: . src/common src/include src/plugins/daemon |
Date: |
Tue, 18 Dec 2007 14:59:57 -0700 (MST) |
Author: moon
Date: 2007-12-18 14:59:57 -0700 (Tue, 18 Dec 2007)
New Revision: 5962
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:
update libgksu2 support and allow direct configuration when config file
is writable by current user (use --with-libgksu2)
Modified: gnunet-gtk/gnunet-gtk.glade
===================================================================
--- gnunet-gtk/gnunet-gtk.glade 2007-12-18 21:23:59 UTC (rev 5961)
+++ gnunet-gtk/gnunet-gtk.glade 2007-12-18 21:59:57 UTC (rev 5962)
@@ -269,6 +269,7 @@
<child>
<widget class="GtkVBox" id="vbox2">
+ <property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
@@ -333,7 +334,7 @@
<child>
<widget class="GtkLabel"
id="startButton">
<property
name="visible">True</property>
- <property name="label"
translatable="yes">start gnunet_d</property>
+ <property name="label"
translatable="yes">Start gnunet_d</property>
<property
name="use_underline">True</property>
<property
name="use_markup">False</property>
<property
name="justify">GTK_JUSTIFY_RIGHT</property>
@@ -413,7 +414,7 @@
<child>
<widget class="GtkLabel"
id="label64">
<property
name="visible">True</property>
- <property name="label"
translatable="yes">sto_p gnunetd</property>
+ <property name="label"
translatable="yes">Sto_p gnunetd</property>
<property
name="use_underline">True</property>
<property
name="use_markup">False</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
@@ -503,7 +504,7 @@
<child>
<widget class="GtkLabel"
id="gnunetdControlLabel">
<property name="visible">True</property>
- <property name="label"
translatable="yes"><b>GNUnet daemon control</b></property>
+ <property name="label"
translatable="yes"><b>GNUnet Daemon Control</b></property>
<property
name="use_underline">False</property>
<property
name="use_markup">True</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
@@ -531,72 +532,6 @@
</child>
<child>
- <widget class="GtkHBox" id="hbox67">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label152">
- <property name="visible">True</property>
- <property name="label"
translatable="yes">_configuration file that should be used when starting
gnunetd:</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">5</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>
-
- <child>
- <widget class="GtkFileChooserButton"
id="gnunetdconfigFileChooserButton">
- <property name="visible">True</property>
- <property name="title"
translatable="yes">Select gnunetd configuration File</property>
- <property
name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
- <property
name="local_only">True</property>
- <property
name="show_hidden">True</property>
- <property
name="do_overwrite_confirmation">False</property>
- <property name="width_chars">-1</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHSeparator" id="hseparator1">
- <property name="visible">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="label_xalign">0</property>
@@ -659,17 +594,8 @@
</child>
<child>
- <widget class="GtkHSeparator" id="hseparator2">
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkFrame" id="daemonConfigFrame">
+ <property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property
name="shadow_type">GTK_SHADOW_NONE</property>
@@ -846,7 +772,7 @@
<child>
<widget class="GtkLabel"
id="daemonConfigLabel">
<property name="visible">True</property>
- <property name="label"
translatable="yes"><b>GNUnet configuration</b></property>
+ <property name="label"
translatable="yes"><b>GNUnet Daemon Configuration</b></property>
<property
name="use_underline">False</property>
<property
name="use_markup">True</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
@@ -874,46 +800,51 @@
</child>
<child>
- <widget class="GtkHBox" id="hbox68">
+ <widget class="GtkHBox" id="hbox67">
+ <property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
- <widget class="GtkRadioButton"
id="configureClientRadioButton">
+ <widget class="GtkLabel" id="label152">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label"
translatable="yes">C_onfigure client</property>
+ <property name="label"
translatable="yes">_Configuration file used for gnunetd :</property>
<property
name="use_underline">True</property>
- <property
name="relief">GTK_RELIEF_NORMAL</property>
- <property
name="focus_on_click">True</property>
- <property name="active">True</property>
- <property
name="inconsistent">False</property>
- <property
name="draw_indicator">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">5</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">True</property>
+ <property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkRadioButton"
id="configureDaemonRadioButton">
+ <widget class="GtkFileChooserButton"
id="gnunetdconfigFileChooserButton">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label"
translatable="yes">Configure da_emon</property>
- <property
name="use_underline">True</property>
- <property
name="relief">GTK_RELIEF_NORMAL</property>
- <property
name="focus_on_click">True</property>
- <property name="active">False</property>
- <property
name="inconsistent">False</property>
- <property
name="draw_indicator">True</property>
- <property
name="group">configureClientRadioButton</property>
+ <property name="title"
translatable="yes">Select gnunetd configuration File</property>
+ <property
name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+ <property
name="local_only">True</property>
+ <property
name="show_hidden">True</property>
+ <property
name="do_overwrite_confirmation">False</property>
+ <property name="width_chars">-1</property>
+ <signal name="file_set"
handler="on_gnunetdconfigfile_set_" last_modification_time="Sun, 16 Dec 2007
22:59:54 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
</packing>
</child>
</widget>
@@ -5349,6 +5280,7 @@
</widget>
<widget class="GtkAboutDialog" id="aboutDialog">
+ <property name="border_width">5</property>
<property agent="glademm" name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="tooltip" translatable="yes">The gnunet-gtk about
dialog</property>
@@ -5692,6 +5624,7 @@
</widget>
<widget class="GtkFileChooserDialog" id="uploadfilechooserdialog">
+ <property name="border_width">5</property>
<property agent="glademm" name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
@@ -7608,6 +7541,7 @@
</widget>
<widget class="GtkFileChooserDialog" id="openDirectoryFileDialog">
+ <property name="border_width">5</property>
<property name="visible">True</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
<property name="local_only">True</property>
@@ -7782,6 +7716,7 @@
</widget>
<widget class="GtkFileChooserDialog" id="directorySaveDialog">
+ <property name="border_width">5</property>
<property name="visible">True</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SAVE</property>
<property name="local_only">True</property>
Modified: gnunet-gtk/src/common/helper.c
===================================================================
--- gnunet-gtk/src/common/helper.c 2007-12-18 21:23:59 UTC (rev 5961)
+++ gnunet-gtk/src/common/helper.c 2007-12-18 21:59:57 UTC (rev 5962)
@@ -38,9 +38,9 @@
#endif
#ifdef WITH_LIBGKSU2
-/*#include <libgksu/libgksu.h>
-* commented because support is broken in Debian,
-* and these headers are not really useful for us */
+/* Not used because libgksu2 headers have broken depends in Debian
+And this is not really needed
+#include <libgksu/libgksu.h> */
#endif
typedef struct
@@ -516,7 +516,7 @@
va_end (arg);
libnotify = notify_notification_new ("gnunet-gtk",
msg,
- PACKAGNUNET_GE_DATA
+ PACKAGE_DATA
"/gnunet-gtk/gnunet-gtk-notify.png",
NULL);
GNUNET_free (msg);
@@ -588,61 +588,79 @@
* Start gnunet-setup, asking for a password if needed
*/
gboolean
-GNUNET_GTK_run_gnunet_setup (gboolean run_wizard)
+GNUNET_GTK_run_gnunet_setup (gchar *conffile, gboolean run_wizard)
{
GtkWidget *mainWindow;
GtkWidget *messageDialog;
- int code;
- char *error_message;
-#ifdef WITH_LIBGKSU2
GError *gerror = NULL;
- if (run_wizard)
+ char *error_message = NULL;
+
+ if (0 == ACCESS(conffile, W_OK))
{
- code = gksu_run ("gnunet-setup -d wizard-gtk", &gerror);
+ if (run_wizard)
+ {
+ char *argv[]
+ = {"gnunet-setup", "-d", "wizard-gtk", "-c", conffile, NULL};
+ g_spawn_async (NULL, argv, NULL,
+ G_SPAWN_SEARCH_PATH|G_SPAWN_CHILD_INHERITS_STDIN,
+ NULL, NULL, NULL, &gerror);
+ }
+ else
+ {
+ char *argv[]
+ = {"gnunet-setup", "-d", "gconfig", "-c", conffile, NULL};
+ g_spawn_async (NULL, argv, NULL,
+ G_SPAWN_SEARCH_PATH|G_SPAWN_CHILD_INHERITS_STDIN,
+ NULL, NULL, NULL, &gerror);
+ }
+ if (gerror)
+ {
+ error_message = GNUNET_strdup(gerror->message);
+ g_error_free (gerror);
+ }
}
else
- {
- code = gksu_run ("gnunet-setup -d", &gerror);
- }
- if (code && !gerror)
- {
- error_message =
- GNUNET_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 = GNUNET_strdup (_("Not implemented yet!"));
- code = TRUE;
+#ifndef WITH_LIBGKSU2
+ {
+ error_message = GNUNET_strdup(_("You don't have rights to write to the
provided configuration file."));
+ }
#else
- error_message =
- GNUNET_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."));
- code = TRUE;
+ {
+ char *commandline;
+
+ if (run_wizard)
+ {
+ commandline = g_strconcat ("gnunet-setup -d wizard-gtk -c ", conffile,
NULL);
+ gksu_run (commandline, &gerror);
+ }
+ else
+ {
+ commandline = g_strconcat ("gnunet-setup -d gconfig -c ", conffile,
NULL);
+ gksu_run (commandline, &gerror);
+ }
+ GNUNET_free (commandline);
+ if (gerror)
+ {
+ error_message = GNUNET_strdup(gerror->message);
+ g_error_free (gerror);
+ }
+ }
#endif
- mainWindow =
- glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "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 tool
(gnunet-setup): %s"),
- error_message);
- gtk_dialog_run (GTK_DIALOG (messageDialog));
- gtk_widget_destroy (messageDialog);
- GNUNET_free (error_message);
- return code;
+ if(error_message) {
+ mainWindow = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
"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
tool (gnunet-setup): %s"),
+ error_message);
+ gtk_dialog_run (GTK_DIALOG (messageDialog));
+ gtk_widget_destroy (messageDialog);
+ GNUNET_free (error_message);
+ return FALSE;
+ }
+ return TRUE;
}
/* end of helper.c */
Modified: gnunet-gtk/src/include/gnunetgtk_common.h
===================================================================
--- gnunet-gtk/src/include/gnunetgtk_common.h 2007-12-18 21:23:59 UTC (rev
5961)
+++ gnunet-gtk/src/include/gnunetgtk_common.h 2007-12-18 21:59:57 UTC (rev
5962)
@@ -43,6 +43,7 @@
#define GNUNET_GTK_DEBUG_END()
#endif
+
void GNUNET_GTK_initialize_common_library (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration
*cfg, void *callback);
@@ -134,10 +135,11 @@
/**
* Start gnunet-setup, asking for a password if needed
+* @param conffile path to the gnunetd configuration file
* @param run_wizard TRUE to run the wizard, FALSE to run the complete tool
* @returns FALSE if gnunet-setup was run, TRUE else
*/
-gboolean GNUNET_GTK_run_gnunet_setup (gboolean run_wizard);
+gboolean GNUNET_GTK_run_gnunet_setup (char *conffile, gboolean run_wizard);
/**
* Identical to "gtk_tree_selection_selected_foreach",
Modified: gnunet-gtk/src/plugins/daemon/daemon.c
===================================================================
--- gnunet-gtk/src/plugins/daemon/daemon.c 2007-12-18 21:23:59 UTC (rev
5961)
+++ gnunet-gtk/src/plugins/daemon/daemon.c 2007-12-18 21:59:57 UTC (rev
5962)
@@ -190,7 +190,7 @@
canStart = (geteuid () == 0);
else
canStart = 1;
- }
+ }
#else
canStart = 1;
#endif
@@ -415,9 +415,26 @@
("Configuration file for GNUnet daemon `%s'
does not exist! Run `gnunet-setup -d'.\n"),
daemon_config);
}
+
+#ifndef WITH_LIBGKSU2
+ GtkWidget *startDaemonConfWizard;
+ GtkWidget *startDaemonConfTool;
+
+ startDaemonConfWizard
+ = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "startDaemonConfWizard");
+ startDaemonConfTool
+ = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "startDaemonConfTool");
+ if (0 != ACCESS (daemon_config, W_OK))
+ {
+ gtk_widget_set_sensitive (startDaemonConfWizard, FALSE);
+ gtk_widget_set_sensitive (startDaemonConfTool, FALSE);
+ }
+#endif
GNUNET_free (daemon_config);
- cron = GNUNET_GTK_get_cron_manager ();
+ cron = GNUNET_GTK_get_cron_manager ();
GNUNET_cron_add_job (cron, &cronCheckDaemon, 0, 15 * GNUNET_CRON_SECONDS,
NULL);
GNUNET_cron_add_job (cron, &updateAppModel, 5 * GNUNET_CRON_MINUTES,
@@ -437,24 +454,77 @@
"applicationList");
gtk_tree_view_set_model (GTK_TREE_VIEW (w), NULL);
+ w = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
"applicationList");
+ gtk_tree_view_set_model (GTK_TREE_VIEW (w), NULL);
+
}
/**
* Launch 'gnunet-setup -d wizard-gtk' with needed rights
*/
void
-on_startDaemonConfWizard_clicked_daemon (GtkWidget * widget, gpointer data)
+on_startDaemonConfWizard_clicked_daemon (GtkWidget *widget, gpointer data)
{
- GNUNET_GTK_run_gnunet_setup (TRUE);
+ GtkWidget *filechooserbutton;
+ char *conffile;
+
+ filechooserbutton
+ = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "gnunetdconfigFileChooserButton");
+ conffile = gtk_file_chooser_get_filename
(GTK_FILE_CHOOSER(filechooserbutton));
+ GNUNET_GTK_run_gnunet_setup (conffile, TRUE);
+ GNUNET_free (conffile);
}
/**
* Launch 'gnunet-setup -d gconfig' with needed rights
*/
void
-on_startDaemonConfTool_clicked_daemon (GtkWidget * widget, gpointer data)
+on_startDaemonConfTool_clicked_daemon (GtkWidget *widget, gpointer data)
{
- GNUNET_GTK_run_gnunet_setup (FALSE);
+ GtkWidget *filechooserbutton;
+ char *conffile;
+
+ filechooserbutton
+ = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "gnunetdconfigFileChooserButton");
+ conffile = gtk_file_chooser_get_filename
(GTK_FILE_CHOOSER(filechooserbutton));
+ GNUNET_GTK_run_gnunet_setup (conffile, FALSE);
+ GNUNET_free (conffile);
}
+/**
+* Update sensitivity of daemon configuration buttons
+*/
+void
+on_gnunetdconfigfile_set_daemon (GtkWidget *filechooserbutton,
+ gpointer data)
+{
+#ifndef WITH_LIBGKSU2
+ GtkWidget *startDaemonConfWizard;
+ GtkWidget *startDaemonConfTool;
+ char *conffile;
+
+ startDaemonConfWizard
+ = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "startDaemonConfWizard");
+ startDaemonConfTool
+ = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "startDaemonConfTool");
+ conffile = gtk_file_chooser_get_filename
(GTK_FILE_CHOOSER(filechooserbutton));
+ if (0 == ACCESS (conffile, W_OK))
+ {
+ gtk_widget_set_sensitive (startDaemonConfWizard, TRUE);
+ gtk_widget_set_sensitive (startDaemonConfTool, TRUE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive (startDaemonConfWizard, FALSE);
+ gtk_widget_set_sensitive (startDaemonConfTool, FALSE);
+ }
+ GNUNET_free_non_null (conffile);
+#endif
+ return;
+}
+
/* end of daemon.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5962 - in gnunet-gtk: . src/common src/include src/plugins/daemon,
gnunet <=