From: Darren S. <ds...@us...> - 2006-07-06 18:04:56
|
Update of /cvsroot/xine/gnome-xine/src In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv5548/src Modified Files: desktop_integration.c desktop_integration.h wizards.c Log Message: Some setup wizard fixes, primarily disabling GNOME registration if no VFS. Also fix the symlink check (may return +ve without error) and improve the report layout slightly. Index: desktop_integration.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/desktop_integration.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- desktop_integration.c 6 Jul 2006 18:03:31 -0000 1.25 +++ desktop_integration.c 6 Jul 2006 18:04:41 -0000 1.26 @@ -87,7 +87,7 @@ #define gnome_vfs_mime_freeze gnome_vfs->mime_freeze static void * gnome_vfs_handle = NULL; - +static int gnome_vfs_available = -1; static struct gnome_vfs_functions * gnome_vfs = NULL; @@ -108,24 +108,27 @@ #define GET_FUNC(VAR,NAME) \ if (!(VAR = (typeof (VAR)) get_func ((NAME)))) \ - return 0 + return gnome_vfs_available = 0 #define GET_FUNC_S(VAR) \ if (!(gnome_vfs->VAR = (typeof (gnome_vfs->VAR)) \ get_func ("gnome_vfs_" #VAR))) \ - return 0 + return gnome_vfs_available = 0 -static int gnome_vfs_init (void) +gboolean di_gnome_vfs_init (void) { void (*gnome_vfs_init_func) (void) = NULL; void (*gnome_vfs_mime_get_value) (const char *, const char *) = NULL; + if (gnome_vfs_available != -1) + return gnome_vfs_available; + /* load the gnomevfs library */ gnome_vfs_handle = dlopen ("libgnomevfs-2.so.0", RTLD_LAZY); if (!gnome_vfs_handle) { fprintf (stderr, "%s.\n", dlerror()); - return 0; + return gnome_vfs_available = 0; } gnome_vfs = (struct gnome_vfs_functions *) calloc (1, sizeof (struct gnome_vfs_functions)); @@ -146,7 +149,7 @@ GET_FUNC_S (application_registry_set_bool_value); GET_FUNC_S (application_registry_remove_mime_type); - return 1; + return gnome_vfs_available = 1; } /* @@ -197,7 +200,7 @@ if (section) { asreprintf (&report, _("%s%s<i>Errors while registering with %s:</i>\n"), - report ? : "", report ? "\n" : "", section); + report ? : "", report ? "\n\n" : "", section); section = NULL; } @@ -266,7 +269,7 @@ section = "GNOME"; - if (!gnome_vfs_init()) + if (!di_gnome_vfs_init()) { di_report (_("GNOME initialisation failed")); return; @@ -498,7 +501,7 @@ * the object (if it exists) and create a fresh symlink in its place. */ - if (readlink (fname, buf, sizeof (buf)) && + if (readlink (fname, buf, sizeof (buf)) == -1 && errno != EINVAL && errno != ENOENT) { di_report (_("symlink check on %s failed: %s"), fname, strerror (errno)); Index: desktop_integration.h =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/desktop_integration.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- desktop_integration.h 6 Jul 2006 18:03:31 -0000 1.6 +++ desktop_integration.h 6 Jul 2006 18:04:41 -0000 1.7 @@ -28,6 +28,7 @@ #ifdef USE_INTEGRATION_WIZARD const char *di_registration_report (void); void di_registration_flush (void); +gboolean di_gnome_vfs_init (void); void di_register_gnome (void); void di_register_kde (void); void di_register_mailcap (void); Index: wizards.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/wizards.c,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- wizards.c 6 Jul 2006 18:03:32 -0000 1.48 +++ wizards.c 6 Jul 2006 18:04:42 -0000 1.49 @@ -198,11 +198,14 @@ static void integrate_cb (GtkButton *button, gpointer data) { gboolean state = !!data; - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_mailcap), state); + if (GTK_WIDGET_SENSITIVE (cb_mailcap)) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_mailcap), state); if (GTK_WIDGET_SENSITIVE (cb_moz)) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_moz), state); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_gnome), state); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_kde), state); + if (GTK_WIDGET_SENSITIVE (cb_gnome)) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_gnome), state); + if (GTK_WIDGET_SENSITIVE (cb_kde)) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_kde), state); } static gboolean ask_integration_wizard (GtkWidget *w, GtkWidget *vbox) @@ -210,7 +213,7 @@ struct stat st; gchar *sname; GtkWidget *b, *hbox; - gboolean have_plugin; + gboolean enable; add_heading (vbox, _("Registration")); add_label (vbox, _("Register gxine with the following applications " @@ -223,14 +226,16 @@ cb_moz = gtk_check_button_new_with_mnemonic (_("_Mozilla & Mozilla Firefox (plugin)")); gtk_box_pack_start (GTK_BOX(vbox), cb_moz, FALSE, FALSE, 5); sname = g_strconcat (plugindir, "/gxineplugin.so", NULL); - have_plugin = !stat (sname, &st); + enable = !stat (sname, &st); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_moz), enable); + gtk_widget_set_sensitive (cb_moz, enable); g_free (sname); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_moz), have_plugin); - gtk_widget_set_sensitive (cb_moz, have_plugin); cb_gnome = gtk_check_button_new_with_mnemonic (_("_GNOME, Nautilus")); gtk_box_pack_start (GTK_BOX(vbox), cb_gnome, FALSE, FALSE, 5); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_gnome), TRUE); + enable = di_gnome_vfs_init (); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_gnome), enable); + gtk_widget_set_sensitive (cb_gnome, enable); cb_kde = gtk_check_button_new_with_mnemonic (_("_KDE, Konqueror")); gtk_box_pack_start (GTK_BOX(vbox), cb_kde, FALSE, FALSE, 5); |