comparison src/dbusbind.c @ 109371:bf0e558ade02

* dbusbind.c (xd_initialize): Don't compare boolean with a constant.
author Andreas Schwab <schwab@linux-m68k.org>
date Mon, 12 Jul 2010 21:03:53 +0200
parents a0cffb71f267
children 25b9c8c975be
comparison
equal deleted inserted replaced
109370:a0caeaa02476 109371:bf0e558ade02
712 return Qnil; 712 return Qnil;
713 } 713 }
714 } 714 }
715 715
716 /* Initialize D-Bus connection. BUS is a Lisp symbol, either :system 716 /* Initialize D-Bus connection. BUS is a Lisp symbol, either :system
717 or :session. It tells which D-Bus to be initialized. RAISE_ERROR 717 or :session. It tells which D-Bus to initialize. If RAISE_ERROR
718 can be TRUE or FALSE, it controls whether an error is signalled in 718 is non-zero signal an error when the connection cannot be
719 case the connection cannot be initialized. */ 719 initialized. */
720 static DBusConnection * 720 static DBusConnection *
721 xd_initialize (Lisp_Object bus, int raise_error) 721 xd_initialize (Lisp_Object bus, int raise_error)
722 { 722 {
723 DBusConnection *connection; 723 DBusConnection *connection;
724 DBusError derror; 724 DBusError derror;
725 725
726 /* Parameter check. */ 726 /* Parameter check. */
727 CHECK_SYMBOL (bus); 727 CHECK_SYMBOL (bus);
728 if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus))) 728 if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus)))
729 if (raise_error == TRUE) 729 if (raise_error)
730 XD_SIGNAL2 (build_string ("Wrong bus name"), bus); 730 XD_SIGNAL2 (build_string ("Wrong bus name"), bus);
731 else 731 else
732 return NULL; 732 return NULL;
733 733
734 /* We do not want to have an autolaunch for the session bus. */ 734 /* We do not want to have an autolaunch for the session bus. */
735 if (EQ (bus, QCdbus_session_bus) 735 if (EQ (bus, QCdbus_session_bus)
736 && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) 736 && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL)
737 if (raise_error == TRUE) 737 if (raise_error)
738 XD_SIGNAL2 (build_string ("No connection to bus"), bus); 738 XD_SIGNAL2 (build_string ("No connection to bus"), bus);
739 else 739 else
740 return NULL; 740 return NULL;
741 741
742 /* Open a connection to the bus. */ 742 /* Open a connection to the bus. */
746 connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror); 746 connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror);
747 else 747 else
748 connection = dbus_bus_get (DBUS_BUS_SESSION, &derror); 748 connection = dbus_bus_get (DBUS_BUS_SESSION, &derror);
749 749
750 if (dbus_error_is_set (&derror)) 750 if (dbus_error_is_set (&derror))
751 if (raise_error == TRUE) 751 if (raise_error)
752 XD_ERROR (derror); 752 XD_ERROR (derror);
753 else 753 else
754 connection = NULL; 754 connection = NULL;
755 755
756 if ((connection == NULL) && (raise_error == TRUE)) 756 if (connection == NULL && raise_error)
757 XD_SIGNAL2 (build_string ("No connection to bus"), bus); 757 XD_SIGNAL2 (build_string ("No connection to bus"), bus);
758 758
759 /* Cleanup. */ 759 /* Cleanup. */
760 dbus_error_free (&derror); 760 dbus_error_free (&derror);
761 761