# HG changeset patch # User Luke Schierer # Date 1043613709 0 # Node ID bf770f11132b5b142d165f4e20e8954c6f207a72 # Parent b5669740e34c11684605c037de958475815195ce [gaim-migrate @ 4704] (15:41:59) Robot101: the hunk that got left out in the cold. its a good thing when things compile committer: Tailor Script diff -r b5669740e34c -r bf770f11132b configure.ac --- a/configure.ac Sun Jan 26 19:39:43 2003 +0000 +++ b/configure.ac Sun Jan 26 20:41:49 2003 +0000 @@ -122,10 +122,7 @@ AC_DEFINE_UNQUOTED(STATIC_PROTO_INIT, $extern_init void static_proto_init() { $load_proto }, [Loads static protocol plugin module initialization functions.]) -AC_ARG_ENABLE(esd, [ --disable-esd Turn off ESD (default=auto)],,enable_esd=yes) -AC_ARG_ENABLE(nas, [ --enable-nas Enable NAS (Network Audio System) support],,enable_nas=no) -AC_ARG_ENABLE(artsc, [ --disable-artsc Turn off ArtsC (default=auto)],,enable_artsc=yes) - +AC_ARG_ENABLE(audio, [ --disable-audio compile without libao/libaudiofile for sound playing],,enable_audio=yes) AC_ARG_ENABLE(plugins, [ --disable-plugins compile without plugin support],,enable_plugins=yes) AC_ARG_ENABLE(perl, [ --disable-perl compile without perl scripting],,enable_perl=yes) AC_ARG_ENABLE(gtkspell, [ --disable-gtkspell compile without GtkSpell automatic spell checking],,enable_gtkspell=yes) @@ -274,45 +271,28 @@ fi fi -if test "$enable_nas" = yes ; then - AC_DEFINE(NAS_SOUND, 1, [Define if we have NAS sound support.]) - SOUND_LIBS="-laudio -lXt" -fi -if test "$enable_esd" = yes ; then - AM_PATH_GESD - if test "$no_esd" != yes ; then - old_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ESD_CFLAGS" - AC_TRY_COMPILE(,[#include ], - [ - AC_DEFINE(ESD_SOUND, 1, [Define if we have ESD sound support.]) - SOUND_LIBS="$SOUND_LIBS $ESD_LIBS" - ],[ - enable_esd=no - CFLAGS="$old_CFLAGS" - ]) +if test "$enable_audio" = yes ; then + AC_CHECK_HEADERS(ao/ao.h, found_ao_lib=true, found_ao_lib=false) + if test "$found_ao_lib" = "true"; then + AC_CHECK_LIB(ao, ao_initialize, found_ao_lib=true, found_ao_lib=false) + fi + + AC_CHECK_HEADERS(audiofile.h, found_af_lib=true, found_af_lib=false) + if test "$found_af_lib" = "true"; then + AC_CHECK_LIB(audiofile, afOpenFile, found_af_lib=true, found_af_lib=false) + fi + + if test "$found_ao_lib" = "true" -a "$found_af_lib" = "true"; then + SOUND_LIBS="-lao -laudiofile" + AC_SUBST(SOUND_LIBS) + AC_DEFINE(USE_AO, 1, [Define if we're using libao and libaudiofile for sound playing]) + enable_audio=yes else - enable_esd=no - fi + enable_audio=no + fi +else + enable_audio=no fi -if test "x$enable_artsc" = "xyes"; then - AM_PATH_ARTSC - if test "x$no_artsc" != "xyes" ; then - old_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ARTSC_CFLAGS" - AC_TRY_COMPILE(,[#include ], - [ - AC_DEFINE(ARTSC_SOUND, 1, [Define if we have artsc sound support.]) - SOUND_LIBS="$SOUND_LIBS $ARTSC_LIBS" - ],[ - enable_artsc=no - CFLAGS="$old_CFLAGS" - ]) - else - enable_artsc=no - fi -fi -AC_SUBST(SOUND_LIBS) if test "$ac_cv_cygwin" = yes ; then LDADD="$LDADD -static" @@ -442,20 +422,16 @@ echo Build Protocol Plugins........ : $enable_prpls echo Protocols to link statically.. : $STATIC_PRPLS echo -echo UI Library.................... : GTK 2.0 +echo UI Library.................... : GTK 2.x echo echo Build with Plugin support..... : $enable_plugins echo Build with Perl support....... : $enable_perl -echo -echo Build with GtkSpell............: $enable_gtkspell +echo Build with Audio support...... : $enable_audio +echo Build with GtkSpell support... : $enable_gtkspell echo echo Use XScreenSaver Extension.... : $enable_xss echo Use X Session Management...... : $enable_sm echo -echo Build with ESD................ : $enable_esd -echo Build with NAS................ : $enable_nas -echo Build with ArtsC.............. : $enable_artsc -echo echo Print debugging messages...... : $enable_debug echo eval eval echo Gaim will be installed in $bindir. diff -r b5669740e34c -r bf770f11132b configure.in --- a/configure.in Sun Jan 26 19:39:43 2003 +0000 +++ b/configure.in Sun Jan 26 20:41:49 2003 +0000 @@ -112,16 +112,13 @@ AC_DEFINE_UNQUOTED(STATIC_PROTO_INIT, $extern_init void static_proto_init() { $load_proto }, [Loads static protocol plugin module initialization functions.]) -AC_ARG_ENABLE(esd, [ --disable-esd Turn off ESD (default=auto)],,enable_esd=yes) -AC_ARG_ENABLE(nas, [ --enable-nas Enable NAS (Network Audio System) support],,enable_nas=no) -AC_ARG_ENABLE(artsc, [ --disable-artsc Turn off ArtsC (default=auto)],,enable_artsc=yes) - +AC_ARG_ENABLE(audio, [ --disable-audio compile without libao/libaudiofile for sound playing],,enable_audio=yes) AC_ARG_ENABLE(plugins, [ --disable-plugins compile without plugin support],,enable_plugins=yes) AC_ARG_ENABLE(perl, [ --disable-perl compile without perl scripting],,enable_perl=yes) AC_ARG_ENABLE(gtkspell, [ --disable-gtkspell compile without GtkSpell automatic spell checking],,enable_gtkspell=yes) - AC_ARG_ENABLE(debug, [ --enable-debug compile with debugging support],,enable_debug=no) AC_ARG_ENABLE(screensaver, [ --disable-screensaver compile without X screensaver extension],,enable_xss=yes) +AC_ARG_ENABLE(sm, [ --disable-sm compile without X session management support],,enable_sm=yes) AC_ARG_WITH(krb4, [ --with-krb4=PREFIX Compile Zephyr plugin with Kerberos 4 support],kerberos="$withval",kerberos="no") if test "$enable_debug" = yes ; then @@ -248,45 +245,28 @@ fi fi -if test "$enable_nas" = yes ; then - AC_DEFINE(NAS_SOUND, 1, [Define if we have NAS sound support.]) - SOUND_LIBS="-laudio -lXt" -fi -if test "$enable_esd" = yes ; then - AM_PATH_GESD - if test "$no_esd" != yes ; then - old_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ESD_CFLAGS" - AC_TRY_COMPILE(,[#include ], - [ - AC_DEFINE(ESD_SOUND, 1, [Define if we have ESD sound support.]) - SOUND_LIBS="$SOUND_LIBS $ESD_LIBS" - ],[ - enable_esd=no - CFLAGS="$old_CFLAGS" - ]) +if test "$enable_audio" = yes ; then + AC_CHECK_HEADERS(ao/ao.h, found_ao_lib=true, found_ao_lib=false) + if test "$found_ao_lib" = "true"; then + AC_CHECK_LIB(ao, ao_initialize, found_ao_lib=true, found_ao_lib=false) + fi + + AC_CHECK_HEADERS(audiofile.h, found_af_lib=true, found_af_lib=false) + if test "$found_af_lib" = "true"; then + AC_CHECK_LIB(audiofile, afOpenFile, found_af_lib=true, found_af_lib=false) + fi + + if test "$found_ao_lib" = "true" -a "$found_af_lib" = "true"; then + SOUND_LIBS="-lao -laudiofile" + AC_SUBST(SOUND_LIBS) + AC_DEFINE(USE_AO, 1, [Define if we're using libao and libaudiofile for sound playing]) + enable_audio=yes else - enable_esd=no - fi + enable_audio=no + fi +else + enable_audio=no fi -if test "x$enable_artsc" = "xyes"; then - AM_PATH_ARTSC - if test "x$no_artsc" != "xyes" ; then - old_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ARTSC_CFLAGS" - AC_TRY_COMPILE(,[#include ], - [ - AC_DEFINE(ARTSC_SOUND, 1, [Define if we have artsc sound support.]) - SOUND_LIBS="$SOUND_LIBS $ARTSC_LIBS" - ],[ - enable_artsc=no - CFLAGS="$old_CFLAGS" - ]) - else - enable_artsc=no - fi -fi -AC_SUBST(SOUND_LIBS) if test "$ac_cv_cygwin" = yes ; then LDADD="$LDADD -static" @@ -418,18 +398,15 @@ echo Build Protocol Plugins........ : $enable_prpls echo Protocols to link statically.. : $STATIC_PRPLS echo -echo UI Library.................... : GTK 2.0 +echo UI Library.................... : GTK 2.x echo echo Build with Plugin support..... : $enable_plugins echo Build with Perl support....... : $enable_perl -echo -echo Build with GtkSpell............: $enable_gtkspell +echo Build with Audio support...... : $enable_audio +echo Build with GtkSpell support... : $enable_gtkspell echo echo Use XScreenSaver Extension.... : $enable_xss -echo -echo Build with ESD................ : $enable_esd -echo Build with NAS................ : $enable_nas -echo Build with ArtsC.............. : $enable_artsc +echo Use X Session Management...... : $enable_sm echo echo Print debugging messages...... : $enable_debug echo diff -r b5669740e34c -r bf770f11132b src/aim.c --- a/src/aim.c Sun Jan 26 19:39:43 2003 +0000 +++ b/src/aim.c Sun Jan 26 20:41:49 2003 +0000 @@ -896,6 +896,8 @@ gtk_main(); core_quit(); /* don't need ui_quit here because ui doesn't create anything */ + /* maybe we do now? -Robot101 */ + sound_quit(); #ifdef _WIN32 wgaim_cleanup(); #endif diff -r b5669740e34c -r bf770f11132b src/browser.c --- a/src/browser.c Sun Jan 26 19:39:43 2003 +0000 +++ b/src/browser.c Sun Jan 26 20:41:49 2003 +0000 @@ -487,263 +487,106 @@ gdk_x11_xatom_to_atom (XA_STRING), 8, GDK_PROP_MODE_REPLACE, (unsigned char *)command, strlen(command)); - while (!done) { - GdkEvent *event; - - event = gdk_event_get(); - - if (!event) - continue; - - if (event->any.window != window) { - gtk_main_do_event(event); - continue; - } - - if (event->type == GDK_DESTROY && event->any.window == window) { - - /* Print to warn user... */ - debug_printf("%s: window 0x%x was destroyed.\n", progname, (unsigned int)window); - result = 6; - done = True; - } else if (event->type == GDK_PROPERTY_NOTIFY && - event->property.state == GDK_PROPERTY_NEW_VALUE && - event->property.window == window && - event->property.atom == GDKA_MOZILLA_RESPONSE) { - GdkAtom actual_type; - gint actual_format, nitems; - unsigned char *data = 0; - - result = gdk_property_get(window, GDKA_MOZILLA_RESPONSE, - gdk_x11_xatom_to_atom (XA_STRING), 0, - (65536 / sizeof(long)), - 1, &actual_type, &actual_format, &nitems, &data); - - - if (result == Success && data && *data) { - debug_printf("%s: (server sent " MOZILLA_RESPONSE_PROP - " \"%s\" to 0x%x.)\n", - progname, data, (unsigned int)window); - } + gdk_window_add_filter(window, (GdkFilterFunc) netscape_response_cb, window); +} - if (result != Success) { - debug_printf("%s: failed reading " MOZILLA_RESPONSE_PROP - " from window 0x%0x.\n", progname, (unsigned int)window); - result = 6; - done = True; - } else if (!data || strlen((char *)data) < 5) { - debug_printf("%s: invalid data on " MOZILLA_RESPONSE_PROP - " property of window 0x%0x.\n", - progname, (unsigned int)window); - result = 6; - done = True; - } else if (*data == '1') { /* positive preliminary reply */ - debug_printf("%s: %s\n", progname, data + 4); - /* keep going */ - done = False; - } else if (!strncmp((char *)data, "200", 3)) { - result = 0; - done = True; - } else if (*data == '2') { - debug_printf("%s: %s\n", progname, data + 4); - result = 0; - done = True; - } else if (*data == '3') { - debug_printf("%s: internal error: " - "server wants more information? (%s)\n", progname, data); - result = 3; - done = True; - } else if (*data == '4' || *data == '5') { - debug_printf("%s: %s\n", progname, data + 4); - result = (*data - '0'); - done = True; - } else { - debug_printf("%s: unrecognised " MOZILLA_RESPONSE_PROP - " from window 0x%x: %s\n", - progname, (unsigned int)window, data); - result = 6; - done = True; - } - - if (data) - g_free(data); - } else if (event->type == GDK_PROPERTY_NOTIFY && - event->property.window == window && - event->property.state == GDK_PROPERTY_DELETE && - event->property.atom == GDKA_MOZILLA_COMMAND) { - debug_printf("%s: (server 0x%x has accepted " - MOZILLA_COMMAND_PROP ".)\n", progname, (unsigned int)window); - } - gdk_event_free(event); +static gboolean netscape_command(const char *command) +{ + GdkWindow *window = NULL; + + if (netscape_lock) { + debug_printf("netscape_command() is currently in use.\n"); + return FALSE; } - if (new_command) - g_free(new_command); - - return result; -} - - -gboolean check_netscape(gpointer data) -{ - char *msg = data; - int status; - GdkWindow *window; + netscape_lock = 1; mozilla_remote_init_atoms(); window = mozilla_remote_find_window(); - if (window && (GDK_WINDOW_OBJECT(window)->destroyed == FALSE)) { - - XSelectInput(gdk_display, GDK_WINDOW_XWINDOW(window), - (PropertyChangeMask | StructureNotifyMask)); - - - mozilla_remote_obtain_lock(window); - - status = mozilla_remote_command(window, msg, False); - - if (status != 6) - mozilla_remote_free_lock(window); - + if (window == NULL || (GDK_WINDOW_OBJECT(window)->destroyed == TRUE)) { + debug_printf("Remote window absent or unsuitable.\n"); netscape_lock = 0; - - g_free(msg); return FALSE; - } else - return TRUE; -} - - -static void netscape_command(char *command) -{ - int status; - pid_t pid; - GdkWindow *window; - - if (netscape_lock) - return; - - netscape_lock = 1; - - - - mozilla_remote_init_atoms(); - window = mozilla_remote_find_window(); - - if (window && (GDK_WINDOW_OBJECT(window)->destroyed == FALSE)) { - - XSelectInput(gdk_display, GDK_WINDOW_XWINDOW(window), - (PropertyChangeMask | StructureNotifyMask)); - - mozilla_remote_obtain_lock(window); - - status = mozilla_remote_command(window, command, False); - - if (status != 6) - mozilla_remote_free_lock(window); - - netscape_lock = 0; - - gdk_window_destroy(window); - } else { - pid = fork(); - if (pid == 0) { - char *args[2]; - int e; - - args[0] = g_strdup("netscape"); - args[1] = NULL; - e = execvp(args[0], args); - printf("Hello%d\n", getppid()); - - _exit(0); - } else { - char *tmp = g_strdup(command); - g_timeout_add(200, check_netscape, tmp); - } } + mozilla_remote_command(window, command, False); + + netscape_lock = 0; + return TRUE; } void open_url(GtkWidget *w, char *url) { - gchar *space_free_url; - - if (web_browser == BROWSER_NETSCAPE) { - char *command; - - if (misc_options & OPT_MISC_BROWSER_POPUP) - command = g_strdup_printf("OpenURL(%s, new-window)", url); - else - command = g_strdup_printf("OpenURL(%s)", url); - - netscape_command(command); - g_free(command); -/* fixme: GNOME helper * - * } else if (web_browser == BROWSER_GNOME) { * - * gnome_url_show(url); */ - } else { - pid_t pid; - - pid = fork(); - - if (pid == 0) { - /* args will be allocated below but we don't bother - * freeing it since we're just going to exec and - * exit */ - char **args=NULL; - char command[1024]; - - if (web_browser == BROWSER_OPERA) { - args = g_new(char *, 4); - args[0] = "opera"; - args[1] = "-newwindow"; - args[2] = url; - args[3] = NULL; - } else if (web_browser == BROWSER_KONQ) { - args = g_new(char *, 4); - args[0] = "kfmclient"; - args[1] = "openURL"; - args[2] = url; - args[3] = NULL; - } else if (web_browser == BROWSER_GALEON) { - args = g_new(char *, 4); - args[0] = "galeon"; - if (misc_options & OPT_MISC_BROWSER_POPUP) { - args[1] = "-w"; - args[2] = url; - args[3] = NULL; - } else { - args[1] = url; - args[2] = NULL; - } - } else if (web_browser == BROWSER_MOZILLA) { - args = g_new(char *, 4); - args[0] = "mozilla"; - args[1] = url; - args[2] = NULL; - } else if (web_browser == BROWSER_MANUAL) { - if(strcmp(web_command,"") == 0) - _exit(0); - space_free_url = g_strdelimit(url, " ", '+'); - g_snprintf(command, sizeof(command), web_command, space_free_url); - g_free(space_free_url); - args = g_strsplit(command, " ", 0); + char *command = NULL; + GError *error = NULL; + + switch (web_browser) { + case BROWSER_NETSCAPE: { + char *args = NULL; + + if (misc_options & OPT_MISC_BROWSER_POPUP) + args = g_strdup_printf("OpenURL(%s, new-window)", url); + else + args = g_strdup_printf("OpenURL(%s)", url); + + if (netscape_command(args)) { + g_free(args); + return; } - execvp(args[0], args); - _exit(0); - } + /* if netscape is running ... + command = g_strdup_printf("netscape -remote %s", args); */ + + command = g_strdup_printf("netscape %s", url); + g_free(args); + } break; + + case BROWSER_OPERA: + command = g_strdup_printf("opera -newwindow %s", url); + break; + + case BROWSER_KONQ: + command = g_strdup_printf("kfmclient openURL %s", url); + break; + + case BROWSER_GALEON: + command = g_strdup_printf("galeon -w %s", url); + command = g_strdup_printf("galeon %s", url); + break; + + case BROWSER_MOZILLA: + command = g_strdup_printf("mozilla %s", url); + break; + + case BROWSER_MANUAL: { + char *space_free_url = NULL; + + if (!web_command[0]) { + do_error_dialog(_("Unable to launch your browser because the 'Manual' browser command has been chosen, but no command has been set."), NULL, GAIM_ERROR); + return; + } + + space_free_url = g_strdelimit(url, " ", '+'); + command = g_strdup_printf("%s %s", web_command, space_free_url); + g_free(space_free_url); + } break; } + + if (g_spawn_command_line_async(command, &error) == FALSE) { + char *tmp = g_strdup_printf(_("There was an error launching your chosen browser: %s"), error->message); + do_error_dialog(tmp, NULL, GAIM_ERROR); + g_free(tmp); + g_error_free(error); + } + + g_free(command); } void add_bookmark(GtkWidget *w, char *url) { if (web_browser == BROWSER_NETSCAPE) { - char *command = g_malloc(1024); - - g_snprintf(command, 1024, "AddBookmark(%s)", url); + char *command = g_strdup_printf("AddBookmark(%s)", url); netscape_command(command); g_free(command); diff -r b5669740e34c -r bf770f11132b src/gaimrc.c --- a/src/gaimrc.c Sun Jan 26 19:39:43 2003 +0000 +++ b/src/gaimrc.c Sun Jan 26 20:41:49 2003 +0000 @@ -820,8 +820,8 @@ } /* this is where we do bugs and compatibility stuff */ - if (!(sound_options & (OPT_SOUND_BEEP | OPT_SOUND_ESD | OPT_SOUND_NORMAL | OPT_SOUND_NAS | OPT_SOUND_ARTSC | OPT_SOUND_CMD))) - sound_options |= OPT_SOUND_ESD | OPT_SOUND_NORMAL | OPT_SOUND_NAS | OPT_SOUND_ARTSC; + if (!(sound_options & (OPT_SOUND_BEEP | OPT_SOUND_NORMAL | OPT_SOUND_CMD))) + sound_options |= OPT_SOUND_NORMAL; if (conv_size.width == 0 && conv_size.height == 0 && @@ -1244,10 +1244,7 @@ OPT_SOUND_RECV | OPT_SOUND_SEND | OPT_SOUND_SILENT_SIGNON | - OPT_SOUND_NORMAL | - OPT_SOUND_NAS | - OPT_SOUND_ARTSC | - OPT_SOUND_ESD; + OPT_SOUND_NORMAL; #ifdef USE_SCREENSAVER report_idle = IDLE_SCREENSAVER; diff -r b5669740e34c -r bf770f11132b src/prefs.c --- a/src/prefs.c Sun Jan 26 19:39:43 2003 +0000 +++ b/src/prefs.c Sun Jan 26 20:41:49 2003 +0000 @@ -956,19 +956,12 @@ #ifndef _WIN32 vbox = make_frame (ret, _("Sound Method")); dd = gaim_dropdown(vbox, _("_Method"), &sound_options, OPT_SOUND_BEEP | - OPT_SOUND_ESD | OPT_SOUND_ARTSC | OPT_SOUND_NAS | OPT_SOUND_NORMAL | + OPT_SOUND_NORMAL | OPT_SOUND_CMD, _("Console beep"), OPT_SOUND_BEEP, -#ifdef ESD_SOUND - "ESD", OPT_SOUND_ESD, +#ifdef USE_AO + _("Automatic"), OPT_SOUND_NORMAL, #endif -#ifdef ARTSC_SOUND - "ArtsC", OPT_SOUND_ARTSC, -#endif -#ifdef NAS_SOUND - "NAS", OPT_SOUND_NAS, -#endif - _("Internal"), OPT_SOUND_NORMAL, _("Command"), OPT_SOUND_CMD, NULL); gtk_size_group_add_widget(sg, dd); gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); diff -r b5669740e34c -r bf770f11132b src/sound.c --- a/src/sound.c Sun Jan 26 19:39:43 2003 +0000 +++ b/src/sound.c Sun Jan 26 20:41:49 2003 +0000 @@ -40,17 +40,10 @@ #include #include -#ifdef ESD_SOUND -#include -#endif - -#ifdef ARTSC_SOUND -#include -#endif - -#ifdef NAS_SOUND -#include