libmbca r2 - in trunk: . doc po src src/bluez-gnome src/gnome-panel



Author: kaijanma
Date: Wed Jul 23 22:00:46 2008
New Revision: 2
URL: http://svn.gnome.org/viewvc/libmbca?rev=2&view=rev

Log:
Initial commit

Added:
   trunk/AUTHORS
   trunk/ChangeLog
   trunk/MAINTAINERS
   trunk/Makefile.am
   trunk/README
   trunk/README.svn
   trunk/configure.ac
   trunk/doc/
   trunk/doc/Doxyfile
   trunk/doc/Makefile.am
   trunk/po/
   trunk/po/Makevars
   trunk/po/POTFILES.in
   trunk/src/
   trunk/src/Makefile.am
   trunk/src/bluetooth_page.c
   trunk/src/bluez-gnome/
   trunk/src/bluez-gnome/AUTHORS
   trunk/src/bluez-gnome/COPYING
   trunk/src/bluez-gnome/COPYING.LIB
   trunk/src/bluez-gnome/README
   trunk/src/bluez-gnome/bluetooth-device-selection.c
   trunk/src/bluez-gnome/bluetooth-device-selection.h
   trunk/src/bluez-gnome/client.c
   trunk/src/bluez-gnome/client.h
   trunk/src/bluez-gnome/dbus-glue.h
   trunk/src/bluez-gnome/marshal.c
   trunk/src/bluez-gnome/marshal.h
   trunk/src/callbacks.h
   trunk/src/common.c
   trunk/src/common.h
   trunk/src/gnome-panel/
   trunk/src/gnome-panel/AUTHORS
   trunk/src/gnome-panel/COPYING
   trunk/src/gnome-panel/COPYING.LIB
   trunk/src/gnome-panel/MAINTAINERS
   trunk/src/gnome-panel/README
   trunk/src/gnome-panel/system-timezone.c
   trunk/src/gnome-panel/system-timezone.h
   trunk/src/hal_page.c
   trunk/src/mbca_assistant.c
   trunk/src/mbca_assistant.h
   trunk/src/mbca_serviceprovider.c
   trunk/src/mbca_serviceprovider.h
   trunk/src/mbca_serviceprovider_private.h
   trunk/src/method_page.c
   trunk/src/provider_page.c
   trunk/src/provider_thread.c
   trunk/src/provider_thread.h
   trunk/src/serial_page.c
   trunk/src/serviceprovider_parser.c
   trunk/src/serviceprovider_parser.h
   trunk/src/summary_page.c
   trunk/src/test_mbca.c

Added: trunk/AUTHORS
==============================================================================
--- (empty file)
+++ trunk/AUTHORS	Wed Jul 23 22:00:46 2008
@@ -0,0 +1 @@
+Antti KaijanmÃki <antti kaijanmaki net>

Added: trunk/MAINTAINERS
==============================================================================
--- (empty file)
+++ trunk/MAINTAINERS	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,3 @@
+Antti KaijanmÃki
+E-mail: antti kaijanmaki net
+Userid: kaijanma

Added: trunk/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/Makefile.am	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,3 @@
+## Process this file with automake to produce Makefile.in
+
+SUBDIRS = src po data

Added: trunk/README
==============================================================================
--- (empty file)
+++ trunk/README	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,78 @@
+============================================
+= Mobile Broadband Configuration Assistant =
+============================================
+
+First of all this software is highly experimental so be warned.
+
+do the following:
+
+1. configure
+============
+$ ./configure
+
+2. Make
+=======
+$ make
+
+3. Install
+========================
+$ sudo make install
+
+4. run test program
+====================
+$ cd src/
+$ ./test_mbca
+
+5. Uninstall
+============
+$ sudo make uninstall
+
+
+Runtime dependencies
+====================
+
+Although these packages are not required at build time they are required for
+correct runtime functionality:
+
+	Mobile Broadband Service Provider Database:
+	 - http://svn.gnome.org/viewvc/mobile-broadband-provider-info
+	bluez (-gnome):
+	  - BlueZ is used for Bluetooth functionality and bluez-gnome package
+	    contains some translations for Bluetooth page (not vital)
+
+
+How to update PO-files
+======================
+$ cd po && make update-po
+
+
+Other notes
+===========
+This package uses GNU Libtool in order to build shared libraries on a
+variety of systems. While this is very nice for making usable
+binaries, it can be a pain when trying to debug a program. For that
+reason, compilation of shared libraries can be turned off by
+specifying the â--disable-sharedâ option to âconfigureâ.
+
+
+Known problems
+==============
+
+if gtk gives you an error:
+   ' ** ERROR **: could not load the UI: Unprocessed tag: "requires" '
+
+this means that your version of gtk has a bug. Ubuntu hardy users can enable
+my Personal Packet Archive and have an update:
+
+   https://launchpad.net/~kaijanmaki/+archive
+
+If you can't or won't update your gtk you can work around the bug by editing
+the UI definition file
+
+    nano -w data/mbca.ui
+
+and remove the following line:
+
+    <requires lib="gtk+" version="2.12"/>
+
+remember to 'make install' after you have edited the file.
\ No newline at end of file

Added: trunk/README.svn
==============================================================================
--- (empty file)
+++ trunk/README.svn	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,3 @@
+to bootstrap the package execute:
+    $ auroreconf -fi
+

Added: trunk/configure.ac
==============================================================================
--- (empty file)
+++ trunk/configure.ac	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,35 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT([libmbca], [0.0.1])
+
+AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+AC_CONFIG_HEADERS(config.h)
+AM_MAINTAINER_MODE
+
+AC_ISC_POSIX
+AC_PROG_CC
+AM_PROG_CC_STDC
+AM_PROG_CC_C_O
+AC_HEADER_STDC
+
+dnl ***************************************************************************
+dnl Internatinalization
+dnl ***************************************************************************
+GETTEXT_PACKAGE=libmbca
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.17])
+
+AC_PROG_LIBTOOL
+
+PKG_CHECK_MODULES(LIBMBCA, [glib-2.0 >= 2.16, libxml-2.0 >= 2.6, gweather, gio-2.0, hal, gthread-2.0, dbus-glib-1])
+AC_SUBST(LIBMBCA_CFLAGS)
+AC_SUBST(LIBMBCA_LIBS)
+
+AC_OUTPUT([
+Makefile
+src/Makefile
+po/Makefile.in
+data/Makefile
+])

Added: trunk/doc/Doxyfile
==============================================================================
--- (empty file)
+++ trunk/doc/Doxyfile	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,1356 @@
+# Doxyfile 1.5.5
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file 
+# that follow. The default is UTF-8 which is also the encoding used for all 
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the 
+# iconv built into libc) for the transcoding. See 
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = Mobile Broadband Configuration Assistant
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = 
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 
+# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, 
+# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), 
+# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, 
+# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, 
+# and Ukrainian.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = 
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = 
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like regular Qt-style comments 
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
+# interpret the first line (until the first dot) of a Qt-style 
+# comment as the brief description. If set to NO, the comments 
+# will behave just like regular Qt-style comments (thus requiring 
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member 
+# documentation.
+
+DETAILS_AT_TOP         = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 5
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Java. For instance, namespaces will be presented as packages, qualified 
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 
+# sources. Doxygen will then generate output that is tailored for 
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 
+# to include (a tag file for) the STL sources as input, then you should 
+# set this tag to YES in order to let doxygen match functions declarations and 
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
+# func(std::string) {}). This also make the inheritance and collaboration 
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 
+# Doxygen will parse them like normal C++ but will assume all classes use public 
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 
+# is documented as struct, union, or enum with the name of the typedef. So 
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
+# with name TypeT. When disabled the typedef will appear as a member of a file, 
+# namespace, or class. And the struct will be named TypeS. This can typically 
+# be useful for C code in case the coding convention dictates that all compound 
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = YES
+
+# If this flag is set to YES, the members of anonymous namespaces will be 
+# extracted and appear in the documentation as a namespace called 
+# 'anonymous_namespace{file}', where file will be replaced with the base 
+# name of the file that contains the anonymous namespace. By default 
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the 
+# hierarchy of group names into alphabetical order. If set to NO (the default) 
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from 
+# the version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the program writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = ../src/mbca_assistant.h ../src/mbca_serviceprovider.h
+
+# This tag can be used to specify the character encoding of the source files 
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
+# also the default input encoding. Doxygen uses libiconv (or the iconv built 
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for 
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS          = 
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = 
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
+# (namespaces, classes, functions, etc.) that should be excluded from the 
+# output. The symbol name can be a fully qualified name, a word, or if the 
+# wildcard * is used, a substring. Examples: ANamespace, AClass, 
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.  Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files 
+# will be generated that can be used as input for Apple's Xcode 3 
+# integrated development environment, introduced with OSX 10.5 (Leopard). 
+# To create a documentation set, doxygen will generate a Makefile in the 
+# HTML output directory. Running make will produce the docset in that 
+# directory and running "make install" will install the docset in 
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find 
+# it at startup.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the 
+# feed. A documentation feed provides an umbrella under which multiple 
+# documentation sets from a single provider (such as a company or product suite) 
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 
+# should uniquely identify the documentation set bundle. This should be a 
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
+# documentation will contain sections that can be hidden and shown after the 
+# page has loaded. For this to work a browser that supports 
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = G_BEGIN_DECLS G_END_DECLS
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc 
+# command. Doxygen will then run the mscgen tool (see 
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the 
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where 
+# the mscgen tool resides. If left empty the tool is assumed to be found in the 
+# default search path.
+
+MSCGEN_PATH            = 
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then 
+# doxygen will generate a call dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable call graphs 
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then 
+# doxygen will generate a caller dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable caller 
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
+# nodes that will be shown in the graph. If the number of nodes in a graph 
+# becomes larger than this value, doxygen will truncate the graph, which is 
+# visualized by representing a node as a red box. Note that doxygen if the 
+# number of direct children of the root node in a graph is already larger than 
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that the size of a graph can be further restricted by 
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is enabled by default, which results in a transparent 
+# background. Warning: Depending on the platform used, enabling this option 
+# may lead to badly anti-aliased labels on the edges of a graph (i.e. they 
+# become hard to read).
+
+DOT_TRANSPARENT        = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO

Added: trunk/doc/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/doc/Makefile.am	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,12 @@
+## Process this file with automake to produce Makefile.in
+
+EXTRA_DIST = Doxyfile
+
+doc_DATA = html
+
+# custom rule to generate doxygen files
+html-local:
+	doxygen Doxyfile
+
+clean-local:
+	-rm -rf html/

Added: trunk/po/Makevars
==============================================================================
--- (empty file)
+++ trunk/po/Makevars	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,41 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Antti KaijanmÃki <antti kaijanmaki net>
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+#   in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+#   understood.
+# - Strings which make invalid assumptions about notation of date, time or
+#   money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS = antti kaijanmaki net
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =

Added: trunk/po/POTFILES.in
==============================================================================
--- (empty file)
+++ trunk/po/POTFILES.in	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,4 @@
+# List of source files containing translatable strings.
+
+# do not put anything here
+# if you do the po template will get screwed
\ No newline at end of file

Added: trunk/src/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/src/Makefile.am	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,78 @@
+## Process this file with automake to produce Makefile.in
+
+EXTRA_DIST= \
+	bluez-gnome/AUTHORS \
+	bluez-gnome/COPYING \
+	bluez-gnome/COPYING.LIB \
+	bluez-gnome/README \
+	gnome-panel/AUTHORS \
+	gnome-panel/COPYING \
+	gnome-panel/COPYING.LIB \
+	gnome-panel/MAINTAINERS \
+	gnome-panel/README
+
+AM_CPPFLAGS = \
+	-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
+	-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
+	-DPACKAGE_DATA_DIR=\""$(datadir)"\" \
+	$(LIBMBCA_CFLAGS)
+
+AM_CFLAGS =\
+	 -Wall\
+	 -g
+
+include_HEADERS = \
+	mbca_assistant.h \
+	mbca_serviceprovider.h
+
+lib_LTLIBRARIES = \
+	libmbca.la
+
+libmbca_la_SOURCES = \
+	bluetooth_page.c\
+	callbacks.h \
+	common.c \
+	common.h \
+	hal_page.c \
+	mbca_assistant.c \
+	mbca_assistant.h \
+	method_page.c \
+	provider_page.c \
+	provider_thread.c \
+	provider_thread.h \
+	serial_page.c \
+	mbca_serviceprovider.c \
+	mbca_serviceprovider.h \
+	mbca_serviceprovider_private.h \
+	serviceprovider_parser.c \
+	serviceprovider_parser.h \
+	summary_page.c \
+	bluez-gnome/bluetooth-device-selection.c \
+	bluez-gnome/bluetooth-device-selection.h \
+	bluez-gnome/client.h \
+	bluez-gnome/dbus-glue.h \
+	bluez-gnome/marshal.c \
+	bluez-gnome/marshal.h \
+	bluez-gnome/client.c \
+	gnome-panel/system-timezone.c \
+	gnome-panel/system-timezone.h
+
+libmbca_la_LIBADD = \
+	$(LIBMBCA_LIBS)
+
+noinst_PROGRAMS = \
+	test_mbca
+
+test_mbca_SOURCES = \
+	test_mbca.c
+
+test_mbca_CFLAGS = \
+	libmbca.la \
+	$(LIBMBCA_CFLAGS)
+
+test_mbca_LDADD = \
+	$(LIBMBCA_LIBS)
+
+test_mbca_DEPENDENCIES = \
+	libmbca.la
+

Added: trunk/src/bluetooth_page.c
==============================================================================
--- (empty file)
+++ trunk/src/bluetooth_page.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,198 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+ 
+#include "callbacks.h"
+
+void
+mbca_bluetooth_page_prepare_cb (GtkAssistant* gtkassistant,
+						  GtkWidget* page,
+						  gpointer user_data)
+{
+	/* bluetooth rescan is controlled in mbca_assistant_prepare_cb() */
+}
+
+void
+mbca_bluetooth_selected_device_changed(BluetoothDeviceSelection* selector,
+							    gchar* address,
+							    gpointer user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	GObject* page;
+	gchar* name;
+	
+	
+	g_object_get (G_OBJECT (selector), "device-selected-name", &name, NULL);
+
+	priv->nice_device_name = name;
+	priv->conf->device = g_strdup (address);
+	
+	page = gtk_builder_get_object (priv->builder, "bluetooth_page");
+	g_return_if_fail (page);
+	gtk_assistant_set_page_complete (priv->assistant,
+							   GTK_WIDGET (page),
+							   TRUE);
+}
+
+void
+mbca_bluetooth_manual_checkbutton_toggled_cb (GtkToggleButton* togglebutton,
+									 gpointer user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	GObject* manual_entry;
+	GObject* manual_box;
+	GObject* bt_box;
+	gboolean set;
+	
+	manual_box = gtk_builder_get_object (priv->builder, 
+								  "bluetooth_manual_hbox");
+	bt_box = gtk_builder_get_object (priv->builder,
+							   "bluetooth_placeholder_vbox");
+	manual_entry = gtk_builder_get_object (priv->builder,
+								    "bluetooth_manual_entry");
+	g_return_if_fail (manual_box);
+	g_return_if_fail (bt_box);
+	g_return_if_fail (manual_entry);
+	
+	set = gtk_toggle_button_get_active (togglebutton);
+
+	gtk_widget_set_sensitive (GTK_WIDGET (manual_box), set);
+	gtk_widget_set_sensitive (GTK_WIDGET (bt_box), !set);
+	
+	if (set)
+	{
+		mbca_bluetooth_manual_entry_changed_cb (GTK_EDITABLE (manual_entry),
+										priv);
+	}
+	else
+	{
+		BluetoothDeviceSelection* selector;
+		gchar* address;
+		
+		selector = BLUETOOTH_DEVICE_SELECTION (priv->btselector);
+		g_object_get (G_OBJECT (selector),
+				    "device-selected",
+				    &address,
+				    NULL);
+		if (!address)
+		{
+			GtkWidget* page;
+			
+			page = gtk_assistant_get_nth_page (priv->assistant,
+										PAGE_BLUETOOTH);
+			gtk_assistant_set_page_complete (priv->assistant,
+									   page,
+									   FALSE);				
+			return;
+		}
+		mbca_bluetooth_selected_device_changed(selector, address, priv);
+		g_free (address);
+	}
+}
+
+void
+mbca_bluetooth_manual_entry_changed_cb (GtkEditable* editable,
+								gpointer user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	gboolean is_valid;
+	GtkWidget* page;
+	gchar* chars;
+	gint i;
+	
+	/* validate */
+	chars = gtk_editable_get_chars (editable, 0, -1);
+	is_valid = TRUE;
+	for (i = 0; i < 6; i++)
+	{
+		gint offset = i*3;
+		
+		if (!g_ascii_isxdigit (chars[offset]))
+		{
+			is_valid = FALSE;
+			break;
+		}
+		if (!g_ascii_isxdigit (chars[offset+1]))
+		{
+			is_valid = FALSE;
+			break;
+		}
+		
+		if (i != 5)
+		{
+			if (chars[offset+2] != ':')
+			{
+				is_valid = FALSE;
+				break;
+			}
+		}
+	}
+
+	page = gtk_assistant_get_nth_page (priv->assistant,
+								PAGE_BLUETOOTH);
+	gtk_assistant_set_page_complete (priv->assistant,
+							   page,
+							   is_valid);	
+	if (!is_valid)
+	{
+		return;
+	}
+	
+	g_free (priv->conf->device);
+	g_free (priv->nice_device_name);
+	priv->conf->device = chars;
+	priv->nice_device_name = g_strdup (priv->conf->device);
+}
+
+gpointer
+mbca_bluetooth_rescan_cb (gpointer data)
+{
+	MBCAAssistantPrivate* priv = data;
+	
+	gboolean was_enabled = FALSE;
+	gulong slept = 0;
+		
+	while (!priv->exit_btrescan)
+	{
+		if (!was_enabled && priv->btrescan_enabled)
+		{
+			/* scan immediately when enable is set */
+			slept = 5000000;
+		}
+		was_enabled = priv->btrescan_enabled;
+		if (slept < 5000000)
+		{
+			g_usleep (500000);
+			slept += 500000;
+			continue;
+		}
+		slept = 0;		
+		
+		if (priv->btrescan_enabled)
+		{
+			BluetoothDeviceSelection* selector;
+			selector = BLUETOOTH_DEVICE_SELECTION (priv->btselector);
+			bluetooth_device_selection_start_discovery (selector);
+		}
+	}
+	
+	return NULL;
+}

Added: trunk/src/bluez-gnome/AUTHORS
==============================================================================
--- (empty file)
+++ trunk/src/bluez-gnome/AUTHORS	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,4 @@
+Marcel Holtmann <marcel holtmann org>
+Bastien Nocera <hadess hadess net>
+Chris Rivera <crivera novell com>
+Jaap A. Haitsma <jaap haitsma org>

Added: trunk/src/bluez-gnome/COPYING
==============================================================================
--- (empty file)
+++ trunk/src/bluez-gnome/COPYING	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.

Added: trunk/src/bluez-gnome/COPYING.LIB
==============================================================================
--- (empty file)
+++ trunk/src/bluez-gnome/COPYING.LIB	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,504 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+

Added: trunk/src/bluez-gnome/README
==============================================================================
--- (empty file)
+++ trunk/src/bluez-gnome/README	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,36 @@
+BlueZ - Bluetooth protocol stack for Linux
+******************************************
+
+Copyright (C) 2005-2008  Marcel Holtmann <marcel holtmann org>
+
+Bluetooth helpers for GNOME
+
+
+Compilation and installation
+============================
+
+In order to compile Bluetooth helpers you need following software packages:
+	- Linux Bluetooth protocol stack (BlueZ)
+	- GCC compiler
+	- D-Bus library
+	- GTK+ library
+	- Notification library
+
+To configure run:
+	./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc
+ 
+Configure automatically searches for all required components and packages. 
+
+To compile and install run:
+	make && make install
+
+
+Information
+===========
+
+Mailing lists:
+	bluez-users lists sf net - BlueZ general questions and discussions
+	bluez-devel lists sf net - BlueZ development 
+
+For additional information about the project visit BlueZ web site:
+	http://www.bluez.org

Added: trunk/src/bluez-gnome/bluetooth-device-selection.c
==============================================================================
--- (empty file)
+++ trunk/src/bluez-gnome/bluetooth-device-selection.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,804 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2005-2008  Marcel Holtmann <marcel holtmann org>
+ *  Copyright (C) 2006-2007  Bastien Nocera <hadess hadess net>
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+
+#include <glib/gi18n-lib.h>
+
+#include "client.h"
+
+#include "bluetooth-device-selection.h"
+
+enum {
+	SELECTED_DEVICE_CHANGED,
+	LAST_SIGNAL
+};
+
+static int selection_table_signals[LAST_SIGNAL] = { 0 };
+
+#define BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+										 BLUETOOTH_TYPE_DEVICE_SELECTION, BluetoothDeviceSelectionPrivate))
+
+typedef struct _BluetoothDeviceSelectionPrivate BluetoothDeviceSelectionPrivate;
+
+struct _BluetoothDeviceSelectionPrivate {
+	BluetoothClient *client;
+	GtkTreeSelection *selection;
+	GtkTreeModel *model, *filter;
+
+	gulong discov_started_id;
+	gulong discov_completed_id;
+	gulong default_adapter_changed_id;
+
+	/* Widgets/UI bits that can be shown or hidden */
+	GtkWidget *title;
+	GtkCellRenderer *bonded_cell;
+	GtkWidget *treeview;
+	GtkWidget *search_button;
+	GtkWidget *device_type_label, *device_type;
+	GtkWidget *device_category_label, *device_category;
+	GtkWidget *filters_vbox;
+
+	/* Current filter */
+	int device_type_filter;
+	int device_category_filter;
+
+	guint show_bonded : 1;
+	guint show_search : 1;
+	guint show_device_type : 1;
+	guint show_device_category : 1;
+};
+
+G_DEFINE_TYPE(BluetoothDeviceSelection, bluetooth_device_selection, GTK_TYPE_VBOX)
+
+static const char *
+bluetooth_device_category_to_string (int type)
+{
+	switch (type) {
+	case BLUETOOTH_CATEGORY_ALL:
+		return N_("All categories");
+	case BLUETOOTH_CATEGORY_BONDED:
+		return N_("Bonded");
+	case BLUETOOTH_CATEGORY_TRUSTED:
+		return N_("Trusted");
+	default:
+		return N_("Unknown");
+	}
+}
+
+static int
+int_log2(int v)
+{
+	int rv = 0;
+	while (v >>= 1)
+		rv++;
+	return rv;
+}
+
+static void
+name_to_text (GtkTreeViewColumn *column, GtkCellRenderer *cell,
+	      GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
+{
+	gchar *address;
+	gchar *name;
+
+	gtk_tree_model_get (model, iter, COLUMN_ADDRESS, &address,
+			    COLUMN_NAME, &name, -1);
+
+	/* If we don't have a name, replace the name with the
+	 * Bluetooth address, with the ":" replaced by "-" */
+	if (name == NULL) {
+		name = g_strdup (address);
+		g_strdelimit (name, ":", '-');
+	}
+
+	g_object_set (cell, "text", name ? name : address, NULL);
+
+	g_free (name);
+	g_free (address);
+}
+
+static void
+type_to_icon (GtkTreeViewColumn *column, GtkCellRenderer *cell,
+	      GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
+{
+	guint type;
+
+	gtk_tree_model_get (model, iter, COLUMN_TYPE, &type, -1);
+
+	switch (type) {
+	case BLUETOOTH_TYPE_PHONE:
+		g_object_set (cell, "icon-name", "stock_cell-phone", NULL);
+		break;
+	case BLUETOOTH_TYPE_MODEM:
+		g_object_set (cell, "icon-name", "modem", NULL);
+		break;
+	case BLUETOOTH_TYPE_COMPUTER:
+		g_object_set (cell, "icon-name", "computer", NULL);
+		break;
+	case BLUETOOTH_TYPE_NETWORK:
+		g_object_set (cell, "icon-name", "network-wireless", NULL);
+		break;
+	case BLUETOOTH_TYPE_HEADSET:
+		g_object_set (cell, "icon-name", "stock_headphones", NULL);
+		break;
+	case BLUETOOTH_TYPE_KEYBOARD:
+		g_object_set (cell, "icon-name", "input-keyboard", NULL);
+		break;
+	case BLUETOOTH_TYPE_MOUSE:
+		g_object_set (cell, "icon-name", "input-mouse", NULL);
+		break;
+	case BLUETOOTH_TYPE_CAMERA:
+		g_object_set (cell, "icon-name", "camera-photo", NULL);
+		break;
+	case BLUETOOTH_TYPE_PRINTER:
+		g_object_set (cell, "icon-name", "printer", NULL);
+		break;
+	default:
+		g_object_set (cell, "icon-name", "bluetooth", NULL);
+		break;
+	}
+}
+
+static void
+bonded_to_icon (GtkTreeViewColumn *column, GtkCellRenderer *cell,
+	      GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
+{
+	gboolean bonded;
+
+	gtk_tree_model_get (model, iter, COLUMN_BONDED, &bonded, -1);
+
+	if (bonded == FALSE)
+		g_object_set (cell, "stock-id", NULL, NULL);
+	else
+		g_object_set (cell, "stock-id", GTK_STOCK_DIALOG_AUTHENTICATION, NULL);
+}
+
+static void
+type_to_text (GtkTreeViewColumn *column, GtkCellRenderer *cell,
+	      GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
+{
+	guint type;
+
+	gtk_tree_model_get (model, iter, COLUMN_TYPE, &type, -1);
+	if (type == 0)
+		g_object_set (cell, "text", _("Unknown"), NULL);
+	else
+		g_object_set (cell, "text", bluetooth_type_to_string (type), NULL);
+}
+
+void
+bluetooth_device_selection_start_discovery (BluetoothDeviceSelection *self)
+{
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
+
+	gtk_widget_set_sensitive (GTK_WIDGET(priv->search_button), FALSE);
+	bluetooth_client_discover_devices (priv->client, NULL);
+}
+
+gchar *
+bluetooth_device_selection_get_selected_device (BluetoothDeviceSelection *self)
+{
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
+	GtkTreeIter iter;
+	gchar *address;
+	gboolean selected;
+
+	selected = gtk_tree_selection_get_selected (priv->selection, NULL, &iter);
+	if (selected == FALSE)
+		return NULL;
+
+	gtk_tree_model_get (priv->filter, &iter, COLUMN_ADDRESS, &address, -1);
+	return address;
+}
+
+gchar *
+bluetooth_device_selection_get_selected_device_name (BluetoothDeviceSelection *self)
+{
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
+	GtkTreeIter iter;
+	gchar *name;
+	gboolean selected;
+
+	selected = gtk_tree_selection_get_selected (priv->selection, NULL, &iter);
+	if (selected == FALSE)
+		return NULL;
+
+	gtk_tree_model_get (priv->filter, &iter, COLUMN_NAME, &name, -1);
+	return name;
+}
+
+static void
+search_button_clicked (GtkButton *button, gpointer user_data)
+{
+	BluetoothDeviceSelection *self = BLUETOOTH_DEVICE_SELECTION(user_data);
+
+	bluetooth_device_selection_start_discovery (self);
+}
+
+static void
+discovery_started (BluetoothClient *client, const char *adapter_path, gboolean is_default, gpointer user_data)
+{
+	BluetoothDeviceSelection *self = BLUETOOTH_DEVICE_SELECTION(user_data);
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
+
+	if (is_default)
+		gtk_widget_set_sensitive (GTK_WIDGET(priv->search_button), FALSE);
+}
+
+static void
+discovery_completed (BluetoothClient *client, const char *adapter_path, gboolean is_default, gpointer user_data)
+{
+	BluetoothDeviceSelection *self = BLUETOOTH_DEVICE_SELECTION(user_data);
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
+
+	if (is_default)
+		gtk_widget_set_sensitive (GTK_WIDGET(priv->search_button), TRUE);
+}
+
+static void
+select_browse_device_callback (GtkTreeSelection *selection, gpointer user_data)
+{
+	BluetoothDeviceSelection *self = user_data;
+	gchar *address;
+
+	g_object_notify (G_OBJECT(self), "device-selected");
+	address = bluetooth_device_selection_get_selected_device (self);
+	g_signal_emit (G_OBJECT (self),
+		       selection_table_signals[SELECTED_DEVICE_CHANGED],
+		       0, address);
+	g_free (address);
+}
+
+static gboolean
+filter_type_func (GtkTreeModel *model, GtkTreeIter *iter, BluetoothDeviceSelectionPrivate *priv)
+{
+	int type;
+
+	if (priv->device_type_filter == BLUETOOTH_TYPE_ANY)
+		return TRUE;
+
+	gtk_tree_model_get (model, iter, COLUMN_TYPE, &type, -1);
+	return (type & priv->device_type_filter);
+}
+
+static gboolean
+filter_category_func (GtkTreeModel *model, GtkTreeIter *iter, BluetoothDeviceSelectionPrivate *priv)
+{
+	if (priv->device_category_filter == BLUETOOTH_CATEGORY_ALL)
+		return TRUE;
+
+	if (priv->device_category_filter == BLUETOOTH_CATEGORY_BONDED) {
+		gboolean bonded;
+
+		gtk_tree_model_get (model, iter, COLUMN_BONDED, &bonded, -1);
+		return bonded;
+	}
+	if (priv->device_category_filter == BLUETOOTH_CATEGORY_TRUSTED) {
+		gboolean trusted;
+
+		gtk_tree_model_get (model, iter, COLUMN_TRUSTED, &trusted, -1);
+		return trusted;
+	}
+
+	return FALSE;
+}
+
+static gboolean
+filter_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
+{
+	BluetoothDeviceSelection *self = BLUETOOTH_DEVICE_SELECTION (data);
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
+
+	return filter_type_func (model, iter, priv) && filter_category_func (model, iter, priv);
+}
+
+static void
+filter_type_changed_cb (GtkComboBox *widget, gpointer data)
+{
+	BluetoothDeviceSelection *self = BLUETOOTH_DEVICE_SELECTION (data);
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
+
+	priv->device_type_filter = 1 << gtk_combo_box_get_active (GTK_COMBO_BOX(priv->device_type));
+	if (priv->filter)
+		gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->filter));
+	g_object_notify (G_OBJECT(self), "device-type-filter");
+}
+static void
+filter_category_changed_cb (GtkComboBox *widget, gpointer data)
+{
+	BluetoothDeviceSelection *self = BLUETOOTH_DEVICE_SELECTION (data);
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
+
+	priv->device_category_filter = gtk_combo_box_get_active (GTK_COMBO_BOX(priv->device_category));
+	if (priv->filter)
+		gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->filter));
+	g_object_notify (G_OBJECT(self), "device-category-filter");
+}
+
+static void default_adapter_changed (GObject    *gobject,
+				     GParamSpec *arg1,
+				     gpointer    data)
+{
+	BluetoothDeviceSelection *self = BLUETOOTH_DEVICE_SELECTION (data);
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
+	char *adapter;
+
+	g_object_get (gobject, "default-adapter", &adapter, NULL);
+
+	if (adapter == NULL) {
+		gtk_widget_set_sensitive (GTK_WIDGET (priv->treeview), FALSE);
+		gtk_tree_view_set_model (GTK_TREE_VIEW(priv->treeview), NULL);
+	}
+
+	if (priv->model) {
+		g_object_unref (priv->model);
+		priv->model = NULL;
+	}
+
+	if (adapter == NULL)
+		return;
+
+	priv->model = bluetooth_client_get_model_with_filter (priv->client, NULL, NULL, NULL);
+	if (priv->model) {
+		priv->filter = gtk_tree_model_filter_new (priv->model, NULL);
+		gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (priv->filter),
+							filter_func, self, NULL);
+		gtk_tree_view_set_model (GTK_TREE_VIEW(priv->treeview), priv->filter);
+		g_object_unref (priv->filter);
+		gtk_widget_set_sensitive (GTK_WIDGET (priv->treeview), TRUE);
+	}
+}
+
+static GtkWidget *
+create_treeview (BluetoothDeviceSelection *self)
+{
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
+	GtkWidget *scrolled, *tree;
+	GtkCellRenderer *renderer;
+	GtkTreeViewColumn *column;
+
+	/* Create the scrolled window */
+	scrolled = gtk_scrolled_window_new (NULL, NULL);
+
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scrolled),
+					GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(scrolled),
+					     GTK_SHADOW_OUT);
+
+	/* Create the tree view */
+	tree = gtk_tree_view_new ();
+
+	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(tree), TRUE);
+
+	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(tree), TRUE);
+
+	g_object_set (tree, "show-expanders", FALSE, NULL);
+
+	column = gtk_tree_view_column_new ();
+
+	gtk_tree_view_column_set_title (column, _("Device"));
+
+	/* The type icon */
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_tree_view_column_set_spacing (column, 4);
+	gtk_tree_view_column_pack_start (column, renderer, FALSE);
+
+	gtk_tree_view_column_set_cell_data_func (column, renderer,
+						 type_to_icon, NULL, NULL);
+
+	/* The device name */
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_tree_view_column_pack_start (column, renderer, TRUE);
+
+	gtk_tree_view_column_set_cell_data_func (column, renderer,
+						 name_to_text, NULL, NULL);
+
+	/* The bonded icon */
+	priv->bonded_cell = gtk_cell_renderer_pixbuf_new ();
+	gtk_tree_view_column_pack_end (column, priv->bonded_cell, FALSE);
+
+	gtk_tree_view_column_set_cell_data_func (column, priv->bonded_cell,
+						 bonded_to_icon, NULL, NULL);
+
+	gtk_tree_view_append_column (GTK_TREE_VIEW(tree), column);
+
+	gtk_tree_view_column_set_min_width (GTK_TREE_VIEW_COLUMN(column), 280);
+
+	gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW(tree), -1,
+						    _("Type"), gtk_cell_renderer_text_new(),
+						    type_to_text, NULL, NULL);
+
+	priv->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(tree));
+
+	gtk_tree_selection_set_mode (priv->selection, GTK_SELECTION_SINGLE);
+
+	g_signal_connect (G_OBJECT(priv->selection), "changed",
+			  G_CALLBACK(select_browse_device_callback), self);
+
+	/* Set the model, and filter */
+	priv->model = bluetooth_client_get_model_with_filter (priv->client, NULL, NULL, NULL);
+	if (priv->model) {
+		priv->filter = gtk_tree_model_filter_new (priv->model, NULL);
+		gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (priv->filter),
+							filter_func, self, NULL);
+		gtk_tree_view_set_model (GTK_TREE_VIEW(tree), priv->filter);
+		g_object_unref (priv->filter);
+	} else {
+		gtk_widget_set_sensitive (GTK_WIDGET (tree), FALSE);
+	}
+
+	gtk_container_add (GTK_CONTAINER(scrolled), tree);
+	priv->treeview = tree;
+
+	return scrolled;
+}
+
+static void
+bluetooth_device_selection_init(BluetoothDeviceSelection *self)
+{
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
+	GtkTooltips *tooltips;
+	char *str;
+	int i;
+
+	GtkWidget *vbox;
+	GtkWidget *label;
+	GtkWidget *alignment;
+	GtkWidget *hbox;
+	GtkWidget *scrolled_window;
+	GtkWidget *table;
+
+	priv->show_bonded = FALSE;
+	priv->show_search = FALSE;
+
+	priv->client = bluetooth_client_new ();
+
+	priv->discov_started_id = g_signal_connect (G_OBJECT(priv->client),
+			"discovery-started", G_CALLBACK(discovery_started), self);
+	priv->discov_completed_id = g_signal_connect (G_OBJECT(priv->client),
+			"discovery-completed", G_CALLBACK(discovery_completed), self);
+
+	tooltips = gtk_tooltips_new ();
+
+	/* Setup the widget itself */
+	gtk_box_set_spacing (GTK_BOX(self), 18);
+	gtk_container_set_border_width (GTK_CONTAINER(self), 0);
+
+	vbox = gtk_vbox_new (FALSE, 0);
+	gtk_widget_show (vbox);
+	gtk_box_pack_start (GTK_BOX (self), vbox, TRUE, TRUE, 0);
+
+
+	alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
+	gtk_widget_show (alignment);
+	gtk_box_pack_start (GTK_BOX (vbox), alignment, TRUE, TRUE, 0);
+	/* gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0); */
+
+	/* The treeview label */
+	vbox = gtk_vbox_new (FALSE, 6);
+	gtk_widget_show (vbox);
+	gtk_container_add (GTK_CONTAINER (alignment), vbox);
+
+	hbox = gtk_hbox_new (FALSE, 24);
+	gtk_widget_show (hbox);
+	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
+
+	priv->title = gtk_label_new_with_mnemonic (_("_Select a device from the following list:"));
+	gtk_widget_show (priv->title);
+	gtk_box_pack_start (GTK_BOX (hbox), priv->title, FALSE, TRUE, 0);
+	gtk_misc_set_alignment (GTK_MISC (priv->title), 0, 1);
+
+	/* The search button */
+	priv->search_button = gtk_button_new_with_mnemonic (_("S_earch"));
+	gtk_widget_set_no_show_all (priv->search_button, TRUE);
+	gtk_box_pack_end (GTK_BOX (hbox), priv->search_button, FALSE, TRUE, 0);
+	g_signal_connect (G_OBJECT(priv->search_button), "clicked",
+			  G_CALLBACK(search_button_clicked), self);
+	gtk_tooltips_set_tip (tooltips, priv->search_button, _("Rescan Bluetooth devices"), NULL);
+	if (priv->show_search)
+		gtk_widget_show (priv->search_button);
+
+	/* The treeview */
+	scrolled_window = create_treeview (self);
+	gtk_widget_show_all (scrolled_window);
+	gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
+
+	vbox = gtk_vbox_new (FALSE, 6);
+	gtk_widget_show (vbox);
+	gtk_box_pack_start (GTK_BOX (self), vbox, FALSE, TRUE, 0);
+	priv->filters_vbox = vbox;
+
+	/* The filters */
+	str = g_strdup_printf ("<b>%s</b>", _("Show Only Bluetooth Devices With..."));
+	label = gtk_label_new (str);
+	g_free (str);
+	gtk_widget_show (label);
+	gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
+	gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+
+	alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
+	gtk_widget_show (alignment);
+	gtk_box_pack_start (GTK_BOX (vbox), alignment, TRUE, TRUE, 0);
+	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
+
+	table = gtk_table_new (2, 2, FALSE);
+	gtk_widget_show (table);
+	gtk_container_add (GTK_CONTAINER (alignment), table);
+	gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+	gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+
+	/* The device category filter */
+	label = gtk_label_new_with_mnemonic (_("Device _category:"));
+	gtk_widget_set_no_show_all (label, TRUE);
+	gtk_widget_show (label);
+	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
+			  (GtkAttachOptions) (GTK_FILL),
+			  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+	priv->device_category_label = label;
+
+	priv->device_category = gtk_combo_box_new_text ();
+	gtk_widget_set_no_show_all (priv->device_category, TRUE);
+	gtk_widget_show (priv->device_category);
+	gtk_table_attach (GTK_TABLE (table), priv->device_category, 1, 2, 1, 2,
+			  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+			  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
+	gtk_tooltips_set_tip (tooltips, priv->device_category, _("Select the device category to filter above list"), NULL);
+	for (i = 0; i < BLUETOOTH_CATEGORY_NUM_CATEGORIES; i++) {
+		gtk_combo_box_append_text (GTK_COMBO_BOX(priv->device_category),
+					   _(bluetooth_device_category_to_string (i)));
+	}
+	g_signal_connect (G_OBJECT (priv->device_category), "changed",
+			  G_CALLBACK(filter_category_changed_cb), self);
+	gtk_combo_box_set_active (GTK_COMBO_BOX(priv->device_category), priv->device_category_filter);
+	if (priv->show_device_category) {
+		gtk_widget_show (priv->device_category_label);
+		gtk_widget_show (priv->device_category);
+	}
+
+	/* The device type filter */
+	label = gtk_label_new_with_mnemonic (_("Device _type:"));
+	gtk_widget_set_no_show_all (label, TRUE);
+	gtk_widget_show (label);
+	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
+			  (GtkAttachOptions) (GTK_FILL),
+			  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+	priv->device_type_label = label;
+
+	priv->device_type = gtk_combo_box_new_text ();
+	gtk_widget_set_no_show_all (priv->device_type, TRUE);
+	gtk_widget_show (priv->device_type);
+	gtk_table_attach (GTK_TABLE (table), priv->device_type, 1, 2, 0, 1,
+			  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+			  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
+	gtk_tooltips_set_tip (tooltips, priv->device_type, _("Select the device type to filter above list"), NULL);
+	/* The types match the types used in client.h */
+	for (i = 0; i < BLUETOOTH_TYPE_NUM_TYPES; i++) {
+		gtk_combo_box_append_text (GTK_COMBO_BOX(priv->device_type),
+					   _(bluetooth_type_to_string (1 << i)));
+	}
+	g_signal_connect (G_OBJECT (priv->device_type), "changed",
+			  G_CALLBACK(filter_type_changed_cb), self);
+	gtk_combo_box_set_active (GTK_COMBO_BOX(priv->device_type), int_log2(priv->device_type_filter));
+	if (priv->show_device_type) {
+		gtk_widget_show (priv->device_type_label);
+		gtk_widget_show (priv->device_type);
+	}
+
+	/* if filters are not visible hide the vbox */
+	if (!priv->show_device_type && !priv->show_device_category)
+		gtk_widget_hide (priv->filters_vbox);
+
+	priv->default_adapter_changed_id = g_signal_connect (priv->client, "notify::default-adapter",
+							     G_CALLBACK (default_adapter_changed), self);
+}
+
+static void
+bluetooth_device_selection_finalize (GObject *object)
+{
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(object);
+
+	g_signal_handler_disconnect (G_OBJECT(priv->client), priv->discov_started_id);
+	g_signal_handler_disconnect (G_OBJECT(priv->client), priv->discov_completed_id);
+	g_signal_handler_disconnect (G_OBJECT(priv->client), priv->default_adapter_changed_id);
+
+	bluetooth_client_cancel_discovery (priv->client, NULL);
+}
+
+enum {
+	PROP_0,
+	PROP_TITLE,
+	PROP_DEVICE_SELECTED,
+	PROP_DEVICE_SELECTED_NAME,
+	PROP_SHOW_BONDING,
+	PROP_SHOW_SEARCH,
+	PROP_SHOW_DEVICE_TYPE,
+	PROP_SHOW_DEVICE_CATEGORY,
+	PROP_DEVICE_TYPE_FILTER,
+	PROP_DEVICE_CATEGORY_FILTER
+};
+
+static void
+bluetooth_device_selection_set_property (GObject *object, guint prop_id,
+					 const GValue *value, GParamSpec *pspec)
+{
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(object);
+
+	switch (prop_id) {
+	case PROP_TITLE:
+		{
+			if (!g_value_get_string(value))
+			{
+				gtk_widget_hide (priv->title);
+				break;	
+			}
+
+			gtk_label_set_markup (GTK_LABEL(priv->title), g_value_get_string(value));
+		}
+		break;
+	case PROP_SHOW_BONDING:
+		priv->show_bonded = g_value_get_boolean (value);
+		if (priv->bonded_cell != NULL)
+			g_object_set (G_OBJECT (priv->bonded_cell), "visible", priv->show_bonded, NULL);
+		break;
+	case PROP_SHOW_SEARCH:
+		priv->show_search = g_value_get_boolean (value);
+		g_object_set (G_OBJECT (priv->search_button), "visible", priv->show_search, NULL);
+		break;
+	case PROP_SHOW_DEVICE_TYPE:
+		priv->show_device_type = g_value_get_boolean (value);
+		g_object_set (G_OBJECT (priv->device_type_label), "visible", priv->show_device_type, NULL);
+		g_object_set (G_OBJECT (priv->device_type), "visible", priv->show_device_type, NULL);
+		if (priv->show_device_type || priv->show_device_category)
+			g_object_set (G_OBJECT (priv->filters_vbox), "visible", TRUE, NULL);
+		else
+			g_object_set (G_OBJECT (priv->filters_vbox), "visible", FALSE, NULL);
+		break;
+	case PROP_SHOW_DEVICE_CATEGORY:
+		priv->show_device_category = g_value_get_boolean (value);
+		g_object_set (G_OBJECT (priv->device_category_label), "visible", priv->show_device_category, NULL);
+		g_object_set (G_OBJECT (priv->device_category), "visible", priv->show_device_category, NULL);
+		if (priv->show_device_type || priv->show_device_category)
+			g_object_set (G_OBJECT (priv->filters_vbox), "visible", TRUE, NULL);
+		else
+			g_object_set (G_OBJECT (priv->filters_vbox), "visible", FALSE, NULL);
+		break;
+	case PROP_DEVICE_TYPE_FILTER:
+		priv->device_type_filter = g_value_get_int (value);
+		gtk_combo_box_set_active (GTK_COMBO_BOX(priv->device_type), int_log2(priv->device_type_filter));
+		break;
+	case PROP_DEVICE_CATEGORY_FILTER:
+		priv->device_category_filter = g_value_get_int (value);
+		gtk_combo_box_set_active (GTK_COMBO_BOX(priv->device_category), priv->device_category_filter);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+bluetooth_device_selection_get_property (GObject *object, guint prop_id,
+					 GValue *value, GParamSpec *pspec)
+{
+	BluetoothDeviceSelection *self = BLUETOOTH_DEVICE_SELECTION(object);
+	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(object);
+
+	switch (prop_id) {
+	case PROP_DEVICE_SELECTED:
+		g_value_take_string (value, bluetooth_device_selection_get_selected_device (self));
+		break;
+	case PROP_DEVICE_SELECTED_NAME:
+		g_value_take_string (value, bluetooth_device_selection_get_selected_device_name (self));
+		break;
+	case PROP_SHOW_BONDING:
+		g_value_set_boolean (value, priv->show_bonded);
+		break;
+	case PROP_SHOW_SEARCH:
+		g_value_set_boolean (value, priv->show_search);
+		break;
+	case PROP_SHOW_DEVICE_TYPE:
+		g_value_set_boolean (value, priv->show_device_type);
+		break;
+	case PROP_SHOW_DEVICE_CATEGORY:
+		g_value_set_boolean (value, priv->show_device_category);
+		break;
+	case PROP_DEVICE_TYPE_FILTER:
+		g_value_set_int (value, priv->device_type_filter);
+		break;
+	case PROP_DEVICE_CATEGORY_FILTER:
+		g_value_set_int (value, priv->device_category_filter);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+bluetooth_device_selection_class_init (BluetoothDeviceSelectionClass *klass)
+{
+	g_type_class_add_private(klass, sizeof(BluetoothDeviceSelectionPrivate));
+
+	G_OBJECT_CLASS(klass)->finalize = bluetooth_device_selection_finalize;
+
+	G_OBJECT_CLASS(klass)->set_property = bluetooth_device_selection_set_property;
+	G_OBJECT_CLASS(klass)->get_property = bluetooth_device_selection_get_property;
+
+	selection_table_signals[SELECTED_DEVICE_CHANGED] =
+		g_signal_new ("selected-device-changed",
+			      G_TYPE_FROM_CLASS (klass),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (BluetoothDeviceSelectionClass, selected_device_changed),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__STRING,
+			      G_TYPE_NONE, 1, G_TYPE_STRING);
+
+	g_object_class_install_property (G_OBJECT_CLASS(klass),
+					 PROP_TITLE, g_param_spec_string ("title",
+									  NULL, NULL, NULL, G_PARAM_WRITABLE));
+	g_object_class_install_property (G_OBJECT_CLASS(klass),
+					 PROP_DEVICE_SELECTED, g_param_spec_string ("device-selected",
+										    NULL, NULL, NULL, G_PARAM_READABLE));
+	g_object_class_install_property (G_OBJECT_CLASS(klass),
+					 PROP_DEVICE_SELECTED_NAME, g_param_spec_string ("device-selected-name",
+										    NULL, NULL, NULL, G_PARAM_READABLE));
+	g_object_class_install_property (G_OBJECT_CLASS(klass),
+					 PROP_SHOW_BONDING, g_param_spec_boolean ("show-bonding",
+										  NULL, NULL, FALSE, G_PARAM_READWRITE));
+	g_object_class_install_property (G_OBJECT_CLASS(klass),
+					 PROP_SHOW_SEARCH, g_param_spec_boolean ("show-search",
+										 NULL, NULL, FALSE, G_PARAM_READWRITE));
+	g_object_class_install_property (G_OBJECT_CLASS(klass),
+					 PROP_SHOW_DEVICE_TYPE, g_param_spec_boolean ("show-device-type",
+										      NULL, NULL, TRUE, G_PARAM_READWRITE));
+	g_object_class_install_property (G_OBJECT_CLASS(klass),
+					 PROP_SHOW_DEVICE_CATEGORY, g_param_spec_boolean ("show-device-category",
+											  NULL, NULL, TRUE, G_PARAM_READWRITE));
+	g_object_class_install_property (G_OBJECT_CLASS(klass),
+					 PROP_DEVICE_TYPE_FILTER, g_param_spec_int ("device-type-filter", NULL, NULL,
+										    1, 1 << (BLUETOOTH_TYPE_NUM_TYPES - 1), 1, G_PARAM_READWRITE));
+	g_object_class_install_property (G_OBJECT_CLASS(klass),
+					 PROP_DEVICE_CATEGORY_FILTER, g_param_spec_int ("device-category-filter", NULL, NULL,
+					 						0, BLUETOOTH_CATEGORY_NUM_CATEGORIES, 0, G_PARAM_READWRITE));
+}
+
+GtkWidget *
+bluetooth_device_selection_new (const gchar *title)
+{
+	return g_object_new(BLUETOOTH_TYPE_DEVICE_SELECTION,
+			    "title", title,
+			    NULL);
+}
+

Added: trunk/src/bluez-gnome/bluetooth-device-selection.h
==============================================================================
--- (empty file)
+++ trunk/src/bluez-gnome/bluetooth-device-selection.h	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,72 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2005-2008  Marcel Holtmann <marcel holtmann org>
+ *  Copyright (C) 2006-2007  Bastien Nocera <hadess hadess net>
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifndef __BLUETOOTH_DEVICE_SELECTION_H
+#define __BLUETOOTH_DEVICE_SELECTION_H
+
+#include <gtk/gtkvbox.h>
+
+G_BEGIN_DECLS
+
+#define BLUETOOTH_TYPE_DEVICE_SELECTION (bluetooth_device_selection_get_type())
+#define BLUETOOTH_DEVICE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+				BLUETOOTH_TYPE_DEVICE_SELECTION, BluetoothDeviceSelection))
+#define BLUETOOTH_DEVICE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
+				BLUETOOTH_TYPE_DEVICE_SELECTION, BluetoothDeviceSelectionClass))
+#define BLUETOOTH_IS_DEVICE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+						BLUETOOTH_TYPE_DEVICE_SELECTION))
+#define BLUETOOTH_IS_DEVICE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), \
+						BLUETOOTH_TYPE_DEVICE_SELECTION))
+#define BLUETOOTH_GET_DEVICE_SELECTION_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
+				BLUETOOTH_TYPE_DEVICE_SELECTION, BluetoothDeviceSelectionClass))
+
+enum {
+	BLUETOOTH_CATEGORY_ALL,
+	BLUETOOTH_CATEGORY_BONDED,
+	BLUETOOTH_CATEGORY_TRUSTED,
+	BLUETOOTH_CATEGORY_NUM_CATEGORIES
+};
+
+typedef struct _BluetoothDeviceSelection BluetoothDeviceSelection;
+typedef struct _BluetoothDeviceSelectionClass BluetoothDeviceSelectionClass;
+
+struct _BluetoothDeviceSelection {
+	GtkVBox parent;
+};
+
+struct _BluetoothDeviceSelectionClass {
+	GtkVBoxClass parent_class;
+
+	void (*selected_device_changed) (BluetoothDeviceSelection *sel, gchar *device);
+};
+
+GType bluetooth_device_selection_get_type (void);
+
+GtkWidget *bluetooth_device_selection_new (const gchar *title);
+gchar *bluetooth_device_selection_get_selected_device (BluetoothDeviceSelection *sel);
+void bluetooth_device_selection_start_discovery (BluetoothDeviceSelection *sel);
+
+G_END_DECLS
+
+#endif /* __BLUETOOTH_DEVICE_SELECTION_H */

Added: trunk/src/bluez-gnome/client.c
==============================================================================
--- (empty file)
+++ trunk/src/bluez-gnome/client.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,1587 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2005-2008  Marcel Holtmann <marcel holtmann org>
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+#include <gtk/gtk.h>
+
+#include <dbus/dbus-glib.h>
+
+#include "client.h"
+
+#include "marshal.h"
+
+#include "dbus-glue.h"
+
+static BluetoothClient *self = NULL;
+
+#define BLUETOOTH_CLIENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+				BLUETOOTH_TYPE_CLIENT, BluetoothClientPrivate))
+
+typedef struct _BluetoothClientPrivate BluetoothClientPrivate;
+
+struct _BluetoothClientPrivate {
+	gboolean registered;
+
+	DBusGConnection *conn;
+	DBusGProxy *manager_object;
+	GtkTreeStore *store;
+	gchar *default_adapter;
+};
+
+enum {
+	DISCOVERY_STARTED,
+	DISCOVERY_COMPLETED,
+	LAST_SIGNAL
+};
+
+enum {
+	PROP_0,
+	PROP_DEFAULT_ADAPTER
+};
+
+static int client_table_signals[LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE(BluetoothClient, bluetooth_client, G_TYPE_OBJECT)
+
+static gboolean find_iter_for_object(DBusGProxy *object,
+				     BluetoothClient *client,
+				     GtkTreeIter *iter)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	gboolean cont;
+
+	if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), iter) == FALSE)
+		return FALSE;
+
+	cont = TRUE;
+	while (cont == TRUE) {
+		DBusGProxy *o;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), iter,
+						COLUMN_OBJECT, &o, -1);
+		if (o == object)
+			return TRUE;
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), iter);
+	}
+
+	return FALSE;
+}
+
+static void timeout_changed(DBusGProxy *object,
+				const guint32 timeout, gpointer user_data)
+{
+}
+
+static void name_changed(DBusGProxy *object,
+				const char *name, gpointer user_data)
+{
+	BluetoothClient *client = BLUETOOTH_CLIENT(user_data);
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+
+	GtkTreeIter iter;
+
+	if (find_iter_for_object(object, BLUETOOTH_CLIENT(client), &iter) == FALSE)
+		return;
+
+	gtk_tree_store_set(priv->store, &iter, COLUMN_NAME, name, -1);
+}
+
+static void minor_changed(DBusGProxy *object,
+				const char *minor, gpointer user_data)
+{
+}
+
+const gchar *bluetooth_type_to_string(guint type)
+{
+	switch (type) {
+	case BLUETOOTH_TYPE_ANY:
+		return N_("All types");
+	case BLUETOOTH_TYPE_PHONE:
+		return N_("Phone");
+	case BLUETOOTH_TYPE_MODEM:
+		return N_("Modem");
+	case BLUETOOTH_TYPE_COMPUTER:
+		return N_("Computer");
+	case BLUETOOTH_TYPE_NETWORK:
+		return N_("Network");
+	case BLUETOOTH_TYPE_HEADSET:
+		return N_("Headset");
+	case BLUETOOTH_TYPE_KEYBOARD:
+		return N_("Keyboard");
+	case BLUETOOTH_TYPE_MOUSE:
+		return N_("Mouse");
+	case BLUETOOTH_TYPE_CAMERA:
+		return N_("Camera");
+	case BLUETOOTH_TYPE_PRINTER:
+		return N_("Printer");
+	case BLUETOOTH_TYPE_JOYPAD:
+		return N_("Joypad");
+	case BLUETOOTH_TYPE_TABLET:
+		return N_("Tablet");
+	default:
+		return N_("Unknown");
+	}
+}
+
+static guint class_to_type(guint32 class)
+{
+	switch ((class & 0x1f00) >> 8) {
+	case 0x01:
+		return BLUETOOTH_TYPE_COMPUTER;
+	case 0x02:
+		switch ((class & 0xfc) >> 2) {
+		case 0x01:
+		case 0x02:
+		case 0x03:
+		case 0x05:
+			return BLUETOOTH_TYPE_PHONE;
+		case 0x04:
+			return BLUETOOTH_TYPE_MODEM;
+		}
+		break;
+	case 0x03:
+		return BLUETOOTH_TYPE_NETWORK;
+	case 0x04:
+		switch ((class & 0xfc) >> 2) {
+		case 0x01:
+		case 0x02:
+			return BLUETOOTH_TYPE_HEADSET;
+		}
+		break;
+	case 0x05:
+		switch ((class & 0xc0) >> 6) {
+		case 0x00:
+			switch ((class & 0x1e) >> 2) {
+			case 0x01:
+			case 0x02:
+				return BLUETOOTH_TYPE_JOYPAD;
+			}
+			break;
+		case 0x01:
+			return BLUETOOTH_TYPE_KEYBOARD;
+		case 0x02:
+			switch ((class & 0x1e) >> 2) {
+			case 0x05:
+				return BLUETOOTH_TYPE_TABLET;
+			default:
+				return BLUETOOTH_TYPE_MOUSE;
+			}
+		}
+		break;
+	case 0x06:
+		if (class & 0x80)
+			return BLUETOOTH_TYPE_PRINTER;
+		if (class & 0x20)
+			return BLUETOOTH_TYPE_CAMERA;
+		break;
+	}
+
+	return BLUETOOTH_TYPE_ANY;
+}
+
+static void insert_device(DBusGProxy *object, GtkTreeIter *parent,
+			BluetoothClient *client, const char *address,
+			const int rssi, gboolean active, gboolean lookup)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	GHashTable *hash = NULL;
+	GValue *value;
+	const char *name = NULL;
+	guint type;
+	guint32 class = 0;
+	gboolean bonded = FALSE, trusted = FALSE, connected = FALSE;
+	gboolean cont;
+
+	dbus_g_proxy_call(object, "GetRemoteInfo", NULL,
+				G_TYPE_STRING, address, G_TYPE_INVALID,
+				dbus_g_type_get_map("GHashTable",
+						G_TYPE_STRING, G_TYPE_VALUE),
+				&hash, G_TYPE_INVALID);
+
+	value = (hash == NULL) ? NULL : g_hash_table_lookup(hash, "name");
+	if (value == NULL) {
+		if (lookup) {
+			dbus_g_proxy_call(object, "GetRemoteName", NULL,
+				  G_TYPE_STRING, address, G_TYPE_INVALID,
+				  G_TYPE_STRING, &name, G_TYPE_INVALID);
+		} else
+			name = g_strdup(address);
+	} else
+		name = g_value_get_string(value);
+
+	value = (hash == NULL) ? NULL : g_hash_table_lookup(hash, "class");
+	if (value == NULL) {
+		if (lookup) {
+			dbus_g_proxy_call(object, "GetRemoteClass", NULL,
+				  G_TYPE_STRING, address, G_TYPE_INVALID,
+				  G_TYPE_UINT, &class, G_TYPE_INVALID);
+		}
+	} else
+		class = g_value_get_uint(value);
+
+	value = (hash == NULL) ? NULL : g_hash_table_lookup(hash, "bonded");
+	if (value == NULL)
+		dbus_g_proxy_call(object, "HasBonding", NULL,
+				G_TYPE_STRING, address, G_TYPE_INVALID,
+				G_TYPE_BOOLEAN, &bonded, G_TYPE_INVALID);
+	else
+		bonded = g_value_get_boolean(value);
+
+	value = (hash == NULL) ? NULL : g_hash_table_lookup(hash, "trusted");
+	if (value == NULL)
+		dbus_g_proxy_call(object, "IsTrusted", NULL,
+				G_TYPE_STRING, address, G_TYPE_INVALID,
+				G_TYPE_BOOLEAN, &trusted, G_TYPE_INVALID);
+	else
+		trusted = g_value_get_boolean(value);
+
+	value = (hash == NULL) ? NULL : g_hash_table_lookup(hash, "connected");
+	if (value == NULL)
+		dbus_g_proxy_call(object, "IsConnected", NULL,
+				G_TYPE_STRING, address, G_TYPE_INVALID,
+				G_TYPE_BOOLEAN, &connected, G_TYPE_INVALID);
+	else
+		connected = g_value_get_boolean(value);
+
+	cont = gtk_tree_model_iter_children(GTK_TREE_MODEL(priv->store),
+							&iter, parent);
+
+	type = class_to_type(class);
+
+	while (cont == TRUE) {
+		gchar *value;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_ADDRESS, &value, -1);
+
+		if (g_ascii_strcasecmp(address, value) == 0) {
+			gtk_tree_store_set(priv->store, &iter,
+						COLUMN_ACTIVE, active,
+						COLUMN_CLASS, class,
+						COLUMN_RSSI, rssi,
+						COLUMN_NAME, name,
+						COLUMN_TYPE, type,
+						COLUMN_BONDED, bonded,
+						COLUMN_TRUSTED, trusted,
+						COLUMN_CONNECTED, connected,
+						COLUMN_DISCOVERING, FALSE, -1);
+			return;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+
+	gtk_tree_store_insert_with_values(priv->store, &iter, parent, -1,
+					COLUMN_ACTIVE, active,
+					COLUMN_ADDRESS, address,
+					COLUMN_CLASS, class,
+					COLUMN_RSSI, rssi,
+					COLUMN_NAME, name,
+					COLUMN_TYPE, type,
+					COLUMN_BONDED, bonded,
+					COLUMN_TRUSTED, trusted,
+					COLUMN_CONNECTED, connected,
+					COLUMN_DISCOVERING, FALSE, -1);
+}
+
+static void invalidate_device(DBusGProxy *object,
+				GtkTreeIter *parent,
+				BluetoothClient *client,
+				const char *address)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	cont = gtk_tree_model_iter_children(GTK_TREE_MODEL(priv->store),
+							&iter, parent);
+
+	while (cont == TRUE) {
+		gchar *value;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_ADDRESS, &value, -1);
+
+		if (g_ascii_strcasecmp(address, value) == 0) {
+			gtk_tree_store_set(priv->store, &iter,
+						COLUMN_ACTIVE, FALSE, -1);
+			return;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+}
+
+static void change_connected(DBusGProxy *object, GtkTreeIter *parent,
+			        BluetoothClient *client,
+				const char *address, gboolean connected)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	cont = gtk_tree_model_iter_children(GTK_TREE_MODEL(priv->store),
+							&iter, parent);
+
+	while (cont == TRUE) {
+		gchar *value;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_ADDRESS, &value, -1);
+
+		if (g_ascii_strcasecmp(address, value) == 0) {
+			gtk_tree_store_set(priv->store, &iter,
+					COLUMN_CONNECTED, connected, -1);
+			return;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+}
+
+static void rename_device(DBusGProxy *object, GtkTreeIter *parent,
+					BluetoothClient *client,
+					const char *address, const char *name)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	cont = gtk_tree_model_iter_children(GTK_TREE_MODEL(priv->store),
+							&iter, parent);
+
+	while (cont == TRUE) {
+		gchar *value;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_ADDRESS, &value, -1);
+
+		if (g_ascii_strcasecmp(address, value) == 0) {
+			gtk_tree_store_set(priv->store, &iter,
+						COLUMN_NAME, name, -1);
+			return;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+}
+
+static void change_bonded(DBusGProxy *object, GtkTreeIter *parent,
+					BluetoothClient *client,
+					const char *address, gboolean bonded)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	cont = gtk_tree_model_iter_children(GTK_TREE_MODEL(priv->store),
+							&iter, parent);
+
+	while (cont == TRUE) {
+		gchar *value;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_ADDRESS, &value, -1);
+
+		if (g_ascii_strcasecmp(address, value) == 0) {
+			gtk_tree_store_set(priv->store, &iter,
+						COLUMN_BONDED, bonded, -1);
+			return;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+}
+
+static void change_trusted(DBusGProxy *object, GtkTreeIter *parent,
+					BluetoothClient *client,
+					const char *address, gboolean trusted)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	cont = gtk_tree_model_iter_children(GTK_TREE_MODEL(priv->store),
+							&iter, parent);
+
+	while (cont == TRUE) {
+		gchar *value;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_ADDRESS, &value, -1);
+
+		if (g_ascii_strcasecmp(address, value) == 0) {
+			gtk_tree_store_set(priv->store, &iter,
+						COLUMN_TRUSTED, trusted, -1);
+			return;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+}
+
+static void device_found(DBusGProxy *object, const char *address,
+		const unsigned int class, const int rssi, gpointer user_data)
+{
+	GtkTreeIter iter;
+
+	if (find_iter_for_object(object, BLUETOOTH_CLIENT(user_data), &iter) == FALSE)
+		return;
+
+	insert_device(object, &iter, BLUETOOTH_CLIENT(user_data),
+						address, rssi, TRUE, TRUE);
+}
+
+static void device_disappeared(DBusGProxy *object,
+				const char *address, gpointer user_data)
+{
+	GtkTreeIter iter;
+
+	if (find_iter_for_object(object, BLUETOOTH_CLIENT(user_data), &iter) == FALSE)
+		return;
+
+	invalidate_device(object, &iter, BLUETOOTH_CLIENT(user_data), address);
+}
+
+static void device_connected(DBusGProxy *object,
+				const char *address, gpointer user_data)
+{
+	GtkTreeIter iter;
+
+	if (find_iter_for_object(object, BLUETOOTH_CLIENT(user_data), &iter) == FALSE)
+		return;
+
+	change_connected(object, &iter, BLUETOOTH_CLIENT(user_data), address, TRUE);
+}
+
+static void device_disconnected(DBusGProxy *object,
+				const char *address, gpointer user_data)
+{
+	GtkTreeIter iter;
+
+	if (find_iter_for_object(object, BLUETOOTH_CLIENT(user_data), &iter) == FALSE)
+		return;
+
+	change_connected(object, &iter, BLUETOOTH_CLIENT(user_data), address, FALSE);
+}
+
+static void name_updated(DBusGProxy *object,
+		const char *address, const char *name, gpointer user_data)
+{
+	GtkTreeIter iter;
+
+	if (find_iter_for_object(object, BLUETOOTH_CLIENT(user_data), &iter) == FALSE)
+		return;
+
+	rename_device(object, &iter, BLUETOOTH_CLIENT(user_data), address, name);
+}
+
+static void bonding_created(DBusGProxy *object,
+				const char *address, gpointer user_data)
+{
+	GtkTreeIter iter;
+
+	if (find_iter_for_object(object, BLUETOOTH_CLIENT(user_data), &iter) == FALSE)
+		return;
+
+	change_bonded(object, &iter, BLUETOOTH_CLIENT(user_data), address, TRUE);
+}
+
+static void bonding_removed(DBusGProxy *object,
+				const char *address, gpointer user_data)
+{
+	GtkTreeIter iter;
+
+	if (find_iter_for_object(object, BLUETOOTH_CLIENT(user_data), &iter) == FALSE)
+		return;
+
+	change_bonded(object, &iter, BLUETOOTH_CLIENT(user_data), address, FALSE);
+}
+
+static void trust_added(DBusGProxy *object,
+				const char *address, gpointer user_data)
+{
+	GtkTreeIter iter;
+
+	if (find_iter_for_object(object, BLUETOOTH_CLIENT(user_data), &iter) == FALSE)
+		return;
+
+	change_trusted(object, &iter, BLUETOOTH_CLIENT(user_data), address, TRUE);
+}
+
+static void trust_removed(DBusGProxy *object,
+				const char *address, gpointer user_data)
+{
+	GtkTreeIter iter;
+
+	if (find_iter_for_object(object, BLUETOOTH_CLIENT(user_data), &iter) == FALSE)
+		return;
+
+	change_trusted(object, &iter, BLUETOOTH_CLIENT(user_data), address, FALSE);
+}
+
+static void update_adapter(DBusGProxy *object, GtkTreeIter *iter, BluetoothClient *client)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GError *error = NULL;
+	char **array = NULL;
+	char *address = NULL, *mode = NULL;
+	char *name = NULL, *major = NULL, *minor = NULL;
+	const guint32 timeout;
+
+	adapter_get_address(object, &address, NULL);
+
+	adapter_get_mode(object, &mode, NULL);
+
+	dbus_g_proxy_call(object, "GetDiscoverableTimeout", NULL, G_TYPE_INVALID,
+				G_TYPE_UINT, &timeout, G_TYPE_INVALID);
+
+	adapter_get_name(object, &name, NULL);
+
+	adapter_get_major_class(object, &major, NULL);
+
+	adapter_get_minor_class(object, &minor, NULL);
+
+	gtk_tree_store_set(priv->store, iter, COLUMN_ADDRESS, address,
+						COLUMN_NAME, name, -1);
+
+	adapter_list_connections(object, &array, &error);
+
+	if (error == NULL) {
+		while (*array) {
+			insert_device(object, iter, client,
+						*array, 0, FALSE, TRUE);
+			array++;
+		}
+	} else {
+		g_error_free(error);
+		error = NULL;
+		goto failover;
+	}
+
+	adapter_list_bondings(object, &array, &error);
+
+	if (error == NULL) {
+		while (*array) {
+			insert_device(object, iter, client,
+						*array, 0, FALSE, FALSE);
+			array++;
+		}
+	} else {
+		g_error_free(error);
+		error = NULL;
+		goto failover;
+	}
+
+	adapter_list_trusts(object, &array, &error);
+
+	if (error == NULL) {
+		while (*array) {
+			insert_device(object, iter, client,
+						*array, 0, FALSE, FALSE);
+			array++;
+		}
+	} else {
+		g_error_free(error);
+		error = NULL;
+		goto failover;
+	}
+
+failover:
+	adapter_list_remote_devices(object, &array, &error);
+
+	if (error == NULL) {
+		while (*array) {
+			insert_device(object, iter, client,
+						*array, 0, FALSE, FALSE);
+			array++;
+		}
+	} else
+		g_error_free(error);
+}
+
+static void mode_changed(DBusGProxy *object,
+				const char *mode, gpointer user_data)
+{
+	BluetoothClient *client = (BluetoothClient *) user_data;
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		DBusGProxy *o;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_OBJECT, &o, -1);
+
+		if (object == o) {
+			gtk_tree_store_set(priv->store, &iter,
+						COLUMN_ACTIVE, TRUE, -1);
+			update_adapter(object, &iter, client);
+
+			return;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+}
+
+static void discovery_event(DBusGProxy *object,
+			    BluetoothClient *client,
+			    gboolean starting)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	char *adapter;
+	gboolean is_default;
+
+	if (find_iter_for_object(object, BLUETOOTH_CLIENT(client), &iter) == FALSE)
+		return;
+
+	gtk_tree_store_set(priv->store, &iter, COLUMN_DISCOVERING, starting, -1);
+
+	/* Find out whether we're checking the default adapter */
+	is_default = FALSE;
+	gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter, COLUMN_PATH, &adapter, -1);
+	if (priv->default_adapter != NULL) {
+		if (g_str_equal (priv->default_adapter, adapter) != FALSE)
+			is_default = TRUE;
+	}
+
+	if (starting)
+		g_signal_emit(G_OBJECT(client), client_table_signals[DISCOVERY_STARTED],
+			      0, adapter, is_default);
+	else
+		g_signal_emit(G_OBJECT(client), client_table_signals[DISCOVERY_COMPLETED],
+			      0, adapter, is_default);
+
+	g_free (adapter);
+}
+
+static void discovery_completed(DBusGProxy *object,
+				gpointer user_data)
+{
+	BluetoothClient *client = BLUETOOTH_CLIENT(user_data);
+
+	discovery_event (object, client, FALSE);
+}
+
+static void discovery_started(DBusGProxy *object,
+			      gpointer user_data)
+{
+	BluetoothClient *client = BLUETOOTH_CLIENT(user_data);
+
+	discovery_event (object, client, TRUE);
+}
+
+static void add_adapter(const char *path, BluetoothClient *client)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	DBusGProxy *object;
+	GtkTreeIter iter;
+	gboolean cont;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		gchar *value;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_PATH, &value,
+						COLUMN_OBJECT, &object, -1);
+
+		if (g_ascii_strcasecmp(path, value) == 0) {
+			gtk_tree_store_set(priv->store, &iter,
+						COLUMN_ACTIVE, TRUE, -1);
+
+			update_adapter(object, &iter, client);
+
+			return;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+
+	object = dbus_g_proxy_new_for_name(priv->conn, "org.bluez",
+						path, "org.bluez.Adapter");
+
+	gtk_tree_store_insert_with_values(priv->store, &iter, NULL, -1,
+						COLUMN_PATH, path,
+						COLUMN_ACTIVE, TRUE,
+						COLUMN_OBJECT, object, -1);
+
+	g_object_unref(object);
+
+	dbus_g_proxy_add_signal(object, "ModeChanged",
+					G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "ModeChanged",
+				G_CALLBACK(mode_changed), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "DiscoverableTimeoutChanged",
+					G_TYPE_UINT, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "DiscoverableTimeoutChanged",
+				G_CALLBACK(timeout_changed), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "NameChanged",
+					G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "NameChanged",
+				G_CALLBACK(name_changed), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "MinorClassChanged",
+					G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "MinorClassChanged",
+				G_CALLBACK(minor_changed), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "RemoteDeviceFound",
+						G_TYPE_STRING, G_TYPE_UINT,
+						G_TYPE_INT, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "RemoteDeviceFound",
+				G_CALLBACK(device_found), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "RemoteDeviceDisappeared",
+						G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "RemoteDeviceDisappeared",
+				G_CALLBACK(device_disappeared), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "RemoteDeviceConnected",
+						G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "RemoteDeviceConnected",
+				G_CALLBACK(device_connected), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "RemoteDeviceDisconnected",
+						G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "RemoteDeviceDisconnected",
+				G_CALLBACK(device_disconnected), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "RemoteNameUpdated",
+				G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "RemoteNameUpdated",
+				G_CALLBACK(name_updated), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "BondingCreated",
+						G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "BondingCreated",
+				G_CALLBACK(bonding_created), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "BondingRemoved",
+						G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "BondingRemoved",
+				G_CALLBACK(bonding_removed), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "TrustAdded",
+						G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "TrustAdded",
+				G_CALLBACK(trust_added), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "TrustRemoved",
+						G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "TrustRemoved",
+				G_CALLBACK(trust_removed), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "DiscoveryStarted", G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "DiscoveryStarted",
+				G_CALLBACK(discovery_started), client, NULL);
+
+	dbus_g_proxy_add_signal(object, "DiscoveryCompleted", G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "DiscoveryCompleted",
+				G_CALLBACK(discovery_completed), client, NULL);
+
+	update_adapter(object, &iter, client);
+}
+
+static void remove_adapter(const char *path, BluetoothClient *client)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		gchar *value;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_PATH, &value, -1);
+
+		if (g_ascii_strcasecmp(path, value) == 0) {
+			GtkTreeIter child;
+
+			gtk_tree_store_set(priv->store, &iter,
+						COLUMN_ACTIVE, FALSE,
+						COLUMN_ADDRESS, NULL,
+						COLUMN_NAME, NULL, -1);
+
+			/* Remove the children */
+			if (gtk_tree_model_iter_children(GTK_TREE_MODEL(priv->store),
+							 &child, &iter) == FALSE)
+				return;
+
+			cont = gtk_tree_store_remove (priv->store, &child);
+			while (cont != FALSE)
+				cont = gtk_tree_store_remove (priv->store, &child);
+			return;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+}
+
+static void adapter_added(DBusGProxy *object,
+				const char *path, gpointer user_data)
+{
+	add_adapter(path, BLUETOOTH_CLIENT(user_data));
+}
+
+static void adapter_removed(DBusGProxy *object,
+				const char *path, gpointer user_data)
+{
+	remove_adapter(path, BLUETOOTH_CLIENT(user_data));
+}
+
+static void default_adapter_changed(DBusGProxy *object,
+				const char *path, gpointer user_data)
+{
+	BluetoothClient *client = (BluetoothClient *) user_data;
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+
+	g_free(priv->default_adapter);
+	if (path != NULL && *path != '\0')
+		priv->default_adapter = g_strdup(path);
+	else
+		priv->default_adapter = NULL;
+
+	g_object_notify (G_OBJECT (client), "default-adapter");
+}
+
+static void setup_manager(BluetoothClient *client)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GError *error = NULL;
+	char **array = NULL;
+
+	priv->manager_object = dbus_g_proxy_new_for_name(priv->conn, "org.bluez",
+					"/org/bluez", "org.bluez.Manager");
+
+	dbus_g_proxy_add_signal(priv->manager_object, "AdapterAdded",
+					G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(priv->manager_object, "AdapterAdded",
+				G_CALLBACK(adapter_added), client, NULL);
+
+	dbus_g_proxy_add_signal(priv->manager_object, "AdapterRemoved",
+					G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(priv->manager_object, "AdapterRemoved",
+				G_CALLBACK(adapter_removed), client, NULL);
+
+	dbus_g_proxy_add_signal(priv->manager_object, "DefaultAdapterChanged",
+					G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(priv->manager_object, "DefaultAdapterChanged",
+			G_CALLBACK(default_adapter_changed), client, NULL);
+
+	manager_default_adapter(priv->manager_object, &priv->default_adapter, NULL);
+
+	manager_list_adapters(priv->manager_object, &array, &error);
+
+	if (error == NULL) {
+		while (*array) {
+			add_adapter(*array, client);
+			array++;
+		}
+	} else
+		g_error_free(error);
+}
+
+static void name_owner_changed(DBusGProxy *object, const char *name,
+			const char *prev, const char *new, gpointer user_data)
+{
+	//BluetoothClient *client = BLUETOOTH_CLIENT(user_data);
+
+	if (!g_ascii_strcasecmp(name, "org.bluez") && *new == '\0') {
+		/* FIXME disable adapters */
+	}
+}
+
+static void setup_dbus(BluetoothClient *client)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	DBusGProxy *object;
+	GError *error = NULL;
+
+	priv->conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+	if (error != NULL) {
+		g_printerr("Connecting to system bus failed: %s\n",
+							error->message);
+		g_error_free(error);
+		return;
+	}
+
+	object = dbus_g_proxy_new_for_name(priv->conn, DBUS_SERVICE_DBUS,
+					DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
+
+	dbus_g_proxy_add_signal(object, "NameOwnerChanged",
+					G_TYPE_STRING, G_TYPE_STRING,
+					G_TYPE_STRING, G_TYPE_INVALID);
+
+	dbus_g_proxy_connect_signal(object, "NameOwnerChanged",
+				G_CALLBACK(name_owner_changed), client, NULL);
+}
+
+static void bluetooth_client_finalize(GObject *object)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(object);
+
+	/* Disconnect the handlers from setup_manager() */
+	g_signal_handlers_disconnect_by_func (priv->manager_object, adapter_added, object);
+	g_signal_handlers_disconnect_by_func (priv->manager_object, adapter_removed, object);
+	g_signal_handlers_disconnect_by_func (priv->manager_object, default_adapter_changed,
+					      object);
+
+	priv->registered = FALSE;
+	g_free(priv->default_adapter);
+	g_object_unref(G_OBJECT(priv->store));
+	g_object_unref (priv->manager_object);
+}
+
+static void bluetooth_client_init(BluetoothClient *client)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+
+	priv->registered = FALSE;
+
+	priv->store = gtk_tree_store_new(NUM_COLS, G_TYPE_STRING, G_TYPE_BOOLEAN,
+			G_TYPE_OBJECT, G_TYPE_STRING, G_TYPE_UINT,
+			G_TYPE_INT, G_TYPE_STRING, G_TYPE_UINT,
+			G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
+
+	setup_dbus(client);
+
+	setup_manager(client);
+}
+
+static void bluetooth_client_set_property(GObject *object, guint prop_id,
+					const GValue *value, GParamSpec *pspec)
+{
+	//BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(object);
+
+	switch (prop_id) {
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+		break;
+	}
+}
+
+static void bluetooth_client_get_property(GObject *object, guint prop_id,
+					GValue *value, GParamSpec *pspec)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(object);
+
+	switch (prop_id) {
+	case PROP_DEFAULT_ADAPTER:
+		g_value_set_string (value, priv->default_adapter);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+		break;
+	}
+}
+
+static void bluetooth_client_class_init(BluetoothClientClass *klass)
+{
+	GObjectClass *object_class;
+
+	g_type_class_add_private(klass, sizeof(BluetoothClientPrivate));
+
+	G_OBJECT_CLASS(klass)->finalize = bluetooth_client_finalize;
+
+	G_OBJECT_CLASS(klass)->set_property = bluetooth_client_set_property;
+	G_OBJECT_CLASS(klass)->get_property = bluetooth_client_get_property;
+
+	client_table_signals[DISCOVERY_STARTED] =
+		g_signal_new ("discovery-started",
+				G_TYPE_FROM_CLASS (klass),
+				G_SIGNAL_RUN_LAST,
+				G_STRUCT_OFFSET (BluetoothClientClass,
+							discovery_started),
+				NULL, NULL,
+				marshal_VOID__STRING_BOOLEAN,
+				G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_BOOLEAN);
+
+	client_table_signals[DISCOVERY_COMPLETED] =
+		g_signal_new ("discovery-completed",
+				G_TYPE_FROM_CLASS (klass),
+				G_SIGNAL_RUN_LAST,
+				G_STRUCT_OFFSET (BluetoothClientClass,
+							discovery_completed),
+				NULL, NULL,
+				marshal_VOID__STRING_BOOLEAN,
+				G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_BOOLEAN);
+
+	object_class = (GObjectClass *) klass;
+
+	g_object_class_install_property (object_class, PROP_DEFAULT_ADAPTER,
+					 g_param_spec_string ("default-adapter", NULL, NULL,
+							      NULL, G_PARAM_READABLE));
+
+	dbus_g_object_register_marshaller(marshal_VOID__STRING_UINT_INT,
+				G_TYPE_NONE, G_TYPE_STRING, G_TYPE_UINT,
+						G_TYPE_INT, G_TYPE_INVALID);
+
+	dbus_g_object_register_marshaller(marshal_VOID__STRING_STRING,
+						G_TYPE_NONE, G_TYPE_STRING,
+						G_TYPE_STRING, G_TYPE_INVALID);
+}
+
+BluetoothClient *bluetooth_client_new(void)
+{
+	if (self == NULL) {
+		self = BLUETOOTH_CLIENT(g_object_new(BLUETOOTH_TYPE_CLIENT, NULL));
+		return self;
+	} else {
+		return g_object_ref(self);
+	}
+}
+
+gboolean bluetooth_client_register_passkey_agent(BluetoothClient *client,
+		const char *path, const char *address, const void *info)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	DBusGProxy *proxy;
+
+	if (priv->registered == FALSE) {
+		dbus_g_object_type_install_info(BLUETOOTH_TYPE_CLIENT, info);
+
+		dbus_g_connection_register_g_object(priv->conn, path, G_OBJECT(client));
+
+		priv->registered = TRUE;
+	}
+
+	if (priv->default_adapter == NULL)
+		return FALSE;
+
+	proxy = dbus_g_proxy_new_for_name(priv->conn, "org.bluez",
+				priv->default_adapter, "org.bluez.Security");
+
+	security_register_passkey_agent(proxy, path, address, NULL);
+
+	g_object_unref(proxy);
+
+	return TRUE;
+}
+
+static void create_bonding_reply(DBusGProxy *proxy,
+					GError *error, gpointer userdata)
+{
+	//g_printf("create bonding reply\n");
+}
+
+gboolean bluetooth_client_create_bonding(BluetoothClient *client,
+					gchar *adapter, const gchar *address)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	if (adapter == NULL)
+		adapter = priv->default_adapter;
+
+	if (adapter == NULL)
+		return FALSE;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		DBusGProxy *object;
+		gchar *path;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_PATH, &path,
+						COLUMN_OBJECT, &object, -1);
+
+		if (g_ascii_strcasecmp(path, adapter) == 0) {
+			adapter_create_bonding_async(object, address,
+						create_bonding_reply, NULL);
+			return TRUE;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+
+	return FALSE;
+}
+
+static void remove_bonding_reply(DBusGProxy *proxy,
+					GError *error, gpointer userdata)
+{
+	//g_printf("remove bonding reply\n");
+}
+
+gboolean bluetooth_client_remove_bonding(BluetoothClient *client,
+					gchar *adapter, const gchar *address)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	if (adapter == NULL)
+		adapter = priv->default_adapter;
+
+	if (adapter == NULL)
+		return FALSE;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		DBusGProxy *object;
+		gchar *path;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_PATH, &path,
+						COLUMN_OBJECT, &object, -1);
+
+		if (g_ascii_strcasecmp(path, adapter) == 0) {
+			adapter_remove_bonding_async(object, address,
+						remove_bonding_reply, NULL);
+			return TRUE;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+
+	return FALSE;
+}
+
+static void set_trusted_reply(DBusGProxy *proxy,
+					GError *error, gpointer userdata)
+{
+	//g_printf("set trusted reply\n");
+}
+
+gboolean bluetooth_client_set_trusted(BluetoothClient *client,
+					gchar *adapter, const gchar *address)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	if (adapter == NULL)
+		adapter = priv->default_adapter;
+
+	if (adapter == NULL)
+		return FALSE;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		DBusGProxy *object;
+		gchar *path;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_PATH, &path,
+						COLUMN_OBJECT, &object, -1);
+
+		if (g_ascii_strcasecmp(path, adapter) == 0) {
+			adapter_set_trusted_async(object, address,
+						set_trusted_reply, NULL);
+			return TRUE;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+
+	return FALSE;
+}
+
+static void remove_trust_reply(DBusGProxy *proxy,
+					GError *error, gpointer userdata)
+{
+	//g_printf("remove trust reply\n");
+}
+
+gboolean bluetooth_client_remove_trust(BluetoothClient *client,
+					gchar *adapter, const gchar *address)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	if (adapter == NULL)
+		adapter = priv->default_adapter;
+
+	if (adapter == NULL)
+		return FALSE;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		DBusGProxy *object;
+		gchar *path;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_PATH, &path,
+						COLUMN_OBJECT, &object, -1);
+
+		if (g_ascii_strcasecmp(path, adapter) == 0) {
+			adapter_remove_trust_async(object, address,
+						remove_trust_reply, NULL);
+			return TRUE;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+
+	return FALSE;
+}
+
+static void disconnect_remote_device_reply(DBusGProxy *proxy,
+					GError *error, gpointer userdata)
+{
+	//g_printf("disconnect remote device reply\n");
+}
+
+gboolean bluetooth_client_disconnect(BluetoothClient *client,
+					gchar *adapter, const gchar *address)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	if (adapter == NULL)
+		adapter = priv->default_adapter;
+
+	if (adapter == NULL)
+		return FALSE;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		DBusGProxy *object;
+		gchar *path;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_PATH, &path,
+						COLUMN_OBJECT, &object, -1);
+
+		if (g_ascii_strcasecmp(path, adapter) == 0) {
+			adapter_disconnect_remote_device_async(object, address,
+					disconnect_remote_device_reply, NULL);
+			return TRUE;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+
+	return FALSE;
+}
+
+gboolean bluetooth_client_discover_devices(BluetoothClient *client, gchar *adapter)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	if (adapter == NULL)
+		adapter = priv->default_adapter;
+
+	if (adapter == NULL)
+		return FALSE;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		DBusGProxy *object;
+		gchar *path;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_PATH, &path,
+						COLUMN_OBJECT, &object,
+						-1);
+
+		if (g_ascii_strcasecmp(path, adapter) == 0) {
+			dbus_g_proxy_call(object, "DiscoverDevices",
+							NULL, G_TYPE_INVALID);
+			return TRUE;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+
+	return FALSE;
+}
+
+gboolean bluetooth_client_cancel_discovery(BluetoothClient *client, gchar *adapter)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	if (adapter == NULL)
+		adapter = priv->default_adapter;
+
+	if (adapter == NULL)
+		return FALSE;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		DBusGProxy *object;
+		gchar *path;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_PATH, &path,
+						COLUMN_OBJECT, &object, -1);
+
+		if (g_ascii_strcasecmp(path, adapter) == 0) {
+			dbus_g_proxy_call(object, "CancelDiscovery",
+							NULL, G_TYPE_INVALID);
+			return TRUE;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+
+	return FALSE;
+}
+
+GtkTreeModel *bluetooth_client_get_model(BluetoothClient *client)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+
+	g_object_ref(priv->store);
+
+	return GTK_TREE_MODEL(priv->store);
+}
+
+GtkTreeModel *bluetooth_client_get_model_simple(BluetoothClient *client)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	gboolean cont;
+
+	model = gtk_tree_model_filter_new(GTK_TREE_MODEL(priv->store), NULL);
+
+	gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(model),
+								COLUMN_ACTIVE);
+
+	if (gtk_tree_model_iter_n_children(model, NULL) != 1)
+		return model;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		gboolean active;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_ACTIVE, &active, -1);
+
+		if (active == TRUE) {
+			GtkTreePath *path;
+
+			path = gtk_tree_model_get_path(GTK_TREE_MODEL(priv->store), &iter);
+
+			g_object_unref(model);
+
+			model = gtk_tree_model_filter_new(GTK_TREE_MODEL(priv->store), path);
+
+			gtk_tree_path_free(path);
+
+			break;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+
+	return model;
+}
+
+static gboolean adapter_list_filter(GtkTreeModel *model,
+					GtkTreeIter *iter, gpointer data)
+{
+	gchar *path;
+	gboolean active;
+
+	gtk_tree_model_get(model, iter, COLUMN_PATH, &path,
+					COLUMN_ACTIVE, &active, -1);
+
+	if (path == NULL)
+		return FALSE;
+
+	g_free(path);
+
+	return active;
+}
+
+GtkTreeModel *bluetooth_client_get_model_adapter_list(BluetoothClient *client)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeModel *model;
+
+	model = gtk_tree_model_filter_new(GTK_TREE_MODEL(priv->store), NULL);
+
+	gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(model),
+					adapter_list_filter, NULL, NULL);
+
+	return model;
+}
+
+static gboolean device_active_filter(GtkTreeModel *model,
+					GtkTreeIter *iter, gpointer data)
+{
+	gboolean active;
+
+	gtk_tree_model_get(model, iter, COLUMN_ACTIVE, &active, -1);
+
+	return active;
+}
+
+GtkTreeModel *bluetooth_client_get_model_for_adapter(BluetoothClient *client,
+								gchar *adapter)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	gboolean cont;
+
+	if (adapter == NULL)
+		adapter = priv->default_adapter;
+
+	if (adapter == NULL)
+		return NULL;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		gchar *path;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_PATH, &path, -1);
+
+		if (g_ascii_strcasecmp(path, adapter) == 0) {
+			GtkTreePath *path;
+
+			path = gtk_tree_model_get_path(GTK_TREE_MODEL(priv->store), &iter);
+
+			model = gtk_tree_model_filter_new(GTK_TREE_MODEL(priv->store), path);
+
+			gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(model),
+							device_active_filter, NULL, NULL);
+
+			gtk_tree_path_free(path);
+
+			return model;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+
+	return NULL;
+}
+
+GtkTreeModel *bluetooth_client_get_model_with_filter(BluetoothClient *client,
+			gchar *adapter, GtkTreeModelFilterVisibleFunc func,
+								gpointer data)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	gboolean cont;
+
+	if (adapter == NULL)
+		adapter = priv->default_adapter;
+
+	if (adapter == NULL)
+		return NULL;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		gchar *path;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_PATH, &path, -1);
+
+		if (g_ascii_strcasecmp(path, adapter) == 0) {
+			GtkTreePath *path;
+
+			path = gtk_tree_model_get_path(GTK_TREE_MODEL(priv->store), &iter);
+
+			model = gtk_tree_model_filter_new(GTK_TREE_MODEL(priv->store), path);
+
+			if (func != NULL)
+				gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(model),
+								       func, data, NULL);
+
+			gtk_tree_path_free(path);
+
+			return model;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+
+	return NULL;
+}
+
+static gboolean device_bonded_filter(GtkTreeModel *model,
+					GtkTreeIter *iter, gpointer data)
+{
+	gboolean bonded, trusted, connected;
+
+	gtk_tree_model_get(model, iter, COLUMN_BONDED, &bonded,
+					COLUMN_TRUSTED, &trusted,
+					COLUMN_CONNECTED, &connected, -1);
+
+	return (bonded == TRUE || trusted == TRUE ||
+			connected == TRUE) ? TRUE : FALSE;
+}
+
+GtkTreeModel *bluetooth_client_get_model_bonded_list(BluetoothClient *client,
+								gchar *adapter)
+{
+	return bluetooth_client_get_model_with_filter(client, adapter,
+						device_bonded_filter, NULL);
+}

Added: trunk/src/bluez-gnome/client.h
==============================================================================
--- (empty file)
+++ trunk/src/bluez-gnome/client.h	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,131 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2005-2008  Marcel Holtmann <marcel holtmann org>
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifndef __BLUETOOTH_CLIENT_H
+#define __BLUETOOTH_CLIENT_H
+
+#include <glib-object.h>
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define BLUETOOTH_TYPE_CLIENT (bluetooth_client_get_type())
+#define BLUETOOTH_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+					BLUETOOTH_TYPE_CLIENT, BluetoothClient))
+#define BLUETOOTH_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
+					BLUETOOTH_TYPE_CLIENT, BluetoothClientClass))
+#define BLUETOOTH_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+							BLUETOOTH_TYPE_CLIENT))
+#define BLUETOOTH_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), \
+							BLUETOOTH_TYPE_CLIENT))
+#define BLUETOOTH_GET_CLIENT_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
+					BLUETOOTH_TYPE_CLIENT, BluetoothClientClass))
+
+typedef struct _BluetoothClient BluetoothClient;
+typedef struct _BluetoothClientClass BluetoothClientClass;
+
+struct _BluetoothClient {
+	GObject parent;
+};
+
+struct _BluetoothClientClass {
+	GObjectClass parent_class;
+
+	void (*discovery_started) (BluetoothClient *self, const char *adapter_path, gboolean is_default);
+	void (*discovery_completed) (BluetoothClient *self, const char *adapter_path, gboolean is_default);
+};
+
+GType bluetooth_client_get_type(void);
+
+BluetoothClient *bluetooth_client_new(void);
+
+enum {
+	COLUMN_PATH,
+	COLUMN_ACTIVE,
+	COLUMN_OBJECT,
+	COLUMN_ADDRESS,
+	COLUMN_CLASS,
+	COLUMN_RSSI,
+	COLUMN_NAME,
+	COLUMN_TYPE,
+	COLUMN_BONDED,
+	COLUMN_TRUSTED,
+	COLUMN_CONNECTED,
+	COLUMN_DISCOVERING,
+	NUM_COLS
+};
+
+enum {
+	BLUETOOTH_TYPE_ANY        = 1,
+	BLUETOOTH_TYPE_PHONE      = 1 << 1,
+	BLUETOOTH_TYPE_MODEM      = 1 << 2,
+	BLUETOOTH_TYPE_COMPUTER   = 1 << 3,
+	BLUETOOTH_TYPE_NETWORK    = 1 << 4,
+	BLUETOOTH_TYPE_HEADSET    = 1 << 5,
+	BLUETOOTH_TYPE_KEYBOARD   = 1 << 6,
+	BLUETOOTH_TYPE_MOUSE      = 1 << 7,
+	BLUETOOTH_TYPE_CAMERA     = 1 << 8,
+	BLUETOOTH_TYPE_PRINTER    = 1 << 9,
+	BLUETOOTH_TYPE_JOYPAD     = 1 << 10,
+	BLUETOOTH_TYPE_TABLET     = 1 << 11,
+};
+
+#define BLUETOOTH_TYPE_NUM_TYPES 12
+#define BLUETOOTH_TYPE_INPUT (BLUETOOTH_TYPE_KEYBOARD | BLUETOOTH_TYPE_MOUSE)
+
+const gchar *bluetooth_type_to_string(guint type);
+
+gboolean bluetooth_client_register_passkey_agent(BluetoothClient *self,
+		const char *path, const char *address, const void *info);
+
+gboolean bluetooth_client_create_bonding(BluetoothClient *self,
+					gchar *adapter, const gchar *address);
+gboolean bluetooth_client_remove_bonding(BluetoothClient *self,
+					gchar *adapter, const gchar *address);
+gboolean bluetooth_client_set_trusted(BluetoothClient *self,
+					gchar *adapter, const gchar *address);
+gboolean bluetooth_client_remove_trust(BluetoothClient *self,
+					gchar *adapter, const gchar *address);
+
+gboolean bluetooth_client_disconnect(BluetoothClient *self,
+					gchar *adapter, const gchar *address);
+
+gboolean bluetooth_client_discover_devices(BluetoothClient *self, gchar *adapter);
+
+gboolean bluetooth_client_cancel_discovery(BluetoothClient *self, gchar *adapter);
+
+GtkTreeModel *bluetooth_client_get_model(BluetoothClient *self);
+GtkTreeModel *bluetooth_client_get_model_simple(BluetoothClient *self);
+GtkTreeModel *bluetooth_client_get_model_adapter_list(BluetoothClient *self);
+GtkTreeModel *bluetooth_client_get_model_for_adapter(BluetoothClient *self,
+								gchar *adapter);
+GtkTreeModel *bluetooth_client_get_model_with_filter(BluetoothClient *self,
+			gchar *adapter, GtkTreeModelFilterVisibleFunc func,
+								gpointer data);
+GtkTreeModel *bluetooth_client_get_model_bonded_list(BluetoothClient *self,
+								gchar *adapter);
+
+G_END_DECLS
+
+#endif /* __BLUETOOTH_CLIENT_H */

Added: trunk/src/bluez-gnome/dbus-glue.h
==============================================================================
--- (empty file)
+++ trunk/src/bluez-gnome/dbus-glue.h	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,813 @@
+/* Generated by dbus-binding-tool; do not edit! */
+
+#include <glib/gtypes.h>
+#include <glib/gerror.h>
+#include <dbus/dbus-glib.h>
+
+G_BEGIN_DECLS
+
+#ifndef DBUS_GLIB_CLIENT_WRAPPERS_manager
+#define DBUS_GLIB_CLIENT_WRAPPERS_manager
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+manager_default_adapter (DBusGProxy *proxy, char ** OUT_arg0, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "DefaultAdapter", error, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg0, G_TYPE_INVALID);
+}
+
+typedef void (*manager_default_adapter_reply) (DBusGProxy *proxy, char * OUT_arg0, GError *error, gpointer userdata);
+
+static void
+manager_default_adapter_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  char * OUT_arg0;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg0, G_TYPE_INVALID);
+  (*(manager_default_adapter_reply)data->cb) (proxy, OUT_arg0, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+manager_default_adapter_async (DBusGProxy *proxy, manager_default_adapter_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "DefaultAdapter", manager_default_adapter_async_callback, stuff, g_free, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+manager_find_adapter (DBusGProxy *proxy, const char * IN_pattern, char ** OUT_arg1, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "FindAdapter", error, G_TYPE_STRING, IN_pattern, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg1, G_TYPE_INVALID);
+}
+
+typedef void (*manager_find_adapter_reply) (DBusGProxy *proxy, char * OUT_arg1, GError *error, gpointer userdata);
+
+static void
+manager_find_adapter_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  char * OUT_arg1;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg1, G_TYPE_INVALID);
+  (*(manager_find_adapter_reply)data->cb) (proxy, OUT_arg1, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+manager_find_adapter_async (DBusGProxy *proxy, const char * IN_pattern, manager_find_adapter_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "FindAdapter", manager_find_adapter_async_callback, stuff, g_free, G_TYPE_STRING, IN_pattern, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+manager_list_adapters (DBusGProxy *proxy, char *** OUT_arg0, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "ListAdapters", error, G_TYPE_INVALID, G_TYPE_STRV, OUT_arg0, G_TYPE_INVALID);
+}
+
+typedef void (*manager_list_adapters_reply) (DBusGProxy *proxy, char * *OUT_arg0, GError *error, gpointer userdata);
+
+static void
+manager_list_adapters_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  char ** OUT_arg0;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRV, &OUT_arg0, G_TYPE_INVALID);
+  (*(manager_list_adapters_reply)data->cb) (proxy, OUT_arg0, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+manager_list_adapters_async (DBusGProxy *proxy, manager_list_adapters_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "ListAdapters", manager_list_adapters_async_callback, stuff, g_free, G_TYPE_INVALID);
+}
+#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_manager */
+
+#ifndef DBUS_GLIB_CLIENT_WRAPPERS_security
+#define DBUS_GLIB_CLIENT_WRAPPERS_security
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+security_register_default_passkey_agent (DBusGProxy *proxy, const char * IN_path, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "RegisterDefaultPasskeyAgent", error, G_TYPE_STRING, IN_path, G_TYPE_INVALID, G_TYPE_INVALID);
+}
+
+typedef void (*security_register_default_passkey_agent_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
+
+static void
+security_register_default_passkey_agent_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
+  (*(security_register_default_passkey_agent_reply)data->cb) (proxy, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+security_register_default_passkey_agent_async (DBusGProxy *proxy, const char * IN_path, security_register_default_passkey_agent_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "RegisterDefaultPasskeyAgent", security_register_default_passkey_agent_async_callback, stuff, g_free, G_TYPE_STRING, IN_path, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+security_unregister_default_passkey_agent (DBusGProxy *proxy, const char * IN_path, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "UnregisterDefaultPasskeyAgent", error, G_TYPE_STRING, IN_path, G_TYPE_INVALID, G_TYPE_INVALID);
+}
+
+typedef void (*security_unregister_default_passkey_agent_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
+
+static void
+security_unregister_default_passkey_agent_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
+  (*(security_unregister_default_passkey_agent_reply)data->cb) (proxy, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+security_unregister_default_passkey_agent_async (DBusGProxy *proxy, const char * IN_path, security_unregister_default_passkey_agent_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "UnregisterDefaultPasskeyAgent", security_unregister_default_passkey_agent_async_callback, stuff, g_free, G_TYPE_STRING, IN_path, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+security_register_passkey_agent (DBusGProxy *proxy, const char * IN_path, const char * IN_address, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "RegisterPasskeyAgent", error, G_TYPE_STRING, IN_path, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID);
+}
+
+typedef void (*security_register_passkey_agent_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
+
+static void
+security_register_passkey_agent_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
+  (*(security_register_passkey_agent_reply)data->cb) (proxy, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+security_register_passkey_agent_async (DBusGProxy *proxy, const char * IN_path, const char * IN_address, security_register_passkey_agent_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "RegisterPasskeyAgent", security_register_passkey_agent_async_callback, stuff, g_free, G_TYPE_STRING, IN_path, G_TYPE_STRING, IN_address, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+security_unregister_passkey_agent (DBusGProxy *proxy, const char * IN_path, const char * IN_address, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "UnregisterPasskeyAgent", error, G_TYPE_STRING, IN_path, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID);
+}
+
+typedef void (*security_unregister_passkey_agent_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
+
+static void
+security_unregister_passkey_agent_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
+  (*(security_unregister_passkey_agent_reply)data->cb) (proxy, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+security_unregister_passkey_agent_async (DBusGProxy *proxy, const char * IN_path, const char * IN_address, security_unregister_passkey_agent_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "UnregisterPasskeyAgent", security_unregister_passkey_agent_async_callback, stuff, g_free, G_TYPE_STRING, IN_path, G_TYPE_STRING, IN_address, G_TYPE_INVALID);
+}
+#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_security */
+
+#ifndef DBUS_GLIB_CLIENT_WRAPPERS_adapter
+#define DBUS_GLIB_CLIENT_WRAPPERS_adapter
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_get_address (DBusGProxy *proxy, char ** OUT_arg0, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "GetAddress", error, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg0, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_get_address_reply) (DBusGProxy *proxy, char * OUT_arg0, GError *error, gpointer userdata);
+
+static void
+adapter_get_address_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  char * OUT_arg0;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg0, G_TYPE_INVALID);
+  (*(adapter_get_address_reply)data->cb) (proxy, OUT_arg0, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_get_address_async (DBusGProxy *proxy, adapter_get_address_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "GetAddress", adapter_get_address_async_callback, stuff, g_free, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_get_mode (DBusGProxy *proxy, char ** OUT_arg0, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "GetMode", error, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg0, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_get_mode_reply) (DBusGProxy *proxy, char * OUT_arg0, GError *error, gpointer userdata);
+
+static void
+adapter_get_mode_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  char * OUT_arg0;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg0, G_TYPE_INVALID);
+  (*(adapter_get_mode_reply)data->cb) (proxy, OUT_arg0, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_get_mode_async (DBusGProxy *proxy, adapter_get_mode_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "GetMode", adapter_get_mode_async_callback, stuff, g_free, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_get_name (DBusGProxy *proxy, char ** OUT_arg0, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "GetName", error, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg0, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_get_name_reply) (DBusGProxy *proxy, char * OUT_arg0, GError *error, gpointer userdata);
+
+static void
+adapter_get_name_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  char * OUT_arg0;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg0, G_TYPE_INVALID);
+  (*(adapter_get_name_reply)data->cb) (proxy, OUT_arg0, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_get_name_async (DBusGProxy *proxy, adapter_get_name_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "GetName", adapter_get_name_async_callback, stuff, g_free, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_get_major_class (DBusGProxy *proxy, char ** OUT_arg0, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "GetMajorClass", error, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg0, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_get_major_class_reply) (DBusGProxy *proxy, char * OUT_arg0, GError *error, gpointer userdata);
+
+static void
+adapter_get_major_class_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  char * OUT_arg0;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg0, G_TYPE_INVALID);
+  (*(adapter_get_major_class_reply)data->cb) (proxy, OUT_arg0, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_get_major_class_async (DBusGProxy *proxy, adapter_get_major_class_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "GetMajorClass", adapter_get_major_class_async_callback, stuff, g_free, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_get_minor_class (DBusGProxy *proxy, char ** OUT_arg0, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "GetMinorClass", error, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg0, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_get_minor_class_reply) (DBusGProxy *proxy, char * OUT_arg0, GError *error, gpointer userdata);
+
+static void
+adapter_get_minor_class_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  char * OUT_arg0;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg0, G_TYPE_INVALID);
+  (*(adapter_get_minor_class_reply)data->cb) (proxy, OUT_arg0, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_get_minor_class_async (DBusGProxy *proxy, adapter_get_minor_class_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "GetMinorClass", adapter_get_minor_class_async_callback, stuff, g_free, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_list_remote_devices (DBusGProxy *proxy, char *** OUT_arg0, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "ListRemoteDevices", error, G_TYPE_INVALID, G_TYPE_STRV, OUT_arg0, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_list_remote_devices_reply) (DBusGProxy *proxy, char * *OUT_arg0, GError *error, gpointer userdata);
+
+static void
+adapter_list_remote_devices_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  char ** OUT_arg0;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRV, &OUT_arg0, G_TYPE_INVALID);
+  (*(adapter_list_remote_devices_reply)data->cb) (proxy, OUT_arg0, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_list_remote_devices_async (DBusGProxy *proxy, adapter_list_remote_devices_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "ListRemoteDevices", adapter_list_remote_devices_async_callback, stuff, g_free, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_list_connections (DBusGProxy *proxy, char *** OUT_arg0, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "ListConnections", error, G_TYPE_INVALID, G_TYPE_STRV, OUT_arg0, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_list_connections_reply) (DBusGProxy *proxy, char * *OUT_arg0, GError *error, gpointer userdata);
+
+static void
+adapter_list_connections_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  char ** OUT_arg0;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRV, &OUT_arg0, G_TYPE_INVALID);
+  (*(adapter_list_connections_reply)data->cb) (proxy, OUT_arg0, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_list_connections_async (DBusGProxy *proxy, adapter_list_connections_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "ListConnections", adapter_list_connections_async_callback, stuff, g_free, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_list_bondings (DBusGProxy *proxy, char *** OUT_arg0, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "ListBondings", error, G_TYPE_INVALID, G_TYPE_STRV, OUT_arg0, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_list_bondings_reply) (DBusGProxy *proxy, char * *OUT_arg0, GError *error, gpointer userdata);
+
+static void
+adapter_list_bondings_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  char ** OUT_arg0;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRV, &OUT_arg0, G_TYPE_INVALID);
+  (*(adapter_list_bondings_reply)data->cb) (proxy, OUT_arg0, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_list_bondings_async (DBusGProxy *proxy, adapter_list_bondings_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "ListBondings", adapter_list_bondings_async_callback, stuff, g_free, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_list_trusts (DBusGProxy *proxy, char *** OUT_arg0, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "ListTrusts", error, G_TYPE_INVALID, G_TYPE_STRV, OUT_arg0, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_list_trusts_reply) (DBusGProxy *proxy, char * *OUT_arg0, GError *error, gpointer userdata);
+
+static void
+adapter_list_trusts_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  char ** OUT_arg0;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRV, &OUT_arg0, G_TYPE_INVALID);
+  (*(adapter_list_trusts_reply)data->cb) (proxy, OUT_arg0, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_list_trusts_async (DBusGProxy *proxy, adapter_list_trusts_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "ListTrusts", adapter_list_trusts_async_callback, stuff, g_free, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_disconnect_remote_device (DBusGProxy *proxy, const char * IN_address, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "DisconnectRemoteDevice", error, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_disconnect_remote_device_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
+
+static void
+adapter_disconnect_remote_device_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
+  (*(adapter_disconnect_remote_device_reply)data->cb) (proxy, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_disconnect_remote_device_async (DBusGProxy *proxy, const char * IN_address, adapter_disconnect_remote_device_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "DisconnectRemoteDevice", adapter_disconnect_remote_device_async_callback, stuff, g_free, G_TYPE_STRING, IN_address, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_create_bonding (DBusGProxy *proxy, const char * IN_address, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "CreateBonding", error, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_create_bonding_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
+
+static void
+adapter_create_bonding_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
+  (*(adapter_create_bonding_reply)data->cb) (proxy, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_create_bonding_async (DBusGProxy *proxy, const char * IN_address, adapter_create_bonding_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "CreateBonding", adapter_create_bonding_async_callback, stuff, g_free, G_TYPE_STRING, IN_address, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_remove_bonding (DBusGProxy *proxy, const char * IN_address, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "RemoveBonding", error, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_remove_bonding_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
+
+static void
+adapter_remove_bonding_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
+  (*(adapter_remove_bonding_reply)data->cb) (proxy, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_remove_bonding_async (DBusGProxy *proxy, const char * IN_address, adapter_remove_bonding_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "RemoveBonding", adapter_remove_bonding_async_callback, stuff, g_free, G_TYPE_STRING, IN_address, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_set_trusted (DBusGProxy *proxy, const char * IN_address, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "SetTrusted", error, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_set_trusted_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
+
+static void
+adapter_set_trusted_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
+  (*(adapter_set_trusted_reply)data->cb) (proxy, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_set_trusted_async (DBusGProxy *proxy, const char * IN_address, adapter_set_trusted_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "SetTrusted", adapter_set_trusted_async_callback, stuff, g_free, G_TYPE_STRING, IN_address, G_TYPE_INVALID);
+}
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+gboolean
+adapter_remove_trust (DBusGProxy *proxy, const char * IN_address, GError **error)
+
+{
+  return dbus_g_proxy_call (proxy, "RemoveTrust", error, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID);
+}
+
+typedef void (*adapter_remove_trust_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
+
+static void
+adapter_remove_trust_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+{
+  DBusGAsyncData *data = (DBusGAsyncData*) user_data;
+  GError *error = NULL;
+  dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
+  (*(adapter_remove_trust_reply)data->cb) (proxy, error, data->userdata);
+  return;
+}
+
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+DBusGProxyCall*
+adapter_remove_trust_async (DBusGProxy *proxy, const char * IN_address, adapter_remove_trust_reply callback, gpointer userdata)
+
+{
+  DBusGAsyncData *stuff;
+  stuff = g_new (DBusGAsyncData, 1);
+  stuff->cb = G_CALLBACK (callback);
+  stuff->userdata = userdata;
+  return dbus_g_proxy_begin_call (proxy, "RemoveTrust", adapter_remove_trust_async_callback, stuff, g_free, G_TYPE_STRING, IN_address, G_TYPE_INVALID);
+}
+#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_adapter */
+
+G_END_DECLS

Added: trunk/src/bluez-gnome/marshal.c
==============================================================================
--- (empty file)
+++ trunk/src/bluez-gnome/marshal.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,236 @@
+
+#include	<glib-object.h>
+
+
+#ifdef G_ENABLE_DEBUG
+#define g_marshal_value_peek_boolean(v)  g_value_get_boolean (v)
+#define g_marshal_value_peek_char(v)     g_value_get_char (v)
+#define g_marshal_value_peek_uchar(v)    g_value_get_uchar (v)
+#define g_marshal_value_peek_int(v)      g_value_get_int (v)
+#define g_marshal_value_peek_uint(v)     g_value_get_uint (v)
+#define g_marshal_value_peek_long(v)     g_value_get_long (v)
+#define g_marshal_value_peek_ulong(v)    g_value_get_ulong (v)
+#define g_marshal_value_peek_int64(v)    g_value_get_int64 (v)
+#define g_marshal_value_peek_uint64(v)   g_value_get_uint64 (v)
+#define g_marshal_value_peek_enum(v)     g_value_get_enum (v)
+#define g_marshal_value_peek_flags(v)    g_value_get_flags (v)
+#define g_marshal_value_peek_float(v)    g_value_get_float (v)
+#define g_marshal_value_peek_double(v)   g_value_get_double (v)
+#define g_marshal_value_peek_string(v)   (char*) g_value_get_string (v)
+#define g_marshal_value_peek_param(v)    g_value_get_param (v)
+#define g_marshal_value_peek_boxed(v)    g_value_get_boxed (v)
+#define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
+#define g_marshal_value_peek_object(v)   g_value_get_object (v)
+#else /* !G_ENABLE_DEBUG */
+/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
+ *          Do not access GValues directly in your code. Instead, use the
+ *          g_value_get_*() functions
+ */
+#define g_marshal_value_peek_boolean(v)  (v)->data[0].v_int
+#define g_marshal_value_peek_char(v)     (v)->data[0].v_int
+#define g_marshal_value_peek_uchar(v)    (v)->data[0].v_uint
+#define g_marshal_value_peek_int(v)      (v)->data[0].v_int
+#define g_marshal_value_peek_uint(v)     (v)->data[0].v_uint
+#define g_marshal_value_peek_long(v)     (v)->data[0].v_long
+#define g_marshal_value_peek_ulong(v)    (v)->data[0].v_ulong
+#define g_marshal_value_peek_int64(v)    (v)->data[0].v_int64
+#define g_marshal_value_peek_uint64(v)   (v)->data[0].v_uint64
+#define g_marshal_value_peek_enum(v)     (v)->data[0].v_long
+#define g_marshal_value_peek_flags(v)    (v)->data[0].v_ulong
+#define g_marshal_value_peek_float(v)    (v)->data[0].v_float
+#define g_marshal_value_peek_double(v)   (v)->data[0].v_double
+#define g_marshal_value_peek_string(v)   (v)->data[0].v_pointer
+#define g_marshal_value_peek_param(v)    (v)->data[0].v_pointer
+#define g_marshal_value_peek_boxed(v)    (v)->data[0].v_pointer
+#define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
+#define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
+#endif /* !G_ENABLE_DEBUG */
+
+
+/* VOID:STRING,UINT,INT (marshal.list:1) */
+void
+marshal_VOID__STRING_UINT_INT (GClosure     *closure,
+                               GValue       *return_value G_GNUC_UNUSED,
+                               guint         n_param_values,
+                               const GValue *param_values,
+                               gpointer      invocation_hint G_GNUC_UNUSED,
+                               gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__STRING_UINT_INT) (gpointer     data1,
+                                                      gpointer     arg_1,
+                                                      guint        arg_2,
+                                                      gint         arg_3,
+                                                      gpointer     data2);
+  register GMarshalFunc_VOID__STRING_UINT_INT callback;
+  register GCClosure *cc = (GCClosure*) closure;
+  register gpointer data1, data2;
+
+  g_return_if_fail (n_param_values == 4);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__STRING_UINT_INT) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_string (param_values + 1),
+            g_marshal_value_peek_uint (param_values + 2),
+            g_marshal_value_peek_int (param_values + 3),
+            data2);
+}
+
+/* VOID:STRING,STRING (marshal.list:2) */
+void
+marshal_VOID__STRING_STRING (GClosure     *closure,
+                             GValue       *return_value G_GNUC_UNUSED,
+                             guint         n_param_values,
+                             const GValue *param_values,
+                             gpointer      invocation_hint G_GNUC_UNUSED,
+                             gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__STRING_STRING) (gpointer     data1,
+                                                    gpointer     arg_1,
+                                                    gpointer     arg_2,
+                                                    gpointer     data2);
+  register GMarshalFunc_VOID__STRING_STRING callback;
+  register GCClosure *cc = (GCClosure*) closure;
+  register gpointer data1, data2;
+
+  g_return_if_fail (n_param_values == 3);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__STRING_STRING) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_string (param_values + 1),
+            g_marshal_value_peek_string (param_values + 2),
+            data2);
+}
+
+/* VOID:STRING,BOOLEAN (marshal.list:3) */
+void
+marshal_VOID__STRING_BOOLEAN (GClosure     *closure,
+                              GValue       *return_value G_GNUC_UNUSED,
+                              guint         n_param_values,
+                              const GValue *param_values,
+                              gpointer      invocation_hint G_GNUC_UNUSED,
+                              gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__STRING_BOOLEAN) (gpointer     data1,
+                                                     gpointer     arg_1,
+                                                     gboolean     arg_2,
+                                                     gpointer     data2);
+  register GMarshalFunc_VOID__STRING_BOOLEAN callback;
+  register GCClosure *cc = (GCClosure*) closure;
+  register gpointer data1, data2;
+
+  g_return_if_fail (n_param_values == 3);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__STRING_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_string (param_values + 1),
+            g_marshal_value_peek_boolean (param_values + 2),
+            data2);
+}
+
+/* VOID:STRING,STRING,UINT64 (marshal.list:4) */
+void
+marshal_VOID__STRING_STRING_UINT64 (GClosure     *closure,
+                                    GValue       *return_value G_GNUC_UNUSED,
+                                    guint         n_param_values,
+                                    const GValue *param_values,
+                                    gpointer      invocation_hint G_GNUC_UNUSED,
+                                    gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__STRING_STRING_UINT64) (gpointer     data1,
+                                                           gpointer     arg_1,
+                                                           gpointer     arg_2,
+                                                           guint64      arg_3,
+                                                           gpointer     data2);
+  register GMarshalFunc_VOID__STRING_STRING_UINT64 callback;
+  register GCClosure *cc = (GCClosure*) closure;
+  register gpointer data1, data2;
+
+  g_return_if_fail (n_param_values == 4);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__STRING_STRING_UINT64) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_string (param_values + 1),
+            g_marshal_value_peek_string (param_values + 2),
+            g_marshal_value_peek_uint64 (param_values + 3),
+            data2);
+}
+
+/* VOID:UINT64 (marshal.list:5) */
+void
+marshal_VOID__UINT64 (GClosure     *closure,
+                      GValue       *return_value G_GNUC_UNUSED,
+                      guint         n_param_values,
+                      const GValue *param_values,
+                      gpointer      invocation_hint G_GNUC_UNUSED,
+                      gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__UINT64) (gpointer     data1,
+                                             guint64      arg_1,
+                                             gpointer     data2);
+  register GMarshalFunc_VOID__UINT64 callback;
+  register GCClosure *cc = (GCClosure*) closure;
+  register gpointer data1, data2;
+
+  g_return_if_fail (n_param_values == 2);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__UINT64) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_uint64 (param_values + 1),
+            data2);
+}
+

Added: trunk/src/bluez-gnome/marshal.h
==============================================================================
--- (empty file)
+++ trunk/src/bluez-gnome/marshal.h	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,52 @@
+
+#ifndef __marshal_MARSHAL_H__
+#define __marshal_MARSHAL_H__
+
+#include	<glib-object.h>
+
+G_BEGIN_DECLS
+
+/* VOID:STRING,UINT,INT (marshal.list:1) */
+extern void marshal_VOID__STRING_UINT_INT (GClosure     *closure,
+                                           GValue       *return_value,
+                                           guint         n_param_values,
+                                           const GValue *param_values,
+                                           gpointer      invocation_hint,
+                                           gpointer      marshal_data);
+
+/* VOID:STRING,STRING (marshal.list:2) */
+extern void marshal_VOID__STRING_STRING (GClosure     *closure,
+                                         GValue       *return_value,
+                                         guint         n_param_values,
+                                         const GValue *param_values,
+                                         gpointer      invocation_hint,
+                                         gpointer      marshal_data);
+
+/* VOID:STRING,BOOLEAN (marshal.list:3) */
+extern void marshal_VOID__STRING_BOOLEAN (GClosure     *closure,
+                                          GValue       *return_value,
+                                          guint         n_param_values,
+                                          const GValue *param_values,
+                                          gpointer      invocation_hint,
+                                          gpointer      marshal_data);
+
+/* VOID:STRING,STRING,UINT64 (marshal.list:4) */
+extern void marshal_VOID__STRING_STRING_UINT64 (GClosure     *closure,
+                                                GValue       *return_value,
+                                                guint         n_param_values,
+                                                const GValue *param_values,
+                                                gpointer      invocation_hint,
+                                                gpointer      marshal_data);
+
+/* VOID:UINT64 (marshal.list:5) */
+extern void marshal_VOID__UINT64 (GClosure     *closure,
+                                  GValue       *return_value,
+                                  guint         n_param_values,
+                                  const GValue *param_values,
+                                  gpointer      invocation_hint,
+                                  gpointer      marshal_data);
+
+G_END_DECLS
+
+#endif /* __marshal_MARSHAL_H__ */
+

Added: trunk/src/callbacks.h
==============================================================================
--- (empty file)
+++ trunk/src/callbacks.h	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,179 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file callbacks.h
+ * @brief GUI callbacks
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ *
+ * Defines GUI callbacks. Functions are documented in C-files.
+ */
+ 
+#ifndef MBCA_CALLBACKS_H
+#define MBCA_CALLBACKS_H
+
+#include "common.h"
+
+G_BEGIN_DECLS
+
+/*******************************************************************************
+ * GtkAssistant - main.c *
+ *************************/
+void
+mbca_assistant_apply_cb (GtkAssistant* assistant,
+					gpointer user_data);
+void
+mbca_assistant_cancel_cb (GtkButton* button,
+					 gpointer user_data);
+void
+mbca_assistant_close_cb (GtkButton* button,
+					gpointer user_data);
+void
+mbca_assistant_prepare_cb (GtkAssistant* assistant,
+					  GtkWidget* page,
+					  gpointer user_data);
+
+
+/*******************************************************************************
+ * Connection method page - method_page.c *
+ ******************************************/
+void
+mbca_method_page_prepare_cb (GtkAssistant* assistant,
+					    GtkWidget* page,
+					    gpointer user_data);
+
+void
+mbca_bluetooth_radiobutton_clicked_cb (GtkButton* button,
+							    gpointer user_data);
+void
+mbca_builtin_radiobutton_clicked_cb (GtkButton* button,
+						       gpointer user_data);
+void
+mbca_pcmcia_radiobutton_clicked_cb (GtkButton* button,
+						      gpointer user_data);
+void
+mbca_serialcable_radiobutton_clicked_cb (GtkButton* button,
+								 gpointer user_data);
+void
+mbca_usb_radiobutton_clicked_cb (GtkButton* button,
+						   gpointer user_data);
+
+/*******************************************************************************
+ * Bluetooth page - bluetooth_page.c *
+ *************************************/
+ 
+void
+mbca_bluetooth_page_prepare_cb (GtkAssistant* assistant,
+						  GtkWidget* page,
+						  gpointer user_data);
+
+void
+mbca_bluetooth_selected_device_changed(BluetoothDeviceSelection* selector,
+							    gchar* address,
+							    gpointer user_data);
+				    
+void
+mbca_bluetooth_manual_checkbutton_toggled_cb (GtkToggleButton* togglebutton,
+									 gpointer user_data);
+
+void
+mbca_bluetooth_manual_entry_changed_cb (GtkEditable* editable,
+								gpointer user_data);
+						
+gpointer
+mbca_bluetooth_rescan_cb (gpointer data);
+
+/*******************************************************************************
+ * Serial cable page - serial_page.c *
+ *************************************/
+void
+mbca_serial_page_prepare_cb (GtkAssistant* assistant,
+					    GtkWidget* page,
+					    gpointer user_data);
+void
+mbca_serial_manual_checkbutton_toggled_cb (GtkToggleButton* togglebutton,
+								   gpointer user_data);
+
+void
+mbca_serial_manual_entry_changed_cb (GtkEditable* editable,
+							  gpointer user_data);
+
+void
+mbca_serial_manual_baud_entry_changed_cb (GtkEditable* editable,
+								  gpointer user_data);
+void
+mbca_serial_treeview_selection_changed_cb (GtkTreeSelection* selection,
+								   gpointer          user_data);
+
+void
+mbca_serial_baud_treeview_selection_changed_cb (GtkTreeSelection* selection,
+									   gpointer          user_data);
+
+/*******************************************************************************
+ * HAL page - hal_page.c *
+ *************************/
+void
+mbca_hal_page_prepare_cb (GtkAssistant* assistant,
+					 GtkWidget* page,
+					 gpointer user_data);
+
+void
+mbca_hal_treeview_selection_changed_cb (GtkTreeSelection* selection,
+							     gpointer          user_data);
+
+/*******************************************************************************
+ * Service provider page - provider_page.c *
+ *******************************************/
+void
+mbca_provider_page_prepare_cb (GtkAssistant* assistant,
+					      GtkWidget* page,
+					      gpointer user_data);
+void
+mbca_country_selection_changed_cb (GtkTreeSelection* selection,
+							gpointer user_data);
+void
+mbca_provider_selection_changed_cb (GtkTreeSelection* selection,
+							 gpointer user_data);
+
+gboolean
+mbca_country_code_qyery_tooltip_cb (GtkWidget* widget,
+							 gint x,
+							 gint y,
+							 gboolean keyboard_mode,
+							 GtkTooltip* tooltip,
+							 gpointer userdata);
+
+gpointer
+mbca_construct_provider_page_cb (gpointer data);
+
+/*******************************************************************************
+ * Summary page - summary_page.c *
+ *********************************/
+void
+mbca_summary_page_prepare_cb (GtkAssistant* assistant,
+					     GtkWidget* page,
+					     gpointer user_data);
+void
+mbca_summary_name_entry_changed_cb (GtkEditable* editable,
+							 gpointer user_data);
+
+G_END_DECLS
+#endif /* MBCA_CALLBACKS_H */

Added: trunk/src/common.c
==============================================================================
--- (empty file)
+++ trunk/src/common.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,69 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file common.c
+ * @brief implements common bits and pieces
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ *
+ * Implementation of common structures and includes.
+ */
+
+#include "common.h"
+
+enum AssistantPages
+mbca_page_name_to_number (const gchar* name)
+{
+	if (g_utf8_collate (name, "intro_page") == 0)
+	{
+		return PAGE_INTRO;
+	}
+	else if (g_utf8_collate (name, "method_page") == 0)
+	{
+		return PAGE_METHOD;
+	}
+	else if (g_utf8_collate (name, "bluetooth_page") == 0)
+	{
+		return PAGE_BLUETOOTH;
+	}
+	else if (g_utf8_collate (name, "serial_page") == 0)
+	{
+		return PAGE_SERIAL;
+	}
+	else if (g_utf8_collate (name, "hal_page") == 0)
+	{
+		return PAGE_HAL;
+	}
+	else if (g_utf8_collate (name, "provider_page") == 0)
+	{
+		return PAGE_PROVIDER;
+	}
+	else if (g_utf8_collate (name, "summary_page") == 0)
+	{
+		return PAGE_SUMMARY;
+	}
+	else
+	{
+		g_warn_if_reached ();
+	}
+
+	return PAGE_INTRO;
+}

Added: trunk/src/common.h
==============================================================================
--- (empty file)
+++ trunk/src/common.h	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,259 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file common.h
+ * @brief defines common bits and pieces
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ *
+ * Definition of common structures and includes.
+ */
+ 
+#ifndef MBCA_COMMON_H
+#define MBCA_COMMON_H
+
+#include "../config.h"
+
+#include "mbca_serviceprovider_private.h"
+#include "serviceprovider_parser.h"
+#include "mbca_assistant.h"
+
+#include "bluez-gnome/bluetooth-device-selection.h"
+#include "bluez-gnome/client.h"
+ 
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <glib/gi18n-lib.h>
+#include <hal/libhal.h>
+
+#define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
+#include <libgweather/gweather-xml.h>
+
+#define RESOURCE_DIR PACKAGE_DATA_DIR "/" PACKAGE
+#define MBCA_UI_DEFINITION RESOURCE_DIR "/mbca.ui"
+
+/** @todo make me a configure option */
+#define SERVICE_PROVIDERS_FILE "/usr/share/mobile-broadband-provider-info/serviceproviders.xml"
+
+G_BEGIN_DECLS
+
+/**
+ * @brief page numbers
+ *
+ * Page numbers for assistants pages.
+ * 
+ * @note If pages are added to the UI definition this enum must be updated to
+ *	    correspond with the new page layout.
+ */
+enum AssistantPages
+{
+	PAGE_INTRO = 0,
+	PAGE_METHOD,
+	PAGE_BLUETOOTH,
+	PAGE_SERIAL,
+	PAGE_HAL,
+	PAGE_PROVIDER,
+	PAGE_SUMMARY
+};
+
+/**
+ * @brief serial liststore columns
+ *
+ * columns of serial device list on serial page
+ */
+enum SerialListStoreColumns
+{
+	SERIAL_SUBSYSTEM_COLUMN, /**< subsystem reported by HAL	*/
+	SERIAL_PORT_COLUMN,		/**< device path				*/
+	SERIAL_N_COLUMNS		/**< total number of columns		*/
+};
+
+/**
+ *Â brief serial baud liststore columns
+ *
+ * columns of baud rate list on serial page
+ */
+enum SerialBaudListStoreColumns
+{
+	SERIALBAUD_RATE_COLUMN,  /**< BAUD rate				*/
+	SERIALBAUD_N_COLUMNS	/**< total number of columns  */
+};
+
+/**
+ *Â brief hal device liststore columns
+ *
+ * columns of device list on HAL page
+ */
+enum HALDeviceListStoreColumns
+{
+	HAL_PRODUCT_COLUMN, /**< device product name */
+	HAL_VENDOR_COLUMN,  /**< device vendor name */
+	HAL_UDI_COLUMN,	/**< HAL udi of the device */
+	HAL_N_COLUMNS		/**< total number of columns  */
+};
+
+/**
+ * @brief country liststore columns
+ *
+ * columns of country list on provider page
+ */
+enum CountryListStoreColumns
+{
+	COUNTRY_CODE_COLUMN,		/**< ISO 3166-1 alpha-2 code of a country  */
+	COUNTRY_NAME_COLUMN,		/**< localized name of a country		   */
+	COUNTRY_PROVIDERS_COLUMN,	/**< GSList of providers of a country	   */
+	COUNTRY_SORTED_COLUMN,		/**< helper for automatic sorting		   */
+	COUNTRY_N_COLUMNS			/**< total number of columns			   */
+};
+
+/**
+ * @brief providers liststore columns
+ *
+ * columns of provider list on provider page
+ */
+enum ProvidersListStoreColumns
+{
+	PROVIDER_NAME_COLUMN,    /**< name of the service provider		*/
+	PROVIDER_DATA_COLUMN,    /**< pointer to ServiceProvider struct  */
+	PROVIDER_N_COLUMNS		/**< total number of columns			*/
+};
+
+/**
+ *Â brief class private members
+ *
+ * Private members of the assistant class.
+ * All databases and models are shared between instances.
+ *
+ * @note instances <b>must not</b> alter any model. They are strictly readers!
+ */
+struct _MBCAAssistantClassPrivate
+{
+	DBusConnection* halconn; /**< connection to HAL */
+	LibHalContext* halctx;   /**< HAL context for halconn */
+
+	GtkListStore* serial_store;
+	GtkListStore* baud_store;
+	GtkListStore* hal_store;		   /**< constains available HAL devices  */	
+
+
+	/* Provider page resource loading thread
+	 *  - these members should be accessed with great care to avoid any nasty
+	 *    race or other concurrency issues
+	 */
+	GThread* provider_thread; /**< thread for loading provider page data
+						  *   in the background */
+
+	GtkTreeModel* gweather_database; /**< database containing country
+							    *   information from libgweather */
+	
+	GtkListStore* country_store;	   /**< contains available countries */
+
+	gchar* country_code; /**< ISO 3166-1 alpha-2 code of systems country */
+	
+	volatile gboolean abort_provider_thread; /**< if TRUE interrupts loading
+									  */
+	volatile gboolean provider_thread_ready; /**< TRUE if loading is done   */
+	
+	GMutex* instances_mutex;	  /**< mutex for waiting_instances */
+	GSList* waiting_instances; /**< instances waiting for resources, see
+						   *   comments at the end of assistant_init()
+						   */ 
+						   
+	GMutex* trigger_mutex;
+	
+	
+	GSList* database;			   /**< service provider database    */
+};
+
+/**
+ *Â brief instance private members
+ *
+ * Private members of a instance of the assistant.
+ */
+struct _MBCAAssistantPrivate
+{
+	gboolean dispose_has_run;
+
+	enum MBCAAssistantState state;
+	
+	/* Generic */
+	GtkBuilder* builder;	/**< GtkBuilder instance containing the GUI that
+						 *   is built from UI Definition         */
+	GtkAssistant* assistant; /**< commodity pointer to mbca_assistant */
+
+	MBCAConfiguration* conf; /**< configuration that is filled during steps */
+	
+	gchar* nice_device_name; /**< humanly pleasant name for device          */
+	gchar* hal_device_type;  /**< device type user has selected for HAL device
+						 */
+	gchar* provider_name;    /**< name of the selected provider for summary */
+	gchar* country_name;	/**< name of the selected country for summary  */
+
+	
+	gboolean device_is_preset; /**< set TRUE if device and address are preset
+						   */
+	gboolean done;			  /**< TRUE if apply() callback was reached */
+
+
+	/* Bluetooth page */
+	GtkWidget* btselector; /**< Bluetooth device selector widget */
+
+	GThread* btrescan_thread; /**< rescans for new BT devices */
+
+	volatile gboolean btrescan_enabled; /**< if TRUE rescan is enabled     */
+	volatile gboolean exit_btrescan;    /**< if TRUE btrescan thread exits */
+
+
+	/* Serial page */
+	gboolean serial_device_set; /**< TRUE if conf.device is set */
+	gboolean serial_baud_set;   /**< TRUE if conf.baud is set   */
+
+
+	/* HAL page*/
+	gboolean hal_page_initialized; /**< TRUE, if hal_page is initialized */
+
+
+	/* Service provider page */
+	gboolean country_list_sorted; /**< TRUE is country list is initially
+							 *   sorted.				    */ 
+
+
+	MBCAAssistantClassPrivate* kpriv;
+};
+
+
+/**
+ * @brief converts page names to corresponding numbers.
+ *
+ * Numbers are easy to process and they are used with many GtkAssistant
+ * methods.
+ *
+ * @param name of a page
+ *
+ * @returns page number
+ */
+enum AssistantPages
+mbca_page_name_to_number (const gchar* name);
+
+
+G_END_DECLS
+
+#endif /* MBCA_COMMON_H */

Added: trunk/src/gnome-panel/AUTHORS
==============================================================================
--- (empty file)
+++ trunk/src/gnome-panel/AUTHORS	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,47 @@
+gnome-panel authors
+-------------------
+
+George Lebl <jirka 5z com>
+Jacob Berkman <jberkman andrew cmu edu>
+Miguel de Icaza <miguel kernel org>
+Federico Mena <quartic gimp org>
+Tom Tromey <tromey cygnus com>
+Ian Main <imain gtk org>
+Elliot Lee <sopwith redhat com>
+Owen Taylor <otaylor redhat com>
+Mark McLoughlin <mark skynet ie>
+Alex Larsson <alexl redhat com>
+Martin Baulig <baulig suse de>
+Seth Nickell <snickell stanford edu>
+Darin Adler <darin bentspoon com>
+Glynn Foster <glynn foster sun com>
+Stephen Browne <stephen browne sun com>
+Anders Carlsson <andersca gnu org>
+Padraig O'Briain <padraig obriain sun com>
+Ian McKellar <yakk yakk net>
+Arvind Samptur <arvind samptur wipro com>
+Vincent Untz <vuntz gnome org>
+
+libpanel-applet authors
+-----------------------
+
+Mark McLoughlin <mark skynet ie>
+Padraig O'Briain <padraig obriain sun com>
+
+gen_util applet authors
+-----------------------
+
+Miguel de Icaza <miguel kernel org>
+Jacob Berkman <jberkman andrew cmu edu>
+George Lebl <jirka 5z com>
+Federico Mena <quartic gimp org>
+Alex Larsson <alexl redhat com>
+Jaka Mocnik <jaka mocnik kiss uni-lj si>
+Lennart Poettering <poettering gmx net>
+Havoc Pennington <havoc redhat com>
+
+fish applet authors
+-------------------
+
+Wanda The Fish <wanda gnome org>
+George Lebl <jirka 5z com>

Added: trunk/src/gnome-panel/COPYING
==============================================================================
--- (empty file)
+++ trunk/src/gnome-panel/COPYING	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.

Added: trunk/src/gnome-panel/COPYING.LIB
==============================================================================
--- (empty file)
+++ trunk/src/gnome-panel/COPYING.LIB	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,482 @@
+		  GNU LIBRARY GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL.  It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it.  You can use it for
+your libraries, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library.  If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software.  To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+  Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs.  This
+license, the GNU Library General Public License, applies to certain
+designated libraries.  This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+  The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it.  Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program.  However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+  Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries.  We
+concluded that weaker conditions might promote sharing better.
+
+  However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves.  This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them.  (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.)  The hope is that this
+will lead to faster development of free libraries.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+  Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+		  GNU LIBRARY GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License").  Each licensee is
+addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    c) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    d) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+     Appendix: How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+    MA 02111-1307, USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!

Added: trunk/src/gnome-panel/MAINTAINERS
==============================================================================
--- (empty file)
+++ trunk/src/gnome-panel/MAINTAINERS	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,18 @@
+Currently active maintainers
+----------------------------
+
+Vincent Untz
+E-mail: vuntz gnome org
+Userid: vuntz
+
+Non-active maintainers, who have a good understanding of the code
+-----------------------------------------------------------------
+
+#Mark McLoughlin
+#E-mail: mark skynet ie
+
+#Arvind Samptur
+#E-mail: arvind samptur wipro com
+
+#George Lebl
+#E-mail: jirka 5z com

Added: trunk/src/gnome-panel/README
==============================================================================
--- (empty file)
+++ trunk/src/gnome-panel/README	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,46 @@
+gnome-panel 2.23.4
+==================
+
+This package is free software and is part of the GNOME 2.0 project.
+
+The package contains the GNOME panel which is the area on your desktop from
+which you can run applications and applets, and perform other tasks.
+
+The libpanel-applet library is also in this package. This library allows one to
+develop small applications which may be embedded in the panel. These are called
+applet.
+
+Several applets are also supplied - the Workspace Switcher, the Window List,
+the Window Selector, the Notification Area, the Clock and the infamous 'Wanda
+the Fish'.
+
+You may download updates to the package from:
+   http://download.gnome.org/sources/gnome-panel/
+
+There is a page about gnome-panel on the GNOME Wiki:
+   http://live.gnome.org/GnomePanel
+
+desktop-devel-list gnome org is the relevant mailing list:
+   http://mail.gnome.org/mailman/listinfo/desktop-devel-list
+
+To subscribe, send a mail to desktop-devel-list-request gnome org with the
+subject "subscribe".
+
+Installation
+============
+
+See the file 'INSTALL'
+
+How to report bugs
+==================
+
+Bugs should be reported to the GNOME bug tracking system. 
+(http://bugzilla.gnome.org, product gnome-panel.) You will
+need to create an account for yourself.
+
+Please read the following page on how to prepare a useful
+bug report
+   http://bugzilla.gnome.org/bug-HOWTO.html
+
+Please read the HACKING file for information on where to
+send changes or bugfixes for this package.

Added: trunk/src/gnome-panel/system-timezone.c
==============================================================================
--- (empty file)
+++ trunk/src/gnome-panel/system-timezone.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,1113 @@
+/* URL: svn://svn.gnome.org/svn/gnome-panel/trunk/applets/clock/system-timezone.c
+ * Revision: 11081
+ */
+
+
+/* System timezone handling
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Authors: Vincent Untz <vuntz gnome org>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ * 
+ * Some code is based on previous code in clock-location.c and on code from
+ * tz.c (shipped with version <= 2.22.0). Those files were under the same
+ * license, with those authors and copyrights:
+ * 
+ * clock-location.c:
+ * ================
+ * No header, but most of the work was done (AFAIK) by
+ * Federico Mena Quintero <federico novell com>
+ * Matthias Clasen <mclasen redhat com>
+ *
+ * tz.c:
+ * ====
+ * Copyright (C) 2000-2001 Ximian, Inc.
+ * Copyright (C) 2004 Sun Microsystems, Inc.
+ *
+ * Authors: Hans Petter Jansson <hpj ximian com>
+ *	    additional functions by Erwann Chenede <erwann chenede sun com>
+ *	    reworked by Vincent Untz <vuntz gnome org>
+ * 
+ * Largely based on Michael Fulbright's work on Anaconda.
+ */
+
+/* To compile a test program, do:
+ * $ gcc -DSYSTZ_GET_TEST -Wall -g -O0 -o system-timezone-get `pkg-config --cflags --libs glib-2.0 gobject-2.0 gio-2.0` system-timezone.c
+ * or:
+ * $ gcc -DSYSTZ_SET_TEST -Wall -g -O0 -o system-timezone-set `pkg-config --cflags --libs glib-2.0 gobject-2.0 gio-2.0` system-timezone.c
+ *
+ * You can then read the system timezone with:
+ * $ system-timezone-get
+ * and simulate a set of system timezone (in /tmp/etc/...) with:
+ * $ system-timezone-set "Europe/Paris"
+ */
+
+
+/* FIXME: it'd be nice to filter out the timezones that we might get when
+ * parsing config files that are not in zone.tab. Note that it's also wrong
+ * in some cases: eg, in tzdata2008b, Asia/Calcutta got renamed to
+ * Asia/Kolkata and the old name is not in zone.tab. */
+
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <glib/gstdio.h>
+#include <gio/gio.h>
+
+#include "system-timezone.h"
+
+/* Files that we look at and that should be monitored */
+#define CHECK_NB 5
+#ifndef SYSTZ_SET_TEST
+#define ETC_TIMEZONE        "/etc/timezone"
+#define ETC_TIMEZONE_MAJ    "/etc/TIMEZONE"
+#define ETC_RC_CONF         "/etc/rc.conf"
+#define ETC_SYSCONFIG_CLOCK "/etc/sysconfig/clock"
+#define ETC_CONF_D_CLOCK    "/etc/conf.d/clock"
+#define ETC_LOCALTIME       "/etc/localtime"
+#else
+/* Filenames that will be writable for testing */
+#define TEST_PREFIX         "/tmp/systz-test"
+#define ETC_TIMEZONE        TEST_PREFIX"/etc/timezone"
+#define ETC_TIMEZONE_MAJ    TEST_PREFIX"/etc/TIMEZONE"
+#define ETC_RC_CONF         TEST_PREFIX"/etc/rc.conf"
+#define ETC_SYSCONFIG_CLOCK TEST_PREFIX"/etc/sysconfig/clock"
+#define ETC_CONF_D_CLOCK    TEST_PREFIX"/etc/conf.d/clock"
+#define ETC_LOCALTIME       TEST_PREFIX"/etc/localtime"
+#endif /* SYSTZ_SET_TEST */
+
+/* The first 4 characters in a timezone file, from tzfile.h */
+#define TZ_MAGIC "TZif"
+
+static char *files_to_check[CHECK_NB] = {
+        ETC_TIMEZONE,
+        ETC_TIMEZONE_MAJ,
+        ETC_SYSCONFIG_CLOCK,
+        ETC_CONF_D_CLOCK,
+        ETC_LOCALTIME
+};
+
+static GObject *systz_singleton = NULL;
+
+G_DEFINE_TYPE (SystemTimezone, system_timezone, G_TYPE_OBJECT)
+
+typedef struct {
+        char *tz;
+        char *env_tz;
+        GFileMonitor *monitors[CHECK_NB];
+} SystemTimezonePrivate;
+
+enum {
+	CHANGED,
+	LAST_SIGNAL
+};
+
+static guint system_timezone_signals[LAST_SIGNAL] = { 0 };
+
+static GObject *system_timezone_constructor (GType                  type,
+                                             guint                  n_construct_properties,
+                                             GObjectConstructParam *construct_properties);
+static void system_timezone_finalize (GObject *obj);
+
+static void system_timezone_monitor_changed (GFileMonitor *handle,
+                                             GFile *file,
+                                             GFile *other_file,
+                                             GFileMonitorEvent event,
+                                             gpointer user_data);
+static char *system_timezone_find (void);
+
+#define PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SYSTEM_TIMEZONE_TYPE, SystemTimezonePrivate))
+
+SystemTimezone *
+system_timezone_new (void)
+{
+        return g_object_new (SYSTEM_TIMEZONE_TYPE, NULL);
+}
+
+const char *
+system_timezone_get (SystemTimezone *systz)
+{
+        SystemTimezonePrivate *priv;
+
+        g_return_val_if_fail (IS_SYSTEM_TIMEZONE (systz), NULL);
+
+        priv = PRIVATE (systz);
+        return priv->tz;
+}
+
+const char *
+system_timezone_get_env (SystemTimezone *systz)
+{
+        SystemTimezonePrivate *priv;
+
+        g_return_val_if_fail (IS_SYSTEM_TIMEZONE (systz), NULL);
+
+        priv = PRIVATE (systz);
+        return priv->env_tz;
+}
+
+static void
+system_timezone_class_init (SystemTimezoneClass *class)
+{
+        GObjectClass *g_obj_class = G_OBJECT_CLASS (class);
+
+        g_obj_class->constructor = system_timezone_constructor;
+        g_obj_class->finalize = system_timezone_finalize;
+
+        system_timezone_signals[CHANGED] =
+		g_signal_new ("changed",
+			      G_OBJECT_CLASS_TYPE (g_obj_class),
+			      G_SIGNAL_RUN_FIRST,
+			      G_STRUCT_OFFSET (SystemTimezoneClass, changed),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__STRING,
+			      G_TYPE_NONE, 1, G_TYPE_STRING);
+
+        g_type_class_add_private (class, sizeof (SystemTimezonePrivate));
+}
+
+static void
+system_timezone_init (SystemTimezone *systz)
+{
+        int i;
+        SystemTimezonePrivate *priv = PRIVATE (systz);
+
+        priv->tz = NULL;
+        priv->env_tz = NULL;
+        for (i = 0; i < CHECK_NB; i++) 
+                priv->monitors[i] = NULL;
+}
+
+static GObject *
+system_timezone_constructor (GType                  type,
+                             guint                  n_construct_properties,
+                             GObjectConstructParam *construct_properties)
+{
+        GObject *obj;
+        SystemTimezonePrivate *priv;
+        int i;
+
+        /* This is a singleton, we don't need to have it per-applet */
+        if (systz_singleton)
+                return g_object_ref (systz_singleton);
+
+        obj = G_OBJECT_CLASS (system_timezone_parent_class)->constructor (
+                                                type,
+                                                n_construct_properties,
+                                                construct_properties);
+
+        priv = PRIVATE (obj);
+
+        priv->tz = system_timezone_find ();
+
+        priv->env_tz = g_strdup (g_getenv ("TZ"));
+
+        for (i = 0; i < CHECK_NB; i++) {
+                GFile *file;
+
+                file = g_file_new_for_path (files_to_check[i]);
+                priv->monitors[i] = g_file_monitor_file (file,
+                                                         G_FILE_MONITOR_NONE,
+                                                         NULL, NULL);
+                g_object_unref (file);
+
+                if (priv->monitors[i])
+                        g_signal_connect (G_OBJECT (priv->monitors[i]),
+                                          "changed", 
+                                          G_CALLBACK (system_timezone_monitor_changed),
+                                          obj);
+        }
+
+        systz_singleton = obj;
+
+        return systz_singleton;
+}
+
+static void
+system_timezone_finalize (GObject *obj)
+{
+        int i;
+        SystemTimezonePrivate *priv = PRIVATE (obj);
+
+        if (priv->tz) {
+                g_free (priv->tz);
+                priv->tz = NULL;
+        }
+
+        if (priv->env_tz) {
+                g_free (priv->env_tz);
+                priv->env_tz = NULL;
+        }
+
+        for (i = 0; i < CHECK_NB; i++) {
+                g_object_unref (priv->monitors[i]);
+                priv->monitors[i] = NULL;
+        }
+
+        G_OBJECT_CLASS (system_timezone_parent_class)->finalize (obj);
+
+        g_assert (obj == systz_singleton);
+
+        systz_singleton = NULL;
+}
+
+static void
+system_timezone_monitor_changed (GFileMonitor *handle,
+                                 GFile *file,
+                                 GFile *other_file,
+                                 GFileMonitorEvent event,
+                                 gpointer user_data)
+{
+        SystemTimezonePrivate *priv = PRIVATE (user_data);
+        char *new_tz;
+
+        if (event != G_FILE_MONITOR_EVENT_CHANGED &&
+            event != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT &&
+            event != G_FILE_MONITOR_EVENT_DELETED &&
+            event != G_FILE_MONITOR_EVENT_CREATED)
+                return;
+
+        new_tz = system_timezone_find ();
+
+        g_assert (priv->tz != NULL && new_tz != NULL);
+
+        if (strcmp (priv->tz, new_tz) != 0) {
+                g_free (priv->tz);
+                priv->tz = new_tz;
+
+                g_signal_emit (G_OBJECT (user_data),
+                               system_timezone_signals[CHANGED],
+                               0, priv->tz);
+        } else
+                g_free (new_tz);
+}
+
+
+/*
+ * Code to deal with the system timezone on all distros.
+ * There's no dependency on the SystemTimezone GObject here.
+ *
+ * Here's what we know:
+ *
+ *  + /etc/localtime contains the binary data of the timezone.
+ *    It can be a symlink to the actual data file, a hard link to the data
+ *    file, or just a copy. So we can determine the timezone with this
+ *    (reading the symlink, comparing inodes, or comparing content).
+ *
+ *  + However, most distributions also have the timezone setting
+ *    configured somewhere else. This might be better to read it from there.
+ *
+ *    Debian/Ubuntu/Gentoo (new): content of /etc/timezone
+ *    Fedora/Mandriva: the ZONE key in /etc/sysconfig/clock
+ *    openSUSE: the TIMEZONE key in /etc/sysconfig/clock
+ *    Solaris/OpenSolaris: the TZ key in /etc/TIMEZONE
+ *    Arch Linux: the TIMEZONE key in /etc/rc.conf
+ *    Gentoo (old): the ZONE key in /etc/conf.d/clock
+ *
+ *    FIXME: reading the system-tools-backends, it seems there's this too:
+ *           Solaris: the TZ key in /etc/default/init
+ *                    /etc/TIMEZONE seems to be a link to /etc/default/init
+ *
+ * First, some functions to handle those system config files.
+ *
+ */
+
+/* This works for Debian and derivatives (including Ubuntu), and new Gentoo */
+static char *
+system_timezone_read_etc_timezone (void)
+{
+        FILE    *etc_timezone;
+        GString *reading;
+        int      c;
+
+        etc_timezone = g_fopen (ETC_TIMEZONE, "r");
+        if (!etc_timezone)
+                return NULL;
+
+        reading = g_string_new ("");
+
+        c = fgetc (etc_timezone);
+        /* only get the first line, we'll validate the value later */
+        while (c != EOF && !g_ascii_isspace (c)) {
+                reading = g_string_append_c (reading, c);
+                c = fgetc (etc_timezone);
+        }
+
+        fclose (etc_timezone);
+
+        if (reading->str && reading->str[0] != '\0')
+                return g_string_free (reading, FALSE);
+        else
+                g_string_free (reading, TRUE);
+
+        return NULL;
+}
+
+static gboolean
+system_timezone_write_etc_timezone (const char  *tz,
+                                    GError     **error)
+{
+        char     *content;
+        GError   *our_error;
+        gboolean  retval;
+
+        if (!g_file_test (ETC_TIMEZONE, G_FILE_TEST_IS_REGULAR))
+                return TRUE;
+
+        content = g_strdup_printf ("%s\n", tz);
+
+        our_error = NULL;
+        retval = g_file_set_contents (ETC_TIMEZONE, content, -1, &our_error);
+        g_free (content);
+
+        if (!retval) {
+                g_set_error (error, SYSTEM_TIMEZONE_ERROR,
+                             SYSTEM_TIMEZONE_ERROR_GENERAL,
+                             ETC_TIMEZONE" cannot be overwritten: %s",
+                             our_error->message);
+                g_error_free (our_error);
+        }
+
+        return retval;
+}
+
+
+/* Read a file that looks like a key-file (but there's no need for groups)
+ * and get the last value for a specific key */
+static char *
+system_timezone_read_key_file (const char *filename,
+                               const char *key)
+{
+        GIOChannel *channel;
+        char       *key_eq;
+        char       *line;
+        char       *retval;
+
+        if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR))
+                return NULL;
+
+        channel = g_io_channel_new_file (filename, "r", NULL);
+        if (!channel)
+                return NULL;
+
+        key_eq = g_strdup_printf ("%s=", key);
+        retval = NULL;
+
+        while (g_io_channel_read_line (channel, &line, NULL,
+                                       NULL, NULL) == G_IO_STATUS_NORMAL) {
+                if (g_str_has_prefix (line, key_eq)) {
+                        char *value;
+                        int   len;
+
+                        value = line + strlen (key_eq);
+                        g_strstrip (value);
+
+                        len = strlen (value);
+
+                        if (value[0] == '\"') {
+                                if (value[len - 1] == '\"') {
+                                        if (retval)
+                                                g_free (retval);
+
+                                        retval = g_strndup (value + 1,
+                                                            len - 2);
+                                }
+                        } else {
+                                if (retval)
+                                        g_free (retval);
+
+                                retval = g_strdup (line + strlen (key_eq));
+                        }
+
+                        g_strstrip (retval);
+                }
+
+                g_free (line);
+        }
+
+        g_free (key_eq);
+        g_io_channel_unref (channel);
+
+        return retval;
+}
+
+static gboolean
+system_timezone_write_key_file (const char  *filename,
+                                const char  *key,
+                                const char  *value,
+                                GError     **error)
+{
+        GError    *our_error;
+        char      *content;
+        gsize      len;
+        char      *key_eq;
+        char     **lines;
+        gboolean   replaced;
+        gboolean   retval;
+        int        n;
+        
+        if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR))
+                return TRUE;
+
+        our_error = NULL;
+
+        if (!g_file_get_contents (filename, &content, &len, &our_error)) {
+                g_set_error (error, SYSTEM_TIMEZONE_ERROR,
+                             SYSTEM_TIMEZONE_ERROR_GENERAL,
+                             "%s cannot be read: %s",
+                             filename, our_error->message);
+                g_error_free (our_error);
+                return FALSE;
+        }
+
+        lines = g_strsplit (content, "\n", 0);
+        g_free (content);
+
+        key_eq = g_strdup_printf ("%s=", key);
+        replaced = FALSE;
+
+        for (n = 0; lines[n] != NULL; n++) {
+                if (g_str_has_prefix (lines[n], key_eq)) {
+                        char     *old_value;
+                        gboolean  use_quotes;
+
+                        old_value = lines[n] + strlen (key_eq);
+                        g_strstrip (old_value);
+                        use_quotes = old_value[0] == '\"';
+
+                        g_free (lines[n]);
+
+                        if (use_quotes)
+                                lines[n] = g_strdup_printf ("%s\"%s\"",
+                                                            key_eq, value);
+                        else
+                                lines[n] = g_strdup_printf ("%s%s",
+                                                            key_eq, value);
+
+                        replaced = TRUE;
+                }
+        }
+
+        g_free (key_eq);
+
+        if (!replaced) {
+                g_strfreev (lines);
+                return TRUE;
+        }
+
+        content = g_strjoinv ("\n", lines);
+        g_strfreev (lines);
+
+        retval = g_file_set_contents (filename, content, -1, &our_error);
+        g_free (content);
+
+        if (!retval) {
+                g_set_error (error, SYSTEM_TIMEZONE_ERROR,
+                             SYSTEM_TIMEZONE_ERROR_GENERAL,
+                             "%s cannot be overwritten: %s",
+                             filename, our_error->message);
+                g_error_free (our_error);
+        }
+
+        return retval;
+}
+
+/* This works for Solaris/OpenSolaris */
+static char *
+system_timezone_read_etc_TIMEZONE (void)
+{
+        return system_timezone_read_key_file (ETC_TIMEZONE_MAJ,
+                                              "TZ");
+}
+
+static gboolean
+system_timezone_write_etc_TIMEZONE (const char  *tz,
+                                    GError     **error)
+{
+        return system_timezone_write_key_file (ETC_TIMEZONE_MAJ,
+                                               "TZ", tz, error);
+}
+
+/* This works for Fedora and Mandriva */
+static char *
+system_timezone_read_etc_sysconfig_clock (void)
+{
+        return system_timezone_read_key_file (ETC_SYSCONFIG_CLOCK,
+                                              "ZONE");
+}
+
+static gboolean
+system_timezone_write_etc_sysconfig_clock (const char  *tz,
+                                           GError     **error)
+{
+        return system_timezone_write_key_file (ETC_SYSCONFIG_CLOCK,
+                                               "ZONE", tz, error);
+}
+
+/* This works for openSUSE */
+static char *
+system_timezone_read_etc_sysconfig_clock_alt (void)
+{
+        return system_timezone_read_key_file (ETC_SYSCONFIG_CLOCK,
+                                              "TIMEZONE");
+}
+
+static gboolean
+system_timezone_write_etc_sysconfig_clock_alt (const char  *tz,
+                                               GError     **error)
+{
+        return system_timezone_write_key_file (ETC_SYSCONFIG_CLOCK,
+                                               "TIMEZONE", tz, error);
+}
+
+/* This works for old Gentoo */
+static char *
+system_timezone_read_etc_conf_d_clock (void)
+{
+        return system_timezone_read_key_file (ETC_CONF_D_CLOCK,
+                                              "TIMEZONE");
+}
+
+static gboolean
+system_timezone_write_etc_conf_d_clock (const char  *tz,
+                                        GError     **error)
+{
+        return system_timezone_write_key_file (ETC_CONF_D_CLOCK,
+                                               "TIMEZONE", tz, error);
+}
+
+/* This works for Arch Linux */
+static char *
+system_timezone_read_etc_rc_conf (void)
+{
+        return system_timezone_read_key_file (ETC_RC_CONF,
+                                              "TIMEZONE");
+}
+
+static gboolean
+system_timezone_write_etc_rc_conf (const char  *tz,
+                                   GError     **error)
+{
+        return system_timezone_write_key_file (ETC_RC_CONF,
+                                               "TIMEZONE", tz, error);
+}
+
+/*
+ *
+ * First, getting the timezone.
+ *
+ */
+
+static char *
+system_timezone_strip_path_if_valid (const char *filename)
+{
+        int skip;
+
+        if (!filename || !g_str_has_prefix (filename, SYSTEM_ZONEINFODIR"/"))
+                return NULL;
+
+        /* Timezone data files also live under posix/ and right/ for some
+         * reason.
+         * FIXME: make sure accepting those files is valid. I think "posix" is
+         * okay, not sure about "right" */
+        if (g_str_has_prefix (filename, SYSTEM_ZONEINFODIR"/posix/"))
+                skip = strlen (SYSTEM_ZONEINFODIR"/posix/");
+        else if (g_str_has_prefix (filename, SYSTEM_ZONEINFODIR"/right/"))
+                skip = strlen (SYSTEM_ZONEINFODIR"/right/");
+        else
+                skip = strlen (SYSTEM_ZONEINFODIR"/");
+
+        return g_strdup (filename + skip);
+}
+
+/* Read the soft symlink from /etc/localtime */
+static char *
+system_timezone_read_etc_localtime_softlink (void)
+{
+        char *file;
+        char *tz;
+
+        if (!g_file_test (ETC_LOCALTIME, G_FILE_TEST_IS_SYMLINK))
+                return NULL;
+
+        file = g_file_read_link (ETC_LOCALTIME, NULL);
+        tz = system_timezone_strip_path_if_valid (file);
+        g_free (file);
+
+        return tz;
+}
+
+typedef gboolean (*CompareFiles) (struct stat *a_stat,
+                                  struct stat *b_stat,
+                                  const char  *a_content,
+                                  gsize        a_content_len,
+                                  const char  *b_filename);
+
+static char *
+recursive_compare (struct stat  *localtime_stat,
+                   const char   *localtime_content,
+                   gsize         localtime_content_len,
+                   char         *file,
+                   CompareFiles  compare_func)
+{
+        struct stat file_stat;
+
+        if (g_stat (file, &file_stat) != 0)
+                return NULL;
+
+        if (S_ISREG (file_stat.st_mode)) {
+                if (compare_func (localtime_stat,
+                                  &file_stat,
+                                  localtime_content,
+                                  localtime_content_len,
+                                  file))
+                        return system_timezone_strip_path_if_valid (file);
+                else
+                        return NULL;
+        } else if (S_ISDIR (file_stat.st_mode)) {
+                GDir       *dir = NULL;
+                char       *ret = NULL;
+                const char *subfile = NULL;
+                char       *subpath = NULL;
+
+                dir = g_dir_open (file, 0, NULL);
+                if (dir == NULL)
+                        return NULL;
+
+                while ((subfile = g_dir_read_name (dir)) != NULL) {
+                        subpath = g_build_filename (file, subfile, NULL);
+
+                        ret = recursive_compare (localtime_stat,
+                                                 localtime_content,
+                                                 localtime_content_len,
+                                                 subpath,
+                                                 compare_func);
+
+                        g_free (subpath);
+
+                        if (ret != NULL)
+                                break;
+                }
+
+                g_dir_close (dir);
+
+                return ret;
+        }
+
+        return NULL;
+}
+
+
+static gboolean
+files_are_identical_inode (struct stat *a_stat,
+                           struct stat *b_stat,
+                           const char  *a_content,
+                           gsize        a_content_len,
+                           const char  *b_filename)
+{
+        return (a_stat->st_ino == b_stat->st_ino);
+}
+
+
+/* Determine if /etc/localtime is a hard link to some file, by looking at
+ * the inodes */
+static char *
+system_timezone_read_etc_localtime_hardlink (void)
+{
+        struct stat stat_localtime;
+
+        if (g_stat (ETC_LOCALTIME, &stat_localtime) != 0)
+                return NULL;
+
+        if (!S_ISREG (stat_localtime.st_mode))
+                return NULL;
+
+        return recursive_compare (&stat_localtime,
+                                  NULL,
+                                  0,
+                                  SYSTEM_ZONEINFODIR,
+                                  files_are_identical_inode);
+}
+
+static gboolean
+files_are_identical_content (struct stat *a_stat,
+                             struct stat *b_stat,
+                             const char  *a_content,
+                             gsize        a_content_len,
+                             const char  *b_filename)
+{
+        char  *b_content = NULL;
+        gsize  b_content_len = -1;
+        int    cmp;
+
+        if (a_stat->st_size != b_stat->st_size)
+                return FALSE;
+
+        if (!g_file_get_contents (b_filename,
+                                  &b_content, &b_content_len, NULL))
+                return FALSE;
+
+        if (a_content_len != b_content_len) {
+                g_free (b_content);
+                return FALSE;
+        }
+
+        cmp = memcmp (a_content, b_content, a_content_len);
+        g_free (b_content);
+
+        return (cmp == 0);
+}
+
+/* Determine if /etc/localtime is a copy of a timezone file */
+static char *
+system_timezone_read_etc_localtime_content (void)
+{
+        struct stat  stat_localtime;
+        char        *localtime_content = NULL;
+        gsize        localtime_content_len = -1;
+        char        *retval;
+
+        if (g_stat (ETC_LOCALTIME, &stat_localtime) != 0)
+                return NULL;
+
+        if (!S_ISREG (stat_localtime.st_mode))
+                return NULL;
+
+        if (!g_file_get_contents (ETC_LOCALTIME,
+                                  &localtime_content,
+                                  &localtime_content_len,
+                                  NULL))
+                return NULL;
+
+        retval = recursive_compare (&stat_localtime,
+                                   localtime_content,
+                                   localtime_content_len,
+                                   SYSTEM_ZONEINFODIR,
+                                   files_are_identical_content);
+
+        g_free (localtime_content);
+
+        return retval;
+}
+
+typedef char * (*GetSystemTimezone) (void);
+/* The order of the functions here define the priority of the methods used
+ * to find the timezone. First method has higher priority. */
+static GetSystemTimezone get_system_timezone_methods[] = {
+        /* cheap and "more correct" than data from a config file */
+        system_timezone_read_etc_localtime_softlink,
+        /* reading various config files */
+        system_timezone_read_etc_timezone,
+        system_timezone_read_etc_sysconfig_clock,
+        system_timezone_read_etc_sysconfig_clock_alt,
+        system_timezone_read_etc_TIMEZONE,
+        system_timezone_read_etc_rc_conf,
+        /* reading deprecated config files */
+        system_timezone_read_etc_conf_d_clock,
+        /* reading /etc/timezone directly. Expensive since we have to stat
+         * many files */
+        system_timezone_read_etc_localtime_hardlink,
+        system_timezone_read_etc_localtime_content,
+        NULL
+};
+
+static gboolean
+system_timezone_is_valid (const char *tz)
+{
+        const char *c;
+
+        if (!tz)
+                return FALSE;
+
+        for (c = tz; *c != '\0'; c++) {
+                if (!(g_ascii_isalnum (*c) ||
+                      *c == '/' || *c == '-' || *c == '_'))
+                        return FALSE;
+        }
+
+        return TRUE;
+}
+
+static char *
+system_timezone_find (void)
+{
+        char *tz;
+        int   i;
+
+        for (i = 0; get_system_timezone_methods[i] != NULL; i++) {
+                tz = get_system_timezone_methods[i] ();
+
+                if (system_timezone_is_valid (tz))
+                        return tz;
+
+                g_free (tz);
+        }
+
+        return g_strdup ("UTC");
+}
+
+/*
+ *
+ * Now, setting the timezone.
+ *
+ */
+
+static gboolean
+system_timezone_is_zone_file_valid (const char  *zone_file,
+                                    GError     **error)
+{
+        GError     *our_error;
+        GIOChannel *channel;
+        GIOStatus   status;
+        char        buffer[strlen (TZ_MAGIC)];
+        gsize       read;
+
+        /* First, check the zone_file is properly rooted */
+        if (!g_str_has_prefix (zone_file, SYSTEM_ZONEINFODIR"/")) {
+                g_set_error (error, SYSTEM_TIMEZONE_ERROR,
+                             SYSTEM_TIMEZONE_ERROR_INVALID_TIMEZONE_FILE,
+                             "Timezone file needs to be under "SYSTEM_ZONEINFODIR);
+                return FALSE;
+        }
+
+        /* Second, check it's a regular file that exists */
+        if (!g_file_test (zone_file, G_FILE_TEST_IS_REGULAR)) {
+                g_set_error (error, SYSTEM_TIMEZONE_ERROR,
+                             SYSTEM_TIMEZONE_ERROR_INVALID_TIMEZONE_FILE,
+                             "No such timezone file %s", zone_file);
+                return FALSE;
+        }
+
+        /* Third, check that it's a tzfile (see tzfile(5)). The file has a 4
+         * bytes header which is TZ_MAGIC.
+         *
+         * TODO: is there glibc API for this? */
+        our_error = NULL;
+        channel = g_io_channel_new_file (zone_file, "r", &our_error);
+        if (!our_error)
+                status = g_io_channel_read_chars (channel,
+                                                  buffer, strlen (TZ_MAGIC),
+                                                  &read, &our_error);
+        if (channel)
+                g_io_channel_unref (channel);
+
+        if (our_error) {
+                g_set_error (error, SYSTEM_TIMEZONE_ERROR,
+                             SYSTEM_TIMEZONE_ERROR_INVALID_TIMEZONE_FILE,
+                             "Timezone file %s cannot be read: %s",
+                             zone_file, our_error->message);
+                g_error_free (our_error);
+                return FALSE;
+        }
+
+        if (read != strlen (TZ_MAGIC) || strncmp (buffer, TZ_MAGIC, strlen (TZ_MAGIC)) != 0) {
+                g_set_error (error, SYSTEM_TIMEZONE_ERROR,
+                             SYSTEM_TIMEZONE_ERROR_INVALID_TIMEZONE_FILE,
+                             "%s is not a timezone file",
+                             zone_file);
+                return FALSE;
+        }
+
+        return TRUE;
+}
+
+static gboolean
+system_timezone_set_etc_timezone (const char  *zone_file,
+                                  GError     **error)
+{
+        GError *our_error;
+        char   *content;
+        gsize   len;
+
+        if (!system_timezone_is_zone_file_valid (zone_file, error))
+                return FALSE;
+
+        /* If /etc/localtime is a symlink, write a symlink */
+        if (g_file_test (ETC_LOCALTIME, G_FILE_TEST_IS_SYMLINK)) {
+                if (g_unlink (ETC_LOCALTIME) == 0 &&
+                    symlink (zone_file, ETC_LOCALTIME) == 0)
+                        return TRUE;
+
+                /* If we couldn't symlink the file, we'll just fallback on
+                 * copying it */
+        }
+
+        /* Else copy the file to /etc/localtime. We explicitly avoid doing
+         * hard links since they break with different partitions */
+        our_error = NULL;
+        if (!g_file_get_contents (zone_file, &content, &len, &our_error)) {
+                g_set_error (error, SYSTEM_TIMEZONE_ERROR,
+                             SYSTEM_TIMEZONE_ERROR_GENERAL,
+                             "Timezone file %s cannot be read: %s",
+                             zone_file, our_error->message);
+                g_error_free (our_error);
+                return FALSE;
+        }
+
+        if (!g_file_set_contents (ETC_LOCALTIME, content, len, &our_error)) {
+                g_set_error (error, SYSTEM_TIMEZONE_ERROR,
+                             SYSTEM_TIMEZONE_ERROR_GENERAL,
+                             ETC_LOCALTIME" cannot be overwritten: %s",
+                             our_error->message);
+                g_error_free (our_error);
+                g_free (content);
+                return FALSE;
+        }
+
+        g_free (content);
+
+        return TRUE;
+}
+
+typedef gboolean (*SetSystemTimezone) (const char  *tz,
+                                       GError     **error);
+/* The order here does not matter too much: we'll try to change all files
+ * that already have a timezone configured. It matters in case of error,
+ * since the process will be stopped and the last methods won't be called.
+ * So we use the same order as in get_system_timezone_methods */
+static SetSystemTimezone set_system_timezone_methods[] = {
+        /* writing various config files if they exist and have the
+         * setting already present */
+        system_timezone_write_etc_timezone,
+        system_timezone_write_etc_sysconfig_clock,
+        system_timezone_write_etc_sysconfig_clock_alt,
+        system_timezone_write_etc_TIMEZONE,
+        system_timezone_write_etc_rc_conf,
+        /* writing deprecated config files if they exist and have the
+         * setting already present */
+        system_timezone_write_etc_conf_d_clock,
+        NULL
+};
+
+static gboolean
+system_timezone_update_config (const char  *tz,
+                               GError     **error)
+{
+        int i;
+
+        for (i = 0; set_system_timezone_methods[i] != NULL; i++) {
+                if (!set_system_timezone_methods[i] (tz, error))
+                        return FALSE;
+                /* FIXME: maybe continue to change all config files if
+                 * possible? */
+        }
+
+        return TRUE;
+}
+
+gboolean
+system_timezone_set_from_file (const char  *zone_file,
+                               GError     **error)
+{
+        const char *tz;
+
+        g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+        tz = zone_file + strlen (SYSTEM_ZONEINFODIR"/");
+
+        /* FIXME: is it right to return FALSE even when /etc/localtime was
+         * changed but not the config files? */
+        return (system_timezone_set_etc_timezone (zone_file, error) &&
+                system_timezone_update_config (tz, error));
+}
+
+gboolean
+system_timezone_set (const char  *tz,
+                     GError     **error)
+{
+        char     *zone_file;
+        gboolean  retval;
+
+        g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+        zone_file = g_build_filename (SYSTEM_ZONEINFODIR, tz, NULL);
+
+        /* FIXME: is it right to return FALSE even when /etc/localtime was
+         * changed but not the config files? */
+        retval = system_timezone_set_etc_timezone (zone_file, error) &&
+                 system_timezone_update_config (tz, error);
+
+        g_free (zone_file);
+
+        return retval;
+}
+
+GQuark
+system_timezone_error_quark (void)
+{
+        static GQuark ret = 0;
+
+        if (ret == 0) {
+                ret = g_quark_from_static_string ("system-timezone-error");
+        }
+
+        return ret;
+}
+
+#ifdef SYSTZ_GET_TEST
+int
+main (int    argc,
+      char **argv)
+{
+        char *tz;
+
+        tz = system_timezone_find ();
+        g_print ("%s\n", tz);
+        g_free (tz);
+
+        return 0;
+}
+#endif /* SYSTZ_GET_TEST */
+
+#ifdef SYSTZ_SET_TEST
+int
+main (int    argc,
+      char **argv)
+{
+        GError *error;
+        char   *dirname;
+
+        if (argc != 2) {
+                g_print ("Usage: %s TIMEZONE\n", argv[0]);
+                return 1;
+        }
+
+        dirname = g_path_get_dirname (ETC_TIMEZONE);
+        g_mkdir_with_parents (dirname, 0755);
+        g_free (dirname);
+        dirname = g_path_get_dirname (ETC_SYSCONFIG_CLOCK);
+        g_mkdir_with_parents (dirname, 0755);
+        g_free (dirname);
+        dirname = g_path_get_dirname (ETC_CONF_D_CLOCK);
+        g_mkdir_with_parents (dirname, 0755);
+        g_free (dirname);
+
+        error = NULL;
+        if (!system_timezone_set (argv[1], &error)) {
+                g_print ("%s\n", error->message);
+                g_error_free (error);
+                return 1;
+        }
+
+        g_print (TEST_PREFIX" is the test directory where files "
+                 "were written (feel free to populate this directory with "
+                 "files that should be modified by this program).\n");
+
+        return 0;
+}
+#endif /* SYSTZ_SET_TEST */

Added: trunk/src/gnome-panel/system-timezone.h
==============================================================================
--- (empty file)
+++ trunk/src/gnome-panel/system-timezone.h	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,87 @@
+/* URL: svn://svn.gnome.org/svn/gnome-panel/trunk/applets/clock/system-timezone.h
+ * Revision: 11149
+ */
+
+/* System timezone handling
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Authors: Vincent Untz <vuntz gnome org>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __SYSTEM_TIMEZONE_H__
+#define __SYSTEM_TIMEZONE_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#ifdef HAVE_SOLARIS
+#define SYSTEM_ZONEINFODIR "/usr/share/lib/zoneinfo/tab"
+#else
+#define SYSTEM_ZONEINFODIR "/usr/share/zoneinfo"
+#endif
+
+
+#define SYSTEM_TIMEZONE_TYPE         (system_timezone_get_type ())
+#define SYSTEM_TIMEZONE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), SYSTEM_TIMEZONE_TYPE, SystemTimezone))
+#define SYSTEM_TIMEZONE_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST ((c), SYSTEM_TIMEZONE_TYPE, SystemTimezoneClass))
+#define IS_SYSTEM_TIMEZONE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), SYSTEM_TIMEZONE_TYPE))
+#define IS_SYSTEM_TIMEZONE_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c), SYSTEM_TIMEZONE_TYPE))
+#define SYSTEM_TIMEZONE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), SYSTEM_TIMEZONE_TYPE, SystemTimezoneClass))
+
+typedef struct
+{
+        GObject g_object;
+} SystemTimezone;
+
+typedef struct
+{
+        GObjectClass g_object_class;
+
+	void (* changed) (SystemTimezone *systz,
+			  const char     *tz);
+} SystemTimezoneClass;
+
+GType system_timezone_get_type (void);
+
+SystemTimezone *system_timezone_new (void);
+
+const char *system_timezone_get (SystemTimezone *systz);
+const char *system_timezone_get_env (SystemTimezone *systz);
+
+/* Functions to set the timezone. They won't be used by the applet, but
+ * by a program with more privileges */
+
+#define SYSTEM_TIMEZONE_ERROR system_timezone_error_quark ()
+GQuark system_timezone_error_quark (void);
+
+typedef enum
+{
+        SYSTEM_TIMEZONE_ERROR_GENERAL,
+        SYSTEM_TIMEZONE_ERROR_INVALID_TIMEZONE_FILE,
+        SYSTEM_TIMEZONE_NUM_ERRORS
+} SystemTimezoneError;
+
+gboolean system_timezone_set_from_file (const char  *zone_file,
+                                        GError     **error);
+gboolean system_timezone_set (const char  *tz,
+                              GError     **error);
+
+G_END_DECLS
+#endif /* __SYSTEM_TIMEZONE_H__ */

Added: trunk/src/hal_page.c
==============================================================================
--- (empty file)
+++ trunk/src/hal_page.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,67 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+ 
+#include "callbacks.h"
+
+void
+mbca_hal_page_prepare_cb (GtkAssistant* gtkassistant,
+					 GtkWidget* page,
+					 gpointer user_data)
+{
+	MBCAAssistant* assistant = user_data;
+	MBCAAssistantPrivate* priv = assistant->priv;
+	
+	if (!priv->hal_page_initialized)
+	{
+		/** @todo fixme */
+		priv->hal_page_initialized = TRUE;
+	}
+	
+}
+
+void
+mbca_hal_treeview_selection_changed_cb (GtkTreeSelection* selection,
+							     gpointer          user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	GtkTreeModel* model;
+	GtkTreeIter iter;
+	GtkWidget* page;
+	
+	if( gtk_tree_selection_get_selected (selection, &model, &iter))
+	{
+		g_free (priv->conf->device);
+		gtk_tree_model_get (model, &iter,
+						HAL_UDI_COLUMN, &priv->conf->device,
+						-1);
+		g_free (priv->nice_device_name);
+		gtk_tree_model_get (model, &iter,
+						HAL_PRODUCT_COLUMN, &priv->nice_device_name,
+						-1);
+		
+		page = gtk_assistant_get_nth_page (priv->assistant, PAGE_HAL);
+		gtk_assistant_set_page_complete (priv->assistant, page, TRUE);
+	}
+}
+
+
+

Added: trunk/src/mbca_assistant.c
==============================================================================
--- (empty file)
+++ trunk/src/mbca_assistant.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,1397 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file mbca_assistant.c
+ * @brief Mobile Broadband Configuration Assistant
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ *
+ * Main file of Mobile Broadband Configuration Assistant. Contains assistant
+ * callbacks and initialization functions.
+ */
+ 
+#include "provider_thread.h"
+#include "mbca_assistant.h"
+#include "callbacks.h"
+
+#include <stdlib.h>
+
+static GObjectClass *parent_class = NULL;
+
+
+/**
+ * @brief connect signals
+ *
+ * Helper macro for connect_signals().
+ *
+ * @param name name of the widget
+ * @param signal name of the signal
+ * @param callback function
+ *
+ * @note requires symbol <i>priv</i> that is pointer to MBCAAssistantPriv
+ */
+#define CONNECT(name, signal, callback)\
+	object = gtk_builder_get_object (priv->builder, name);  \
+	if (!object) \
+	{ \
+		g_error ("no widget \'%s\' in UI definition", name); \
+	} \
+	g_signal_connect (object, signal, G_CALLBACK (callback), priv)
+
+/**
+ * @brief connect selection signals
+ *
+ * Helper macato for connect_signals().
+ *
+ * @param name of the GtkTreeView
+ * @param signal name of the signal
+ * @param callback funtion
+ *
+ * @note requires symbols <i>selection</i>, <i>object</i> and <i>priv</i>
+ */
+#define CONNECT_SELECTION(name, signal, callback)\
+	object = gtk_builder_get_object (priv->builder, name);  \
+	if (!object) \
+	{ \
+		g_error ("no widget \'%s\' in UI definition", name); \
+	} \
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (object)); \
+	g_signal_connect (G_OBJECT (selection), signal, G_CALLBACK (callback), priv)
+
+/**
+ *Â brief connect GUI signals
+ *
+ * Connect widget signals to callbacks.
+ *
+ * @param assistant assistant to connect signals
+ */
+static void
+connect_signals (MBCAAssistant* assistant)
+{
+	MBCAAssistantPrivate* priv = assistant->priv;
+	GtkTreeSelection* selection;	
+	GObject* object;
+
+	/* assistant */
+	object = gtk_builder_get_object (priv->builder, "mbca_assistant"); 	
+	if (!object) 
+	{ 
+		g_error ("no widget \'%s\' in UI definition", "mbca_assistant"); \
+	}
+	g_signal_connect (object, "apply", 
+				   G_CALLBACK (mbca_assistant_apply_cb), assistant);
+	g_signal_connect (object, "cancel", 
+				   G_CALLBACK (mbca_assistant_cancel_cb), assistant);
+	g_signal_connect (object, "close", 
+				   G_CALLBACK (mbca_assistant_close_cb), assistant);
+	g_signal_connect (object, "prepare", 
+				   G_CALLBACK (mbca_assistant_prepare_cb), assistant);
+	
+	/* connection method page */
+	CONNECT ("bluetooth_radiobutton", "clicked",
+		    mbca_bluetooth_radiobutton_clicked_cb);
+	CONNECT ("builtin_radiobutton", "clicked",
+		    mbca_builtin_radiobutton_clicked_cb);
+	CONNECT ("pcmcia_radiobutton", "clicked",
+		    mbca_pcmcia_radiobutton_clicked_cb);
+	CONNECT ("serialcable_radiobutton", "clicked",
+		    mbca_serialcable_radiobutton_clicked_cb);
+	CONNECT ("usb_radiobutton", "clicked",
+		    mbca_usb_radiobutton_clicked_cb);
+	
+	/* Bluetooth page */
+	CONNECT ("bluetooth_manual_checkbutton", "toggled",
+		    mbca_bluetooth_manual_checkbutton_toggled_cb);
+	CONNECT ("bluetooth_manual_entry", "changed",
+		    mbca_bluetooth_manual_entry_changed_cb);
+	/* btselector signal is connected in setup_bluetooth_page() */
+	
+	/* serial cable page */
+	CONNECT ("serial_manual_checkbutton", "toggled",
+		   mbca_serial_manual_checkbutton_toggled_cb);
+	CONNECT ("serial_manual_entry", "changed",
+		    mbca_serial_manual_entry_changed_cb);
+	CONNECT ("serial_manual_baud_entry", "changed",
+		    mbca_serial_manual_baud_entry_changed_cb);
+	CONNECT_SELECTION ("serial_treeview", "changed",
+				    mbca_serial_treeview_selection_changed_cb);
+	CONNECT_SELECTION ("serial_baud_treeview", "changed",
+				    mbca_serial_baud_treeview_selection_changed_cb);
+	
+	/* HAL page */
+	CONNECT_SELECTION ("hal_treeview", "changed",
+				    mbca_hal_treeview_selection_changed_cb);
+	
+	/* service provider page */
+	CONNECT ("country_treeview", "query-tooltip",
+		    mbca_country_code_qyery_tooltip_cb);
+	CONNECT_SELECTION ("country_treeview", "changed",
+				    mbca_country_selection_changed_cb);
+	CONNECT_SELECTION ("provider_treeview", "changed",
+				    mbca_provider_selection_changed_cb);
+	
+	/* summary page */
+	CONNECT ("summary_name_entry", "changed",
+		    mbca_summary_name_entry_changed_cb);
+}
+
+/**
+ * @brief determine next page
+ *
+ * from GtkAssistant documentation:
+ * "A function used by gtk_assistant_set_forward_page_func() to know which is
+ *  the next page given a current one. It's called both for computing the next
+ *  page when the user presses the 'forward' button and for handling the
+ *  behavior of the 'last' button."
+ *
+ * @param current_page The page number used to calculate the next page
+ * @param data pointer to mbcaAppData
+ */
+static gint
+mbca_page_func (gint current_page,
+			 gpointer data)
+{
+	MBCAAssistantPrivate* priv = data;
+	
+	switch (current_page)
+	{
+		case PAGE_INTRO:
+		{
+			if (priv->device_is_preset)
+			{
+				return PAGE_PROVIDER;
+			}
+			return PAGE_METHOD;
+		}
+		case PAGE_METHOD:
+		{			
+			/* next page is chosen based on radio buttons on method_page */
+			GtkToggleButton* button;
+			GObject* gobject;
+			
+			gobject = gtk_builder_get_object (priv->builder,
+									    "bluetooth_radiobutton");
+			g_return_val_if_fail (gobject, 0);
+			button = GTK_TOGGLE_BUTTON (gobject);
+			if (gtk_toggle_button_get_active (button))
+			{
+				return PAGE_BLUETOOTH;
+			}
+
+			gobject = gtk_builder_get_object (priv->builder,
+									    "serialcable_radiobutton");
+			g_return_val_if_fail (gobject, 0);
+			button = GTK_TOGGLE_BUTTON (gobject);
+			if (gtk_toggle_button_get_active (button))
+			{
+				return PAGE_SERIAL;
+			}
+			
+			gobject = gtk_builder_get_object (priv->builder,
+									    "builtin_radiobutton");
+			g_return_val_if_fail (gobject, 0);
+			button = GTK_TOGGLE_BUTTON (gobject);
+			if (gtk_toggle_button_get_active (button))
+			{
+				return PAGE_HAL;
+			}
+			gobject = gtk_builder_get_object (priv->builder,
+									    "pcmcia_radiobutton");
+			g_return_val_if_fail (gobject, 0);
+			button = GTK_TOGGLE_BUTTON (gobject);
+			if (gtk_toggle_button_get_active (button))
+			{
+				return PAGE_HAL;
+			}
+			gobject = gtk_builder_get_object (priv->builder,
+									    "usb_radiobutton");
+			g_return_val_if_fail (gobject, 0);
+			button = GTK_TOGGLE_BUTTON (gobject);
+			if (gtk_toggle_button_get_active (button))
+			{
+				return PAGE_HAL;
+			}
+			
+			return PAGE_METHOD;
+		}
+		case PAGE_BLUETOOTH:
+		case PAGE_SERIAL:
+		case PAGE_HAL:
+		{
+			return PAGE_PROVIDER;
+		}
+		default:
+		{
+			return current_page + 1;
+		}
+	}	 
+}
+
+/**
+ * Sets up country and provider lists from database and resolves the default
+ * country or expands the country expander.
+ *
+ * @param app private application data
+ *
+ * @returns ' 0' on success
+ * @returns '-1' on error
+ */
+static gint
+setup_provider_page (MBCAAssistantPrivate* priv)
+{
+	GtkListStore* provider_store;
+	GtkTreeSelection* selection;	
+	GtkCellRenderer* renderer;
+	GtkTreeViewColumn* column;
+	GtkWidget* provider_list;	
+	GtkWidget* country_list;
+
+	country_list = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+											 "country_treeview"));
+	provider_list = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+											 "provider_treeview"));
+	g_return_val_if_fail (country_list, -1);
+	g_return_val_if_fail (provider_list, -1);	
+	
+	/* country list columns */	
+	renderer = gtk_cell_renderer_text_new ();
+	column = gtk_tree_view_column_new_with_attributes ("",
+											 renderer,
+											 "text", COUNTRY_CODE_COLUMN,
+											 NULL);
+	gtk_tree_view_column_set_sort_column_id (column, COUNTRY_CODE_COLUMN);
+	gtk_tree_view_column_set_sort_order (column, GTK_SORT_ASCENDING);
+	gtk_tree_view_column_set_sort_indicator (column, TRUE);
+	gtk_tree_view_append_column (GTK_TREE_VIEW (country_list), column);
+	gtk_widget_set_has_tooltip (country_list, TRUE);
+	
+	column = gtk_tree_view_column_new_with_attributes (_("Country"),
+											 renderer,
+											 "text", COUNTRY_NAME_COLUMN,
+											 NULL);
+	gtk_tree_view_column_set_sort_column_id (column, COUNTRY_NAME_COLUMN);
+	gtk_tree_view_column_set_sort_order (column, GTK_SORT_ASCENDING);
+	gtk_tree_view_column_set_sort_indicator (column, TRUE);
+	gtk_tree_view_append_column (GTK_TREE_VIEW (country_list), column);
+	gtk_tree_view_set_search_column (GTK_TREE_VIEW (country_list), COUNTRY_NAME_COLUMN);
+
+	
+	/* service provider list columns */
+	column = gtk_tree_view_column_new_with_attributes (_("Provider"),
+											 renderer,
+											 "text", PROVIDER_NAME_COLUMN,
+											 NULL);
+	gtk_tree_view_column_set_sort_column_id (column, PROVIDER_NAME_COLUMN);
+	gtk_tree_view_column_set_sort_order (column, GTK_SORT_ASCENDING);
+	gtk_tree_view_column_set_sort_indicator (column, TRUE);
+	gtk_tree_view_append_column (GTK_TREE_VIEW (provider_list), column);
+	gtk_tree_view_set_search_column (GTK_TREE_VIEW (provider_list), PROVIDER_NAME_COLUMN);
+
+	
+	/* set selection mode */
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (country_list));
+	gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (provider_list));
+	gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);	
+
+	
+	/* set empty model */
+	provider_store = gtk_list_store_new (PROVIDER_N_COLUMNS,
+								  G_TYPE_STRING,		/* name */
+								  G_TYPE_POINTER);		/* data */
+	gtk_tree_view_set_model (GTK_TREE_VIEW (provider_list),
+						GTK_TREE_MODEL (provider_store));
+			
+	return 0;
+}
+
+/**
+ * @brief set up and initialize HAL page
+ *
+ * Creates treemodels and sets columns for treeviews.
+ *
+ * @param private application data
+ * @param hal_store shared list of HAL devices
+ *
+ * @returns ' 0' on success
+ * @returns '-1' on error
+ */
+static gint
+setup_hal_page (MBCAAssistantPrivate* priv, GtkListStore* hal_store)
+{
+	GtkTreeSelection* selection;
+	GtkCellRenderer* renderer;
+	GtkTreeViewColumn* column;
+	GObject* hal_treeview;
+	
+	hal_treeview = gtk_builder_get_object (priv->builder, "hal_treeview");
+	g_return_val_if_fail (hal_treeview, -1);
+
+	renderer = gtk_cell_renderer_text_new ();
+		
+	column = gtk_tree_view_column_new_with_attributes (_("Product"),
+											 renderer,
+											 "text", HAL_PRODUCT_COLUMN,
+											 NULL);
+	gtk_tree_view_column_set_sort_column_id (column, HAL_PRODUCT_COLUMN);
+	gtk_tree_view_column_set_sort_order (column, GTK_SORT_ASCENDING);
+	gtk_tree_view_column_set_sort_indicator (column, TRUE);
+	gtk_tree_view_append_column (GTK_TREE_VIEW (hal_treeview), column);
+
+	column = gtk_tree_view_column_new_with_attributes (_("Vendor"),
+											 renderer,
+											 "text", HAL_VENDOR_COLUMN,
+											 NULL);
+	gtk_tree_view_column_set_sort_column_id (column, HAL_VENDOR_COLUMN);
+	gtk_tree_view_column_set_sort_order (column, GTK_SORT_ASCENDING);
+	gtk_tree_view_column_set_sort_indicator (column, TRUE);
+	gtk_tree_view_append_column (GTK_TREE_VIEW (hal_treeview), column);
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (hal_treeview));
+	gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);	
+	
+	gtk_tree_view_set_model (GTK_TREE_VIEW (hal_treeview),
+						GTK_TREE_MODEL (hal_store));	
+	return 0;
+}
+
+/**
+ * @brief set up and initialize serial page
+ *
+ * Creates treemodels and sets columns for treeviews.
+ *
+ * @param priv private application data
+ * @param serial_store shared list of serial devices
+ * @param baud_store shared list of baud rates
+ *
+ * @returns ' 0' on success
+ * @returns '-1' on error
+ */
+static gint
+setup_serial_page (MBCAAssistantPrivate* priv,
+			    GtkListStore* serial_store,
+			    GtkListStore* baud_store)
+{
+	GtkTreeSelection* selection;
+	GtkCellRenderer* renderer;
+	GtkTreeViewColumn* column;
+	GtkTreeView* serial_view;
+	GtkTreeView* baud_view;
+	
+	serial_view = GTK_TREE_VIEW (gtk_builder_get_object (priv->builder,
+											   "serial_treeview"));
+	baud_view = GTK_TREE_VIEW (gtk_builder_get_object (priv->builder,
+											 "serial_baud_treeview"));
+	g_return_val_if_fail (serial_view, -1);
+	g_return_val_if_fail (baud_view, -1);
+
+	renderer = gtk_cell_renderer_text_new ();
+	
+	column = gtk_tree_view_column_new_with_attributes ("",
+											 renderer,
+											 "text", SERIAL_SUBSYSTEM_COLUMN,
+											 NULL);
+	gtk_tree_view_column_set_sort_column_id (column, SERIAL_SUBSYSTEM_COLUMN);
+	gtk_tree_view_column_set_sort_order (column, GTK_SORT_ASCENDING);
+	gtk_tree_view_column_set_sort_indicator (column, TRUE);
+	gtk_tree_view_append_column (serial_view, column);
+	
+	column = gtk_tree_view_column_new_with_attributes (_("Port"),
+											 renderer,
+											 "text", SERIAL_PORT_COLUMN,
+											 NULL);
+	gtk_tree_view_column_set_sort_column_id (column, SERIAL_PORT_COLUMN);
+	gtk_tree_view_column_set_sort_order (column, GTK_SORT_ASCENDING);
+	gtk_tree_view_column_set_sort_indicator (column, TRUE);
+	gtk_tree_view_append_column (serial_view, column);
+
+	
+	column = gtk_tree_view_column_new_with_attributes (_("Baud Rate"),
+											 renderer,
+											 "text", SERIALBAUD_RATE_COLUMN,
+											 NULL);
+	gtk_tree_view_column_set_sort_column_id (column, SERIALBAUD_RATE_COLUMN);
+	gtk_tree_view_column_set_sort_order (column, GTK_SORT_ASCENDING);
+	gtk_tree_view_column_set_sort_indicator (column, TRUE);
+	gtk_tree_view_append_column (baud_view, column);
+
+	/* set selection */
+	selection = gtk_tree_view_get_selection (serial_view);
+	gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+	selection = gtk_tree_view_get_selection (baud_view);
+	gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+	
+	gtk_tree_view_set_model (baud_view, GTK_TREE_MODEL (baud_store));
+	gtk_tree_view_set_model (serial_view, GTK_TREE_MODEL (serial_store));
+	
+	return 0;
+}
+
+static void
+setup_bluetooth_page (MBCAAssistantPrivate* priv)
+{
+	GObject* placeholder;
+
+	placeholder = gtk_builder_get_object (priv->builder, 
+								   "bluetooth_placeholder_vbox");
+	g_return_if_fail (placeholder);
+	
+	priv->btselector = bluetooth_device_selection_new(NULL);
+	g_object_set (priv->btselector,
+			    "show-search", FALSE,
+			    "show-bonding", FALSE,
+			    "show-device-type", FALSE,
+			    "show-device-category", FALSE,
+			    "device-type-filter", BLUETOOTH_TYPE_PHONE,
+			    NULL);
+
+	priv->btrescan_thread = g_thread_create (mbca_bluetooth_rescan_cb,
+									priv,
+									TRUE,
+									NULL);
+	g_return_if_fail (priv->btrescan_thread);
+	
+	gtk_widget_show (priv->btselector);		
+
+	gtk_box_pack_start (GTK_BOX (placeholder), priv->btselector, 
+					TRUE, TRUE, 0);
+	
+	g_signal_connect(priv->btselector, "selected-device-changed",
+				  G_CALLBACK(mbca_bluetooth_selected_device_changed), priv);
+}
+
+/** 
+ * Sets all the connection method radiobuttons on method_page inactive and
+ * thus force the user to choose one.
+ *
+ * @param app private application data
+ */
+static void
+set_method_radio_buttons_inactive(MBCAAssistantPrivate* priv)
+{
+	GObject* togglebutton;	
+
+	/* it seems that gtk does not allow every radiobutton in a group to be
+	 * inactive. Let's solve this problem with a hidden button.
+	 */
+	togglebutton = gtk_builder_get_object (priv->builder,
+								    "method_none_radiobutton");
+	g_return_if_fail (togglebutton);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (togglebutton),
+							TRUE);
+}
+
+/******************************************************************************
+ * HAL *
+ *******/
+static void
+find_hal_info (LibHalContext *ctx,
+			const char* udi,
+			gchar** vendor,
+			gchar** product)
+{
+	char* parent;
+	
+	*vendor = NULL;
+	*product = NULL;
+	
+	parent = libhal_device_get_property_string (ctx, udi, "info.parent", NULL);
+	while (parent)
+	{
+		char* tmp;
+		char* subsystem = libhal_device_get_property_string (ctx,
+												   parent,
+												   "info.subsystem",
+												   NULL);		
+		/** @todo pcmcia, pccard, expresscard */ 
+		if (g_utf8_collate (subsystem, "usb_device") == 0)
+		{
+			char* halproduct;
+			char* halvendor;
+			
+			halproduct = libhal_device_get_property_string (ctx,
+												   parent,
+												   "usb_device.product",
+												   NULL);
+			halvendor = libhal_device_get_property_string (ctx,
+												  parent,
+												  "usb_device.vendor",
+												  NULL);
+			*product = g_strdup (halproduct);
+			*vendor = g_strdup (halvendor);
+			libhal_free_string (halproduct);
+			libhal_free_string (halvendor);
+			break;
+		}
+		
+		tmp = libhal_device_get_property_string (ctx,
+										 parent,
+										 "info.parent",
+										 NULL);
+		libhal_free_string (parent);
+		parent = tmp;
+	}
+	libhal_free_string (parent);	
+}
+
+static void
+hal_device_added_cb (LibHalContext *ctx, const char *udi)
+{
+	MBCAAssistantClassPrivate* priv;
+	GtkTreeIter iter;
+	gchar* product;
+	gchar* vendor;
+
+	/** @todo mutex! */
+	
+	if (!libhal_device_query_capability (ctx, udi, "modem", NULL))
+	{
+		return;
+	}
+	priv = (MBCAAssistantClassPrivate*)libhal_ctx_get_user_data (ctx);
+	
+	/* check that device is not already in the list */
+	if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->hal_store), &iter))
+	{
+		do
+		{
+			gchar* modeludi;
+			gtk_tree_model_get (GTK_TREE_MODEL (priv->hal_store), &iter,
+							HAL_UDI_COLUMN, &modeludi,
+							-1);
+			if (g_utf8_collate (modeludi, udi) == 0){
+				/* found! */
+				g_free (modeludi);
+				return;
+			}
+			g_free (modeludi);
+		}
+		while (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->hal_store),
+								   &iter));
+	}
+	
+	find_hal_info (ctx, udi, &vendor, &product);
+	g_return_if_fail (product);
+	
+	gtk_list_store_append (priv->hal_store, &iter);
+	gtk_list_store_set (priv->hal_store, &iter,
+					HAL_PRODUCT_COLUMN, product,
+					HAL_VENDOR_COLUMN, vendor,
+					HAL_UDI_COLUMN, udi,
+					-1);
+	g_free (vendor);
+	g_free (product);
+}
+
+static void
+hal_device_new_capability_cb (LibHalContext *ctx,
+						const char *udi,
+						const char *capability)
+{
+	if (g_utf8_collate (capability, "modem") == 0)
+	{
+		hal_device_added_cb (ctx, udi);
+	}
+}
+
+
+static void
+hal_device_removed_cb (LibHalContext *ctx, const char *udi)
+{
+	MBCAAssistantClassPrivate* priv;
+	GtkTreeIter iter;
+	
+	/**
+	 * @bug there is a possible race between hal_device_removed_cb()
+	 *      and hal_device_added_cb(). This can be solved using a mutex around
+	 *      priv->hal_strore, but it's propably not a problem.
+	 */
+	
+	priv = (MBCAAssistantClassPrivate*)libhal_ctx_get_user_data (ctx);
+	if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->hal_store), &iter))
+	{
+		do
+		{
+			gchar* modeludi;
+			gtk_tree_model_get (GTK_TREE_MODEL (priv->hal_store), &iter,
+							HAL_UDI_COLUMN, &modeludi,
+							-1);
+			if (g_utf8_collate (modeludi, udi) == 0){
+				g_free (modeludi);
+				gtk_list_store_remove (priv->hal_store, &iter);
+				return;
+			}
+			g_free (modeludi);
+		}
+		while (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->hal_store),
+								   &iter));
+	}	
+}
+
+static void
+hal_device_lost_capability_cb (LibHalContext *ctx,
+						 const char *udi,
+						 const char *capability)
+{
+	if (g_utf8_collate (capability, "modem") == 0)
+	{
+		hal_device_removed_cb (ctx, udi);
+	}
+}
+
+/******************************************************************************
+ * GObject *
+ ***********/
+
+static void
+assistant_class_finalize (gpointer g_class,
+					 gpointer class_data)
+{
+	MBCAAssistantClassPrivate* priv;
+	GtkTreeModel* country_store;
+	GtkTreeIter iter;
+
+	g_debug ("assistant_class_finalize");
+	priv = ((MBCAAssistantClass*)g_class)->priv;
+
+	
+	priv->abort_provider_thread = TRUE;
+	g_thread_join (priv->provider_thread);	
+	g_mutex_free (priv->instances_mutex);
+	
+	/* Service provider page */
+	if (priv->gweather_database)
+	{
+		g_object_unref (priv->gweather_database);
+	}
+	
+	country_store = GTK_TREE_MODEL (priv->country_store);
+	if (country_store)
+	{
+		if (gtk_tree_model_get_iter_first (country_store, &iter))
+		{
+			do
+			{
+				GtkTreeModel* provider_store;
+				gtk_tree_model_get (country_store, &iter,
+								COUNTRY_PROVIDERS_COLUMN,
+								&provider_store,
+								-1);
+				gtk_list_store_clear (GTK_LIST_STORE (provider_store));
+				g_object_unref (provider_store);
+			}
+			while (gtk_tree_model_iter_next (country_store, &iter));
+		}
+		gtk_list_store_clear (GTK_LIST_STORE (country_store));
+	}	
+	
+	free_service_provider_database (&(priv->database));	
+	
+	if (priv->halctx)
+	{
+		libhal_ctx_shutdown (priv->halctx, NULL);
+		libhal_ctx_free (priv->halctx);
+	}
+	if (priv->halconn)
+	{
+		dbus_connection_unref(priv->halconn);
+	}
+	
+	g_free (priv->country_code);
+	g_free (priv);
+}
+
+static void
+assistant_dispose (GObject *obj)
+{
+	g_debug ("assistant_dispose");
+#if 0
+  MamanBar *self = (MamanBar *)obj;
+
+  if (self->priv->dispose_has_run) {
+   /* If dispose did already run, return. */
+    return;
+  }
+  /* Make sure dispose does not run twice. */
+  object->priv->dispose_has_run = TRUE;
+
+  /* 
+   * In dispose, you are supposed to free all types referenced from this
+   * object which might themselves hold a reference to self. Generally,
+   * the most simple solution is to unref all members on which you own a 
+   * reference.
+   */
+
+   /* Chain up to the parent class */
+   G_OBJECT_CLASS (parent_class)->dispose (obj);
+#endif
+}
+
+static void
+assistant_finalize (GObject *obj)
+{
+	MBCAAssistant* self = (MBCAAssistant*)obj;
+	MBCAAssistantPrivate* priv;
+	
+	g_debug ("assistant_finalize");
+	priv = self->priv;	
+	
+	/* Everything was set to zero in new() by g_malloc0 so any pointer that
+	 * is not NULL must be freed
+	 */
+	
+	if (!self->priv)
+	{
+		return;
+	}
+
+	priv->exit_btrescan = TRUE;
+	g_thread_join (priv->btrescan_thread);
+	
+	mbca_free_configuration (priv->conf);
+	
+	/* USB page */
+	
+	
+	/* Serial page */
+	
+	
+	/* Bluetooth page */
+	
+	
+	/* Generic  */
+	g_free (priv->nice_device_name);
+	g_free (priv->country_name);
+	g_free (priv->provider_name);
+	
+	/* conf is given to the caller so it must not be freed
+	 */
+	
+	if (priv->assistant)
+	{
+		gtk_widget_destroy (GTK_WIDGET (priv->assistant));
+	}
+	
+	g_object_unref (priv->builder);
+	g_free (priv);	
+	
+	G_OBJECT_CLASS (parent_class)->finalize (obj);
+}
+
+static void
+assistant_class_init (gpointer g_class,
+                      gpointer g_class_data)
+{
+	MBCAAssistantClassPrivate* priv;
+	GObjectClass* gobject_class;
+	MBCAAssistantClass *klass;
+	GtkTreeIter iter;
+	gint ret;
+
+	/* HAL */
+	DBusError halerr;
+	int num_devices;
+	char** devices;
+	char** udi;
+	int num;
+	
+	g_debug ("assistant_class_init");
+	
+	/* translation domain */
+	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+	
+	gobject_class = G_OBJECT_CLASS (g_class);
+	klass = MBCA_ASSISTANT_CLASS (g_class);
+	
+	/* set functions */
+	gobject_class->dispose = assistant_dispose;
+	gobject_class->finalize = assistant_finalize;
+
+	/* store parent class */
+	parent_class = g_type_class_peek_parent (klass);
+
+	
+	/* private structure */
+	priv = g_malloc0 (sizeof (MBCAAssistantClass));	
+	klass->priv = priv;
+	
+	
+	/* create list stores */
+	priv->baud_store = gtk_list_store_new (SERIALBAUD_N_COLUMNS,
+								    G_TYPE_STRING);	    /* rate */
+	priv->serial_store = gtk_list_store_new (SERIAL_N_COLUMNS,
+									 G_TYPE_STRING,    /* subsystem */
+									 G_TYPE_STRING);   /* device	  */
+	priv->hal_store = gtk_list_store_new (HAL_N_COLUMNS,
+								   G_TYPE_STRING,	 /* product */
+								   G_TYPE_STRING,    /* vendor  */
+								   G_TYPE_STRING);   /* udi     */	
+	priv->country_store = gtk_list_store_new (COUNTRY_N_COLUMNS,
+									  G_TYPE_STRING,  /* code      */
+									  G_TYPE_STRING,  /* name      */
+									  G_TYPE_POINTER, /* providers */
+									  G_TYPE_BOOLEAN);/* autosort  */		 	
+	
+	
+	/* HAL connection */
+	dbus_error_init (&halerr);
+	priv->halconn = dbus_bus_get (DBUS_BUS_SYSTEM, &halerr);
+	if(!priv->halconn && dbus_error_is_set (&halerr))
+	{
+		g_error ("%s: %s\n", halerr.name, halerr.message);
+	}
+	
+	priv->halctx = libhal_ctx_new ();
+	g_return_if_fail (priv->halctx);
+
+	if (!libhal_ctx_set_dbus_connection (priv->halctx, priv->halconn))
+	{
+		g_error ("could not set dbus connection for HAL context");
+	}
+	if (!libhal_ctx_init (priv->halctx, NULL))
+	{
+		g_error ("could not initialize HAL context");
+	}
+	if (!libhal_ctx_set_user_data (priv->halctx, priv))
+	{
+		g_error ("could not set HAL context user data");
+	}		
+	
+	
+	/* HAL callbacks */
+	ret = libhal_ctx_set_device_added (priv->halctx, hal_device_added_cb);
+	if (!ret)
+	{
+		g_error ("libhal_ctx_set_device_added failed");
+	}
+
+	ret = libhal_ctx_set_device_removed (priv->halctx, hal_device_removed_cb);
+	if (!ret)
+	{
+		g_error ("libhal_ctx_set_device_removed failed");
+	}
+
+	ret = libhal_ctx_set_device_new_capability (priv->halctx,
+									    hal_device_new_capability_cb);
+	if (!ret)
+	{
+		g_error ("libhal_ctx_set_device_new_capability failed");
+	}
+
+	ret = libhal_ctx_set_device_lost_capability (priv->halctx,
+										hal_device_lost_capability_cb);
+	if (!ret)
+	{
+		g_error ("libhal_ctx_set_device_lost_capability failed");
+	}
+	
+	
+	/* Initial devices for hal_page */
+	devices = libhal_get_all_devices (priv->halctx, &num, NULL);
+	if (!devices)
+	{
+		g_debug ("libhal_get_all_devices failed");
+	}
+	
+	for (udi = devices; *udi; udi++)
+	{
+		if (libhal_device_query_capability (priv->halctx,
+									 *udi,
+									 "modem",
+									 NULL))
+		{
+			/* using the callback like this leads to concurrency issues */
+			hal_device_added_cb (priv->halctx, *udi);
+		}
+	}
+	libhal_free_string_array (devices);
+	
+	
+	/* Initial devices for serial_page
+	 * note: serial_page device list is not updated after this.
+	 */
+	devices = libhal_manager_find_device_string_match (priv->halctx,
+											 "info.category",
+											 "serial",
+											 &num_devices,
+											 NULL);
+	for (udi = devices; *udi; udi++)
+	{
+		char* device;
+		char* parent;
+		char* subsystem;
+		
+		device = libhal_device_get_property_string (priv->halctx,
+										    *udi,
+										    "serial.device",
+										    NULL);
+		parent = libhal_device_get_property_string (priv->halctx,
+										    *udi,
+										    "serial."
+										    "originating_device",
+										    NULL);
+		subsystem = libhal_device_get_property_string (priv->halctx,
+											  parent,
+											  "info.subsystem",
+											  NULL);		
+		
+		gtk_list_store_append (priv->serial_store, &iter);
+		gtk_list_store_set (priv->serial_store, &iter,
+						SERIAL_SUBSYSTEM_COLUMN, subsystem,
+						SERIAL_PORT_COLUMN, device,
+						-1);
+		
+		libhal_free_string (device);
+		libhal_free_string (parent);
+		libhal_free_string (subsystem);
+	}
+	libhal_free_string_array(devices);
+		
+	
+	/* default baudrates */
+	gtk_list_store_append (priv->baud_store, &iter);
+	gtk_list_store_set (priv->baud_store, &iter,
+					SERIALBAUD_RATE_COLUMN, "115200",
+					-1);
+	gtk_list_store_append (priv->baud_store, &iter);
+	gtk_list_store_set (priv->baud_store, &iter,
+					SERIALBAUD_RATE_COLUMN, "57600 ",
+					-1);
+	gtk_list_store_append (priv->baud_store, &iter);
+	gtk_list_store_set (priv->baud_store, &iter,
+					SERIALBAUD_RATE_COLUMN, "38400",
+					-1);
+	gtk_list_store_append (priv->baud_store, &iter);
+	gtk_list_store_set (priv->baud_store, &iter,
+					SERIALBAUD_RATE_COLUMN, "19200",
+					-1);
+	gtk_list_store_append (priv->baud_store, &iter);
+	gtk_list_store_set (priv->baud_store, &iter,
+					SERIALBAUD_RATE_COLUMN, "9600",
+					-1);
+
+	/* provider resource loading thead */
+	/* remember: booleans and pointers are set by g_malloc0 */
+	priv->instances_mutex = g_mutex_new ();
+	
+	priv->trigger_mutex = g_mutex_new ();
+	g_mutex_lock (priv->trigger_mutex);
+
+	priv->provider_thread = g_thread_create (mbca_load_provider_page_resources_thread_func,
+									priv,
+									TRUE,
+									NULL);
+	if (!priv->provider_thread)
+	{
+		g_error ("g_thread_create failed");	
+	}
+	
+	klass->state_changed_signal_id =
+		g_signal_new ("state-changed",
+					G_TYPE_FROM_CLASS (g_class),
+					G_SIGNAL_RUN_LAST |
+					G_SIGNAL_NO_RECURSE |
+					G_SIGNAL_NO_HOOKS,
+					0, /* class_offset */
+					NULL, /* accumulator */
+					NULL, /* accu_data */
+					g_cclosure_marshal_VOID__ENUM,
+					G_TYPE_NONE, /* return_type */
+					1, /* n_params */
+					G_TYPE_INT); /* param_types */ 
+}
+
+static void
+assistant_init (GTypeInstance* instance, gpointer g_class)
+{
+	MBCAAssistantClass *klass = (MBCAAssistantClass*)g_class;
+	MBCAAssistant* self = (MBCAAssistant*)instance;
+	MBCAAssistantPrivate* priv;
+	GError* error = NULL;
+	gint ret;
+	
+	g_debug ("assistant_init");
+	if (!g_thread_supported ())
+	{
+		g_error ("gthreads are not supported. did you forget to call "
+			    "g_thread_init()?"
+			    /* "please, RTFM!" */);
+	}
+	self->priv = g_malloc0 (sizeof (MBCAAssistantPrivate));
+	priv = self->priv;
+
+	
+	priv->builder = gtk_builder_new ();
+	gtk_builder_set_translation_domain  (priv->builder,
+								  GETTEXT_PACKAGE);
+	ret = gtk_builder_add_from_file (priv->builder,
+							   MBCA_UI_DEFINITION,
+							   &error);
+	if (!ret)
+	{
+		g_error ("could not load the UI: %s", error->message);
+	}
+	
+	
+	priv->assistant = GTK_ASSISTANT (gtk_builder_get_object (priv->builder,
+												  "mbca_assistant")
+							   );
+	if (!priv->assistant)
+	{
+		g_error ("who has b0rk3d the UI file?!");
+	}    
+	
+	
+	priv->conf = g_malloc0 (sizeof (MBCAConfiguration));
+	
+	
+	/* do all the GUI initialization before connecting any signals to prevent
+	 * unnecessary callbacks
+	 */
+	setup_bluetooth_page (priv);
+	setup_serial_page (priv,
+				    klass->priv->serial_store,
+				    klass->priv->baud_store);
+	setup_hal_page (priv, klass->priv->hal_store);
+	setup_provider_page (priv);
+	
+	gtk_assistant_set_forward_page_func (priv->assistant,
+								  mbca_page_func,
+								  priv,
+								  NULL);	
+	connect_signals (self);
+
+	
+	priv->kpriv = klass->priv;
+	
+#if 0	
+	/*
+	 * waiting_instances is a GSList of MBCAAssistantPrivate structs for
+	 * every instance waiting for the data. When provider thread is done it
+	 * will automaticly go through the list and attach the data.
+	 *
+	 * provider_thread_ready or waiting_instances must not be accessed if 
+	 * instances_mutex is not locked!
+	 */
+	g_mutex_lock (klass->priv->instances_mutex);
+	if (klass->priv->provider_thread_ready)
+	{
+		g_debug ("assistant_init: attaching resources");
+		/* thread is done so we can attach the resources right away */
+		mbca_provider_attach_resources (klass->priv, priv);
+	}
+	else
+	{
+		g_debug ("assistant_init: adding instance to resource wait queue");
+		/* thread is still running so lets hook up for wait queue and let
+		 * thread handle the attaching
+		 */
+		
+		GSList** list = &klass->priv->waiting_instances;
+		*list = g_slist_prepend (*list, priv);
+	}
+	g_mutex_unlock (klass->priv->instances_mutex);
+#endif	
+	
+	/* everything else in MBCAAssistantPrivate is safely set to NULL, FALSE,
+	 * etc by g_malloc0
+	 */
+}
+
+/******************************************************************************
+ * Public API *
+ **************/
+
+void
+mbca_free_configuration (MBCAConfiguration* configuration)
+{
+	if (!configuration)
+	{
+		return;
+	}
+	
+	free_serviceprovider (configuration->provider);
+	g_free (configuration->baud);
+	g_free (configuration->device);
+	g_free (configuration->name);
+	g_free (configuration);
+}
+
+GType
+mbca_assistant_get_type ()
+{
+	static GType type = 0;
+	if (type == 0) {
+		
+		/** @todo assistant should be static so that resources are freed */
+		static const GTypeInfo info = {
+			sizeof (MBCAAssistantClass),
+			NULL,   /* base_init */
+			NULL,   /* base_finalize */
+			assistant_class_init,
+			NULL,   /* class_finalize */
+			NULL,   /* class_data */
+			sizeof (MBCAAssistant),
+			0,      /* n_preallocs */
+			assistant_init
+		};
+		type = g_type_register_static (G_TYPE_OBJECT,
+								 "MBCAAssistantType",
+								 &info, 0);
+	}
+	return type;
+}
+
+MBCAAssistant*
+mbca_assistant_new ()
+{
+	return g_object_new (mbca_assistant_get_type(), NULL);
+}
+
+gint
+mbca_assistant_run (MBCAAssistant* assistant)
+{
+	return mbca_assistant_run_for_device (assistant,
+								   MBCA_DEVICE_NONE,
+								   NULL, NULL);
+}
+
+gint
+mbca_assistant_run_for_device (MBCAAssistant* assistant,
+						 enum MBCADeviceType type,
+						 const gchar* device,
+						 const gchar* nice_device_name)
+{
+	MBCAAssistantPrivate* priv = assistant->priv;
+	
+	if (priv->dispose_has_run) {
+	  /* Dispose has run. Data is not valid anymore. */
+	  return 0;
+	}
+
+	g_return_val_if_fail (priv->state == MBCA_STATE_READY, -1);
+	priv->state = MBCA_STATE_RUNNING;
+	g_signal_emit (assistant,
+				MBCA_ASSISTANT_GET_CLASS (assistant)->state_changed_signal_id,
+				0,
+				priv->state);
+	
+	
+	/* default baud rate */
+	priv->conf->baud = g_strdup ("115200");
+	
+	
+	if (type != MBCA_DEVICE_NONE)
+	{
+		priv->device_is_preset = TRUE;
+		priv->conf->device = g_strdup (device);
+		priv->nice_device_name = g_strdup (nice_device_name);
+		switch (type)
+		{
+			case MBCA_DEVICE_BLUETOOTH:
+			{
+				priv->conf->type = MBCA_DEVICE_BLUETOOTH;
+				break;
+			}
+			case MBCA_DEVICE_SERIAL:
+			{	
+				/* serial devices are special.
+				 * device name _is_ the nice name and baud is stored 
+				 * in nice_device_name
+				 */
+				
+				g_free (priv->nice_device_name);
+				priv->nice_device_name = g_strdup (device);
+				
+				g_free (priv->conf->baud);
+				priv->conf->baud = g_strdup (nice_device_name);
+				priv->conf->type = MBCA_DEVICE_SERIAL;
+				break;			
+			}
+			case MBCA_DEVICE_HAL:
+			{
+				priv->conf->type = MBCA_DEVICE_HAL;
+				break;
+			}
+			default:
+			{
+				g_return_val_if_reached (-1);
+			}
+		}
+	}
+	
+	set_method_radio_buttons_inactive (priv);
+	gtk_widget_show (GTK_WIDGET (priv->assistant));	
+	
+	return 0;
+}
+				 
+enum MBCAAssistantState
+mbca_assistant_get_state (MBCAAssistant* assistant)
+{
+	if (assistant->priv->dispose_has_run) {
+	  /* Dispose has run. Data is not valid anymore. */
+	  return MBCA_STATE_ABORTED;
+	}
+	
+	return assistant->priv->state;
+}
+
+MBCAConfiguration*
+mbca_assistant_get_configuration (MBCAAssistant* assistant)
+{
+	MBCAConfiguration* newconf;
+	MBCAConfiguration* conf;
+	
+	if (assistant->priv->dispose_has_run) {
+	  /* Dispose has run. Data is not valid anymore. */
+	  return NULL;
+	}
+	
+	g_return_val_if_fail (assistant->priv->state == MBCA_STATE_DONE, NULL);
+
+	/* duplicate */
+	conf = assistant->priv->conf;
+	newconf = g_malloc0 (sizeof (MBCAConfiguration));
+	newconf->name = g_strdup (conf->name);
+	newconf->type = conf->type;
+	newconf->device = g_strdup (conf->device);
+	newconf->baud = g_strdup (conf->baud);
+	newconf->provider = duplicate_serviceprovider (conf->provider);
+	
+	return newconf;
+}
+
+void
+mbca_assistant_abort (MBCAAssistant* assistant)
+{
+	if (assistant->priv->dispose_has_run) {
+	  /* Dispose has run. Data is not valid anymore. */
+	  return;
+	}
+	
+	/** @todo implement */
+}
+
+/*******************************************************************************
+ * Assistant callbacks *
+ ***********************/
+
+void
+mbca_assistant_apply_cb (GtkAssistant* gtkassistant,
+					gpointer user_data)
+{
+	MBCAAssistant* assistant = user_data;
+	MBCAAssistantPrivate* priv = assistant->priv;
+	
+	priv->done = TRUE;
+	priv->state = MBCA_STATE_DONE;
+	
+	/* let close_cb() handle signal emission */
+}
+
+void
+mbca_assistant_cancel_cb (GtkButton* button,
+					 gpointer user_data)
+{
+	MBCAAssistant* assistant = user_data;
+	MBCAAssistantPrivate* priv = assistant->priv;
+	
+	priv->state = MBCA_STATE_ABORTED;
+	mbca_assistant_close_cb (button, user_data);
+}
+
+void
+mbca_assistant_close_cb (GtkButton* button,
+					gpointer user_data)
+{
+	MBCAAssistant* assistant = user_data;
+	MBCAAssistantPrivate* priv = assistant->priv;
+
+	gtk_widget_hide (GTK_WIDGET (priv->assistant));
+	
+	g_signal_emit (assistant,
+				MBCA_ASSISTANT_GET_CLASS (assistant)->state_changed_signal_id,
+				0,
+				priv->state);
+}
+
+void
+mbca_assistant_prepare_cb (GtkAssistant* gtkassistant,
+					  GtkWidget* page,
+					  gpointer user_data)
+{
+	MBCAAssistant* assistant = user_data;
+	MBCAAssistantPrivate* priv = assistant->priv;
+	gint page_number = mbca_page_name_to_number (gtk_widget_get_name (page));
+	
+	if (page_number == PAGE_BLUETOOTH)
+	{
+		priv->btrescan_enabled = TRUE;
+		/* check also mbca_bluetooth_radiobutton_clicked_cb () */
+	}
+	else
+	{
+		priv->btrescan_enabled = FALSE;
+	}
+	
+	switch(page_number)
+	{
+		case PAGE_INTRO:
+		{
+			break;
+		}
+		case PAGE_METHOD:
+		{
+			mbca_method_page_prepare_cb (gtkassistant, page, user_data);
+			break;
+		}
+		case PAGE_BLUETOOTH:
+		{
+			mbca_bluetooth_page_prepare_cb (gtkassistant, page, user_data);
+			break;
+		}
+		case PAGE_SERIAL:
+		{
+			mbca_serial_page_prepare_cb (gtkassistant, page, user_data);
+			break;
+		}
+		case PAGE_HAL:
+		{
+			mbca_hal_page_prepare_cb (gtkassistant, page, user_data);
+			break;
+		}
+		case PAGE_PROVIDER:
+		{
+			mbca_provider_page_prepare_cb (gtkassistant, page, user_data);
+			break;
+		}
+		case PAGE_SUMMARY:
+		{
+			mbca_summary_page_prepare_cb (gtkassistant, page, user_data);
+			break;
+		}
+		default:
+		{
+			g_warn_if_reached();
+		}	
+	}
+} 

Added: trunk/src/mbca_assistant.h
==============================================================================
--- (empty file)
+++ trunk/src/mbca_assistant.h	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,294 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file mbca_assistant.h
+ * @brief public API
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ *
+ * Contains API function definitions and datatypes.
+ * Forms together with mbca_serviceprovider.h public API of libmbca.
+ */
+ 
+#ifndef MBCA_ASSISTANT_H
+#define MBCA_ASSISTANT_H
+
+#include "mbca_serviceprovider.h"
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+
+/** standard typedef */
+typedef struct _MBCAAssistant MBCAAssistant;
+
+/** standard typedef */
+typedef struct _MBCAAssistantClass MBCAAssistantClass;
+
+/** standard typedef */
+typedef struct _MBCAAssistantPrivate MBCAAssistantPrivate;
+
+/** standard typedef */
+typedef struct _MBCAAssistantClassPrivate MBCAAssistantClassPrivate;
+
+/** standard macro */
+#define MBCA_TYPE_ASSISTANT (mbca_assistant_get_type ())
+
+/** standard macro */
+#define MBCA_ASSISTANT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MBCA_TYPE_ASSISTANT, MBCAAssistant))
+
+/** standard macro */
+#define MBCA_ASSISTANT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MBCA_TYPE_ASSISTANT, MBCAAssistantClass))
+
+/** standard macro */
+#define MBCA_IS_ASSISTANT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MBCA_TYPE_ASSISTANT))
+
+/** standard macro */
+#define MBCA_IS_ASSISTANT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MBCA_TYPE_ASSISTANT))
+
+/** standard macro */
+#define MBCA_ASSISTANT_GET_CLASS(obj)(G_TYPE_INSTANCE_GET_CLASS ((obj), MBCA_TYPE_ASSISTANT, MBCAAssistantClass))
+
+
+/**
+ *Â brief instance
+ *
+ * members of an assistant instance.
+ */
+struct _MBCAAssistant
+{
+	GObject parent;	/**< derives MBCAAssistant from GObject			  */
+
+	MBCAAssistantPrivate* priv; /**< private bits and pieces			  */
+};
+
+/**
+ * @brief class
+ *
+ * members of assistant class.
+ *
+ * @par signals:
+ * <code>
+ * void (*state-changed) (MBCAAssistant* assistant,
+ *                        enum MBCAAssistantState state,
+ *                        gpointer user_data)
+ * </code>
+ */
+struct _MBCAAssistantClass
+{
+	GObjectClass parent; /**< derives MBCAAssistantClass from GObjectClass  */
+
+	/* signal ids */
+	guint state_changed_signal_id; /**< signal ID of "state-changed"		  */
+
+	MBCAAssistantClassPrivate* priv; /**< private bits and pieces		  */
+};
+
+/**
+ * @brief standard function
+ *
+ * GObject boilerplate code
+ */
+GType mbca_assistant_get_type (void);
+
+
+/**
+ * @brief type of device
+ *
+ * Type of the device (and connection).
+ */
+enum MBCADeviceType
+{
+	MBCA_DEVICE_NONE,	   /**< no device selected, for initialization	  */
+	MBCA_DEVICE_BLUETOOTH, /**< Bluetooth device						  */
+	MBCA_DEVICE_HAL,	   /**< devices discovered using HAL			  */
+	MBCA_DEVICE_SERIAL	   /**< Serial device						  */
+};
+
+/**
+ * @brief connection information
+ *
+ * Contains all the information needed for establishing a connection.
+ */
+struct _MBCAConfiguration
+{
+	gchar* name;			 /**< name of the connection			       */
+	enum MBCADeviceType type; /**< type of the connection				  */
+	gchar* device;			 /**< device to use, format depends on type
+						  *   @see mbca_assistant_run_for_device()     */
+	gchar* baud;			 /**< baud rate to use with the device		  */
+	
+	MBCAServiceProvider* provider; /**< service provider specific settings  */
+};
+/** standard typedef */
+typedef struct _MBCAConfiguration MBCAConfiguration;
+
+
+/**
+ * @brief free configuration
+ * 
+ * deallocates previously allocated MBCAConfiguration.
+ *
+ * @note this function should be used only with configurations that are build
+ *       in mbca_assistant_run() or mbca_assistant_run_for_device().
+ *
+ * @param configuration configuration to be freed
+ */
+void
+mbca_free_configuration (MBCAConfiguration* configuration);
+
+
+/**
+ * @brief states of MBCAAssistant
+ */
+enum MBCAAssistantState
+{
+	MBCA_STATE_READY,    /**< Assistant is ready to be run */
+	MBCA_STATE_RUNNING,  /**< Assistant is running	     */
+	MBCA_STATE_ABORTED,  /**< Assistant was aborted        */
+	MBCA_STATE_DONE	 /**< Assistant has finished       */
+};
+
+/**
+ * @brief create new instance
+ *
+ * Creates new instance of MBCAAssistant. The instance must be unreferenced
+ * when not anymore needed with g_object_unref()
+ *
+ * @note gtk_init() and g_thread_init() must be called before this function
+ *
+ * @returns a newly allocated instance.
+ */
+MBCAAssistant*
+mbca_assistant_new ();
+
+
+/**
+ * @brief run fully
+ *
+ * Runs the assistant fully. The assistant contains 5 pages:
+ *    1. introduction
+ *    2. connection method
+ *    3. device page based according to method
+ *    4. service provider
+ *    5. summary
+ *
+ * actually calls:
+ * <code>
+ *        mbca_assistant_run_for_device (assistant,
+ *                                       MBCA_DEVICE_NONE,
+ *                                       NULL, NULL);
+ * </code>
+ *
+ * @see mbca_assistant_run_for_device()
+ *
+ * @note assistant must be in MBCA_STATE_READY state
+ *
+ * @param assistant assistant to run
+ *
+ * @returns ' 0' on success
+ * @returns '-1' on failure
+ */
+gint
+mbca_assistant_run (MBCAAssistant* assistant);
+
+/**
+ * @brief run partially
+ *
+ * Runs the assistant. If device type is MBCA_DEVICE_NONE assistant is
+ * run fully. Otherwise assistant skips device selection and service provider
+ * page follows directly after introduction page. After assistant is once run
+ * it can't be run again. Unref the old and create a new one if necessary.
+ *
+ *
+ * format for device depends from type:
+ *
+ * MBCA_DEVICE_BLUETOOTH
+ *  - device is Bluetooth device address
+ *  - e.g. "01:23:45:67:89:AB"
+ *
+ * MBCA_DEVICE_HAL
+ *  - device is HAL UDI of a device that belongs in info.catecory "serial"
+ *  - e.g. "/org/freedesktop/Hal/devices/usb_device_421_453_noserial_if0_3_
+ *          serial_unknown_0"
+ *
+ * MBCA_DEVICE_SERIAL
+ * - device is path to character device representing serial port. For serial
+ *   devices nice_device_name means baud rate!
+ * - e.g. "/dev/ttyS0", "9600"
+ *
+ * @see mbca_assistant_run()
+ *
+ * @note assistant must be in MBCA_STATE_READY state
+ *
+ * @param assistant assistant to run
+ * @param type device type to preset
+ * @param device device to preset
+ * @param nice_device_name name for the device that is displayd to the user
+ *
+ * @returns ' 0' on success
+ * @returns '-1' on failure
+ */
+gint
+mbca_assistant_run_for_device (MBCAAssistant* assistant,
+						 enum MBCADeviceType type,
+						 const gchar* device,
+						 const gchar* nice_device_name);
+
+/**
+ * @brief get state
+ *
+ * @param assistant assistant to get state from
+ *
+ * @returns assistants state
+ */			 
+enum MBCAAssistantState
+mbca_assistant_get_state (MBCAAssistant* assistant);
+
+/**
+ * @brief get configuration
+ *
+ * @note assistant must be in state MBCA_STATE_DONE
+ * @note callee is responciple of calling mbca_free_configuration() when
+ *       returned configuration is no longer needed.
+ * 
+ * @param assistant assistant which configuration to retreive
+ *
+ * @returns configuration of user selection
+ */
+MBCAConfiguration*
+mbca_assistant_get_configuration (MBCAAssistant* assistant);
+
+/**
+ * @brief abort assistant
+ * 
+ * @param assistant assistant to abort
+ *
+ * aborts assistant if in RUNNING state and sets state to MBCA_STATE_ABORTED
+ */
+void
+mbca_assistant_abort (MBCAAssistant* assistant);
+
+
+G_END_DECLS
+
+#endif /* MBCA_ASSISTANT_H */

Added: trunk/src/mbca_serviceprovider.c
==============================================================================
--- (empty file)
+++ trunk/src/mbca_serviceprovider.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,115 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "mbca_serviceprovider.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#define _dupstr(d, s)    \
+if (s)				\
+{					\
+	d = strdup (s);	\
+}					\
+
+MBCAServiceProvider*
+duplicate_serviceprovider (MBCAServiceProvider* provider)
+{
+	MBCAServiceProvider* newprovider;
+	GSList* node;
+
+	if (!provider)
+	{
+		return NULL;
+	}
+	newprovider = g_malloc0 (sizeof (MBCAServiceProvider));
+
+	node = provider->names;		
+	while (node)
+	{
+		MBCAServiceProviderName* newname;
+		MBCAServiceProviderName* name = node->data;
+
+		newname = g_malloc0 (sizeof (MBCAServiceProviderName));
+		_dupstr(newname->lang, name->lang);
+		_dupstr(newname->name, name->name);
+		newprovider->names = g_slist_prepend (newprovider->names, newname);
+	
+		node = node->next;
+	}
+	newprovider->names = g_slist_reverse (newprovider->names);
+	
+	if (provider->type == MBCA_NETWORK_GSM)
+	{
+		_dupstr(newprovider->gsm.apn, provider->gsm.apn);
+	}
+	
+	_dupstr(newprovider->username, provider->username);
+	_dupstr(newprovider->password, provider->password);
+	_dupstr(newprovider->dns1, provider->dns1);
+	_dupstr(newprovider->dns2, provider->dns2);
+	_dupstr(newprovider->gateway, provider->gateway);
+	
+	return newprovider;
+}
+
+/** 
+ * frees also the MBCAServiceProvider struct;
+ */
+void
+free_serviceprovider (MBCAServiceProvider* provider)
+{
+	GSList* node;
+		
+	if (!provider)
+	{
+		return;
+	}
+	
+	/*
+	 * STRINGS ARE ALLOCATED BY xmlStrdup SO THEY MUST BE FREED USING free()
+	 */
+
+	node = provider->names;
+	while (node)
+	{
+		MBCAServiceProviderName* name = node->data;
+
+		free (name->lang);
+		free (name->name);
+		g_free (name);
+		node = node->next;
+	}
+	g_slist_free (provider->names);
+	
+	if (provider->type == MBCA_NETWORK_GSM)
+	{
+		free (provider->gsm.apn);
+	}
+	
+	free (provider->username);
+	free (provider->password);
+	free (provider->dns1);
+	free (provider->dns2);
+	free (provider->gateway);
+	g_free (provider);	
+}

Added: trunk/src/mbca_serviceprovider.h
==============================================================================
--- (empty file)
+++ trunk/src/mbca_serviceprovider.h	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,117 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file mbca_serviceprovider.h
+ * @brief public API
+ *
+ * This file contains structs and enums that describe service providers.
+ * The file forms together with mbca_assistant.h public API of libmbca.
+ *
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ */
+ 
+
+#ifndef MBCA_SERVICEPROVIDER_H
+#define MBCA_SERVICEPROVIDER_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/**
+ * @brief cellural network type
+ *
+ * Cellural network a provider is using. Network type helps to choose the right
+ * dial sequence as data modems are standardised.
+ */
+ enum MBCANetwork
+{
+	MBCA_NETWORK_GSM,      /**< GSM network, means GPRS, UMTS, etc     */
+	MBCA_NETWORK_CDMA      /**< CDMA network					  */
+};
+
+/**
+ * @brief GSM information
+ *
+ * GSM network specific information. 
+ */
+struct _mbcaGSMInfo
+{
+	gchar* apn;    /**< Access Point Name */
+};
+/** standard typedef */
+typedef struct _mbcaGSMInfo mbcaGSMInfo;
+
+/**
+ * @brief service provider name
+ *
+ * Mobile Broadband Service Provider Database supports multiple names in
+ * different languages for a service provider and this struct contains name of
+ * the service provider in some language. 
+ */
+struct _MBCAServiceProviderName
+{
+	gchar* lang;  /**< language, contains xml:lang attribute as defined in
+				*   database                                             */
+	gchar* name;  /**< name of the service provider                         */
+};
+/** standard typedef */
+typedef struct _MBCAServiceProviderName MBCAServiceProviderName;
+
+
+ /**
+ * @brief service provider data
+ *
+ * Contains the data of one service provider. In general NULL means
+ * "not needed" or "undefined". Fields correspond to Mobile Broadband Service
+ * Provider Database format.
+ *
+ * @see http://live.gnome.org/NetworkManager/MobileBroadband/ServiceProviders
+ */
+struct _MBCAServiceProvider
+{
+	GSList* names;		   /**< List of _MBCAServiceProviderName structs.
+					    *   Contains names as defined in the database.  */
+	enum MBCANetwork type; /**< cellural network the provider is using	  */
+	union				
+	{
+		mbcaGSMInfo gsm;  /**< contains GSM network specific settings if 
+					    *   _MBCAServiceProvider::type is MBCA_NETWORK_GSM 
+					    *									  */
+	};				   /**< union containing network specific settings.
+					    *   _MBCAServiceProvider::type indicates valid
+					    *   member */
+
+	gchar* username;	   /**< if NULL, no authentication required         */
+	gchar* password;	   /**< if NULL, no password required.			  */
+
+	gchar* dns1;		   /**< primary DNS, NULL if automatically acquired */
+	gchar* dns2;		   /**< secondary DNS, NULL if none.			  */
+	gchar* gateway;	   /**< gateway to use, NULL if none			  */
+};
+/** standard typedef */
+typedef struct _MBCAServiceProvider MBCAServiceProvider;
+
+G_END_DECLS
+
+#endif /* MBCA_SERVICEPROVIDER_H */
+ 

Added: trunk/src/mbca_serviceprovider_private.h
==============================================================================
--- (empty file)
+++ trunk/src/mbca_serviceprovider_private.h	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,47 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file mbca_serviceprovider_private.h
+ * @brief private API
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ *
+ * This file defines the private API for service provider operations.
+ */
+
+#ifndef MBCA_SERVICEPROVIDER_PRIVATE_H
+#define MBCA_SERVICEPROVIDER_PRIVATE_H
+
+#include "mbca_serviceprovider.h"
+
+G_BEGIN_DECLS
+
+MBCAServiceProvider*
+duplicate_serviceprovider (MBCAServiceProvider* provider);
+
+void
+free_serviceprovider (MBCAServiceProvider* provider);
+
+G_END_DECLS
+
+#endif /* MBCA_SERVICEPROVIDER_PRIVATE_H */
+
+ 

Added: trunk/src/method_page.c
==============================================================================
--- (empty file)
+++ trunk/src/method_page.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,167 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file method_page.c
+ * @brief Connection Method page functionality
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ */
+
+#include "callbacks.h"
+
+static void
+set_hal_device (gchar* device_type,
+			 gchar* primary,
+			 gchar* secondary,
+			 gpointer user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	GtkLabel* secondary_label;
+	GtkLabel* primary_label;
+	GtkWidget* alignment;
+	GtkWidget* hal_page;
+	GtkWidget* page;
+	
+	priv->conf->type = MBCA_DEVICE_HAL;
+	priv->hal_device_type = device_type;
+	
+	hal_page = gtk_assistant_get_nth_page (priv->assistant, PAGE_HAL);
+	page = gtk_assistant_get_nth_page (priv->assistant, PAGE_METHOD);
+	
+	gtk_assistant_set_page_title (priv->assistant,
+							hal_page,
+							device_type);
+	
+	primary_label = GTK_LABEL (gtk_builder_get_object (priv->builder,
+											 "hal_page_primary_"
+											 "info_label"));
+	secondary_label = GTK_LABEL (gtk_builder_get_object (priv->builder,
+											   "hal_page_secondary_"
+											   "info_label"));
+	alignment = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+										   "hal_page_secondary_"
+										   "info_alignment"));
+	g_return_if_fail (primary_label);
+	g_return_if_fail (secondary_label);
+	g_return_if_fail (alignment);
+	
+	gtk_label_set_markup (primary_label, primary);
+	if (!secondary)
+	{
+		/* hide the secondary information */
+		gtk_widget_hide (alignment);
+	}
+	else
+	{
+		/* user might go backwards from page that does not havesecondary info
+		 * to a page which has.
+		 */
+		gtk_widget_show (alignment);
+		gtk_label_set_markup (secondary_label, secondary);
+	}
+		
+	/** @bug maybe: should these set_page_complete come from
+	 *              gtk_assistant_get_nth_page in stead of
+	 *              gtk_builder_get_object?
+	 */
+	gtk_assistant_set_page_complete (priv->assistant,
+							   page,
+							   TRUE);	
+}
+
+void
+mbca_method_page_prepare_cb (GtkAssistant* gtkassistant,
+					    GtkWidget* page,
+					    gpointer user_data)
+{
+	
+}
+
+void
+mbca_bluetooth_radiobutton_clicked_cb (GtkButton* button,
+							    gpointer user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	GtkWidget* page;
+
+	priv->conf->type = MBCA_DEVICE_BLUETOOTH;
+	
+	page = gtk_assistant_get_nth_page (priv->assistant, PAGE_METHOD);
+
+	gtk_assistant_set_page_complete (priv->assistant,
+							   page,
+							   TRUE);
+	/* lookahead :P
+	 * If user decides to choose some other page mbca_assistant_prepare_cb ()
+	 * anyway sets this to FALSE when page is changed.
+	 */
+	priv->btrescan_enabled = TRUE;
+}
+
+void
+mbca_builtin_radiobutton_clicked_cb (GtkButton* button,
+							  gpointer user_data)
+{
+	set_hal_device (_("Built-in"),
+				 _("Select a Built-in device from the list"),
+				 _("<small>Check for kill-switches...</small>"),
+				 user_data);	
+}
+
+void
+mbca_pcmcia_radiobutton_clicked_cb (GtkButton* button,
+							 gpointer user_data)
+{
+	set_hal_device (_("PC Card, PCMCIA or ExpressCard"),
+				 _("Select correct device from the list"),
+				 NULL,
+				 user_data);	
+}
+
+void
+mbca_serialcable_radiobutton_clicked_cb (GtkButton* button,
+								 gpointer user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	GtkWidget* page;
+
+	priv->conf->type = MBCA_DEVICE_SERIAL;
+	
+	page = GTK_WIDGET (gtk_builder_get_object (priv->builder, "method_page"));
+
+	g_return_if_fail(page);
+
+	gtk_assistant_set_page_complete (priv->assistant,
+							   page,
+							   TRUE);
+}
+
+void
+mbca_usb_radiobutton_clicked_cb (GtkButton* button,
+						   gpointer user_data)
+{
+	set_hal_device (_("USB"),
+				 _("Select an USB device from the list"),
+				 _("<small>Device must be plugged in and power must be on."
+				   " Make sure that mobile phone has no security lock acti"
+				   "ve. Make sure the SIM card is in place</small>"),
+				 user_data);	
+}

Added: trunk/src/provider_page.c
==============================================================================
--- (empty file)
+++ trunk/src/provider_page.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,200 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file provider_page.c
+ * @brief Service Provider page functionality
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ */
+
+#include "callbacks.h"
+
+#include <string.h> /* memmove */
+
+void
+mbca_provider_page_prepare_cb (GtkAssistant* gtkassistant,
+					      GtkWidget* page,
+					      gpointer user_data)
+{
+	MBCAAssistant* assistant = user_data;
+	MBCAAssistantPrivate* priv = assistant->priv;
+	
+	g_mutex_lock (priv->kpriv->trigger_mutex);
+	mbca_provider_attach_resources (priv->kpriv, priv);
+	g_mutex_unlock (priv->kpriv->trigger_mutex);
+}
+
+void
+mbca_provider_selection_changed_cb (GtkTreeSelection* selection,
+							 gpointer user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	GtkTreeModel* provider_model;
+	gboolean is_complete;
+	GtkTreeIter iter;
+	GtkWidget* page;
+	MBCAServiceProvider* provider;
+		
+	page = gtk_assistant_get_nth_page (priv->assistant,
+								PAGE_PROVIDER);
+	
+	if (gtk_tree_selection_count_selected_rows (selection) == 1)
+	{
+		gtk_tree_selection_get_selected (selection,
+								   &provider_model,
+								   &iter);
+		gtk_tree_model_get (provider_model, &iter,
+						PROVIDER_NAME_COLUMN, &priv->provider_name,
+						PROVIDER_DATA_COLUMN, &provider,
+						-1);
+		free_serviceprovider (priv->conf->provider);
+		priv->conf->provider = duplicate_serviceprovider (provider);
+
+		is_complete = TRUE;
+	}
+	else
+	{
+		is_complete = FALSE;
+	}
+	
+	gtk_assistant_set_page_complete (priv->assistant, page, is_complete);
+}
+
+void
+mbca_country_selection_changed_cb (GtkTreeSelection* selection,
+							gpointer user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	GtkListStore* provider_store;	
+	GtkTreeModel* country_model;
+	GtkTreeViewColumn* column;
+	GtkWidget* provider_list;
+	GtkLabel* country_label;
+	gchar* countryname;
+	gboolean is_sorted;
+	GtkTreeIter iter;
+	
+	if (!gtk_tree_selection_get_selected (selection,
+								   &country_model,
+								   &iter))
+	{
+		/* no selection */
+		return;
+	}
+	
+	provider_list = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+											  "provider_treeview"));
+	g_return_if_fail (provider_list);
+	
+	gtk_tree_model_get (country_model, &iter,
+					COUNTRY_NAME_COLUMN, &countryname,
+					COUNTRY_PROVIDERS_COLUMN, &provider_store,
+					COUNTRY_SORTED_COLUMN, &is_sorted,
+					-1);
+	gtk_tree_view_set_model (GTK_TREE_VIEW (provider_list),
+						GTK_TREE_MODEL (provider_store));
+
+	g_free (priv->country_name);
+	priv->country_name = g_strdup (countryname);
+	
+	country_label = GTK_LABEL ( gtk_builder_get_object (priv->builder,
+											  "country_label"));
+	g_return_if_fail (country_label);
+	countryname = g_strjoin (NULL, _("_Country:"),  " ", countryname, NULL);
+	gtk_label_set_text_with_mnemonic (country_label, countryname);
+	g_free (countryname);
+		
+	if (!is_sorted)
+	{
+		/* sort the list */
+		column = gtk_tree_view_get_column (GTK_TREE_VIEW (provider_list),
+									PROVIDER_NAME_COLUMN);
+		gtk_tree_view_column_set_sort_order (column, GTK_SORT_ASCENDING);
+		gtk_tree_view_column_clicked (column);
+		
+		gtk_list_store_set (GTK_LIST_STORE (country_model), &iter,
+						COUNTRY_SORTED_COLUMN, TRUE,
+						-1);
+	}
+
+}
+
+gboolean
+mbca_country_code_qyery_tooltip_cb (GtkWidget* widget,
+							 gint x,
+							 gint y,
+							 gboolean keyboard_mode,
+							 GtkTooltip* tooltip,
+							 gpointer userdata)
+{
+	GtkTreeView* country_list = GTK_TREE_VIEW (widget);
+	GtkTreeViewColumn* column;
+	GList* columns;
+	gint column_id;
+	gint length;
+	gint bx;
+	gint by;
+	
+	gtk_tree_view_convert_widget_to_bin_window_coords (country_list,
+											 x,
+											 y,
+											 &bx,
+											 &by);
+	gtk_tree_view_get_path_at_pos (country_list,
+							 bx,
+							 by,
+							 NULL, 
+							 &column,
+							 NULL,
+							 NULL);
+	
+	gtk_tooltip_set_text (tooltip, _("You can search the list by typing "
+								   "with keyboard"));
+	if (column)
+	{
+		columns = gtk_tree_view_get_columns (country_list);
+	
+		length = g_list_length (columns);
+		for (column_id = 0; column_id != length ; column_id++)
+		{
+			if (((GtkTreeViewColumn*)columns->data) == column)
+			{
+				break;
+			}
+			columns = columns->next;
+		}
+		g_list_free (columns);
+	
+		if (column_id == COUNTRY_CODE_COLUMN)
+		{
+			gtk_tooltip_set_text (tooltip, _("Code of the country as defined by "
+									   "ISO 3166 standard"));
+		}
+
+		gtk_tree_view_set_tooltip_cell (GTK_TREE_VIEW (country_list),
+								  tooltip,
+								  NULL,
+								  column,
+								  NULL);	
+	}
+
+	return TRUE;	
+}

Added: trunk/src/provider_thread.c
==============================================================================
--- (empty file)
+++ trunk/src/provider_thread.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,556 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file provider_thread.c
+ * @brief provider page resource loading
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ *
+ * Shared provider page resources are loaded in separate thread. This file
+ * contains resource loading functionality.
+ */
+ 
+#include "provider_thread.h"
+#include "gnome-panel/system-timezone.h"
+
+/**
+ * ret must be freed
+ */
+gchar*
+mbca_alpha2name (const gchar* code,
+			  GtkTreeModel* gweather_database,
+			  volatile gboolean* abort)
+{
+/* from gweather-xml.c:
+ *=============================================================================
+ * <gweather format="1.0">
+ * <region>
+ *  <name>Name of the region</name>
+ *  <name xml:lang="xx">Translated Name</name>
+ *  <name xml:lang="zz">Another Translated Name</name>
+ *  <country>
+ *   <name>Name of the country</name>
+ *   <iso-code>2-letter ISO 3166 code for the country</iso-code>
+ *   <tz-hint>default timezone</tz-hint>
+ *   <location>
+ *    <name>Name of the location</name>
+ *    <code>IWIN code</code>
+ *    <zone>Forecast code (North America, Australia, UK only)</zone>
+ *    <radar>Weather.com radar map code (North America only)</radar>
+ *    <coordinates>Latitude and longitude as DD-MM[-SS][H] pair</coordinates>
+ *   </location>
+ *   <state>
+ *     <location>
+ *       ....
+ *     </location>
+ *     <city>
+ *      <name>Name of city with multiple locations</city>
+ *      <zone>Forecast code</zone>
+ *      <radar>Radar Map code</radar>
+ *      <location>
+ *        ...
+ *      </location>
+ *     </city>
+ *   </state>
+ *  </country>
+ * </region>
+ * <gweather>
+ * ============================================================================
+ * The thing to note is that each country can either contain different locations
+ * or be split into "states" which in turn contain a list of locations.
+ *
+ * <iso-code> can appear at the country or location level. <tz-hint>
+ * can appear at country, state, or location.
+ *
+ * treemodel is constructed as following:
+ *
+ * region1
+ *   |_____country1
+ *           |______location1
+ *           |______location2
+ *   |_____country2
+ *           |______location3
+ *           |______location4
+ * region2
+ *   |_____country3
+ *           |______state1
+ *           |        |______location5
+ *           |        |______location6
+ *           |______state2 
+ *                    |______location5
+ *                    |______location6
+ *
+ *
+ * ISO codes are stored in locations, but every location of a country has the
+ * same code. Thus it's sufficient to check the first location of a country or
+ * first location of first state if a country.
+ */
+	
+	GtkTreeIter region;
+		
+	gtk_tree_model_get_iter_first (gweather_database, &region);
+	do
+	{	
+		GtkTreeIter country;
+		if ( !gtk_tree_model_iter_children (gweather_database,
+									 &country,
+									 &region))
+		{
+			/* no countries */
+			continue;
+		}
+		
+		do
+		{
+			GtkTreeIter location;
+			WeatherLocation* loc;
+
+			if (!gtk_tree_model_iter_children (gweather_database,
+										&location,
+										&country))
+			{
+				/* no locations */
+				continue;
+			}
+			
+			gtk_tree_model_get (gweather_database, &location,
+							GWEATHER_XML_COL_POINTER, &loc,
+							-1);
+			if (!loc)
+			{
+				/* country has states, location means state */
+				GtkTreeIter statelocation;
+				if (!gtk_tree_model_iter_children (gweather_database,
+											&statelocation, 
+											&location))
+				{
+					/* no state locations */
+					continue;
+				}
+				gtk_tree_model_get (gweather_database, &statelocation,
+								GWEATHER_XML_COL_POINTER, &loc,
+								-1);
+				if(!loc)
+				{
+					/* skip */
+					continue;
+				}
+			}
+			
+			if (g_ascii_strcasecmp (code, loc->country_code) == 0)
+			{
+				gchar* name;
+				gtk_tree_model_get (gweather_database, &country,
+								GWEATHER_XML_COL_LOC, &name,
+								-1);				
+				return name;
+			}
+		}
+		while (gtk_tree_model_iter_next (gweather_database,
+								   &country) && !(*abort));
+	}
+	while (gtk_tree_model_iter_next (gweather_database, &region) && !(*abort));
+
+	return NULL;
+}
+
+
+/**
+ *Â brief populate provider list store
+ *
+ * Populates service provider list store from database.
+ *
+ * @param data pointer to ServiceProvider
+ * @param user_data pointer to GtkListStore
+ */
+static void
+mbca_provider_foreach (gpointer data, gpointer user_data)
+{
+	GtkListStore* provider_store = user_data;
+	MBCAServiceProvider* provider = data;
+	const gchar* const* locales;
+	GtkTreeIter iter;
+	const gchar* name;;
+		
+	/* choose the correct localized name for the provider */		
+	locales = g_get_language_names ();
+	g_return_if_fail (provider->names);
+	GSList* nameiter = provider->names;
+	gint best_match = G_MAXINT;
+	name = NULL;
+	gint i;
+	while (nameiter)
+	{
+		MBCAServiceProviderName* namestruct = nameiter->data;
+
+		/* shamelessly adapted from libgweather gweather-xml.c */
+		for( i = 0; namestruct->lang && locales[i] && i < best_match; i++ )
+		{
+			if( !g_ascii_strcasecmp( locales[i], namestruct->lang ) )
+			{
+				name = namestruct->name;
+				best_match = i;
+				break;
+			}
+		}
+		nameiter = nameiter->next;
+	}
+	if (!name)
+	{
+		/* use the first name as default */
+		name = ((MBCAServiceProviderName*)provider->names->data)->name;
+	}
+	
+	gtk_list_store_append (provider_store, &iter);
+	gtk_list_store_set (provider_store, &iter,
+					PROVIDER_NAME_COLUMN, name,
+					PROVIDER_DATA_COLUMN, provider,
+					-1);
+}
+
+/**
+ * @brief populate country list store
+ *
+ * Populates country GtkListStore from database.
+ *
+ * @param data pointer to ServiceProviderCountry
+ * @param user_data pointer to mbcaAppData
+ */
+static void
+mbca_country_foreach (gpointer data, gpointer user_data)
+{
+	MBCAAssistantClassPrivate* priv = user_data;
+	ServiceProviderCountry* country = data;
+	GtkListStore* provider_store;
+	GtkTreeIter iter;
+	gchar* name;
+
+	if (priv->abort_provider_thread)
+	{
+		return;
+	}
+	
+	name = mbca_alpha2name (country->code,
+					    priv->gweather_database,
+					    &priv->abort_provider_thread);
+	if (!name)
+	{
+		/* code missing from libgweather X( */
+		g_warning ("Country name for code \"%s\" is missing from libgweather",
+				 country->code);
+		name = g_strdup (_("missing from libgweather")); /* dup so it can be
+												* freed with g_free
+												*/
+	}
+	
+	provider_store = gtk_list_store_new (PROVIDER_N_COLUMNS,
+								  G_TYPE_STRING,   /* name */
+								  G_TYPE_POINTER); /* ServiceProvider */
+	g_object_ref_sink (provider_store);
+	g_slist_foreach (country->providers, mbca_provider_foreach, provider_store);
+	
+	gtk_list_store_append (priv->country_store, &iter);
+	gtk_list_store_set (priv->country_store, &iter,
+					COUNTRY_NAME_COLUMN, name,
+					COUNTRY_CODE_COLUMN, country->code,
+					COUNTRY_PROVIDERS_COLUMN, provider_store,
+					COUNTRY_SORTED_COLUMN, FALSE,
+					-1);
+	g_free (name);
+}
+
+/**
+ * code must not be freed
+ */
+static const gchar*
+mbca_match_timezone(const gchar* timezone, 
+				GtkTreeModel* gweather_database, 
+				GtkTreeIter country,
+				volatile gboolean* abort)
+{
+	GtkTreeIter location;
+	WeatherLocation* loc;
+
+	if (!gtk_tree_model_iter_children (gweather_database,
+								&location,
+								&country))
+	{
+		/* no locations */
+		return NULL;
+	}
+	
+	do
+	{
+		gtk_tree_model_get (gweather_database, &location,
+						GWEATHER_XML_COL_POINTER, &loc,
+						-1);
+		if (!loc)
+		{			
+			/* country has states , location means state */
+			GtkTreeIter statelocation;
+			if (!gtk_tree_model_iter_children (gweather_database,
+										&statelocation, 
+										&location))
+			{
+				/* no state locations */
+				continue;
+			}
+			
+			
+			do
+			{
+				gtk_tree_model_get (gweather_database, &statelocation,
+								GWEATHER_XML_COL_POINTER, &loc,
+								-1);
+				if(!loc)
+				{
+					/* skip */
+					continue;
+				}
+			}
+			while (gtk_tree_model_iter_next (gweather_database, &statelocation)
+				  && !(*abort));
+			
+			if (!loc)
+			{
+				continue;
+			}
+		}
+		if (g_ascii_strcasecmp (timezone, loc->tz_hint) == 0)
+		{		
+			return loc->country_code;
+		}
+	}
+	while (gtk_tree_model_iter_next (gweather_database, &location)
+		  && !(*abort));
+	
+	return NULL;
+}
+
+/**
+ * code must not be freed!
+ */
+static const gchar*
+mbca_get_system_country (GtkTreeModel* gweather_database, 
+					volatile gboolean* abort)
+{
+	SystemTimezone* tz;
+	const gchar* timezone;
+	GtkTreeIter region;
+	const gchar* code = NULL;
+		
+	tz = system_timezone_new ();
+	timezone = system_timezone_get (tz);
+	
+	gtk_tree_model_get_iter_first (gweather_database, &region);
+	do
+	{	
+		GtkTreeIter country;
+		if ( !gtk_tree_model_iter_children (gweather_database,
+									 &country,
+									 &region))
+		{
+			/* no countries */
+			continue;
+		}
+		
+		do
+		{
+			code = mbca_match_timezone (timezone,
+								   gweather_database,
+								   country,
+								   abort);
+			if (code)
+			{
+				g_object_unref (tz);
+				return code;
+			}
+
+		}
+		while (gtk_tree_model_iter_next (gweather_database,
+								   &country)
+			  && !(*abort));
+	}
+	while (gtk_tree_model_iter_next (gweather_database, &region) && !(*abort));
+
+	if (!code)
+	{
+		/* tz-hint missing from libgweather X( */
+		g_warning ("tz-hint \"%s\" is missing from libgweather",
+				 timezone);
+	}
+	
+	g_object_unref (tz);
+	return NULL;
+}
+
+
+gpointer
+mbca_load_provider_page_resources_thread_func (gpointer data)
+{
+	MBCAAssistantClassPrivate* priv = data;
+	const gchar* code;
+	GSList* iter;
+	gint ret;
+
+	/**
+	 * @bug main program should be aborted if something bad happens here
+	 *      but the user should be informed, because the UI is most propably
+	 *      already visible.
+	 */
+	
+	g_debug ("loading provider resources..");
+	
+	if (priv->abort_provider_thread)
+	{
+		return NULL;
+	}
+	
+	ret = parse_service_provider_xml (SERVICE_PROVIDERS_FILE, &(priv->database));
+	if (priv->abort_provider_thread)
+	{
+		return NULL;
+	}
+	g_return_val_if_fail (!ret, NULL);
+
+	priv->gweather_database = gweather_xml_load_locations ();
+	g_return_val_if_fail (priv->gweather_database, NULL);
+	g_object_ref_sink (priv->gweather_database);
+	if (priv->abort_provider_thread)
+	{
+		return NULL;
+	}
+
+	g_slist_foreach (priv->database, mbca_country_foreach, priv);
+	if (priv->abort_provider_thread)
+	{
+		return NULL;
+	}
+	
+	/* select correct country */
+	code = mbca_get_system_country (priv->gweather_database,
+							  &priv->abort_provider_thread);
+	priv->country_code = g_strdup (code);
+	
+	
+	g_debug ("provider resources loaded");
+	
+
+#if 0
+	/* time for some attaching */
+	g_debug ("attaching resources to waiting instances");
+	g_mutex_lock (priv->instances_mutex);
+	for (iter = priv->waiting_instances;
+		iter && !priv->abort_provider_thread;
+		iter = iter->next)
+	{
+		MBCAAssistantPrivate* ipriv = iter->data;
+		mbca_provider_attach_resources (priv, ipriv);
+	}
+	g_slist_free (priv->waiting_instances);
+	g_debug ("resources attached");
+	priv->provider_thread_ready = TRUE;
+	g_mutex_unlock (priv->instances_mutex);
+#endif
+	priv->provider_thread_ready = TRUE;
+	g_mutex_unlock (priv->trigger_mutex);
+	
+	return NULL;
+}
+ 
+void
+mbca_provider_attach_resources (MBCAAssistantClassPrivate* kpriv,
+						  MBCAAssistantPrivate* ipriv)
+{
+	GtkTreeViewColumn* column;
+	GtkWidget* country_list;
+	GtkExpander* expander;
+	GdkCursor* cursor;
+	GtkWidget* page;
+	gboolean found;
+	
+	g_debug ("attaching resources");
+	
+	country_list = GTK_WIDGET (gtk_builder_get_object (ipriv->builder,
+											 "country_treeview"));
+	g_return_if_fail (country_list);	
+	
+	gtk_tree_view_set_model (GTK_TREE_VIEW (country_list),
+						GTK_TREE_MODEL (kpriv->country_store));
+	
+	/* sort the country list */
+	column = gtk_tree_view_get_column (GTK_TREE_VIEW (country_list), 
+								COUNTRY_NAME_COLUMN);
+	gtk_tree_view_column_set_sort_order (column, 
+								  GTK_SORT_ASCENDING);
+	gtk_tree_view_column_clicked (column);		
+		
+	found = FALSE;
+	if (kpriv->country_code)
+	{
+		/* set country list to correct row */
+		GtkTreeIter iter;
+		gtk_tree_model_get_iter_first (GTK_TREE_MODEL (kpriv->country_store),
+								 &iter);
+		do
+		{
+			gchar* modelcode;
+						
+			gtk_tree_model_get (GTK_TREE_MODEL (kpriv->country_store), &iter,
+							COUNTRY_CODE_COLUMN, &modelcode,
+							-1);
+			if (g_ascii_strcasecmp (kpriv->country_code, modelcode) == 0)
+			{
+				found = TRUE;
+				g_free (modelcode);
+				break;
+			}
+			g_free (modelcode);
+		}
+		while (gtk_tree_model_iter_next (GTK_TREE_MODEL (kpriv->country_store),
+								   &iter));
+		if (found)
+		{
+			GtkTreeSelection* selection;
+			GtkTreePath* path;
+			GtkTreeView* view = GTK_TREE_VIEW (country_list);
+			selection = gtk_tree_view_get_selection (view);
+			
+			path = gtk_tree_model_get_path (GTK_TREE_MODEL (kpriv->country_store),
+									  &iter);
+			gtk_tree_selection_select_path (selection,
+									  path);
+			gtk_tree_view_scroll_to_cell (view, path, NULL, TRUE, 0.5, 0.5);
+			gtk_tree_path_free (path);
+		}
+		/* else continue to expand code.. */
+	}
+	if (!found){
+		/* expand country list */
+		expander = GTK_EXPANDER (gtk_builder_get_object (ipriv->builder,
+											    "country_expander"));
+		g_return_if_fail (expander);
+		gtk_expander_set_expanded (expander, TRUE);
+	}
+	
+	page = gtk_assistant_get_nth_page (ipriv->assistant, PAGE_PROVIDER);
+	gtk_widget_set_sensitive (page, TRUE);
+}

Added: trunk/src/provider_thread.h
==============================================================================
--- (empty file)
+++ trunk/src/provider_thread.h	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,46 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file resource_thread.h
+ * @brief class resource loading functionality
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ *
+ * Shared class resources are loaded in separate thread.
+ */
+
+
+#ifndef RESOURCE_THREAD_H
+#define RESOURCE_THREAD_H
+
+#include "callbacks.h"
+
+G_BEGIN_DECLS
+
+gpointer
+mbca_load_provider_page_resources_thread_func (gpointer data);
+
+void
+mbca_provider_attach_resources (MBCAAssistantClassPrivate* kpriv,
+						  MBCAAssistantPrivate* ipriv);
+
+G_END_DECLS
+#endif /* RESOURCE_THREAD_H */

Added: trunk/src/serial_page.c
==============================================================================
--- (empty file)
+++ trunk/src/serial_page.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,203 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file serial_page.c
+ * @brief Connection Method page functionality
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ */
+
+#include "callbacks.h"
+
+void
+mbca_serial_page_prepare_cb (GtkAssistant* gtkassistant,
+					    GtkWidget* page,
+					    gpointer user_data)
+{
+	
+}
+
+static void
+check_complete (MBCAAssistantPrivate* priv)
+{
+	GtkWidget* page = gtk_assistant_get_nth_page (priv->assistant,
+										 PAGE_SERIAL);
+	gboolean is_complete = (priv->serial_device_set && priv->serial_baud_set);
+	gtk_assistant_set_page_complete (priv->assistant, page, is_complete);
+	
+	g_free (priv->nice_device_name);
+	priv->nice_device_name = g_strdup (priv->conf->device);
+}
+
+void
+mbca_serial_manual_checkbutton_toggled_cb (GtkToggleButton* togglebutton,
+								   gpointer user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	GtkWidget* alignment; /* alignment containing a treeview of serial ports */
+	GtkWidget* hbox;	  /* hbox containing manual path entry */
+	
+	alignment = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+										   "serial_list_alignment"));
+	hbox = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+									   "serial_manual_hbox"));
+	g_return_if_fail (alignment);
+	g_return_if_fail (hbox);
+	
+	priv->serial_device_set = FALSE;
+	priv->serial_baud_set = FALSE;
+	
+	if (gtk_toggle_button_get_active (togglebutton))
+	{
+		GObject* serial_entry;
+		GObject* baud_entry;
+		gtk_widget_set_sensitive (alignment, FALSE);
+		gtk_widget_set_sensitive (hbox, TRUE);
+
+		/* check for content */
+		serial_entry = gtk_builder_get_object (priv->builder,
+									    "serial_manual_entry");
+		baud_entry = gtk_builder_get_object (priv->builder,
+									  "serial_manual_baud_entry");
+		g_return_if_fail (serial_entry);
+		g_return_if_fail (baud_entry);
+		mbca_serial_manual_entry_changed_cb (GTK_EDITABLE (serial_entry),
+									  priv);
+		mbca_serial_manual_baud_entry_changed_cb (GTK_EDITABLE (baud_entry),
+										  priv);
+	}
+	else
+	{
+		GObject* serial_view;
+		GObject* baud_view;
+		GtkTreeSelection* selection;
+		
+		gtk_widget_set_sensitive (alignment, TRUE);
+		gtk_widget_set_sensitive (hbox, FALSE);
+
+		serial_view = gtk_builder_get_object (priv->builder,
+									   "serial_treeview");
+		baud_view = gtk_builder_get_object (priv->builder,
+									 "serial_baud_treeview");
+		g_return_if_fail (serial_view);
+		g_return_if_fail (baud_view);
+		
+		selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (serial_view));
+		mbca_serial_treeview_selection_changed_cb (selection, priv);
+		selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (baud_view));
+		mbca_serial_baud_treeview_selection_changed_cb (selection, priv);
+	}
+}
+
+void
+mbca_serial_manual_entry_changed_cb (GtkEditable* editable,
+							  gpointer user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	
+	gchar* chars;
+	chars = gtk_editable_get_chars (editable, 0, -1);
+	if (g_utf8_strlen (chars, -1) > 0)
+	{
+		g_free (priv->conf->device);
+		priv->conf->device = chars;
+		priv->serial_device_set = TRUE;
+	}
+	else
+	{
+		g_free (chars);
+		priv->serial_device_set = FALSE;
+	}
+
+	check_complete (priv);
+}
+
+void
+mbca_serial_manual_baud_entry_changed_cb (GtkEditable* editable,
+								  gpointer user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	
+	gchar* chars;
+	chars = gtk_editable_get_chars (editable, 0, -1);
+	if (g_utf8_strlen (chars, -1) > 0)
+	{
+		g_free (priv->conf->baud);
+		priv->conf->baud = chars;
+		priv->serial_baud_set = TRUE;
+	}
+	else
+	{
+		g_free (chars);
+		priv->serial_baud_set = FALSE;
+	}
+	
+	check_complete (priv);
+}
+
+void
+mbca_serial_treeview_selection_changed_cb (GtkTreeSelection* selection,
+								   gpointer          user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	GtkTreeModel* model;
+	GtkTreeIter iter;
+	
+	if( gtk_tree_selection_get_selected (selection, &model, &iter))
+	{
+		g_free (priv->conf->device);
+		gtk_tree_model_get (model, &iter,
+						SERIAL_PORT_COLUMN, &priv->conf->device,
+						-1);
+		priv->serial_device_set = TRUE;
+	}
+	else
+	{
+		priv->serial_device_set = FALSE;
+	}
+	
+	check_complete (priv);
+}
+
+
+void
+mbca_serial_baud_treeview_selection_changed_cb (GtkTreeSelection* selection,
+									   gpointer          user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	GtkTreeModel* model;
+	GtkTreeIter iter;
+	
+	if( gtk_tree_selection_get_selected (selection, &model, &iter))
+	{
+		g_free (priv->conf->baud);
+		gtk_tree_model_get (model, &iter,
+						SERIALBAUD_RATE_COLUMN, &priv->conf->baud,
+						-1);
+		priv->serial_baud_set = TRUE;
+	}
+	else
+	{
+		priv->serial_baud_set = FALSE;
+	}
+	
+	check_complete (priv);	
+}

Added: trunk/src/serviceprovider_parser.c
==============================================================================
--- (empty file)
+++ trunk/src/serviceprovider_parser.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,529 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file serviceprovider_parser.c
+ * @brief database xml parser
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ *
+ * Implements the Service Provider Database XML parser.
+ */
+
+#include "serviceprovider_parser.h"
+
+#include <libxml/xmlreader.h>
+#include <string.h>			/* memset */
+
+/**
+ * @brief check root element and version
+ *
+ * Checks documents root element and version attribute. Correct element is
+ * <serviceproviders format="1.0">. reader should be positioned at the begining
+ * of the document prior to this call.
+ *
+ * @param reader a valid xmlTextReaderPtr
+ *
+ *Â returns ' 0' on success
+ * @returns '-1' error
+ */
+static int
+check_root (xmlTextReaderPtr reader)
+{
+	const xmlChar* name;
+	xmlChar* value;
+	int ret;
+
+	/* get root element */
+	for (ret = xmlTextReaderRead (reader);
+		ret == 1;
+		ret = xmlTextReaderRead (reader))
+	{
+		if (xmlTextReaderNodeType (reader) != XML_READER_TYPE_ELEMENT)
+		{
+			/* not interested */
+			continue;
+		}
+
+		/* make sure it's ours */
+		name = xmlTextReaderConstName (reader);
+		if (xmlStrcmp (name, BAD_CAST "serviceproviders") != 0)
+		{
+			g_critical ("this is not a service provider database. "
+					  "expected <serviceprovider>, got <%s>",
+					  name);
+			ret = -1;
+		}
+		
+		break;		
+	}
+	if (ret == 0)
+	{
+		g_critical ("document has no root element");
+		ret = -1;  /* return in next if */
+	}
+	if (ret == -1)
+	{
+		return ret;
+	}
+	
+	/* check format number */
+	value = xmlTextReaderGetAttribute (reader, BAD_CAST "format");
+	if (xmlStrcmp (value, BAD_CAST "1.0") != 0)
+	{
+		g_critical ("database format is not supported. "
+				  "expected \"1.0\", got \"%s\"",
+				  value);
+		ret = -1;
+	}
+	free (value);
+	
+	return 0;
+}
+
+/**
+ * @brief parse provider subtree
+ *
+ * Parses subtree inside <provider> </provider> block. Reader should be
+ * positioned to a <provider> element prior to this call. Call returns when end
+ * element </provider> is encountered. struct pointed by provider will be 
+ * initially cleared with zeroes.
+ *
+ * @param reader a valid xmlTextReaderPtr
+ * @param provider 
+ *
+ *Â returns ' 0' on success
+ * @returns '-1' on error
+ */
+static int
+parse_provider (xmlTextReaderPtr reader, MBCAServiceProvider* provider)
+{
+	int ret;
+	
+	memset (provider, 0, sizeof (MBCAServiceProvider));
+	
+	for (ret = xmlTextReaderRead (reader);
+		ret == 1;
+		ret = xmlTextReaderRead (reader))
+	{
+		const xmlChar* name;
+		const xmlChar* value;
+		int type;
+		
+		name = xmlTextReaderConstName (reader);
+		type = xmlTextReaderNodeType (reader);
+		
+		if (type == XML_READER_TYPE_END_ELEMENT)
+		{
+			if (xmlStrcmp (name, BAD_CAST "provider") == 0)
+			{
+				/* end of provider, ret = 1 */
+				break;
+			}
+			continue;
+		}
+		else if (type != XML_READER_TYPE_ELEMENT)
+		{
+			/* not interested. */
+			continue;
+		}
+		
+		/* found an element */
+		if (xmlStrcmp (name, BAD_CAST "name") == 0)
+		{
+			MBCAServiceProviderName* namestruct;
+			const xmlChar* xmllang;
+
+			xmlTextReaderRead (reader); /* get to text */
+			xmllang = xmlTextReaderConstXmlLang (reader);
+			value = xmlTextReaderConstValue (reader);
+			
+			namestruct = g_malloc (sizeof (MBCAServiceProviderName));
+			namestruct->lang = (gchar*)xmlStrdup (xmllang);
+			namestruct->name = (gchar*)xmlStrdup (value);
+			
+			provider->names = g_slist_prepend (provider->names, namestruct);
+			continue;
+		}
+		else if (xmlStrcmp (name, BAD_CAST "gsm") == 0)
+		{
+			provider->type = MBCA_NETWORK_GSM;
+			
+			/* find apn element */
+			for (ret = xmlTextReaderRead (reader);
+				ret == 1;
+				ret = xmlTextReaderRead (reader))
+			{
+				if (xmlTextReaderNodeType (reader) != 
+				    XML_READER_TYPE_ELEMENT)
+				{
+					/* not interested */
+					continue;
+				}
+				
+				/* found an element */
+				name = xmlTextReaderConstName (reader);
+				if (xmlStrcmp (name , BAD_CAST "apn") != 0)
+				{
+					g_critical ("document is invalid."
+							  "expected <apn>, got <%s>",
+							  name);
+					return -1;
+				}
+				
+				/* get to text */
+				ret = xmlTextReaderRead (reader);
+				if (ret != 1)
+				{
+					g_critical ("document is invalid");
+					return -1;
+				}
+				value = xmlTextReaderConstValue (reader);
+				provider->gsm.apn = (gchar*)xmlStrdup (value);
+				break;
+			}
+			continue;
+		}
+		else if (xmlStrcmp (name, BAD_CAST "cdma") == 0)
+		{
+			provider->type = MBCA_NETWORK_CDMA;
+			continue;
+		}
+		else if (xmlStrcmp (name, BAD_CAST "username") == 0)
+		{
+			xmlTextReaderRead (reader); /* get to text */
+			value = xmlTextReaderConstValue (reader);
+			provider->username = (gchar*)xmlStrdup (value);
+			continue;
+		}
+		else if (xmlStrcmp (name, BAD_CAST "password") == 0)
+		{
+			xmlTextReaderRead (reader); /* get to text */
+			value = xmlTextReaderConstValue (reader);
+			provider->password = (gchar*)xmlStrdup (value);
+			continue;
+		}
+		else if (xmlStrcmp (name, BAD_CAST "dns") == 0)
+		{
+			xmlTextReaderRead (reader); /* get to text */
+			value = xmlTextReaderConstValue (reader);
+			
+			if (!provider->dns1)
+			{
+				provider->dns1 = (gchar*)xmlStrdup (value);
+			}
+			else if (!provider->dns2)
+			{
+				provider->dns2 = (gchar*)xmlStrdup (value);
+			}
+			else
+			{
+				/* skip additioanl dns elements silently */
+			}
+			continue;
+		}
+		else if (xmlStrcmp (name, BAD_CAST "gateway") == 0)
+		{
+			xmlTextReaderRead (reader); /* get to text */
+			value = xmlTextReaderConstValue (reader);
+			provider->gateway = (gchar*)xmlStrdup (value);
+			continue;
+		}
+		else
+		{
+			g_critical ("invalid document, got \"%s\"", name);
+			return -1;
+		}
+	}
+	if (ret != 1)
+	{
+		g_critical ("invalid document.");
+		return -1;
+	}
+	
+	provider->names = g_slist_reverse (provider->names);
+	return 0;
+}
+
+static void
+free_providers (GSList* providers)
+{
+	GSList* node = providers;
+	while (node)
+	{
+		MBCAServiceProvider* provider = node->data;
+		
+		free_serviceprovider (provider);
+		node = node->next;
+	}
+	g_slist_free (providers);
+}
+
+static void
+free_country (ServiceProviderCountry* country)
+{
+	/*
+	 * STRINGS ARE ALLOCATED BY xmlStrdup SO THEY MUST BE FREED USING free()
+	 */
+	
+	free_providers (country->providers);
+	free (country->code);
+	g_free (country);
+}
+
+static void
+free_countries (GSList* countries)
+{
+	GSList* node = countries;
+	
+	while (node)
+	{
+		ServiceProviderCountry* country = node->data;
+		
+		free_country (country);
+		node = node->next;
+	}
+	g_slist_free (countries);
+}
+
+/**
+ * @brief parse country subtree
+ *
+ * Parses subtree inside <countryr> </country> block. Reader should be
+ * positioned to a <country> element prior to this call. Call returns when end
+ * element </country> is encountered.
+ *
+ * @param reader a valid xmlTextReaderPtr
+ *
+ *Â returns ' 0' on success
+ * @returns '-1' on error
+ */
+static int
+parse_country(xmlTextReaderPtr reader, GSList** providers)
+{
+	int ret;
+
+	/* find next country element */
+	for (ret = xmlTextReaderRead (reader);
+		ret == 1;
+		ret = xmlTextReaderRead (reader))
+	{
+		MBCAServiceProvider* provider;
+		const xmlChar* name;
+		int type;
+		
+		type = xmlTextReaderNodeType (reader);
+		if (type == XML_READER_TYPE_END_ELEMENT)
+		{
+			if (xmlStrcmp (xmlTextReaderConstName (reader),
+						BAD_CAST "country") == 0)
+			{
+				break;
+			}
+			continue;
+		}
+		if (type != XML_READER_TYPE_ELEMENT)
+		{
+			/* not interested */
+			continue;
+		}
+		
+		/* found an element */
+		name = xmlTextReaderConstName (reader);
+		if (xmlStrcmp (name, BAD_CAST "provider") != 0)
+		{
+			g_critical ("document is invalid. expected <provider>, got <%s>",
+					  name);
+			ret = -1;
+			break;
+		}			
+		
+		/* found provider
+		 * parse data
+		 */
+		provider = g_malloc (sizeof (MBCAServiceProvider));
+		ret = parse_provider (reader, provider);
+		if (ret)
+		{
+			free_serviceprovider (provider);
+			ret = -1;
+			break;
+		}
+		*providers = g_slist_prepend (*providers, provider);
+		ret = 1;
+	}
+	if (ret != 1)
+	{
+		free_providers (*providers);
+		*providers = NULL;
+		return -1;
+	}
+	
+	*providers = g_slist_reverse (*providers);
+	return 0;
+}
+
+/**
+ * @brief parse database
+ *
+ * Parses the database XML.
+ *
+ * @param reader a valid xmlTextReaderPtr
+ * @param countries pointer to a singly-linked list where ServiceProviderCountry
+ *                  structs are stored.
+ *
+ * @returns ' 0' on success
+ * @returns '-1' on error
+ */
+static gint
+parse_xml (xmlTextReaderPtr reader, GSList** countries)
+{		
+	int ret;
+	
+	ret = check_root (reader);
+	if (ret)
+	{
+		return -1;
+	}
+
+	/* find country elements */
+	for (ret = xmlTextReaderRead (reader);
+		ret == 1;
+		ret = xmlTextReaderRead (reader))
+	{
+		ServiceProviderCountry* country;
+		GSList* providers;	
+		
+		const xmlChar* name;
+		xmlChar* code;
+		int type;
+		
+		type = xmlTextReaderNodeType (reader);
+		if (type == XML_READER_TYPE_END_ELEMENT)
+		{
+			if (xmlStrcmp (xmlTextReaderConstName (reader),
+						BAD_CAST "serviceproviders") == 0)
+			{
+				/* done */
+				break;
+			}
+			continue;
+		}
+		if (type != XML_READER_TYPE_ELEMENT)
+		{
+			/* not interested.. */
+			 continue;
+		}
+		
+		/* found an element */
+		name = xmlTextReaderConstName (reader);
+		if (xmlStrcmp (name, BAD_CAST "country") != 0)
+		{
+			g_critical ("document is invalid. expected <country>, got <%s>",
+					  name);
+			ret = -1;
+			break;
+		}
+
+		/* found a country.
+		 * get code..
+		 */
+		code = xmlTextReaderGetAttribute (reader,
+								    BAD_CAST "code");
+		if (!code)
+		{
+			g_critical ("document is invalid. <country> has no 'code' "
+					  "attribute");
+			ret = -1;
+			break;
+		}
+
+		/* ..and dig in
+		 */
+		providers = NULL;
+		ret = parse_country (reader, &providers);
+		if (ret)
+		{
+			free (code);
+			ret =  -1;
+			break;
+		}
+
+		country = g_malloc (sizeof (ServiceProviderCountry));
+		country->code = (gchar*)code; 
+		country->providers = providers;
+		*countries = g_slist_prepend (*countries, country);
+		
+		ret = 1;
+	}
+	if (ret != 1)
+	{
+		g_print ("FOO\n");
+		free_countries (*countries);
+		*countries = NULL;
+		return -1;
+	}
+	
+	*countries = g_slist_reverse (*countries);
+	return 0;
+}
+
+gint
+parse_service_provider_xml (const gchar* filename, GSList** database)
+{
+	xmlTextReaderPtr reader;
+	GSList* countries;
+	int ret;
+	
+	LIBXML_TEST_VERSION
+		
+	reader = xmlReaderForFile (filename, NULL, 0);
+	if (!reader)
+	{
+		g_critical ("could not create xmlTextReader for file: %s", filename);
+		return -1;
+	}	
+	
+	countries = NULL;
+	ret = parse_xml (reader, &countries);
+
+	xmlTextReaderClose (reader);
+	xmlFreeTextReader (reader);
+	if (ret)
+	{
+		g_critical ("XML parser failed..");
+		ret = -2;
+	}
+	else
+	{
+		*database = countries;
+		ret = 0;
+	}
+	
+	xmlCleanupParser ();
+	xmlMemoryDump ();
+	return ret;
+}
+
+void
+free_service_provider_database (GSList** database)
+{
+	free_countries (*database);
+}

Added: trunk/src/serviceprovider_parser.h
==============================================================================
--- (empty file)
+++ trunk/src/serviceprovider_parser.h	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,83 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file serviceprovider_parser.h
+ * @brief database xml parser
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ *
+ * Defines the interface for Service Provider Database XML parser.
+ */
+ 
+#ifndef SERVICEPROVIDER_PARSER_H
+#define SERVICEPROVIDER_PARSER_H
+
+#include "mbca_serviceprovider.h"
+
+G_BEGIN_DECLS
+
+/**
+ * @brief country
+ *
+ * contains all the service providers of a country.
+ */
+struct _ServiceProviderCountry
+{
+	gchar* code;		/**< ISO 3166-1 alpha-2 code of the country */
+	GSList* providers;  /**< singly-linked list of ServiceProvider structs */
+};
+typedef struct _ServiceProviderCountry ServiceProviderCountry;
+
+
+/**
+ * @brief parse database
+ *
+ * Parses database file. Database is stored as XML.
+ *
+ * @note freeing of the database is left for the caller.
+ *       use free_service_provider_database () to deallicate the database.
+ *
+ * @param filename filename of the database file
+ * @param database will be set pointing to singly-linked list of
+ *                 ServiceProviderCountry structs if call is successful.
+ *
+ * @returns ' 0' on success
+ * @returns '-1' if file could not be opened
+ * @returns '-2' if error was encountered while processing the database
+ *
+ * @note database is trusted to be valid. Check the database always against the
+ *       DTD before feeding to this funtion.
+ */
+gint
+parse_service_provider_xml (const gchar* filename, GSList** database);
+
+/**
+ * @brief deallocate database
+ *
+ * Deallocates a previously parset service provider database.
+ */
+void
+free_service_provider_database (GSList** database);
+
+G_END_DECLS
+
+#endif /* SERVICEPROVIDER_PARSER_H */
+ 

Added: trunk/src/summary_page.c
==============================================================================
--- (empty file)
+++ trunk/src/summary_page.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,122 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "callbacks.h"
+
+void
+mbca_summary_name_entry_changed_cb (GtkEditable* editable,
+							 gpointer user_data)
+{
+	MBCAAssistantPrivate* priv = user_data;
+	gboolean complete;
+	GtkWidget* page;
+	gchar* chars;
+	
+	chars = gtk_editable_get_chars (editable, 0, -1);
+	
+	g_free (priv->conf->name);
+	priv->conf->name = chars;
+	complete = (g_utf8_strlen (chars, -1) > 0);
+	
+	page = gtk_assistant_get_nth_page (priv->assistant,
+								PAGE_SUMMARY);
+	gtk_assistant_set_page_complete (priv->assistant,
+							   page,
+							   complete);
+}
+
+void
+mbca_summary_page_prepare_cb (GtkAssistant* gtkassistant,
+						GtkWidget* page,
+						gpointer user_data)
+{
+	MBCAAssistant* assistant = user_data;
+	MBCAAssistantPrivate* priv = assistant->priv;
+	
+	GtkLabel* method;
+	GtkLabel* device;
+	GtkLabel* country;
+	GtkLabel* provider;
+	GtkEntry* name;
+	gchar* namestr;
+	
+	method = GTK_LABEL (gtk_builder_get_object (priv->builder,
+									    "summary_method_label"));
+	device = GTK_LABEL (gtk_builder_get_object (priv->builder,
+									    "summary_device_label"));
+	country = GTK_LABEL (gtk_builder_get_object (priv->builder,
+										"summary_country_label"));
+	provider = GTK_LABEL (gtk_builder_get_object (priv->builder,
+										 "summary_provider_label"));
+	name = GTK_ENTRY (gtk_builder_get_object (priv->builder,
+									  "summary_name_entry"));
+	
+	switch (priv->conf->type)
+	{
+		case MBCA_DEVICE_BLUETOOTH:
+		{
+			gtk_label_set_text (method, _("Bluetooth"));
+			break;	
+		}
+		case MBCA_DEVICE_SERIAL:
+		{
+			gtk_label_set_text (method, _("Serial cable"));
+			break;
+		}
+		case MBCA_DEVICE_HAL:
+		{
+			gtk_label_set_text (method, priv->hal_device_type);
+			break;
+		}
+		default:
+		{
+			g_return_if_reached ();
+		}
+	}
+
+	if (priv->device_is_preset)
+	{
+		/* hide connection method field as it's unknown and unrelevant */
+		GObject* caption;
+
+		caption = gtk_builder_get_object (priv->builder,
+								    "summary_method_caption_label");
+		gtk_widget_hide (GTK_WIDGET (caption));						    
+		gtk_widget_hide (GTK_WIDGET (method));
+	}	
+	
+	gtk_label_set_text (device, priv->nice_device_name);
+	gtk_label_set_text (country, priv->country_name);
+	gtk_label_set_text (provider, priv->provider_name);
+
+	namestr = g_strjoin (NULL,
+					 priv->nice_device_name,
+					 " - ",
+					 priv->provider_name,
+					 NULL);
+	
+	gtk_entry_set_text (name, namestr);
+	g_free (priv->conf->name);
+	priv->conf->name = namestr;
+	
+	mbca_summary_name_entry_changed_cb (GTK_EDITABLE (name), priv);	
+}

Added: trunk/src/test_mbca.c
==============================================================================
--- (empty file)
+++ trunk/src/test_mbca.c	Wed Jul 23 22:00:46 2008
@@ -0,0 +1,460 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+/* Copyright  2008 Antti KaijanmÃki <antti kaijanmaki net>
+ * 
+ * This file is part of Mobile Broadband Configuration Assistant.
+ *
+ * Mobile Broadband Configuration Assistant is free software:
+ * you can redistribute it and/or modify it under the terms 
+ * of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mobile Broadband Configuration Assistant is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mobile Broadband Configuration Assistant.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * @file main.c
+ * @brief test main
+ * @author Antti KaijanmÃki <antti kaijanmaki net>
+ *
+ * test programs main
+ */
+
+#include "mbca_assistant.h"
+
+#include <gtk/gtk.h>
+#include <glib.h>
+
+#include <getopt.h>
+#include <locale.h>
+#include <string.h>
+
+static void
+dump_configuration (MBCAConfiguration* conf)
+{
+	g_print ("name:      %s\n", conf->name);
+	switch (conf->type)
+	{
+		case MBCA_DEVICE_BLUETOOTH:
+		{
+			g_print ("type:      %s\n", "bluetooth");
+			break;
+		}
+		case MBCA_DEVICE_SERIAL:
+		{
+			g_print ("type:      %s\n", "serial");
+			break;
+		}
+		case MBCA_DEVICE_HAL:
+		{
+			g_print ("type:      %s", "hal");
+			break;
+		}
+		default:
+		{
+			g_return_if_reached ();
+		}
+	}
+	g_print ("device:    %s\n", conf->device);
+	g_print ("baud:      %s\n", conf->baud);
+	
+	/* just take the first one */
+	g_print ("provider:  %s\n", ((MBCAServiceProviderName*)(conf->provider->names->data))->name);
+	
+	switch (conf->provider->type)
+	{
+		case MBCA_NETWORK_GSM:
+		{
+			g_print ("network:   %s\n", "GSM");
+			g_print ("apn:       %s\n", conf->provider->gsm.apn);
+			break;
+		}
+		case MBCA_NETWORK_CDMA:
+		{
+			g_print ("network:   %s\n", "CDMA");
+			break;
+		}
+		default:
+		{
+			g_return_if_reached ();
+		}
+	}
+	
+	if (conf->provider->username)
+	{
+		g_print ("username:  %s\n", conf->provider->username);
+	}
+	if (conf->provider->password)
+	{
+		g_print ("password:  %s\n", conf->provider->password);
+	}
+	if (conf->provider->dns1)
+	{
+		g_print ("dns1:      %s\n", conf->provider->dns1);
+	}
+	if (conf->provider->dns2)
+	{
+		g_print ("dns2:      %s\n", conf->provider->dns1);
+	}
+	if (conf->provider->gateway)
+	{
+		g_print ("gateway:   %s\n", conf->provider->gateway);
+	}
+}
+
+void
+run_gui_state_changed (MBCAAssistant* assistant,
+				   enum MBCAAssistantState state,
+				   gpointer user_data)
+{
+	GSList** assistants = user_data;
+	
+	switch (state)
+	{
+		case MBCA_STATE_READY:
+		case MBCA_STATE_RUNNING: 
+		{
+			return;
+		}
+		case MBCA_STATE_DONE:
+		{
+			MBCAConfiguration* conf;
+			conf = mbca_assistant_get_configuration (assistant);
+			dump_configuration (conf);
+			mbca_free_configuration (conf);
+			
+			/* FALLTHROUGH */
+		}
+		case MBCA_STATE_ABORTED:
+		{	
+			*assistants = g_slist_remove_all (*assistants, assistant);
+			g_object_unref (assistant);
+		}
+	}	
+}
+
+void
+full_button_clicked_cb (GtkWidget* button, gpointer user_data)
+{
+	GSList** assistants = user_data;
+	MBCAAssistant* assistant;
+	gint ret;
+
+	assistant = mbca_assistant_new ();
+	g_signal_connect (G_OBJECT (assistant), "state-changed",
+				   G_CALLBACK (run_gui_state_changed), assistants);
+	
+	*assistants = g_slist_append (*assistants, assistant);
+	ret = mbca_assistant_run (assistant);
+}
+
+void
+preset_button_clicked_cb (GtkWidget* button, gpointer user_data)
+{
+	GSList** assistants = user_data;
+	MBCAAssistant* assistant;
+	gint ret;
+
+	assistant = mbca_assistant_new ();
+	g_signal_connect (G_OBJECT (assistant), "state-changed",
+				   G_CALLBACK (run_gui_state_changed), assistants);
+	
+	*assistants = g_slist_append (*assistants, assistant);
+	ret = mbca_assistant_run_for_device (assistant, MBCA_DEVICE_SERIAL,
+								  "/dev/ttyS0", "9600");
+}
+
+
+static GtkWindow*
+create_gui ()
+{
+	GtkWindow* testwindow;
+	GtkAlignment* align;
+	GtkWidget* vbox;
+
+	GtkWidget* full_button;
+	GtkWidget* preset_button;
+	GtkWidget* quit_button;
+	
+	GSList* assistants = NULL;
+	
+	testwindow = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
+	gtk_widget_set_size_request (GTK_WIDGET (testwindow), 250, -1);
+	gtk_window_set_title (testwindow, "Test libmbca");
+
+	align = GTK_ALIGNMENT (gtk_alignment_new (0.5, 0.5, 1.0, 0.0));
+	gtk_alignment_set_padding (align, 12, 12, 12, 12);
+	gtk_container_add (GTK_CONTAINER (testwindow), GTK_WIDGET (align));
+
+	
+	vbox = GTK_WIDGET (gtk_vbox_new (FALSE, 6));
+	gtk_container_add (GTK_CONTAINER (align), vbox);
+
+	full_button = gtk_button_new_with_label ("Full");
+	gtk_box_pack_start (GTK_BOX(vbox), full_button, FALSE, FALSE, 0);
+
+	preset_button = gtk_button_new_with_label ("Preset");
+	gtk_box_pack_start (GTK_BOX(vbox), preset_button, FALSE, FALSE, 0);
+	
+	gtk_box_pack_start (GTK_BOX(vbox), gtk_vseparator_new(), FALSE, FALSE, 0);
+	
+	quit_button = gtk_button_new_with_label ("Quit");
+	gtk_box_pack_start (GTK_BOX(vbox), quit_button, FALSE, FALSE, 0);
+	
+	g_signal_connect (G_OBJECT (full_button), "clicked",
+				   G_CALLBACK (full_button_clicked_cb), &assistants);
+	g_signal_connect (G_OBJECT (preset_button), "clicked",
+				   G_CALLBACK (preset_button_clicked_cb), &assistants);	
+	g_signal_connect (G_OBJECT (quit_button), "clicked",
+				   G_CALLBACK (gtk_main_quit), NULL);	
+	
+	gtk_widget_show_all (GTK_WIDGET (testwindow));
+
+	return testwindow;
+}
+
+
+static void
+run_gui ()
+{	
+	GtkWindow* window;
+	
+	window = create_gui ();
+	
+	g_signal_connect (G_OBJECT (window), "destroy",
+				   G_CALLBACK (gtk_main_quit), NULL);
+	
+	gtk_main ();
+}
+
+void
+run_once_state_changed (MBCAAssistant* assistant,
+				    enum MBCAAssistantState state,
+				    gpointer user_data)
+{
+	switch (state)
+	{
+		case MBCA_STATE_READY:
+		case MBCA_STATE_RUNNING: 
+		{
+			return;
+		}
+		case MBCA_STATE_DONE:
+		{
+			MBCAConfiguration* conf;
+			conf = mbca_assistant_get_configuration (assistant);
+			dump_configuration (conf);
+			mbca_free_configuration (conf);
+			
+			/* FALLTHROUGH */
+		}
+		case MBCA_STATE_ABORTED:
+		{	
+			gtk_main_quit();
+		}
+	}
+}
+	
+static void
+run_once (enum MBCADeviceType type, gchar** device, gchar** nicename)
+{
+	MBCAAssistant* assistant;
+	gint ret;
+	
+	assistant = mbca_assistant_new ();
+	
+	if (type != MBCA_DEVICE_NONE)
+	{
+		if (!device)
+		{
+			switch (type)
+				{
+				case MBCA_DEVICE_BLUETOOTH:
+				{
+					*device = g_strdup ("00:34:37:FA:15:01");
+					break;
+				}
+				case MBCA_DEVICE_HAL:
+				{
+					*device = g_strdup ("/org/freedesktop/Hal/devices/usb_d"
+									"evice_421_410_noserial_if8_serial_"
+									"unknown_1");
+					break;
+				}
+				case MBCA_DEVICE_SERIAL:
+				{
+					*device = g_strdup ("/dev/ttyS1");
+					if (!*nicename)
+					{
+						*nicename = g_strdup ("9600");
+					}
+					break;
+				}
+				default:
+				{
+					g_return_if_reached ();
+				}
+			}
+		}
+		
+		if (!*nicename)
+		{
+			*nicename = g_strdup ("little cute device");
+		}
+		
+		ret = mbca_assistant_run_for_device (assistant,
+									  type,
+									  *device,
+									  *nicename);
+	}
+	else
+	{
+		ret = mbca_assistant_run (assistant);
+	}	
+	
+	g_signal_connect (G_OBJECT (assistant), "state-changed",
+				   (GCallback)run_once_state_changed,
+				   NULL);
+	/* entering gtk_main */
+	gtk_main ();
+
+	g_object_unref (assistant);
+}
+
+static void
+print_usage(char* prog)
+{	
+	g_print("Usage:\n");
+	g_print("\t%s [options]\n", "test_mbca");
+	g_print("\n");
+	g_print("options may be:\n");
+	g_print("\t-h, --help      ---  print this help\n");
+	g_print("\n");
+	g_print("\t    --bluetooth ---  preset bluetooth device\n");
+	g_print("\t    --hal       ---  preset HAL device\n");
+	g_print("\t    --serial    ---  preset serial device\n");
+	g_print("\t                     preset baudrate with 'nice'\n");
+	g_print("\t    --device    ---  type specific device address\n");
+	g_print("\t    --nicename  ---  nice name for the device\n");
+	g_print("\n");
+	g_print("\t    --gui       ---  show GUI with cute buttons\n");	
+	g_print("\n");
+}
+
+
+int
+main (int argc, char* argv[])
+{
+	int c = 0;
+	int option_index = 0;
+	
+	enum MBCADeviceType type = MBCA_DEVICE_NONE;
+	gchar* device = NULL;
+	gchar* nicename = NULL;
+		
+	gint i;
+	gint ret;
+	
+	gboolean use_gui = FALSE;
+	
+	struct option long_options[] = 
+	{
+		{"help"		, no_argument		, 0  , 'h'},
+		{"bluetooth"   , no_argument		, 0  , 'b'},
+		{"hal"		, no_argument		, 0  , 'u'}, /* 'u' for historical
+											    * reasons :)
+											    */
+		{"serial"		, no_argument		, 0  , 's'},
+		{"device"		, required_argument , 0  , 'd'},
+		{"nicename"	, required_argument , 0  , 'n'},
+		{"gui"		, no_argument		, 0  , 'g'},
+		{0 , 0, 0, 0}
+	};
+
+	gtk_init (&argc, &argv);	
+	g_thread_init (NULL);	
+	
+	while ((c = getopt_long(argc, argv,
+					    "hbusdng",
+					    long_options,
+					    &option_index)) != -1)
+	{
+		switch (c)
+		{
+			case 'b':
+			{
+				/* bluetooth*/
+				type = MBCA_DEVICE_BLUETOOTH;
+				break;
+			}
+			case 'd':
+			{
+				/* --device */
+				device = g_strdup (optarg);
+				break;
+			}
+			case 'g':
+			{
+				use_gui = TRUE;
+				break;
+			}
+			case 'h':
+			{
+				/* --help, -h */
+				print_usage(argv[0]);
+				return 0;
+			}
+			case 'n':
+			{
+				nicename = g_strdup (optarg);
+				break;
+			}
+
+			case 's':
+			{
+				/* --serial */
+				type = MBCA_DEVICE_SERIAL;
+				break;
+			}
+			case 'u':
+			{
+				/* --hal */
+				type = MBCA_DEVICE_HAL;
+				break;
+			}
+				
+			default:
+			{
+				print_usage(argv[0]);
+				return -1;
+			}
+		}
+
+	}
+
+	setlocale (LC_ALL, "");
+	textdomain ("test_mbca");
+	
+	if (use_gui)
+	{
+		run_gui ();
+	}
+	else
+	{
+		run_once (type, &device, &nicename);
+	}
+	
+	g_free (device);
+	g_free (nicename);
+	
+	return 0;
+}
+
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]