Hello there, I've done a quick hack on vino to remove the requirement for gnome and gconf. Instead, I have vino-server reading a very simple configuration file.
It will be obvious to desktop manager/distro developers where to replace this with a nicer configuration system perhaps using libxml2 to place configuration settings in an xml file. The relevant file is server/vino-prefs.c. After applying this patch, configure will need to be re-created. Then, to switch off gconf/gnome and instead compile my non-gconf configuration code, pass the configure option --enable-gconf=no. I also configure with --enable-gnutls=no. Note that I changed the --disable-gconf, --disable-gcrypt and --disable-gnutls configure options to --enable-gconf, --enable-gcrypt and --enable-gnutls respectively. They didn't seem to work properly in the existing 2.12.0 release. The gnome configuration window (capplet) which inserts configuration information into gconf is simply not compiled. You'll have to either write a utility to create a config file as per the code (vino-prefs.c), or a utility which creates a config file to your own specification. Or write out a config file using a text editor of course. As this may be of interest to those integrating vino into a non-gnome (esp. non-gnome, but gtk based) desktops or distros, I'm copying this to the xfce and (x)ubuntu lists. with best regards, Seb James -- William Matthew Limited - Innovative Technology T: +44 (0)845 4580277 http://www.wmltd.co.uk patch follows: diff -Naur vino-2.12.0/capplet/vino-preferences.c vino-2.12.0-esf/capplet/vino-preferences.c --- vino-2.12.0/capplet/vino-preferences.c 2005-05-16 14:13:13.000000000 +0100 +++ vino-2.12.0-esf/capplet/vino-preferences.c 2006-08-08 13:19:17.000000000 +0100 @@ -20,6 +20,28 @@ * Mark McLoughlin <[EMAIL PROTECTED]> */ +#ifndef VINO_ENABLE_GCONF + +/* + * A little informational message saying we don't use the capplet if compiled without gconf + */ +#include <config.h> +#include <stdio.h> + +int +main (int argc, char **argv) +{ + printf ("NB: This capplet isn't relevant if --enable-gonf is set to \"no\" \n" + "during configuration of vino.\n"); + return 0; +} + +#else + +/* + * The capplet code proper + */ + #include <config.h> #include <string.h> @@ -978,3 +1000,5 @@ return 0; } + +#endif /* defined VINO_ENABLE_GCONF */ diff -Naur vino-2.12.0/capplet/vino-url.c vino-2.12.0-esf/capplet/vino-url.c --- vino-2.12.0/capplet/vino-url.c 2005-07-21 16:07:17.000000000 +0100 +++ vino-2.12.0-esf/capplet/vino-url.c 2006-08-08 13:19:17.000000000 +0100 @@ -20,6 +20,10 @@ * Mark McLoughlin <[EMAIL PROTECTED]> */ +#ifndef VINO_ENABLE_GCONF +# warning "Building without gnome/gconf support" +#else + #include <config.h> #include "vino-url.h" @@ -739,3 +743,5 @@ pango_attr_list_unref (filtered); } } + +#endif /* defined VINO_ENABLE_GCONF */ diff -Naur vino-2.12.0/configure.in vino-2.12.0-esf/configure.in --- vino-2.12.0/configure.in 2005-09-06 10:19:33.000000000 +0100 +++ vino-2.12.0-esf/configure.in 2006-08-08 13:19:17.000000000 +0100 @@ -28,8 +28,6 @@ AM_GLIB_GNU_GETTEXT -GNOME_COMPILE_WARNINGS(yes) - AC_ARG_ENABLE(deprecations, [AC_HELP_STRING([--disable-deprecations], [don't warn about deprecated usages [default=no]])],, @@ -45,18 +43,13 @@ AC_SUBST(DISABLE_DEPRECATED_CFLAGS) fi -PKG_CHECK_MODULES(VINO_SERVER, gtk+-x11-2.0 gconf-2.0 libglade-2.0 libgnomeui-2.0) - -PKG_CHECK_MODULES(VINO_CAPPLET, gtk+-2.0 gconf-2.0 libglade-2.0 libgnomeui-2.0 >= 2.5.2) - -dnl --enable-session-support=(yes|no) -AC_ARG_ENABLE(session_support, - [ --enable-session-support=[no/yes] build session management utility program [default=no]],, - enable_session_support=no) -if test "$enable_session_support" = "yes"; then - PKG_CHECK_MODULES(VINO_SESSION, gconf-2.0 libgnomeui-2.0) -fi -AM_CONDITIONAL(SESSION_SUPPORT, [test "$enable_session_support" = "yes"]) +dnl This block of PKG_CHECK_MODULES moved to the gonf/gnome enable/disable section +dnl +dnl Need to make gconf-2.0 checked for only if gconf/gnome is enabled +dnl PKG_CHECK_MODULES(VINO_SERVER, gtk+-x11-2.0 gconf-2.0 libglade-2.0 libgnomeui-2.0) +dnl +dnl We need to build capplet only if gonf/gnome are enabled +dnl PKG_CHECK_MODULES(VINO_CAPPLET, gtk+-2.0 gconf-2.0 libglade-2.0 libgnomeui-2.0 >= 2.5.2) dnl --enable-http-server=(yes|no) AC_ARG_ENABLE(http_server, @@ -70,6 +63,36 @@ AC_SUBST(VINO_HTTP_CFLAGS) AM_CONDITIONAL(HTTP_SERVER, [test "$enable_http_server" = "yes"]) +dnl --enable-gconf=(yes|no) +dnl Probably best called --enable-gnome rather than --enable-gconf. +AC_ARG_ENABLE(gconf, + [ --enable-gconf=[no/yes] enable gconf for configuration settings [default=yes]],, + enable_gconf=yes) +if test "$enable_gconf" = "yes"; then + VINO_GCONF_CFLAGS="-DVINO_ENABLE_GCONF" + dnl This seems to cause problems, even when I give the flag --enable-gconf=no, presumably because my system doesn't have the gnome libraries + dnl GNOME_COMPILE_WARNINGS(true) + PKG_CHECK_MODULES(VINO_SERVER, gtk+-x11-2.0 gconf-2.0 libglade-2.0 libgnomeui-2.0) + PKG_CHECK_MODULES(VINO_CAPPLET, gtk+-2.0 gconf-2.0 libglade-2.0 libgnomeui-2.0 >= 2.5.2) +else + VINO_GCONF_CFLAGS="" + PKG_CHECK_MODULES(VINO_SERVER, gtk+-x11-2.0 libglade-2.0) +fi + +dnl The following should be disabled if gnome/gconf is disabled +dnl --enable-session-support=(yes|no) +AC_ARG_ENABLE(session_support, + [ --enable-session-support=[no/yes] build session management utility program [default=no]],, + enable_session_support=no) +if test "$enable_session_support" = "yes"; then + PKG_CHECK_MODULES(VINO_SESSION, gconf-2.0 libgnomeui-2.0) +fi +AM_CONDITIONAL(SESSION_SUPPORT, [test "$enable_session_support" = "yes"]) + + +AC_SUBST(VINO_GCONF_CFLAGS) +AM_CONDITIONAL(GCONF_SOURCE_2, [test "$enable_gconf" = "yes"]) +AM_CONDITIONAL(GCONF_SCHEMAS_INSTALL, [test "$enable_gconf" = "yes"]) # # If Pango included the shared library dependencies from X11 in # the pkg-config output, then we use that (to avoid duplicates). @@ -114,7 +137,7 @@ # Check for gnutls # AC_ARG_ENABLE(gnutls, - [ --disable-gnutls=[no/yes] don't build VNC over SSL support [default=no]],, + [ --enable-gnutls=[yes/no] build VNC over SSL support [default=yes]],, enable_gnutls=yes) if test "$enable_gnutls" = "yes"; then AM_PATH_LIBGNUTLS(1.0.0, @@ -130,7 +153,7 @@ # Check for gcrypt # AC_ARG_ENABLE(gcrypt, - [ --disable-gcrypt=[no/yes] don't use libgcrypt for random number generation [default=no]],, + [ --enable-gcrypt=[yes/no] use libgcrypt for random number generation [default=yes]],, enable_gcrypt=yes) if test "$enable_gcrypt" = "yes"; then AM_PATH_LIBGCRYPT(1.1.90, @@ -228,7 +251,8 @@ fi AC_SUBST(VINO_DEBUG_CFLAGS) -AM_GCONF_SOURCE_2 +dnl Seb commented: +dnl AM_GCONF_SOURCE_2 dnl define a MAINT-like variable REBUILD which is set dnl if Perl, so autogenerated sources can be rebuilt diff -Naur vino-2.12.0/server/Makefile.am vino-2.12.0-esf/server/Makefile.am --- vino-2.12.0/server/Makefile.am 2005-05-20 10:31:26.000000000 +0100 +++ vino-2.12.0-esf/server/Makefile.am 2006-08-08 13:23:08.000000000 +0100 @@ -7,6 +7,7 @@ $(VINO_SERVER_CFLAGS) \ $(VINO_DEBUG_CFLAGS) \ $(VINO_HTTP_CFLAGS) \ + $(VINO_GCONF_CFLAGS) \ $(LIBGNUTLS_CFLAGS) \ $(LIBGCRYPT_CFLAGS) \ $(WARN_CFLAGS) \ @@ -97,6 +98,7 @@ --eprod "GType @[EMAIL PROTECTED] (void);\n" \ $(vino_enum_headers) > $@ +if GCONF_SCHEMAS_INSTALL CORBA_SRCLIST = \ GNOME_RemoteDesktop-skels.c \ GNOME_RemoteDesktop-common.c \ @@ -109,6 +111,7 @@ schemasdir = $(GCONF_SCHEMA_FILE_DIR) schemas_in_files = vino-server.schemas.in schemas_DATA = $(schemas_in_files:.schemas.in=.schemas) +endif @INTLTOOL_SCHEMAS_RULE@ diff -Naur vino-2.12.0/server/vino-main.c vino-2.12.0-esf/server/vino-main.c --- vino-2.12.0/server/vino-main.c 2004-07-12 13:17:52.000000000 +0100 +++ vino-2.12.0-esf/server/vino-main.c 2006-08-08 13:19:17.000000000 +0100 @@ -67,8 +67,10 @@ #endif #endif /* HAVE_GNUTLS */ +#ifdef VINO_ENABLE_GCONF if (!vino_shell_register (&argc, argv)) return 1; +#endif display = gdk_display_get_default (); diff -Naur vino-2.12.0/server/vino-prefs.c vino-2.12.0-esf/server/vino-prefs.c --- vino-2.12.0/server/vino-prefs.c 2004-02-05 08:54:59.000000000 +0000 +++ vino-2.12.0-esf/server/vino-prefs.c 2006-08-08 13:19:17.000000000 +0100 @@ -20,6 +20,216 @@ * Mark McLoughlin <[EMAIL PROTECTED]> */ +#ifndef VINO_ENABLE_GCONF +/* + * Non-Gconf preferences handling. + */ + +#include <config.h> +#include "vino-prefs.h" +#include <string.h> +#include "vino-util.h" +#include <stdio.h> +#include <stdlib.h> + +static GSList *vino_servers = NULL; + +/* This hardcoded */ +static gboolean vino_enabled = TRUE; +/* Read from file */ +static gboolean vino_prompt_enabled = FALSE; +/* Read from file */ +static gboolean vino_view_only = TRUE; +/* This hardcoded */ +static gboolean vino_require_encryption = FALSE; +/* Read from file */ +static VinoAuthMethod vino_auth_methods = VINO_AUTH_VNC; +/* Read password from file, field vino_password */ +char *vino_vnc_password = NULL; + +#define VINO_CONFIG_FILE "/etc/persistent/hcconf" + +/* + * A function to get boolean values of config settings + * which are stored in a text config file which might look like this: + +vino = 1 +vino_prompt = 1 +vino_control = 0 +vino_require_pass = 1 +vino_password = EWkskQW= + + * etc. Each value can be on (non-zero) or off (zero). + * The function returns TRUE or FALSE accordingly. + * The maximum length for the config setting line is + * 100 characters, including the " = 0\n" portion. + * This function obviously can't read vino_password. + */ +gboolean get_boolean_field_from_config (char * field) +{ + FILE * fp; + char * field_str; + gboolean field_value = FALSE; + int i = 0; + + fp = fopen (VINO_CONFIG_FILE, "r"); + if (!fp) { + /* No config file exists. This is not an error; no config settings + * may have been written. Default value for any setting is + * false. */ + return FALSE; + } + + field_str = g_malloc0 (101 * sizeof (char)); + + while ( fgets (field_str, 100, fp) ) { + field_str = strtok (field_str, "="); + + /* Chomp any spaces off field_str, then compare length with + * field */ + for (i=strlen(field_str)-1; i>=0&&field_str[i]==' '; i--) { + field_str[i] = '\0'; + } + + if ( strlen(field_str) == strlen(field) && + !strncmp (field_str, field, strlen(field)) ) { + /* The line of the file matches the field identifier */ + field_str = strtok (NULL, "\n"); + if (atoi (field_str) > 0) { + field_value = TRUE; + } else { + field_value = FALSE; + } + } else { + /* No match, do nothing */ + } + } + fclose (fp); + return field_value; +} + +/* + * Read base64 obfuscated password from file, malloc space + * for vino_vnc_password, and place the data there. + * vino_vnc_password should be freed in vino_prefs_shutdown(). + */ +void +read_password_from_config_file (void) +{ + FILE * fp; + char * field_str; + char * tmp_str = NULL; + int i = 0, j = 0; + + fp = fopen (VINO_CONFIG_FILE, "r"); + if (!fp) { + /* No config file exists. Leave vino_vnc_password as NULL */ + return; + } + + field_str = g_malloc0 (101 * sizeof (char)); + + while ( fgets (field_str, 100, fp) ) { + field_str = strtok (field_str, "="); + + if (!strncmp (field_str, "vino_password", 13)) { + + field_str = strtok (NULL, "\n"); + + /* Chomp leading spaces */ + tmp_str = g_malloc0 ((strlen(field_str)+1) * sizeof(char)); + while (field_str[i] != '\0') { + if (field_str[i] != ' ') + tmp_str[j++] = field_str[i]; + i++; + } + + /* If it's "null", do nothing, otherwise malloc space and copy the data. */ + if (strncmp (tmp_str, "null", 4)) { + printf ("tmp_str = '%s'\n", tmp_str); + vino_vnc_password = g_strdup (tmp_str); + printf ("After g_strdup(): tmp_str = '%s'\nvino_vnc_password = '%s'\n", + tmp_str, vino_vnc_password); + } else { + vino_vnc_password = NULL; + printf ("Setting vino_vnc_password to null\n"); + } + + } else { + /* No match, do nothing */ + } + } + fclose (fp); + if (field_str != NULL) g_free (field_str); + if (tmp_str != NULL) g_free (tmp_str); + return; +} + +/* + * Read in preferences from a file. This function + * could be rewritten to read preferences in whichever + * way is suitable for your system. + */ +void +vino_prefs_init (gboolean view_only) +{ + vino_prompt_enabled = get_boolean_field_from_config ("vino_prompt") ? TRUE : FALSE; + printf ("vino_prompt_enabled = %d\n", vino_prompt_enabled); + + if (view_only == TRUE) { + vino_view_only = TRUE; + } else { + vino_view_only = get_boolean_field_from_config ("vino_control") ? FALSE : TRUE; + } + printf ("vino_view_only = %d\n", vino_view_only); + + vino_auth_methods = + get_boolean_field_from_config ("vino_require_pass") ? VINO_AUTH_VNC : VINO_AUTH_NONE; + printf ("vino_auth_methods = %d\n", vino_auth_methods); + + /* Finally, read the base64 encoded password in. */ + read_password_from_config_file(); + printf ("vino_vnc_password = %s\n", vino_vnc_password); +} + +void +vino_prefs_create_server (GdkScreen *screen) +{ + VinoServer *server; + + server = g_object_new (VINO_TYPE_SERVER, + "screen", screen, + "prompt-enabled", vino_prompt_enabled, + "view-only", vino_view_only, + "auth-methods", vino_auth_methods, + "require-encryption", vino_require_encryption, + "vnc-password", vino_vnc_password, + "on-hold", !vino_enabled, + NULL); + + vino_servers = g_slist_prepend (vino_servers, server); +} + +void +vino_prefs_shutdown (void) +{ + GSList *l; + + for (l = vino_servers; l; l = l->next) + g_object_unref (l->data); + g_slist_free (vino_servers); + vino_servers = NULL; + + if (vino_vnc_password) + g_free (vino_vnc_password); + vino_vnc_password = NULL; +} + +#else +/* + * Original GConf based preferences code + */ + #include <config.h> #include "vino-prefs.h" @@ -379,3 +589,5 @@ g_object_unref (vino_client); vino_client = NULL; } + +#endif /* ifndef VINO_ENABLE_GCONF */ diff -Naur vino-2.12.0/server/vino-prompt.c vino-2.12.0-esf/server/vino-prompt.c --- vino-2.12.0/server/vino-prompt.c 2005-05-16 14:41:36.000000000 +0100 +++ vino-2.12.0-esf/server/vino-prompt.c 2006-08-08 13:19:17.000000000 +0100 @@ -26,7 +26,9 @@ #include <gtk/gtk.h> #include <glade/glade.h> -#include <libgnomeui/gnome-icon-theme.h> +#ifdef VINO_ENABLE_GCONF +# include <libgnomeui/gnome-icon-theme.h> +#endif #include "vino-util.h" #include "vino-enums.h" #include "vino-marshal.h" @@ -295,6 +297,7 @@ static void vino_prompt_setup_icons (VinoPrompt *prompt, GladeXML *xml) +#ifdef VINO_ENABLE_GCONF { #define ICON_SIZE_STANDARD 48 @@ -325,6 +328,20 @@ #undef ICON_SIZE_STANDARD } +#else /* Non gnome/gconf setting of icon */ +{ + static char *icon_path = "/usr/share/icons/gnome-remote-desktop.png"; + + prompt->priv->sharing_icon = glade_xml_get_widget (xml, "sharing_icon"); + g_assert (prompt->priv->sharing_icon != NULL); + + gtk_window_set_icon_from_file (GTK_WINDOW (prompt->priv->dialog), + icon_path, + NULL); + gtk_image_set_from_file (GTK_IMAGE (prompt->priv->sharing_icon), + icon_path); +} +#endif static gboolean vino_prompt_setup_dialog (VinoPrompt *prompt) @@ -335,10 +352,16 @@ const char *glade_file; GtkWidget *help_button; +#ifdef VINO_ENABLE_GCONF if (g_file_test (VINO_GLADE_FILE, G_FILE_TEST_EXISTS)) glade_file = VINO_GLADE_FILE; else glade_file = VINO_GLADEDIR "/" VINO_GLADE_FILE; +#else + /* In our simple mid-embedded non-gnome system we hardcode the + glade files to be in /usr/share/. Seb */ + glade_file = "/usr/share/" VINO_GLADE_FILE; +#endif xml = glade_xml_new (glade_file, "vino_dialog", NULL); if (!xml) @@ -360,7 +383,13 @@ help_button = glade_xml_get_widget (xml, "help_button"); g_assert (help_button != NULL); + gtk_widget_set_sensitive (help_button, FALSE); + +#ifndef VINO_ENABLE_GCONF + /* We hide the help button for non-gnome systems */ + gtk_widget_hide (help_button); +#endif g_object_unref (xml); @@ -396,7 +425,7 @@ prompt->priv->current_client = rfb_client; - gtk_widget_show_all (prompt->priv->dialog); + gtk_widget_show (prompt->priv->dialog); dprintf (PROMPT, "Prompting for client %p\n", rfb_client); diff -Naur vino-2.12.0/server/vino-server.c vino-2.12.0-esf/server/vino-server.c --- vino-2.12.0/server/vino-server.c 2005-05-19 15:34:32.000000000 +0100 +++ vino-2.12.0-esf/server/vino-server.c 2006-08-08 13:19:17.000000000 +0100 @@ -446,11 +446,25 @@ if (!server->priv->vnc_password) goto auth_failed; +/* gconf stores the password internally base64 encoded, so this + function has to unencode it. Your non-gconf method may store the + password as clear text, or using some other encoding which should + be reversed here. */ +#ifdef VINO_ENABLE_GCONF if (!(password = vino_base64_unencode (server->priv->vnc_password))) { g_warning ("Failed to base64 unencode VNC password\n"); goto auth_failed; } +#else + /* in fact, in our case, we still base64_unencode the password. This + #ifdef/#else/#endif is left as a hook for other peoples' code. */ + if (!(password = vino_base64_unencode (server->priv->vnc_password))) + { + g_warning ("Failed to base64 unencode VNC password\n"); + goto auth_failed; + } +#endif rfb_client = client->rfb_client; @@ -463,6 +477,7 @@ { memset (rfb_client->authChallenge, 0, CHALLENGESIZE); g_warning ("VNC authentication failure from '%s'\n", rfb_client->host); + /*g_warning ("HACKED version which allows connection anyway!!!!");*/ goto auth_failed; } diff -Naur vino-2.12.0/server/vino-shell.c vino-2.12.0-esf/server/vino-shell.c --- vino-2.12.0/server/vino-shell.c 2004-02-05 08:55:03.000000000 +0000 +++ vino-2.12.0-esf/server/vino-shell.c 2006-08-08 13:19:17.000000000 +0100 @@ -19,7 +19,9 @@ * Authors: * Mark McLoughlin <[EMAIL PROTECTED]> */ - +#ifndef VINO_ENABLE_GCONF +#warning "Leaving out the bonobo stuff for our gnome free version of vino" +#else #include <config.h> #include "vino-shell.h" @@ -135,3 +137,5 @@ GNOME_RemoteDesktop_Shell, BONOBO_TYPE_OBJECT, vino_shell); + +#endif /* VINO_ENABLE_GCONF */ _______________________________________________ desktop-devel-list mailing list desktop-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/desktop-devel-list