[hotssh] Complete rewrite!



commit 252def40ca6242a2bfb80263791c2d0928d8b054
Author: Colin Walters <walters verbum org>
Date:   Thu Oct 10 18:17:04 2013 -0400

    Complete rewrite!
    
    * Gtk3
    * Written in C
    * Use libssh2 instead of forking openssh
    * Even hotter

 .gitmodules                          |    3 +
 COPYING                              |  622 ++++++++-----
 MAINTAINERS                          |    3 -
 Makefile-libgssh.am                  |   26 +
 Makefile-src.am                      |   26 +
 Makefile.am                          |   68 ++
 NEWS                                 |    9 -
 README                               |   21 -
 autogen.sh                           |   30 +
 bin/hotssh                           |   73 --
 bin/wscript_build                    |    1 -
 configure.ac                         |   42 +
 git.mk                               |  305 ++++++
 hotssh.csh                           |    2 -
 hotssh.desktop.in                    |    9 -
 hotssh.doap                          |   24 +-
 hotssh/__init__.py                   |   18 -
 hotssh/hotlib/logutil.py             |   47 -
 hotssh/hotlib/timesince.py           |   87 --
 hotssh/hotlib_ui/msgarea.py          |  235 -----
 hotssh/hotlib_ui/quickfind.py        |  221 -----
 hotssh/hotvte/vteterm.py             |  279 ------
 hotssh/hotvte/vtewindow.py           |  604 ------------
 hotssh/sshwindow.py                  | 1683 ----------------------------------
 hotssh/version.py                    |   30 -
 images/hotwire-openssh.png           |  Bin 36862 -> 0 bytes
 libgssh/gssh-channel-input-stream.c  |  238 +++++
 libgssh/gssh-channel-input-stream.h  |   36 +
 libgssh/gssh-channel-output-stream.c |  330 +++++++
 libgssh/gssh-channel-output-stream.h |   36 +
 libgssh/gssh-channel-private.h       |   45 +
 libgssh/gssh-channel.c               |  127 +++
 libgssh/gssh-channel.h               |   30 +
 libgssh/gssh-connection-private.h    |   75 ++
 libgssh/gssh-connection.c            |  753 +++++++++++++++
 libgssh/gssh-connection.h            |   81 ++
 libgssh/gssh-enum-types.c.template   |   38 +
 libgssh/gssh-enum-types.h.template   |   22 +
 libgssh/gssh-types.h                 |   26 +
 libgssh/gssh.h                       |   24 +
 libgsystem                           |    1 +
 po/ChangeLog                         |   88 --
 po/LINGUAS                           |   29 -
 po/POTFILES.in                       |    9 -
 po/POTFILES.skip                     |    2 -
 po/ar.po                             |  307 -------
 po/ca.po                             |  268 ------
 po/cs.po                             |  279 ------
 po/da.po                             |  271 ------
 po/de.po                             |  276 ------
 po/el.po                             |  274 ------
 po/en_CA.po                          |   22 -
 po/es.po                             |  282 ------
 po/fi.po                             |  269 ------
 po/fr.po                             |  272 ------
 po/gl.po                             |  271 ------
 po/he.po                             |  274 ------
 po/hu.po                             |  274 ------
 po/id.po                             |  272 ------
 po/it.po                             |  274 ------
 po/ja.po                             |  273 ------
 po/lv.po                             |  281 ------
 po/nb.po                             |  266 ------
 po/pa.po                             |  271 ------
 po/pl.po                             |  281 ------
 po/pt.po                             |  278 ------
 po/pt_BR.po                          |  281 ------
 po/ro.po                             |  283 ------
 po/ru.po                             |  281 ------
 po/sl.po                             |  297 ------
 po/sr.po                             |  286 ------
 po/sr latin po                       |  286 ------
 po/sv.po                             |  280 ------
 po/wscript_build                     |    2 -
 po/zh_CN.po                          |  266 ------
 src/app-menu.ui                      |   19 +
 src/gears-menu.ui                    |   16 +
 src/hotssh-app.c                     |  171 ++++
 src/hotssh-app.h                     |   33 +
 src/hotssh-prefs.c                   |   99 ++
 src/hotssh-prefs.h                   |   33 +
 src/hotssh-win.c                     |  500 ++++++++++
 src/hotssh-win.h                     |   37 +
 src/hotssh.gresource.xml             |    9 +
 src/main.c                           |   28 +
 src/org.gnome.hotssh.gschema.xml     |   25 +
 src/prefs.ui                         |   83 ++
 src/window.ui                        |  323 +++++++
 waf                                  |  Bin 74835 -> 0 bytes
 wscript                              |   49 -
 90 files changed, 4141 insertions(+), 11539 deletions(-)
---
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..e93bbea
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "libgsystem"]
+       path = libgsystem
+       url = git://git.gnome.org/libgsystem
diff --git a/COPYING b/COPYING
index 60549be..bf50f20 100644
--- a/COPYING
+++ b/COPYING
@@ -1,22 +1,25 @@
-                   GNU GENERAL PUBLIC LICENSE
+                 GNU LIBRARY 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
+ 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
-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.
+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
@@ -27,195 +30,347 @@ 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
+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
-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.
-
+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 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.
+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.
+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 GENERAL PUBLIC LICENSE
+                 GNU LIBRARY 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
+  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 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
+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) You must cause the modified files to carry prominent notices
+    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.
 
-    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.)
-
+    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 Program,
+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 Program, the distribution of the whole must be on the terms of
+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.
+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.
+collective works based on the Library.
 
-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
+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 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
+  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.
 
-  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
+  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 Program or its derivative works.  These actions are
+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 Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
+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 Program or works based on it.
+the Library 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
+  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.
-
-  7. If, as a consequence of a court judgment or allegation of patent
+
+  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 Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
+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 Program.
+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.
+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
+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
@@ -225,116 +380,103 @@ 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
+
+  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 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.
+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
 
-  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.
+  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 Programs
+           How to Apply These Terms to Your New Libraries
 
-  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.
+  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 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.
+  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 program's name and a brief idea of what it does.>
-    Copyright (C) 19yy  <name of author>
+    <one line to give the library'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 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 program is distributed in the hope that it will be useful,
+    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 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
+    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.
 
-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) 19yy 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
+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 program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+  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 1989
+  <signature of Ty Coon>, 1 April 1990
   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.
+That's all there is to it!
diff --git a/Makefile-libgssh.am b/Makefile-libgssh.am
new file mode 100644
index 0000000..158e3dc
--- /dev/null
+++ b/Makefile-libgssh.am
@@ -0,0 +1,26 @@
+noinst_LTLIBRARIES += libgssh.la
+
+libgssh_headers = $(addprefix libgssh/,gssh-connection.h gssh-channel.h gssh-types.h gssh.h)
+
+libgssh_la_SOURCES = $(gssh_headers) \
+       libgssh/gssh-connection.c \
+       libgssh/gssh-channel.c \
+       libgssh/gssh-channel-input-stream.c \
+       libgssh/gssh-channel-input-stream.h \
+       libgssh/gssh-channel-output-stream.h \
+       libgssh/gssh-channel-output-stream.c \
+       $(NULL)
+
+libgssh_la_CFLAGS = $(AM_CFLAGS) $(BUILDDEP_LIBGSSH_CFLAGS) -I$(srcdir)/libgsystem -I$(srcdir)/libgssh
+libgssh_la_LIBADD = $(BUILDDEP_LIBGSSH_LIBS) libgsystem.la
+
+gssh-enum-types.h: $(libgssh_headers) libgssh/gssh-enum-types.h.template
+       $(AM_V_GEN) glib-mkenums --identifier-prefix GSsh --symbol-prefix gssh --template $(filter 
%.template,$^) $(filter-out %.template,$^) > \
+           $  tmp && mv $  tmp $@
+
+gssh-enum-types.c: $(libgssh_headers) libgssh/gssh-enum-types.c.template
+       $(AM_V_GEN) glib-mkenums --identifier-prefix GSsh --symbol-prefix gssh --template $(filter 
%.template,$^) $(filter-out %.template,$^) > \
+           $  tmp && mv $  tmp $@
+
+libgssh_la_SOURCES += gssh-enum-types.c gssh-enum-types.h
+BUILT_SOURCES += gssh-enum-types.h gssh-enum-types.c
diff --git a/Makefile-src.am b/Makefile-src.am
new file mode 100644
index 0000000..9dc230a
--- /dev/null
+++ b/Makefile-src.am
@@ -0,0 +1,26 @@
+bin_PROGRAMS += hotssh
+
+hotssh_headers = $(addprefix src/,hotssh-app.h hotssh-win.h hotssh-prefs.h)
+
+hotssh_SOURCES = $(hotssh_headers) \
+       src/main.c \
+       src/hotssh-app.c \
+       src/hotssh-win.c \
+       src/hotssh-prefs.c \
+       $(NULL)
+
+hotssh_CFLAGS = $(AM_CFLAGS) $(BUILDDEP_HOTSSHAPP_CFLAGS) -I$(srcdir)/libgsystem -I$(srcdir)/libgssh 
-I$(srcdir)/src
+hotssh_LDADD = $(BUILDDEP_HOTSSHAPP_LIBS) libgssh.la libgsystem.la
+
+resources.c: src/hotssh.gresource.xml $(shell glib-compile-resources --sourcedir=$(srcdir)/src 
--generate-dependencies $(srcdir)/src/hotssh.gresource.xml)
+       $(AM_V_GEN) glib-compile-resources $< \
+               --target=$@ --sourcedir=$(srcdir)/src --generate-source
+hotssh_SOURCES += resources.c
+BUILT_SOURCES += resources.c gschemas.compiled
+
+gsettings_SCHEMAS += src/org.gnome.hotssh.gschema.xml
+
+ GSETTINGS_RULES@
+
+gschemas.compiled: src/org.gnome.hotssh.gschema.xml
+       glib-compile-schemas .
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..dcd72a9
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,68 @@
+# Copyright (C) 2011,2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+AM_CPPFLAGS = -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"'
+AM_CFLAGS = $(WARN_CFLAGS)
+
+# Subdirectories
+SUBDIRS =
+
+# Common variables
+NULL = 
+INSTALL_DATA_HOOKS =
+BUILT_SOURCES =
+MANPAGES =
+CLEANFILES =
+EXTRA_DIST =
+bin_PROGRAMS =
+sbin_PROGRAMS =
+bin_SCRIPTS =
+lib_LTLIBRARIES =
+libexec_PROGRAMS =
+noinst_LTLIBRARIES =
+noinst_PROGRAMS =
+privlibdir = $(pkglibdir)
+privlib_LTLIBRARIES =
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA =
+INTROSPECTION_GIRS = 
+girdir = $(datadir)/gir-1.0
+gir_DATA =
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA =
+gsettings_SCHEMAS =
+
+EXTRA_DIST += autogen.sh COPYING README.md
+
+GITIGNOREFILES = aclocal.m4 build-aux config.h.in m4
+
+libgsystem_srcpath := libgsystem
+libgsystem_cflags = $(BUILDDEP_GIO_UNIX_CFLAGS) -I$(srcdir)/libgsystem
+libgsystem_libs = $(BUILDDEP_GIO_UNIX_LIBS)
+include libgsystem/Makefile-libgsystem.am
+noinst_LTLIBRARIES += libgsystem.la
+
+include Makefile-libgssh.am
+include Makefile-src.am
+
+install-data-hook: $(INSTALL_DATA_HOOKS)
+
+release-tag:
+       git tag -m "Release $(VERSION)" v$(VERSION)
+
+-include $(top_srcdir)/git.mk
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..e217ae4
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+
+olddir=`pwd`
+cd $srcdir
+
+AUTORECONF=`which autoreconf`
+if test -z $AUTORECONF; then
+        echo "*** No autoreconf found, please intall it ***"
+        exit 1
+fi
+
+set -e
+
+mkdir -p m4
+
+# Fetch submodules if needed
+if test ! -f libgsystem/README;
+then
+  echo "+ Setting up submodules"
+  git submodule init
+  git submodule update
+fi
+
+autoreconf --force --install --verbose
+
+cd $olddir
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..4d176d8
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,42 @@
+AC_PREREQ([2.63])
+AC_INIT([hotssh], [2013.1], [walters verbum org])
+AC_CONFIG_HEADER([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_AUX_DIR([build-aux])
+
+AM_INIT_AUTOMAKE([1.11 -Wno-portability foreign no-define tar-ustar no-dist-gzip dist-xz])
+AM_MAINTAINER_MODE([enable])
+AM_SILENT_RULES([yes])
+AC_USE_SYSTEM_EXTENSIONS
+AC_SYS_LARGEFILE
+
+AC_PROG_CC
+AM_PROG_CC_C_O
+
+changequote(,)dnl
+if test "x$GCC" = "xyes"; then
+  WARN_CFLAGS="-Wall -Wstrict-prototypes -Werror=missing-prototypes \
+               -Werror=implicit-function-declaration \
+               -Werror=pointer-arith -Werror=init-self -Werror=format=2 \
+               -Werror=format-security \
+               -Werror=missing-include-dirs -Werror=aggregate-return \
+               -Werror=declaration-after-statement"
+fi
+changequote([,])dnl
+AC_SUBST(WARN_CFLAGS)
+
+# Initialize libtool
+LT_PREREQ([2.2.4])
+LT_INIT([disable-static])
+
+PKG_PROG_PKG_CONFIG
+GLIB_GSETTINGS
+
+PKG_CHECK_MODULES(BUILDDEP_GIO_UNIX, [gio-unix-2.0 >= 2.34])
+PKG_CHECK_MODULES(BUILDDEP_HOTSSHAPP, [gio-unix-2.0 >= 2.34 gtk+-3.0 vte-2.90])
+PKG_CHECK_MODULES(BUILDDEP_LIBGSSH, [gio-unix-2.0 libssh2])
+
+AC_CONFIG_FILES([
+Makefile
+])
+AC_OUTPUT
diff --git a/git.mk b/git.mk
new file mode 100644
index 0000000..2fa799d
--- /dev/null
+++ b/git.mk
@@ -0,0 +1,305 @@
+# git.mk
+#
+# Copyright 2009, Red Hat, Inc.
+# Copyright 2010,2011,2012,2013 Behdad Esfahbod
+# Written by Behdad Esfahbod
+#
+# Copying and distribution of this file, with or without modification,
+# is permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+#
+# The latest version of this file can be downloaded from:
+#   https://raw.github.com/behdad/git.mk/master/git.mk
+# Bugs, etc, should be reported upstream at:
+#   https://github.com/behdad/git.mk
+#
+# To use in your project, import this file in your git repo's toplevel,
+# then do "make -f git.mk".  This modifies all Makefile.am files in
+# your project to -include git.mk.  Remember to add that line to new
+# Makefile.am files you create in your project, or just rerun the
+# "make -f git.mk".
+#
+# This enables automatic .gitignore generation.  If you need to ignore
+# more files, add them to the GITIGNOREFILES variable in your Makefile.am.
+# But think twice before doing that.  If a file has to be in .gitignore,
+# chances are very high that it's a generated file and should be in one
+# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES.
+#
+# The only case that you need to manually add a file to GITIGNOREFILES is
+# when remove files in one of mostlyclean-local, clean-local, distclean-local,
+# or maintainer-clean-local make targets.
+#
+# Note that for files like editor backup, etc, there are better places to
+# ignore them.  See "man gitignore".
+#
+# If "make maintainer-clean" removes the files but they are not recognized
+# by this script (that is, if "git status" shows untracked files still), send
+# me the output of "git status" as well as your Makefile.am and Makefile for
+# the directories involved and I'll diagnose.
+#
+# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
+# Makefile.am.sample in the git.mk git repo.
+#
+# Don't EXTRA_DIST this file.  It is supposed to only live in git clones,
+# not tarballs.  It serves no useful purpose in tarballs and clutters the
+# build dir.
+#
+# This file knows how to handle autoconf, automake, libtool, gtk-doc,
+# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu.
+#
+# This makefile provides the following targets:
+#
+# - all: "make all" will build all gitignore files.
+# - gitignore: makes all gitignore files in the current dir and subdirs.
+# - .gitignore: make gitignore file for the current dir.
+# - gitignore-recurse: makes all gitignore files in the subdirs.
+#
+# KNOWN ISSUES:
+#
+# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the
+#   submodule doesn't find us.  If you have configure.{in,ac} files in
+#   subdirs, add a proxy git.mk file in those dirs that simply does:
+#   "include $(top_srcdir)/../git.mk".  Add more ..'s to your taste.
+#   And add those files to git.  See vte/gnome-pty-helper/git.mk for
+#   example.
+#
+
+
+
+###############################################################################
+# Variables user modules may want to add to toplevel MAINTAINERCLEANFILES:
+###############################################################################
+
+#
+# Most autotools-using modules should be fine including this variable in their
+# toplevel MAINTAINERCLEANFILES:
+GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL = \
+       $(srcdir)/aclocal.m4 \
+       $(srcdir)/autoscan.log \
+       $(srcdir)/configure.scan \
+       `AUX_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_AUX_DIR:$$1' ./configure.ac); \
+        test "x$$AUX_DIR" = "x$(srcdir)/" && AUX_DIR=$(srcdir); \
+        for x in \
+               ar-lib \
+               compile \
+               config.guess \
+               config.sub \
+               depcomp \
+               install-sh \
+               ltmain.sh \
+               missing \
+               mkinstalldirs \
+        ; do echo "$$AUX_DIR/$$x"; done` \
+       `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_HEADERS:$$1' ./configure.ac | \
+       head -n 1 | while read f; do echo "$(srcdir)/$$f.in"; done`
+#
+# All modules should also be fine including the following variable, which
+# removes automake-generated Makefile.in files:
+GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN = \
+       `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_FILES:$$1' ./configure.ac | \
+       while read f; do \
+         case $$f in Makefile|*/Makefile) \
+           test -f "$(srcdir)/$$f.am" && echo "$(srcdir)/$$f.in";; esac; \
+       done`
+#
+# Modules that use libtool /and/ use  AC_CONFIG_MACRO_DIR([m4]) may also
+# include this:
+GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL = \
+       $(srcdir)/m4/libtool.m4 \
+       $(srcdir)/m4/ltoptions.m4 \
+       $(srcdir)/m4/ltsugar.m4 \
+       $(srcdir)/m4/ltversion.m4 \
+       $(srcdir)/m4/lt~obsolete.m4
+
+
+
+###############################################################################
+# Default rule is to install ourselves in all Makefile.am files:
+###############################################################################
+
+git-all: git-mk-install
+
+git-mk-install:
+       @echo "Installing git makefile"
+       @any_failed=; \
+               find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while 
read x; do \
+               if grep 'include .*/git.mk' $$x >/dev/null; then \
+                       echo "$$x already includes git.mk"; \
+               else \
+                       failed=; \
+                       echo "Updating $$x"; \
+                       { cat $$x; \
+                         echo ''; \
+                         echo '-include $$(top_srcdir)/git.mk'; \
+                       } > $$x.tmp || failed=1; \
+                       if test x$$failed = x; then \
+                               mv $$x.tmp $$x || failed=1; \
+                       fi; \
+                       if test x$$failed = x; then : else \
+                               echo "Failed updating $$x"; >&2 \
+                               any_failed=1; \
+                       fi; \
+       fi; done; test -z "$$any_failed"
+
+.PHONY: git-all git-mk-install
+
+
+
+###############################################################################
+# Actual .gitignore generation:
+###############################################################################
+
+$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
+       @echo "git.mk: Generating $@"
+       @{ \
+               if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \
+                       for x in \
+                               $(DOC_MODULE)-decl-list.txt \
+                               $(DOC_MODULE)-decl.txt \
+                               tmpl/$(DOC_MODULE)-unused.sgml \
+                               "tmpl/*.bak" \
+                               xml html \
+                       ; do echo "/$$x"; done; \
+                       FLAVOR=$$(cd $(top_srcdir); $(AUTOCONF) --trace 'GTK_DOC_CHECK:$$2' ./configure.ac); \
+                       case $$FLAVOR in *no-tmpl*) echo /tmpl;; esac; \
+               fi; \
+               if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
+                       for lc in $(DOC_LINGUAS); do \
+                               for x in \
+                                       $(if $(DOC_MODULE),$(DOC_MODULE).xml) \
+                                       $(DOC_PAGES) \
+                                       $(DOC_INCLUDES) \
+                               ; do echo "/$$lc/$$x"; done; \
+                       done; \
+                       for x in \
+                               $(_DOC_OMF_ALL) \
+                               $(_DOC_DSK_ALL) \
+                               $(_DOC_HTML_ALL) \
+                               $(_DOC_MOFILES) \
+                               $(DOC_H_FILE) \
+                               "*/.xml2po.mo" \
+                               "*/*.omf.out" \
+                       ; do echo /$$x; done; \
+               fi; \
+               if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \
+                       for lc in $(HELP_LINGUAS); do \
+                               for x in \
+                                       $(HELP_FILES) \
+                                       "$$lc.stamp" \
+                                       "$$lc.mo" \
+                               ; do echo "/$$lc/$$x"; done; \
+                       done; \
+               fi; \
+               if test "x$(gsettings_SCHEMAS)" = x; then :; else \
+                       for x in \
+                               $(gsettings_SCHEMAS:.xml=.valid) \
+                               $(gsettings__enum_file) \
+                       ; do echo "/$$x"; done; \
+               fi; \
+               if test -f $(srcdir)/po/Makefile.in.in; then \
+                       for x in \
+                               po/Makefile.in.in \
+                               po/Makefile.in.in~ \
+                               po/Makefile.in \
+                               po/Makefile \
+                               po/Makevars.template \
+                               po/POTFILES \
+                               po/Rules-quot \
+                               po/stamp-it \
+                               po/.intltool-merge-cache \
+                               "po/*.gmo" \
+                               "po/*.header" \
+                               "po/*.mo" \
+                               "po/*.sed" \
+                               "po/*.sin" \
+                               po/$(GETTEXT_PACKAGE).pot \
+                               intltool-extract.in \
+                               intltool-merge.in \
+                               intltool-update.in \
+                       ; do echo "/$$x"; done; \
+               fi; \
+               if test -f $(srcdir)/configure; then \
+                       for x in \
+                               autom4te.cache \
+                               configure \
+                               config.h \
+                               stamp-h1 \
+                               libtool \
+                               config.lt \
+                       ; do echo "/$$x"; done; \
+               fi; \
+               if test "x$(DEJATOOL)" = x; then :; else \
+                       for x in \
+                               $(DEJATOOL) \
+                       ; do echo "/$$x.sum"; echo "/$$x.log"; done; \
+                       echo /site.exp; \
+               fi; \
+               if test "x$(am__dirstamp)" = x; then :; else \
+                       echo "$(am__dirstamp)"; \
+               fi; \
+               if test "x$(LTCOMPILE)" = x -a "x$(GTKDOC_RUN)" = x; then :; else \
+                       for x in \
+                               "*.lo" \
+                               ".libs" "_libs" \
+                       ; do echo "$$x"; done; \
+               fi; \
+               for x in \
+                       .gitignore \
+                       $(GITIGNOREFILES) \
+                       $(CLEANFILES) \
+                       $(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \
+                       $(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \
+                       $(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \
+                       so_locations \
+                       $(MOSTLYCLEANFILES) \
+                       $(TEST_LOGS) \
+                       $(TEST_LOGS:.log=.trs) \
+                       $(TEST_SUITE_LOG) \
+                       "*.$(OBJEXT)" \
+                       $(DISTCLEANFILES) \
+                       $(am__CONFIG_DISTCLEAN_FILES) \
+                       $(CONFIG_CLEAN_FILES) \
+                       TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
+                       "*.tab.c" \
+                       $(MAINTAINERCLEANFILES) \
+                       $(BUILT_SOURCES) \
+                       $(DEPDIR) \
+                       $(patsubst %.vala,%.c,$(filter %.vala,$(SOURCES))) \
+                       $(filter %_vala.stamp,$(DIST_COMMON)) \
+                       $(filter %.vapi,$(DIST_COMMON)) \
+                       $(patsubst %.vapi,%.h,$(filter %.vapi,$(DIST_COMMON))) \
+                       Makefile \
+                       Makefile.in \
+                       "*.orig" \
+                       "*.rej" \
+                       "*.bak" \
+                       "*~" \
+                       ".*.sw[nop]" \
+                       ".dirstamp" \
+               ; do echo "/$$x"; done; \
+       } | \
+       sed "s ^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
+       sed 's@/[.]/@/@g' | \
+       LC_ALL=C sort | uniq > $  tmp && \
+       mv $  tmp $@;
+
+all: $(srcdir)/.gitignore gitignore-recurse-maybe
+gitignore: $(srcdir)/.gitignore gitignore-recurse
+
+gitignore-recurse-maybe:
+       @for subdir in $(DIST_SUBDIRS); do \
+         case " $(SUBDIRS) " in \
+           *" $$subdir "*) :;; \
+           *) test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore 
|| echo "Skipping $$subdir");; \
+         esac; \
+       done
+gitignore-recurse:
+       @for subdir in $(DIST_SUBDIRS); do \
+           test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || 
echo "Skipping $$subdir"); \
+       done
+
+maintainer-clean: gitignore-clean
+gitignore-clean:
+       -rm -f $(srcdir)/.gitignore
+
+.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe
diff --git a/hotssh.doap b/hotssh.doap
index 84b1190..34a3416 100644
--- a/hotssh.doap
+++ b/hotssh.doap
@@ -1,17 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
          xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
          xmlns:foaf="http://xmlns.com/foaf/0.1/";
          xmlns:gnome="http://api.gnome.org/doap-extensions#";
          xmlns="http://usefulinc.com/ns/doap#";>
 
-  <name xml:lang="en">hotssh</name>
-  <shortdesc xml:lang="en">HotSSH</shortdesc>
-  <homepage rdf:resource="http://www.gnome.org/projects/hotssh"; />
+  <name>HotSSH</name>
+  <shortname>HotSSH</shortname>
+
+  <shortdesc xml:lang="en">SSH client</shortdesc>
+
+  <description xml:lang="en">A SSH client for GNOME.</description>
+
+  <homepage rdf:resource="http://git.gnome.org/browse/hotssh"; />
+  <license rdf:resource="http://usefulinc.com/doap/licenses/lgpl"; />
+
+  <programming-language>C</programming-language>
 
   <maintainer>
     <foaf:Person>
       <foaf:name>Colin Walters</foaf:name>
+      <foaf:mbox rdf:resource="mailto:walters verbum org"/>
       <gnome:userid>walters</gnome:userid>
     </foaf:Person>
   </maintainer>
+
+  <repository>
+    <GitRepository>
+      <browse rdf:resource="http://git.gnome.org/browse/hotssh"/>
+      <location rdf:resource="git://git.gnome.org/hotssh"/>
+    </GitRepository>
+  </repository>
+
 </Project>
diff --git a/libgssh/gssh-channel-input-stream.c b/libgssh/gssh-channel-input-stream.c
new file mode 100644
index 0000000..fe0f310
--- /dev/null
+++ b/libgssh/gssh-channel-input-stream.c
@@ -0,0 +1,238 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gssh-channel-input-stream.h"
+#include "gssh-connection-private.h"
+#include "gssh-channel-private.h"
+
+struct _GSshChannelInputStream
+{
+  GInputStream parent;
+
+  GSshChannel *channel;
+ 
+  gboolean is_closed;
+
+  GTask *read_task;
+  GTask *close_task;
+
+  void *buf;
+  gsize count;
+
+  /* For synchronous operations */
+  gboolean sync_running;
+  gssize sync_bytes_read;
+  GMainContext *sync_context;
+  GError *sync_error;
+};
+
+struct _GSshChannelInputStreamClass
+{
+  GInputStreamClass parent;
+};
+
+G_DEFINE_TYPE(GSshChannelInputStream, _gssh_channel_input_stream, G_TYPE_INPUT_STREAM);
+
+static void
+_gssh_channel_input_stream_init (GSshChannelInputStream *self)
+{
+}
+
+static void
+_gssh_channel_input_stream_dispose (GObject *object)
+{
+  G_GNUC_UNUSED GSshChannelInputStream *self = (GSshChannelInputStream*)object;
+
+  G_OBJECT_CLASS (_gssh_channel_input_stream_parent_class)->dispose (object);
+}
+
+static gboolean
+gssh_channel_input_stream_close (GInputStream  *stream,
+                                    GCancellable   *cancellable,
+                                    GError        **error)
+{
+  GSshChannelInputStream *self = GSSH_CHANNEL_INPUT_STREAM (stream);
+
+  g_return_val_if_fail (!self->is_closed, FALSE);
+
+  self->is_closed = TRUE;
+
+  return TRUE;
+}
+
+static void
+gssh_channel_input_stream_close_async (GInputStream        *stream,
+                                         int                  io_priority,
+                                         GCancellable        *cancellable,
+                                         GAsyncReadyCallback  callback,
+                                         gpointer             data)
+{
+  GSshChannelInputStream *self = GSSH_CHANNEL_INPUT_STREAM (stream);
+  GTask *task;
+
+  g_return_if_fail (!self->is_closed);
+
+  task = g_task_new (stream, cancellable, callback, data);
+  gssh_channel_input_stream_close (stream, cancellable, NULL);
+  g_task_return_boolean (task, TRUE);
+  g_object_unref (task);
+}
+
+static gboolean
+gssh_channel_input_stream_close_finish (GInputStream  *stream,
+                                           GAsyncResult   *result,
+                                           GError        **error)
+{
+  g_return_val_if_fail (g_task_is_valid (result, stream), FALSE);
+
+  return g_task_propagate_boolean (G_TASK (result), error);
+}
+
+static void
+gssh_channel_input_stream_read_async (GInputStream        *stream,
+                                        void                *buffer,
+                                        gsize                count,
+                                        int                  io_priority,
+                                        GCancellable        *cancellable,
+                                        GAsyncReadyCallback  callback,
+                                        gpointer             user_data)
+{
+  GSshChannelInputStream *self = GSSH_CHANNEL_INPUT_STREAM (stream);
+
+  g_return_if_fail (!self->is_closed);
+
+  g_assert (self->read_task == NULL);
+  self->read_task = g_task_new (self, cancellable, callback, user_data);
+  g_task_set_priority (self->read_task, io_priority);
+
+  self->buf = buffer;
+  self->count = count;
+
+  _gssh_channel_input_stream_iteration (self);
+}
+
+static gssize
+gssh_channel_input_stream_read_finish (GInputStream  *stream,
+                                         GAsyncResult   *result,
+                                         GError        **error)
+{
+  g_return_val_if_fail (g_task_is_valid (result, stream), FALSE);
+
+  return g_task_propagate_int (G_TASK (result), error);
+}
+
+static void
+on_sync_read_done (GObject            *src,
+                   GAsyncResult       *result,
+                   gpointer            user_data)
+{
+  GSshChannelInputStream *self = GSSH_CHANNEL_INPUT_STREAM (user_data);
+
+  self->sync_bytes_read = gssh_channel_input_stream_read_finish ((GInputStream*)self, result, 
&self->sync_error);
+  self->sync_running = FALSE;
+  g_main_context_wakeup (self->sync_context);
+}
+
+static gssize
+gssh_channel_input_stream_read (GInputStream   *stream,
+                                  void           *buffer,
+                                  gsize           count,
+                                  GCancellable   *cancellable,
+                                  GError        **error)
+{
+  GSshChannelInputStream *self = GSSH_CHANNEL_INPUT_STREAM (stream);
+
+  g_return_val_if_fail (!self->is_closed, -1);
+
+  self->sync_context = g_main_context_new ();
+  g_main_context_push_thread_default (self->sync_context);
+  self->sync_error = NULL;
+  self->sync_running = FALSE;
+
+  gssh_channel_input_stream_read_async (stream, buffer, count,
+                                          G_PRIORITY_DEFAULT, cancellable,
+                                          on_sync_read_done, self);
+
+  while (self->sync_running)
+    g_main_context_iteration (self->sync_context, TRUE);
+
+  g_main_context_pop_thread_default (self->sync_context);
+
+  if (self->sync_error)
+    {
+      g_propagate_error (error, self->sync_error);
+      return -1;
+    }
+  return self->sync_bytes_read;
+}
+
+void
+_gssh_channel_input_stream_iteration (GSshChannelInputStream     *self)
+{
+  int rc;
+  GError *local_error = NULL;
+  GTask *prev_task = self->read_task;
+
+  g_assert (!self->is_closed);
+  rc = libssh2_channel_read (self->channel->libsshchannel,
+                             self->buf, self->count);
+  if (rc == LIBSSH2_ERROR_EAGAIN)
+    return;
+
+  /* This special dance is required because we may have reentered via
+     g_task_return() */
+  self->read_task = NULL;
+
+  if (rc > 0)
+    {
+      g_task_return_int (prev_task, rc);
+    }
+  else
+    {
+      _gssh_set_error_from_libssh2 (&local_error, "Failed to read",
+                                      self->channel->connection->session);
+      g_task_return_error (prev_task, local_error);
+    }
+  g_object_unref (prev_task);
+}
+
+GSshChannelInputStream  *
+_gssh_channel_input_stream_new (GSshChannel *channel)
+{
+  GSshChannelInputStream *ret = g_object_new (GSSH_TYPE_CHANNEL_INPUT_STREAM, NULL);
+  ret->channel = channel;
+  return ret;
+}
+
+static void
+_gssh_channel_input_stream_class_init (GSshChannelInputStreamClass *class)
+{
+  GInputStreamClass *istream_class;
+
+  G_OBJECT_CLASS (class)->dispose = _gssh_channel_input_stream_dispose;
+
+  istream_class = G_INPUT_STREAM_CLASS (class);
+  istream_class->read_fn = gssh_channel_input_stream_read;
+  istream_class->read_async = gssh_channel_input_stream_read_async;
+  istream_class->read_finish = gssh_channel_input_stream_read_finish;
+  istream_class->close_fn = gssh_channel_input_stream_close;
+  istream_class->close_async  = gssh_channel_input_stream_close_async;
+  istream_class->close_finish = gssh_channel_input_stream_close_finish;
+}
diff --git a/libgssh/gssh-channel-input-stream.h b/libgssh/gssh-channel-input-stream.h
new file mode 100644
index 0000000..a6618d6
--- /dev/null
+++ b/libgssh/gssh-channel-input-stream.h
@@ -0,0 +1,36 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include "gssh-channel.h"
+#include <libssh2.h>
+
+#define GSSH_TYPE_CHANNEL_INPUT_STREAM (_gssh_channel_input_stream_get_type ())
+#define GSSH_CHANNEL_INPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSSH_TYPE_CHANNEL_INPUT_STREAM, 
GSshChannelInputStream))
+
+typedef struct _GSshChannelInputStream         GSshChannelInputStream;
+typedef struct _GSshChannelInputStreamClass    GSshChannelInputStreamClass;
+
+GType                   _gssh_channel_input_stream_get_type     (void);
+
+GSshChannelInputStream  * _gssh_channel_input_stream_new (GSshChannel *channel);
+
+void _gssh_channel_input_stream_iteration (GSshChannelInputStream     *self);
diff --git a/libgssh/gssh-channel-output-stream.c b/libgssh/gssh-channel-output-stream.c
new file mode 100644
index 0000000..b931fc9
--- /dev/null
+++ b/libgssh/gssh-channel-output-stream.c
@@ -0,0 +1,330 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gssh-channel-output-stream.h"
+#include "gssh-channel-private.h"
+#include "gssh-connection-private.h"
+
+typedef enum {
+  GSSH_CHANNEL_OUTPUT_STREAM_STATE_OPEN,
+  GSSH_CHANNEL_OUTPUT_STREAM_STATE_REQUESTED_EOF,
+  GSSH_CHANNEL_OUTPUT_STREAM_STATE_SENT_EOF,
+  GSSH_CHANNEL_OUTPUT_STREAM_STATE_RECEIVED_EOF
+} GSshChannelOutputStreamState;
+
+struct _GSshChannelOutputStream
+{
+  GOutputStream parent;
+  GSshChannel *channel;
+ 
+  GSshChannelOutputStreamState state;
+
+  int efd;
+  GBytes *buf;
+
+  GTask *write_task;
+  GTask *close_task;
+
+  /* For synchronous operations */
+  gboolean sync_running;
+  gssize sync_bytes_written;
+  GMainContext *sync_context;
+  GError *sync_error;
+};
+
+struct _GSshChannelOutputStreamClass
+{
+  GOutputStreamClass parent;
+};
+
+G_DEFINE_TYPE(GSshChannelOutputStream, _gssh_channel_output_stream, G_TYPE_OUTPUT_STREAM);
+
+static void
+_gssh_channel_output_stream_init (GSshChannelOutputStream *self)
+{
+}
+
+static void
+_gssh_channel_output_stream_dispose (GObject *object)
+{
+  G_GNUC_UNUSED GSshChannelOutputStream *self = (GSshChannelOutputStream*)object;
+
+  G_OBJECT_CLASS (_gssh_channel_output_stream_parent_class)->dispose (object);
+}
+
+static void
+gssh_channel_output_stream_close_async (GOutputStream       *stream,
+                                          int                  io_priority,
+                                          GCancellable        *cancellable,
+                                          GAsyncReadyCallback  callback,
+                                          gpointer             data)
+{
+  GSshChannelOutputStream *self = GSSH_CHANNEL_OUTPUT_STREAM (stream);
+  GTask *task;
+
+  g_return_if_fail (self->state == GSSH_CHANNEL_OUTPUT_STREAM_STATE_OPEN);
+
+  self->state = GSSH_CHANNEL_OUTPUT_STREAM_STATE_REQUESTED_EOF;
+
+  task = g_task_new (self, cancellable, callback, data);
+  g_task_set_priority (task, io_priority);
+
+  self->close_task = task;
+
+  _gssh_channel_output_stream_iteration (self);
+}
+
+static gboolean
+gssh_channel_output_stream_close_finish (GOutputStream  *stream,
+                                           GAsyncResult   *result,
+                                           GError        **error)
+{
+  g_return_val_if_fail (g_task_is_valid (result, stream), FALSE);
+
+  return g_task_propagate_boolean (G_TASK (result), error);
+}
+
+static void
+on_sync_close_done (GObject            *src,
+                    GAsyncResult       *result,
+                    gpointer            user_data)
+{
+  GSshChannelOutputStream *self = GSSH_CHANNEL_OUTPUT_STREAM (user_data);
+
+  (void) gssh_channel_output_stream_close_finish ((GOutputStream*)self, result, &self->sync_error);
+  self->sync_running = FALSE;
+  g_main_context_wakeup (self->sync_context);
+}
+
+static gboolean
+gssh_channel_output_stream_close (GOutputStream  *stream,
+                                    GCancellable   *cancellable,
+                                    GError        **error)
+{
+  GSshChannelOutputStream *self = GSSH_CHANNEL_OUTPUT_STREAM (stream);
+
+  self->sync_context = g_main_context_new ();
+  g_main_context_push_thread_default (self->sync_context);
+  self->sync_error = NULL;
+  self->sync_running = FALSE;
+
+  gssh_channel_output_stream_close_async (stream, G_PRIORITY_DEFAULT, cancellable,
+                                            on_sync_close_done, self);
+
+  while (self->sync_running)
+    g_main_context_iteration (self->sync_context, TRUE);
+
+  g_main_context_pop_thread_default (self->sync_context);
+
+  if (self->sync_error)
+    {
+      g_propagate_error (error, self->sync_error);
+      return FALSE;
+    }
+  return TRUE;
+}
+
+static void
+gssh_channel_output_stream_write_async (GOutputStream       *stream,
+                                               const void          *buffer,
+                                               gsize                count,
+                                               int                  io_priority,
+                                               GCancellable        *cancellable,
+                                               GAsyncReadyCallback  callback,
+                                               gpointer             user_data)
+{
+  GSshChannelOutputStream *self = GSSH_CHANNEL_OUTPUT_STREAM (stream);
+
+  g_return_if_fail (self->state == GSSH_CHANNEL_OUTPUT_STREAM_STATE_OPEN);
+
+  g_assert (self->write_task == NULL);
+  self->write_task = g_task_new (self, cancellable, callback, user_data);
+  g_task_set_priority (self->write_task, io_priority);
+
+  self->buf = g_bytes_new (buffer, count);
+
+  _gssh_channel_output_stream_iteration (self);
+}
+
+static gssize
+gssh_channel_output_stream_write_finish (GOutputStream  *stream,
+                                                GAsyncResult   *result,
+                                                GError        **error)
+{
+  g_return_val_if_fail (g_task_is_valid (result, stream), FALSE);
+
+  return g_task_propagate_int (G_TASK (result), error);
+}
+
+static void
+on_sync_write_done (GObject            *src,
+                    GAsyncResult       *result,
+                    gpointer            user_data)
+{
+  GSshChannelOutputStream *self = GSSH_CHANNEL_OUTPUT_STREAM (user_data);
+
+  self->sync_bytes_written = gssh_channel_output_stream_write_finish ((GOutputStream*)self, result, 
&self->sync_error);
+  self->sync_running = FALSE;
+  g_main_context_wakeup (self->sync_context);
+}
+
+static gssize
+gssh_channel_output_stream_write (GOutputStream  *stream,
+                                    const void     *buffer,
+                                    gsize           count,
+                                    GCancellable   *cancellable,
+                                    GError        **error)
+{
+  GSshChannelOutputStream *self = GSSH_CHANNEL_OUTPUT_STREAM (stream);
+  gssize ret = -1;
+
+  g_return_val_if_fail (self->state == GSSH_CHANNEL_OUTPUT_STREAM_STATE_OPEN, -1);
+
+  self->sync_context = g_main_context_new ();
+  g_main_context_push_thread_default (self->sync_context);
+  self->sync_error = NULL;
+  self->sync_running = FALSE;
+
+  gssh_channel_output_stream_write_async (stream, buffer, count,
+                                                 G_PRIORITY_DEFAULT, cancellable,
+                                                 on_sync_write_done, self);
+
+  while (self->sync_running)
+    g_main_context_iteration (self->sync_context, TRUE);
+
+  g_main_context_pop_thread_default (self->sync_context);
+
+  if (self->sync_error)
+    {
+      g_propagate_error (error, self->sync_error);
+      return FALSE;
+    }
+  return TRUE;
+
+  return ret;
+}
+
+void
+_gssh_channel_output_stream_iteration (GSshChannelOutputStream     *self)
+{
+  int rc;
+  GError *local_error = NULL;
+
+  switch (self->state)
+    {
+    case GSSH_CHANNEL_OUTPUT_STREAM_STATE_OPEN:
+      {
+        gsize bufsize;
+        const guint8 *data;
+        GTask *prev_write_task = self->write_task;
+
+        data = g_bytes_get_data (self->buf, &bufsize);
+        rc = libssh2_channel_write (self->channel->libsshchannel,
+                                    (const char*)data, bufsize);
+        if (rc == LIBSSH2_ERROR_EAGAIN)
+          break;
+
+        /* This special dance is required because we may have
+           reentered via g_task_return() */
+        self->write_task = NULL;
+
+        if (rc > 0)
+          {
+            g_task_return_int (prev_write_task, rc);
+          }
+        else
+          {
+            _gssh_set_error_from_libssh2 (&local_error, "Failed to write",
+                                            self->channel->connection->session);
+            g_task_return_error (prev_write_task, local_error);
+          }
+        g_object_unref (prev_write_task);
+      }
+      break;
+    case GSSH_CHANNEL_OUTPUT_STREAM_STATE_REQUESTED_EOF:
+      {
+        rc = libssh2_channel_send_eof (self->channel->libsshchannel);
+        if (rc == LIBSSH2_ERROR_EAGAIN)
+          break;
+        else if (rc == 0)
+          {
+            self->state = GSSH_CHANNEL_OUTPUT_STREAM_STATE_SENT_EOF;
+          }
+        else
+          {
+            _gssh_set_error_from_libssh2 (&local_error, "Failed to close",
+                                            self->channel->connection->session);
+            g_task_return_error (self->close_task, local_error);
+            g_clear_object (&self->close_task);
+            break;
+          }
+      }
+      /* Fall though */
+    case GSSH_CHANNEL_OUTPUT_STREAM_STATE_SENT_EOF:
+      rc = libssh2_channel_eof (self->channel->libsshchannel);
+      if (rc == 1)
+        {
+          g_task_return_boolean (self->close_task, TRUE);
+          g_clear_object (&self->close_task);
+          self->state = GSSH_CHANNEL_OUTPUT_STREAM_STATE_RECEIVED_EOF;
+        }
+      else if (rc == 0)
+        {
+          break;
+        }
+      else
+        {
+          g_assert (rc < 0);
+          _gssh_set_error_from_libssh2 (&local_error, "Failed await closed state",
+                                          self->channel->connection->session);
+          g_task_return_error (self->close_task, local_error);
+          g_clear_object (&self->close_task);
+          break;
+        }
+      /* Fall through */
+    case GSSH_CHANNEL_OUTPUT_STREAM_STATE_RECEIVED_EOF:
+      /* Nothing */
+      break;
+    }
+}
+
+GSshChannelOutputStream  *
+_gssh_channel_output_stream_new (GSshChannel *channel)
+{
+  GSshChannelOutputStream *ret = g_object_new (GSSH_TYPE_CHANNEL_OUTPUT_STREAM, NULL);
+  ret->channel = channel;
+  return ret;
+}
+
+static void
+_gssh_channel_output_stream_class_init (GSshChannelOutputStreamClass *class)
+{
+  GOutputStreamClass *ostream_class;
+
+  G_OBJECT_CLASS (class)->dispose = _gssh_channel_output_stream_dispose;
+
+  ostream_class = G_OUTPUT_STREAM_CLASS (class);
+  ostream_class->write_fn = gssh_channel_output_stream_write;
+  ostream_class->write_async = gssh_channel_output_stream_write_async;
+  ostream_class->write_finish = gssh_channel_output_stream_write_finish;
+  ostream_class->close_fn = gssh_channel_output_stream_close;
+  ostream_class->close_async  = gssh_channel_output_stream_close_async;
+  ostream_class->close_finish = gssh_channel_output_stream_close_finish;
+}
diff --git a/libgssh/gssh-channel-output-stream.h b/libgssh/gssh-channel-output-stream.h
new file mode 100644
index 0000000..eafd6fe
--- /dev/null
+++ b/libgssh/gssh-channel-output-stream.h
@@ -0,0 +1,36 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include "gssh-channel.h"
+#include <libssh2.h>
+
+#define GSSH_TYPE_CHANNEL_OUTPUT_STREAM (_gssh_channel_output_stream_get_type ())
+#define GSSH_CHANNEL_OUTPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSSH_TYPE_CHANNEL_OUTPUT_STREAM, 
GSshChannelOutputStream))
+
+typedef struct _GSshChannelOutputStream         GSshChannelOutputStream;
+typedef struct _GSshChannelOutputStreamClass    GSshChannelOutputStreamClass;
+
+GType                   _gssh_channel_output_stream_get_type     (void);
+
+GSshChannelOutputStream  * _gssh_channel_output_stream_new (GSshChannel *channel);
+
+void _gssh_channel_output_stream_iteration (GSshChannelOutputStream     *self);
diff --git a/libgssh/gssh-channel-private.h b/libgssh/gssh-channel-private.h
new file mode 100644
index 0000000..6f9d7dd
--- /dev/null
+++ b/libgssh/gssh-channel-private.h
@@ -0,0 +1,45 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include "gssh-connection-private.h"
+#include "gssh-channel.h"
+#include "gssh-channel-input-stream.h"
+#include "gssh-channel-output-stream.h"
+
+struct _GSshChannel
+{
+  GIOStream parent;
+
+  GSshConnection *connection;
+  LIBSSH2_CHANNEL *libsshchannel;
+  
+  GSshChannelInputStream *input_stream;
+  GSshChannelOutputStream *output_stream;
+};
+
+struct _GSshChannelClass
+{
+  GIOStreamClass parent_class;
+};
+
+GSshChannel       *_gssh_channel_new (GSshConnection *connection,
+                                          LIBSSH2_CHANNEL *libsshchannel);
diff --git a/libgssh/gssh-channel.c b/libgssh/gssh-channel.c
new file mode 100644
index 0000000..a212809
--- /dev/null
+++ b/libgssh/gssh-channel.c
@@ -0,0 +1,127 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gssh-channel-private.h"
+#include <glib-unix.h>
+#include <fcntl.h>
+
+#include "libgsystem.h"
+
+G_DEFINE_TYPE(GSshChannel, gssh_channel, G_TYPE_IO_STREAM);
+
+static GInputStream *
+gssh_channel_get_input_stream (GIOStream *io_stream)
+{
+  GSshChannel *self = GSSH_CHANNEL (io_stream);
+
+  if (self->input_stream == NULL)
+    self->input_stream = _gssh_channel_input_stream_new (self);
+
+  return (GInputStream*)self->input_stream;
+}
+
+static GOutputStream *
+gssh_channel_get_output_stream (GIOStream *io_stream)
+{
+  GSshChannel *self = GSSH_CHANNEL (io_stream);
+
+  if (self->output_stream == NULL)
+    self->output_stream = _gssh_channel_output_stream_new (self);
+
+  return (GOutputStream*)self->output_stream;
+}
+
+static gboolean
+gssh_channel_close (GIOStream     *stream,
+                      GCancellable  *cancellable,
+                      GError       **error)
+{
+  GSshChannel *self = (GSshChannel*)stream;
+  
+  if (self->connection)
+    g_hash_table_remove (self->connection->channels, self);
+
+  return G_IO_STREAM_CLASS (gssh_channel_parent_class)->close_fn (stream, cancellable, error);
+}
+
+static void
+gssh_channel_close_async (GIOStream           *stream,
+                            int                  io_priority,
+                            GCancellable        *cancellable,
+                            GAsyncReadyCallback  callback,
+                            gpointer             user_data)
+{
+  GSshChannel *self = (GSshChannel*)stream;
+  
+  if (self->connection)
+    g_hash_table_remove (self->connection->channels, self);
+
+  G_IO_STREAM_CLASS (gssh_channel_parent_class)->close_async (stream, io_priority,
+                                                                cancellable, callback,
+                                                                user_data);
+}
+
+static gboolean
+gssh_channel_close_finish (GIOStream     *stream,
+                             GAsyncResult  *result,
+                             GError       **error)
+{
+  return G_IO_STREAM_CLASS (gssh_channel_parent_class)->close_finish (stream, result, error);
+}
+
+static void
+gssh_channel_init (GSshChannel *self)
+{
+}
+
+static void
+gssh_channel_dispose (GObject *object)
+{
+  GSshChannel *self = (GSshChannel*)object;
+
+  g_clear_object (&self->input_stream);
+  g_clear_object (&self->output_stream);
+
+  G_OBJECT_CLASS (gssh_channel_parent_class)->dispose (object);
+}
+
+static void
+gssh_channel_class_init (GSshChannelClass *class)
+{
+  G_OBJECT_CLASS (class)->dispose = gssh_channel_dispose;
+  G_IO_STREAM_CLASS (class)->get_input_stream = gssh_channel_get_input_stream;
+  G_IO_STREAM_CLASS (class)->get_output_stream = gssh_channel_get_output_stream;
+  G_IO_STREAM_CLASS (class)->close_fn = gssh_channel_close;
+  G_IO_STREAM_CLASS (class)->close_async = gssh_channel_close_async;
+  G_IO_STREAM_CLASS (class)->close_finish = gssh_channel_close_finish;
+}
+
+GSshChannel *
+_gssh_channel_new (GSshConnection *connection,
+                     LIBSSH2_CHANNEL *libsshchannel)
+{
+  GSshChannel *self = (GSshChannel*)g_object_new (GSSH_TYPE_CHANNEL, NULL);
+  /* We don't hold a ref; if the connection goes away, it will ensure
+   * this pointer is zeroed.
+   */
+  self->connection = connection; 
+  self->libsshchannel = libsshchannel; 
+  return self;
+}
diff --git a/libgssh/gssh-channel.h b/libgssh/gssh-channel.h
new file mode 100644
index 0000000..9575b69
--- /dev/null
+++ b/libgssh/gssh-channel.h
@@ -0,0 +1,30 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include "gssh-types.h"
+
+#define GSSH_TYPE_CHANNEL (gssh_channel_get_type ())
+#define GSSH_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSSH_TYPE_CHANNEL, GSshChannel))
+
+typedef struct _GSshChannelClass    GSshChannelClass;
+
+GType                   gssh_channel_get_type     (void);
diff --git a/libgssh/gssh-connection-private.h b/libgssh/gssh-connection-private.h
new file mode 100644
index 0000000..92abe63
--- /dev/null
+++ b/libgssh/gssh-connection-private.h
@@ -0,0 +1,75 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include "gssh-connection.h"
+#include <libssh2.h>
+
+typedef enum {
+  GSSH_CONNECTION_HANDSHAKE_STATE_STARTING,
+  GSSH_CONNECTION_HANDSHAKE_STATE_AUTHLIST
+} GSshConnectionHandshakeState;
+
+struct _GSshConnection
+{
+  GObject parent;
+
+  GSshConnectionState state;
+  GSshConnectionHandshakeState handshake_state;
+
+  guint select_inbound : 1;
+  guint select_outbound : 1;
+  guint unused : 30;
+
+  char *username;
+
+  char **authschemes;
+
+  LIBSSH2_SESSION *session;
+  GHashTable *channels;
+
+  GError *cached_error;
+  GMainContext *maincontext;
+  GSocketClient *socket_client;
+  GSocket *socket;
+  GSource *socket_source;
+  GSocketConnectable *address;
+  GSocketConnection *socketconn;
+  GCancellable *cancellable;
+  char *password;
+
+  GTask *connection_task;
+  GTask *auth_task;
+  GHashTable *open_channel_exec_tasks;
+  GHashTable *channel_tasks;
+};
+
+struct _GSshConnectionClass
+{
+  GObjectClass parent_class;
+};
+
+typedef struct _GSshConnectionPrivate GSshConnectionPrivate;
+
+void
+_gssh_set_error_from_libssh2 (GError         **error,
+                                const char      *prefix,
+                                LIBSSH2_SESSION *session);
diff --git a/libgssh/gssh-connection.c b/libgssh/gssh-connection.c
new file mode 100644
index 0000000..21d55a8
--- /dev/null
+++ b/libgssh/gssh-connection.c
@@ -0,0 +1,753 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gssh-connection-private.h"
+#include "gssh-channel-private.h"
+#include "gssh-enum-types.h"
+
+#include "libgsystem.h"
+
+enum {
+  PROP_0,
+  PROP_ADDRESS,
+  PROP_USERNAME,
+  PROP_MAINCONTEXT,
+  PROP_STATE
+};
+
+typedef enum {
+  GSSH_CONNECTION_CHANNEL_CREATION_STATE_OPEN_SESSION,
+  GSSH_CONNECTION_CHANNEL_CREATION_STATE_REQUEST_PTY,
+  GSSH_CONNECTION_CHANNEL_CREATION_STATE_EXEC
+} GSshConnectionChannelCreationState;
+
+typedef struct {
+  char *exec_command; /* If NULL, then shell */
+  GSshConnectionChannelCreationState state;
+  LIBSSH2_CHANNEL *libssh2channel;
+} GSshConnectionChannelCreationData;
+
+G_DEFINE_TYPE(GSshConnection, gssh_connection, G_TYPE_OBJECT);
+
+void
+_gssh_set_error_from_libssh2 (GError         **error,
+                                const char      *prefix,
+                                LIBSSH2_SESSION *session)
+{
+  char *errmsg = NULL;
+  libssh2_session_last_error (session, &errmsg, NULL, FALSE);
+  g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "%s: %s", prefix, errmsg);
+}
+
+static void
+reset_state (GSshConnection               *self)
+{
+  GHashTableIter hiter;
+  gpointer key, value;
+
+  g_assert (self->state == GSSH_CONNECTION_STATE_DISCONNECTED ||
+            self->state == GSSH_CONNECTION_STATE_ERROR);
+  g_clear_object (&self->connection_task);
+  g_clear_pointer (&self->open_channel_exec_tasks, g_hash_table_unref);
+  self->open_channel_exec_tasks = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref);
+  g_clear_pointer (&self->channel_tasks, g_hash_table_unref);
+  self->channel_tasks = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref);
+
+  if (self->channels)
+    {
+      g_hash_table_iter_init (&hiter, self->channels);
+      while (g_hash_table_iter_next (&hiter, &key, &value))
+        {
+          GSshChannel *channel = key;
+          channel->connection = NULL;
+        }
+    }
+  g_clear_pointer (&self->channels, g_hash_table_unref);
+  /* This hash doesn't hold a ref */
+  self->channels = g_hash_table_new_full (NULL, NULL, NULL, NULL);
+
+  g_clear_error (&self->cached_error);
+  g_clear_object (&self->socket);
+  if (self->socket_source)
+    g_source_destroy (self->socket_source);
+  g_clear_pointer (&self->socket_source, g_source_unref);
+  g_clear_pointer (&self->authschemes, g_strfreev);
+  self->handshake_state = GSSH_CONNECTION_HANDSHAKE_STATE_STARTING;
+}
+
+static void
+state_transition (GSshConnection                *self,
+                 GSshConnectionState            new_state)
+{
+  if (new_state == self->state)
+    return;
+
+  g_debug ("STATE: %d => %d", self->state, new_state);
+
+  self->state = new_state;
+  g_object_notify ((GObject*)self, "state");
+
+  if (self->state == GSSH_CONNECTION_STATE_DISCONNECTED ||
+      self->state == GSSH_CONNECTION_STATE_ERROR)
+    reset_state (self);
+}
+
+static void
+state_transition_take_error (GSshConnection       *self,
+                             GError                 *error)
+{
+  g_debug ("caught error: %s", error->message);
+
+  if (self->connection_task)
+    {
+      g_task_return_error (self->connection_task, error);
+      g_clear_object (&self->connection_task);
+    }
+  else
+    {
+      GHashTableIter hiter;
+      gpointer hkey, hvalue;
+      gboolean had_active_channel_task = FALSE;
+
+      g_hash_table_iter_init (&hiter, self->channel_tasks);
+      while (g_hash_table_iter_next (&hiter, &hkey, &hvalue))
+        {
+          GTask *channeltask = hkey;
+          GError *error_copy = g_error_copy (error);
+
+          had_active_channel_task = TRUE;
+          g_task_return_error (channeltask, error_copy);
+        }
+
+      /* Keep it around for the next async call */
+      if (!had_active_channel_task)
+        self->cached_error = error;
+      else
+        g_error_free (error);
+    }
+  state_transition (self, GSSH_CONNECTION_STATE_ERROR);
+}
+
+static gboolean
+on_socket_ready (GSocket *socket,
+                GIOCondition condition,
+                gpointer user_data);
+
+static void
+recalculate_socket_state (GSshConnection   *self)
+{
+  int directions = libssh2_session_block_directions (self->session);
+  guint block_inbound = (directions & LIBSSH2_SESSION_BLOCK_INBOUND) ? 1 : 0;
+  guint block_outbound = (directions & LIBSSH2_SESSION_BLOCK_OUTBOUND) ? 1 : 0;
+  GIOCondition conditions = G_IO_HUP | G_IO_ERR;
+
+  if (block_inbound == self->select_inbound &&
+      block_outbound == self->select_outbound &&
+      self->socket_source != NULL)
+    return;
+
+  self->select_inbound = block_inbound;
+  if (self->select_inbound)
+    conditions |= G_IO_IN;
+  self->select_outbound = block_outbound;
+  if (self->select_outbound)
+    conditions |= G_IO_IN;
+  
+  if (self->socket_source)
+    { 
+      g_source_destroy (self->socket_source);
+      g_source_unref (self->socket_source);
+    }
+  g_printerr ("socket will select on inbound: %d outbound: %d\n",
+             self->select_inbound, self->select_outbound);
+  self->socket_source = g_socket_create_source (self->socket,
+                                               conditions,
+                                               self->cancellable);
+  g_source_set_callback (self->socket_source, (GSourceFunc)on_socket_ready, self, NULL);
+  g_source_attach (self->socket_source, NULL);
+}
+
+static void
+process_channel_reads (GSshConnection   *self)
+{
+  GHashTableIter hiter;
+  gpointer hkey, hvalue;
+
+  g_hash_table_iter_init (&hiter, self->channels);
+  while (g_hash_table_iter_next (&hiter, &hkey, &hvalue))
+    {
+      GSshChannel *channel = hkey;
+      _gssh_channel_input_stream_iteration (channel->input_stream);
+    }
+}
+
+static void
+process_channel_writes (GSshConnection   *self)
+{
+  GHashTableIter hiter;
+  gpointer hkey, hvalue;
+
+  g_hash_table_iter_init (&hiter, self->channels);
+  while (g_hash_table_iter_next (&hiter, &hkey, &hvalue))
+    {
+      GSshChannel *channel = hkey;
+      _gssh_channel_output_stream_iteration (channel->output_stream);
+    }
+}
+
+static void
+process_channels (GSshConnection   *self,
+                  GIOCondition        condition)
+{
+  GHashTableIter hiter;
+  gpointer hkey, hvalue;
+  int rc;
+  GError *local_error = NULL;
+
+  /* Channel I/O */
+  if ((condition & G_IO_IN) > 0)
+    process_channel_reads (self);
+  if ((condition & G_IO_OUT) > 0)
+    process_channel_writes (self);
+  
+  /* And new channel requests */
+  g_hash_table_iter_init (&hiter, self->open_channel_exec_tasks);
+  while (g_hash_table_iter_next (&hiter, &hkey, &hvalue))
+    {
+      GTask *task = hkey;
+      GSshConnectionChannelCreationData *data = g_task_get_task_data (task);
+
+      switch (data->state)
+        {
+        case GSSH_CONNECTION_CHANNEL_CREATION_STATE_OPEN_SESSION:
+          {
+            data->libssh2channel = libssh2_channel_open_session (self->session);
+            if (data->libssh2channel == NULL)
+              {
+                if (libssh2_session_last_error (self->session, NULL, NULL, 0) == LIBSSH2_ERROR_EAGAIN)
+                  break;
+                else
+                  {
+                    _gssh_set_error_from_libssh2 (&local_error, "Failed to open session: ", self->session);
+                    g_task_return_error (task, local_error);
+                    g_hash_table_iter_remove (&hiter);
+                    break;
+                  }
+              }
+            data->state = GSSH_CONNECTION_CHANNEL_CREATION_STATE_REQUEST_PTY;
+            /* Fall through */
+          }
+        case GSSH_CONNECTION_CHANNEL_CREATION_STATE_REQUEST_PTY:
+          {
+            rc = libssh2_channel_request_pty (data->libssh2channel, "xterm");
+            if (rc == LIBSSH2_ERROR_EAGAIN)
+              break;
+            else if (rc < 0)
+              {
+                _gssh_set_error_from_libssh2 (&local_error, "Failed to open session: ", self->session);
+                g_task_return_error (task, local_error);
+                g_hash_table_iter_remove (&hiter);
+                break;
+              }
+            else
+              {
+                g_assert (rc == 0);
+                data->state = GSSH_CONNECTION_CHANNEL_CREATION_STATE_EXEC;
+              }
+            /* Fall through */
+          } 
+        case GSSH_CONNECTION_CHANNEL_CREATION_STATE_EXEC:
+          {
+            if (data->exec_command == NULL)
+              rc = libssh2_channel_shell (data->libssh2channel);
+            else
+              rc = libssh2_channel_process_startup (data->libssh2channel,
+                                                    "exec", 4,
+                                                    data->exec_command,
+                                                    strlen (data->exec_command));
+            if (rc == LIBSSH2_ERROR_EAGAIN)
+              break;
+            else if (rc < 0)
+              {
+                _gssh_set_error_from_libssh2 (&local_error, "Failed to exec: ", self->session);
+                g_task_return_error (task, local_error);
+                g_hash_table_iter_remove (&hiter);
+                break;
+              }
+            else
+              {
+                GSshChannel *new_channel; 
+
+                g_assert (rc == 0);
+
+                new_channel = _gssh_channel_new (self, data->libssh2channel);
+                g_hash_table_insert (self->channels, new_channel, new_channel);
+
+                g_task_return_pointer (task, new_channel, g_object_unref);
+                g_hash_table_iter_remove (&hiter);
+                break;
+              }
+          }
+        }
+    }
+}
+
+static void
+gssh_connection_iteration (GSshConnection   *self,
+                             GIOCondition        condition)
+{
+  GError *local_error = NULL;
+  GError **error = &local_error;
+  int rc;
+
+ repeat:
+
+  switch (self->state)
+    {
+    case GSSH_CONNECTION_STATE_DISCONNECTED:
+      g_assert_not_reached ();
+      break;
+    case GSSH_CONNECTION_STATE_CONNECTING:
+      g_assert_not_reached ();
+      break;
+    case GSSH_CONNECTION_STATE_HANDSHAKING:
+      {
+       int socket_fd = g_socket_get_fd (self->socket);
+        switch (self->handshake_state)
+          {
+          case GSSH_CONNECTION_HANDSHAKE_STATE_STARTING:
+            {
+              g_debug ("handshake on socket fd=%d", socket_fd);
+              if ((rc = libssh2_session_handshake (self->session, socket_fd)) == LIBSSH2_ERROR_EAGAIN)
+                {
+                  recalculate_socket_state (self);
+                  return;
+                }
+              if (rc)
+                {
+                  _gssh_set_error_from_libssh2 (error, "Failed to handshake SSH2 session", self->session);
+                  state_transition_take_error (self, local_error);
+                  return;
+                }
+              self->handshake_state = GSSH_CONNECTION_HANDSHAKE_STATE_AUTHLIST;
+              goto repeat;
+            }
+          case GSSH_CONNECTION_HANDSHAKE_STATE_AUTHLIST:
+            {
+              const char *authschemes;
+
+              authschemes = libssh2_userauth_list (self->session,
+                                                   self->username,
+                                                   strlen (self->username));
+              if (authschemes == NULL)
+                {
+                  if (libssh2_userauth_authenticated (self->session))
+                    {
+                      /* Unusual according to the docs, but it's
+                       * possible for the remote server to be
+                       * configured without auth.
+                       */
+                      state_transition (self, GSSH_CONNECTION_STATE_CONNECTED);
+                      goto repeat;
+                    }
+                  else if (libssh2_session_last_error (self->session, NULL, NULL, 0) == LIBSSH2_ERROR_EAGAIN)
+                    {
+                      recalculate_socket_state (self);
+                      return;
+                    }
+                  else
+                    {
+                      _gssh_set_error_from_libssh2 (error, "Failed to list auth mechanisms", self->session);
+                      state_transition_take_error (self, local_error);
+                      return;
+                    }
+                }
+              self->authschemes = g_strsplit (authschemes, ",", 0);
+              state_transition (self, GSSH_CONNECTION_STATE_AUTHENTICATION_REQUIRED);
+              goto repeat;
+            }
+          }
+      }
+      break;
+    case GSSH_CONNECTION_STATE_AUTHENTICATION_REQUIRED:
+      {
+        /* User should have connected to notify:: state and
+         * watch for AUTHENTICATION_REQUIRED, then call
+         * gssh_connection_auth_password_async().
+         */
+        if (self->auth_task != NULL)
+          {
+            if (self->password)
+              {
+                rc = libssh2_userauth_password (self->session, self->username, self->password);
+                if (rc == LIBSSH2_ERROR_EAGAIN)
+                  {
+                    recalculate_socket_state (self);
+                  }
+                else if (rc == LIBSSH2_ERROR_AUTHENTICATION_FAILED)
+                  {
+                    g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
+                                         "Authentication failed");
+                    g_task_return_error (self->auth_task, local_error);
+                  }
+                else if (rc == LIBSSH2_ERROR_PASSWORD_EXPIRED)
+                  {
+                    g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
+                                         "Password expired");
+                    g_task_return_error (self->auth_task, local_error);
+                    g_clear_object (&self->auth_task);
+                  }
+                else if (rc)
+                  {
+                    _gssh_set_error_from_libssh2 (error, "Failed to password auth", self->session);
+                    g_task_return_error (self->auth_task, local_error);
+                    g_clear_object (&self->auth_task);
+                  }
+                else
+                  {
+                    g_task_return_boolean (self->auth_task, TRUE);
+                    g_clear_object (&self->auth_task);
+                    state_transition (self, GSSH_CONNECTION_STATE_CONNECTED);
+                    goto repeat;
+                  }
+              }
+            else
+              {
+                g_assert_not_reached ();
+              }
+          }
+        break;
+      }
+    case GSSH_CONNECTION_STATE_CONNECTED:
+      process_channels (self, condition);
+      break;
+    case GSSH_CONNECTION_STATE_ERROR:
+      break;
+    }
+}
+
+static void
+gssh_connection_iteration_default (GSshConnection   *self)
+{
+  /* This is a bit of a hack, but eh... we'll just get EAGAIN */
+  gssh_connection_iteration (self, G_IO_IN | G_IO_OUT);
+}
+
+static gboolean
+on_socket_ready (GSocket *socket,
+                GIOCondition condition,
+                gpointer user_data)
+{
+  GSshConnection *self = user_data;
+
+  if (condition & (G_IO_ERR | G_IO_HUP))
+    {
+      GError *local_error = NULL;
+      g_set_error_literal (&local_error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                          "I/O error");
+      state_transition_take_error (self, local_error);
+      return FALSE;
+    }
+
+  g_debug ("socket ready: state %d handshake_state: %d", self->state, self->handshake_state);
+
+  gssh_connection_iteration (self, condition);
+
+  return TRUE;
+}
+
+static void
+on_socket_client_connected (GObject         *src,
+                           GAsyncResult    *result,
+                           gpointer         user_data)
+{
+  GSshConnection *self = user_data;
+  GError *local_error = NULL;
+  GError **error = &local_error;
+
+  g_assert (src == (GObject*)self->socket_client);
+
+  g_clear_object (&self->socketconn);
+  self->socketconn = g_socket_client_connect_finish (self->socket_client, result, error);
+  if (!self->socketconn)
+    goto out;
+
+  self->socket = g_socket_connection_get_socket (self->socketconn);
+
+  self->session = libssh2_session_init ();
+  if (!self->session)
+    {
+      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                           "Failed to initialize SSH2 session");
+      goto out;
+    }
+
+  libssh2_session_set_blocking (self->session, 0);
+
+  state_transition (self, GSSH_CONNECTION_STATE_HANDSHAKING);
+
+  recalculate_socket_state (self);
+  gssh_connection_iteration_default (self);
+
+  return;
+out:
+  if (local_error)
+    state_transition_take_error (self, local_error);
+}
+
+GSshConnectionState
+gssh_connection_get_state (GSshConnection        *self)
+{
+  return self->state;
+}
+
+const char*const*
+gssh_connection_get_authentication_mechanisms (GSshConnection   *self)
+{
+  return (const char *const*)self->authschemes;
+}
+
+void
+gssh_connection_auth_password_async (GSshConnection    *self,
+                                       const char          *password,
+                                       GCancellable        *cancellable,
+                                       GAsyncReadyCallback  callback,
+                                       gpointer             user_data)
+{
+  g_return_if_fail (self->state == GSSH_CONNECTION_STATE_AUTHENTICATION_REQUIRED);
+  g_return_if_fail (self->auth_task == NULL);
+
+  if (self->password)
+    g_free (self->password);
+  self->password = g_strdup (password);
+
+  self->auth_task = g_task_new (self, cancellable, callback, user_data);
+  
+  gssh_connection_iteration_default (self);
+}
+
+gboolean
+gssh_connection_auth_password_finish (GSshConnection    *self,
+                                        GAsyncResult        *result,
+                                        GError             **error)
+{
+  g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
+  return g_task_propagate_boolean (G_TASK (result), error);
+}
+
+GSocketClient *
+gssh_connection_get_socket_client (GSshConnection *self)
+{
+  return self->socket_client;
+}
+
+void
+gssh_connection_reset (GSshConnection      *self)
+{
+  state_transition (self, GSSH_CONNECTION_STATE_DISCONNECTED);
+}
+
+void
+gssh_connection_handshake_async (GSshConnection    *self,
+                                   GCancellable        *cancellable,
+                                   GAsyncReadyCallback  callback,
+                                   gpointer             user_data)
+{
+  g_return_if_fail (self->state == GSSH_CONNECTION_STATE_DISCONNECTED);
+
+  state_transition (self, GSSH_CONNECTION_STATE_CONNECTING);
+
+  self->connection_task = g_task_new (self, cancellable, callback, user_data);
+
+  g_socket_client_connect_async (self->socket_client, self->address, cancellable,
+                                on_socket_client_connected, self);
+}
+
+gboolean
+gssh_connection_handshake_finish (GSshConnection    *self,
+                                    GAsyncResult        *result,
+                                    GError             **error)
+{
+  g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
+
+  return g_task_propagate_boolean (G_TASK (result), error);
+}
+
+static void
+channel_creation_data_free (gpointer datap)
+{
+  GSshConnectionChannelCreationData *data = datap;
+  g_free (data->exec_command);
+  g_free (data);
+}
+
+void
+gssh_connection_open_shell_async (GSshConnection         *self,
+                                    GCancellable             *cancellable,
+                                    GAsyncReadyCallback       callback,
+                                    gpointer                  user_data)
+{
+  GTask *task;
+  GSshConnectionChannelCreationData *data =
+    g_new0 (GSshConnectionChannelCreationData, 1);
+
+  /* Don't do anything to data, we have no exec command */
+
+  task = g_task_new (self, cancellable, callback, user_data);
+  g_task_set_task_data (task, data, channel_creation_data_free);
+  g_hash_table_add (self->open_channel_exec_tasks, task);
+
+  gssh_connection_iteration_default (self);
+}
+
+GSshChannel *
+gssh_connection_open_shell_finish (GSshConnection         *self,
+                                     GAsyncResult             *result,
+                                     GError                  **error)
+{
+  g_return_val_if_fail (g_task_is_valid (result, self), NULL);
+
+  return g_task_propagate_pointer (G_TASK (result), error);
+}
+
+static void
+gssh_connection_init (GSshConnection *self)
+{
+  self->socket_client = g_socket_client_new ();
+  reset_state (self);
+}
+
+static void
+gssh_connection_dispose (GObject *object)
+{
+  GSshConnection *self = GSSH_CONNECTION (object);
+
+  state_transition (self, GSSH_CONNECTION_STATE_DISCONNECTED);
+
+  G_OBJECT_CLASS (gssh_connection_parent_class)->dispose (object);
+}
+
+static void
+gssh_connection_get_property (GObject    *object,
+                                guint       prop_id,
+                                GValue     *value,
+                                GParamSpec *pspec)
+{
+  GSshConnection *self = GSSH_CONNECTION (object);
+
+  switch (prop_id)
+    {
+    case PROP_ADDRESS:
+      g_value_set_object (value, self->address);
+      break;
+
+    case PROP_USERNAME:
+      g_value_set_string (value, self->username);
+      break;
+
+    case PROP_STATE:
+      g_value_set_enum (value, self->state);
+      break;
+
+    case PROP_MAINCONTEXT:
+      g_value_set_boxed (value, self->maincontext);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gssh_connection_set_property (GObject    *object,
+                                guint       prop_id,
+                                const GValue     *value,
+                                GParamSpec *pspec)
+{
+  GSshConnection *self = GSSH_CONNECTION (object);
+
+  switch (prop_id)
+    {
+    case PROP_ADDRESS:
+      self->address = g_value_dup_object (value);
+      break;
+
+    case PROP_USERNAME:
+      self->username = g_value_dup_string (value);
+      break;
+
+    case PROP_STATE:
+      self->state = g_value_get_enum (value);
+      break;
+
+    case PROP_MAINCONTEXT:
+      self->maincontext = g_value_dup_boxed (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gssh_connection_class_init (GSshConnectionClass *class)
+{
+  G_OBJECT_CLASS (class)->dispose = gssh_connection_dispose;
+  G_OBJECT_CLASS (class)->get_property = gssh_connection_get_property;
+  G_OBJECT_CLASS (class)->set_property = gssh_connection_set_property;
+
+  g_object_class_install_property (G_OBJECT_CLASS (class), PROP_ADDRESS,
+                                  g_param_spec_object ("address", "", "",
+                                                        G_TYPE_SOCKET_CONNECTABLE,
+                                                        G_PARAM_CONSTRUCT_ONLY |
+                                                        G_PARAM_READWRITE |
+                                                        G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (class), PROP_USERNAME,
+                                  g_param_spec_string ("username", "", "",
+                                                        NULL,
+                                                        G_PARAM_CONSTRUCT_ONLY |
+                                                        G_PARAM_READWRITE |
+                                                        G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (class), PROP_STATE,
+                                  g_param_spec_enum ("state", "", "",
+                                                      GSSH_TYPE_CONNECTION_STATE,
+                                                      GSSH_CONNECTION_STATE_DISCONNECTED,
+                                                      G_PARAM_CONSTRUCT_ONLY |
+                                                      G_PARAM_READWRITE |
+                                                      G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (G_OBJECT_CLASS (class), PROP_MAINCONTEXT,
+                                  g_param_spec_boxed ("maincontext", "", "",
+                                                      G_TYPE_MAIN_CONTEXT,
+                                                      G_PARAM_CONSTRUCT_ONLY |
+                                                      G_PARAM_READWRITE |
+                                                      G_PARAM_STATIC_STRINGS));
+
+}
+
+GSshConnection *
+gssh_connection_new (GSocketConnectable   *address,
+                       const char           *username)
+{
+  return g_object_new (GSSH_TYPE_CONNECTION,
+                       "address", address,
+                       "username", username,
+                       "maincontext", g_main_context_get_thread_default (),
+                       NULL);
+}
diff --git a/libgssh/gssh-connection.h b/libgssh/gssh-connection.h
new file mode 100644
index 0000000..85540e1
--- /dev/null
+++ b/libgssh/gssh-connection.h
@@ -0,0 +1,81 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include "gssh-types.h"
+
+#define GSSH_TYPE_CONNECTION (gssh_connection_get_type ())
+#define GSSH_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSSH_TYPE_CONNECTION, GSshConnection))
+
+typedef struct _GSshConnection         GSshConnection;
+typedef struct _GSshConnectionClass    GSshConnectionClass;
+
+typedef enum /*< prefix=GSSH_CONNECTION_STATE >*/
+  {
+    GSSH_CONNECTION_STATE_DISCONNECTED,
+    GSSH_CONNECTION_STATE_CONNECTING,
+    GSSH_CONNECTION_STATE_HANDSHAKING,
+    GSSH_CONNECTION_STATE_AUTHENTICATION_REQUIRED,
+    GSSH_CONNECTION_STATE_CONNECTED,
+    GSSH_CONNECTION_STATE_ERROR
+  } GSshConnectionState;
+
+GType                   gssh_connection_get_type     (void);
+
+GSshConnection       *gssh_connection_new (GSocketConnectable  *address,
+                                               const char          *username);
+
+GSocketClient          *gssh_connection_get_socket_client (GSshConnection *self);
+
+GSshConnectionState   gssh_connection_get_state (GSshConnection        *self);
+
+void                    gssh_connection_reset (GSshConnection      *self);
+
+void                    gssh_connection_handshake_async (GSshConnection    *self,
+                                                           GCancellable        *cancellable,
+                                                           GAsyncReadyCallback  callback,
+                                                           gpointer             user_data);
+
+gboolean                gssh_connection_handshake_finish (GSshConnection    *self,
+                                                            GAsyncResult        *result,
+                                                            GError             **error);
+
+const char*const*       gssh_connection_get_authentication_mechanisms (GSshConnection   *self);
+
+void                    gssh_connection_auth_password_async (GSshConnection    *self,
+                                                               const char          *password,
+                                                               GCancellable        *cancellable,
+                                                               GAsyncReadyCallback  callback,
+                                                               gpointer             user_data);
+
+gboolean                gssh_connection_auth_password_finish (GSshConnection    *self,
+                                                                GAsyncResult        *result,
+                                                                GError             **error);
+
+void                    gssh_connection_open_shell_async (GSshConnection         *self,
+                                                            GCancellable             *cancellable,
+                                                            GAsyncReadyCallback       callback,
+                                                            gpointer                  user_data);
+
+GSshChannel *         gssh_connection_open_shell_finish (GSshConnection         *self,
+                                                             GAsyncResult             *result,
+                                                             GError                  **error);
+
diff --git a/libgssh/gssh-enum-types.c.template b/libgssh/gssh-enum-types.c.template
new file mode 100644
index 0000000..0a7f83b
--- /dev/null
+++ b/libgssh/gssh-enum-types.c.template
@@ -0,0 +1,38 @@
+/*** BEGIN file-header ***/
+#include "config.h"
+#include "gssh-enum-types.h"
+#include "gssh.h"
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+ enum_name@_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+
+  if (g_once_init_enter (&g_define_type_id__volatile))
+    {
+      static const G Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+        { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+        { 0, NULL, NULL }
+      };
+      GType g_define_type_id =
+        g_ type@_register_static (g_intern_static_string ("@EnumName@"), values);
+      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+    }
+
+  return g_define_type_id__volatile;
+}
+
+/*** END value-tail ***/
diff --git a/libgssh/gssh-enum-types.h.template b/libgssh/gssh-enum-types.h.template
new file mode 100644
index 0000000..a9f7d8c
--- /dev/null
+++ b/libgssh/gssh-enum-types.h.template
@@ -0,0 +1,22 @@
+/*** BEGIN file-header ***/
+#pragma once
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GLIB_AVAILABLE_IN_ALL GType @enum_name _get_type (void) G_GNUC_CONST;
+#define @ENUMPREFIX _TYPE_@ENUMSHORT@ (@enum_name _get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+/*** END file-tail ***/
diff --git a/libgssh/gssh-types.h b/libgssh/gssh-types.h
new file mode 100644
index 0000000..e2af90e
--- /dev/null
+++ b/libgssh/gssh-types.h
@@ -0,0 +1,26 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <gio/gio.h>
+
+typedef struct _GSshConnection         GSshConnection;
+typedef struct _GSshChannel            GSshChannel;
diff --git a/libgssh/gssh.h b/libgssh/gssh.h
new file mode 100644
index 0000000..9ac1cb0
--- /dev/null
+++ b/libgssh/gssh.h
@@ -0,0 +1,24 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include "gssh-connection.h"
+#include "gssh-channel.h"
diff --git a/libgsystem b/libgsystem
new file mode 160000
index 0000000..4d74152
--- /dev/null
+++ b/libgsystem
@@ -0,0 +1 @@
+Subproject commit 4d7415264738f03e4e72600b24883adc93d7307a
diff --git a/src/app-menu.ui b/src/app-menu.ui
new file mode 100644
index 0000000..b0eddb6
--- /dev/null
+++ b/src/app-menu.ui
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <menu id="appmenu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Preferences</attribute>
+        <attribute name="action">app.preferences</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Quit</attribute>
+        <attribute name="action">app.quit</attribute>
+        <attribute name="accel"><![CDATA[<Ctrl>Q]]></attribute>
+      </item>
+    </section>
+  </menu>
+</interface>
diff --git a/src/gears-menu.ui b/src/gears-menu.ui
new file mode 100644
index 0000000..fb0e929
--- /dev/null
+++ b/src/gears-menu.ui
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <menu id="menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Words</attribute>
+        <attribute name="action">win.show-words</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Lines</attribute>
+        <attribute name="action">win.show-lines</attribute>
+      </item>
+    </section>
+  </menu>
+</interface>
diff --git a/src/hotssh-app.c b/src/hotssh-app.c
new file mode 100644
index 0000000..2fd3a99
--- /dev/null
+++ b/src/hotssh-app.c
@@ -0,0 +1,171 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "hotssh-app.h"
+#include "hotssh-win.h"
+#include "hotssh-prefs.h"
+
+#include "libgsystem.h"
+
+#include <libssh2.h>
+
+struct _HotSshApp
+{
+  GtkApplication parent;
+};
+
+struct _HotSshAppClass
+{
+  GtkApplicationClass parent_class;
+};
+
+G_DEFINE_TYPE(HotSshApp, hotssh_app, GTK_TYPE_APPLICATION);
+
+static void
+hotssh_app_init (HotSshApp *app)
+{
+}
+
+static void
+preferences_activated (GSimpleAction *action,
+                       GVariant      *parameter,
+                       gpointer       app)
+{
+  HotSshPrefs *prefs;
+  GtkWindow *win;
+
+  win = gtk_application_get_active_window (GTK_APPLICATION (app));
+  prefs = hotssh_prefs_new (HOTSSH_WINDOW (win));
+  gtk_window_present (GTK_WINDOW (prefs));
+}
+
+static void
+quit_activated (GSimpleAction *action,
+                GVariant      *parameter,
+                gpointer       app)
+{
+  g_application_quit (G_APPLICATION (app));
+}
+
+static GActionEntry app_entries[] =
+{
+  { "preferences", preferences_activated, NULL, NULL, NULL },
+  { "quit", quit_activated, NULL, NULL, NULL }
+};
+
+static void
+hotssh_app_startup (GApplication *app)
+{
+  GtkBuilder *builder;
+  GMenuModel *app_menu;
+  int rc;
+
+  G_APPLICATION_CLASS (hotssh_app_parent_class)->startup (app);
+
+  rc = libssh2_init (0);
+  g_assert (rc == 0);
+
+  g_action_map_add_action_entries (G_ACTION_MAP (app),
+                                   app_entries, G_N_ELEMENTS (app_entries),
+                                   app);
+
+  builder = gtk_builder_new_from_resource ("/org/gnome/hotssh/app-menu.ui");
+  app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
+  gtk_application_set_app_menu (GTK_APPLICATION (app), app_menu);
+  g_object_unref (builder);
+}
+
+static void
+hotssh_app_activate (GApplication *app)
+{
+  HotSshWindow *win;
+
+  win = hotssh_window_new (HOTSSH_APP (app));
+  gtk_window_present (GTK_WINDOW (win));
+}
+
+static int
+hotssh_app_command_line (GApplication              *app,
+                        GApplicationCommandLine   *cmdline)
+{
+  HotSshWindow *win;
+  gchar **args = NULL;
+  gs_free gchar **argv = NULL;
+  gint i;
+  GError *error = NULL;
+  gint argc;
+  char *host = NULL;
+  char *username = NULL;
+  gboolean help = FALSE;
+  GOptionContext *context;
+  GOptionEntry entries[] = {
+    { "host", 'h', 0, G_OPTION_ARG_STRING, &host, NULL, NULL },
+    { "username", 'u', 0, G_OPTION_ARG_STRING, &username, NULL, NULL },
+    { "help", '?', 0, G_OPTION_ARG_NONE, &help, NULL, NULL },
+    { NULL } 
+  };
+
+  args = g_application_command_line_get_arguments (cmdline, &argc);
+  argv = g_new (gchar*, argc + 1);
+  for (i = 0; i <= argc; i++)
+    argv[i] = args[i];
+  
+  context = g_option_context_new (NULL);
+  g_option_context_set_help_enabled (context, FALSE);
+  g_option_context_add_main_entries (context, entries, NULL);
+  
+  if (!g_option_context_parse (context, &argc, &argv, &error))
+    {
+      g_application_command_line_printerr (cmdline, "%s\n", error->message);
+      g_error_free (error);
+      g_application_command_line_set_exit_status (cmdline, 1);
+    }
+  else if (help)
+    {
+      gs_free gchar *text = g_option_context_get_help (context, FALSE, NULL);
+      g_application_command_line_print (cmdline, "%s",  text);
+    }
+
+  g_strfreev (args);
+  g_option_context_free (context);
+      
+  win = hotssh_window_new (HOTSSH_APP (app));
+  hotssh_window_prefill (win, host, username);
+  gtk_window_present (GTK_WINDOW (win));
+
+  return 0;
+}
+
+static void
+hotssh_app_class_init (HotSshAppClass *class)
+{
+  G_APPLICATION_CLASS (class)->startup = hotssh_app_startup;
+  G_APPLICATION_CLASS (class)->activate = hotssh_app_activate;
+  G_APPLICATION_CLASS (class)->command_line = hotssh_app_command_line;
+}
+
+HotSshApp *
+hotssh_app_new (void)
+{
+  return g_object_new (HOTSSH_TYPE_APP,
+                       "application-id", "org.gnome.hotssh",
+                       "flags", G_APPLICATION_HANDLES_COMMAND_LINE,
+                       NULL);
+}
diff --git a/src/hotssh-app.h b/src/hotssh-app.h
new file mode 100644
index 0000000..a880fa9
--- /dev/null
+++ b/src/hotssh-app.h
@@ -0,0 +1,33 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <gtk/gtk.h>
+
+#define HOTSSH_TYPE_APP (hotssh_app_get_type ())
+#define HOTSSH_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), HOTSSH_TYPE_APP, HotSshApp))
+
+
+typedef struct _HotSshApp       HotSshApp;
+typedef struct _HotSshAppClass  HotSshAppClass;
+
+GType           hotssh_app_get_type    (void);
+HotSshApp     *hotssh_app_new         (void);
diff --git a/src/hotssh-prefs.c b/src/hotssh-prefs.c
new file mode 100644
index 0000000..8c1226f
--- /dev/null
+++ b/src/hotssh-prefs.c
@@ -0,0 +1,99 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+#include "hotssh-app.h"
+#include "hotssh-win.h"
+#include "hotssh-prefs.h"
+
+struct _HotSshPrefs
+{
+  GtkDialog parent;
+};
+
+struct _HotSshPrefsClass
+{
+  GtkDialogClass parent_class;
+};
+
+typedef struct _HotSshPrefsPrivate HotSshPrefsPrivate;
+
+struct _HotSshPrefsPrivate
+{
+  GSettings *settings;
+  GtkWidget *font;
+  GtkWidget *transition;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(HotSshPrefs, hotssh_prefs, GTK_TYPE_DIALOG)
+
+static void
+preferences_closed (GtkWidget *button)
+{
+  gtk_widget_destroy (gtk_widget_get_toplevel (button));
+}
+
+static void
+hotssh_prefs_init (HotSshPrefs *prefs)
+{
+  HotSshPrefsPrivate *priv;
+
+  priv = hotssh_prefs_get_instance_private (prefs);
+  gtk_widget_init_template (GTK_WIDGET (prefs));
+  priv->settings = g_settings_new ("org.gnome.hotssh");
+
+  g_settings_bind (priv->settings, "font",
+                   priv->font, "font",
+                   G_SETTINGS_BIND_DEFAULT);
+  g_settings_bind (priv->settings, "transition",
+                   priv->transition, "active-id",
+                   G_SETTINGS_BIND_DEFAULT);
+}
+
+static void
+hotssh_prefs_dispose (GObject *object)
+{
+  HotSshPrefsPrivate *priv;
+
+  priv = hotssh_prefs_get_instance_private (HOTSSH_PREFS (object));
+  g_clear_object (&priv->settings);
+
+  G_OBJECT_CLASS (hotssh_prefs_parent_class)->dispose (object);
+}
+
+static void
+hotssh_prefs_class_init (HotSshPrefsClass *class)
+{
+  G_OBJECT_CLASS (class)->dispose = hotssh_prefs_dispose;
+
+  gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
+                                               "/org/gnome/hotssh/prefs.ui");
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshPrefs, font);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshPrefs, transition);
+
+  gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), preferences_closed);
+}
+
+HotSshPrefs *
+hotssh_prefs_new (HotSshWindow *win)
+{
+  return g_object_new (HOTSSH_TYPE_PREFS, "transient-for", win, NULL);
+}
diff --git a/src/hotssh-prefs.h b/src/hotssh-prefs.h
new file mode 100644
index 0000000..a46cc80
--- /dev/null
+++ b/src/hotssh-prefs.h
@@ -0,0 +1,33 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include "hotssh-win.h"
+
+#define HOTSSH_TYPE_PREFS (hotssh_prefs_get_type ())
+#define HOTSSH_PREFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), HOTSSH_TYPE_PREFS, HotSshPrefs))
+
+
+typedef struct _HotSshPrefs          HotSshPrefs;
+typedef struct _HotSshPrefsClass     HotSshPrefsClass;
+
+GType                   hotssh_prefs_get_type     (void);
+HotSshPrefs        *hotssh_prefs_new          (HotSshWindow *win);
diff --git a/src/hotssh-win.c b/src/hotssh-win.c
new file mode 100644
index 0000000..7f1c338
--- /dev/null
+++ b/src/hotssh-win.c
@@ -0,0 +1,500 @@
+#include "hotssh-app.h"
+#include "hotssh-win.h"
+#include "gssh-connection.h"
+
+#include "libgsystem.h"
+
+#include <libssh2.h>
+#include <vte/vte.h>
+#include <stdio.h>
+
+struct _HotSshWindow
+{
+  GtkApplicationWindow parent;
+};
+
+struct _HotSshWindowClass
+{
+  GtkApplicationWindowClass parent_class;
+};
+
+typedef struct _HotSshWindowPrivate HotSshWindowPrivate;
+
+typedef enum {
+  HOTSSH_WINDOW_PAGE_NEW_CONNECTION,
+  HOTSSH_WINDOW_PAGE_INTERSTITAL,
+  HOTSSH_WINDOW_PAGE_TERMINAL
+} HotSshWindowPage;
+
+struct _HotSshWindowPrivate
+{
+  GtkWidget *terminal;
+  GSettings *settings;
+
+  /* Bound via template */
+  GtkWidget *toplevel_notebook;
+  GtkWidget *host_entry;
+  GtkWidget *username_entry;
+  GtkWidget *connect_button;
+  GtkWidget *connection_text_container;
+  GtkWidget *connection_text;
+  GtkWidget *password_container;
+  GtkWidget *password_entry;
+  GtkWidget *password_submit;
+  GtkWidget *connect_cancel_button;
+  GtkWidget *disconnect_button;
+  GtkWidget *terminal_box;
+
+  /* State */
+  HotSshWindowPage active_page;
+
+  GSocketConnectable *address;
+  GSshConnection *connection;
+  GSshChannel *channel;
+
+  gboolean have_outstanding_write;
+  gboolean have_outstanding_auth;
+  GQueue write_queue;
+
+  GCancellable *cancellable;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(HotSshWindow, hotssh_window, GTK_TYPE_APPLICATION_WINDOW);
+
+static void
+set_status (HotSshWindow     *self,
+           const char       *text)
+{
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+  gtk_label_set_text ((GtkLabel*)priv->connection_text, text);
+}
+
+static void
+reset_focus_state (HotSshWindow   *self)
+{
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+  if (gtk_entry_get_text ((GtkEntry*)priv->host_entry)[0] == '\0')
+    gtk_widget_grab_focus (priv->host_entry);
+  else
+    gtk_widget_grab_focus (priv->username_entry);
+}
+
+static void
+state_reset_for_new_connection (HotSshWindow                *self)
+{
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+  g_debug ("reset state");
+  g_clear_object (&priv->address);
+  g_clear_object (&priv->connection);
+  g_clear_object (&priv->cancellable);
+  vte_terminal_reset ((VteTerminal*)priv->terminal, TRUE, TRUE);
+  gtk_entry_set_text ((GtkEntry*)priv->password_entry, "");
+  reset_focus_state (self);
+  gtk_widget_hide (priv->password_container);
+  gtk_widget_show (priv->connection_text_container);
+  gtk_widget_set_sensitive (priv->password_container, TRUE);
+  g_debug ("reset state done");
+}
+
+static void
+page_transition (HotSshWindow        *self,
+                HotSshWindowPage     new_page)
+{
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+
+  if (new_page == priv->active_page)
+    return;
+
+  g_debug ("PAGE: %d => %d", priv->active_page, new_page);
+  g_assert (new_page >= HOTSSH_WINDOW_PAGE_NEW_CONNECTION &&
+           new_page <= HOTSSH_WINDOW_PAGE_TERMINAL);
+  priv->active_page = new_page;
+
+  if (priv->active_page == HOTSSH_WINDOW_PAGE_NEW_CONNECTION)
+    state_reset_for_new_connection (self);
+
+  gtk_notebook_set_current_page ((GtkNotebook*)priv->toplevel_notebook, (guint)new_page);
+  
+  if (priv->active_page == HOTSSH_WINDOW_PAGE_TERMINAL)
+    gtk_widget_grab_focus ((GtkWidget*)priv->terminal);
+}
+
+static void
+page_transition_take_error (HotSshWindow               *self,
+                           GError                     *error)
+{
+  set_status (self, error->message);
+  g_error_free (error);
+}
+
+static void
+on_istream_read_complete (GObject           *src,
+                         GAsyncResult      *res,
+                         gpointer           user_data)
+{
+  HotSshWindow *self = user_data;
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+  GBytes *result = NULL;
+  GError *local_error = NULL;
+  const guint8 *buf;
+  gsize len;
+
+  result = g_input_stream_read_bytes_finish ((GInputStream*)src, res, &local_error);
+  if (!result)
+    goto out;
+
+  buf = g_bytes_get_data (result, &len);
+  g_debug ("read %u bytes", (guint)len);
+  
+  vte_terminal_feed ((VteTerminal*)priv->terminal, (char*)buf, len);
+
+  g_input_stream_read_bytes_async ((GInputStream*)src, 8192, G_PRIORITY_DEFAULT,
+                                  priv->cancellable, on_istream_read_complete, self);
+
+ out:
+  if (local_error)
+    page_transition_take_error (self, local_error);
+}
+
+static void
+on_open_shell_complete (GObject           *src,
+                       GAsyncResult      *res,
+                       gpointer           user_data)
+{
+  HotSshWindow *self = user_data;
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+  GError *local_error = NULL;
+  GInputStream *istream;
+
+  g_debug ("open shell complete");
+
+  priv->channel = gssh_connection_open_shell_finish ((GSshConnection*)src,
+                                                      res, &local_error);
+  if (!priv->channel)
+    goto out;
+
+  page_transition (self, HOTSSH_WINDOW_PAGE_TERMINAL);
+
+  istream = g_io_stream_get_input_stream ((GIOStream*)priv->channel);
+
+  g_input_stream_read_bytes_async (istream, 8192, G_PRIORITY_DEFAULT,
+                                  priv->cancellable, on_istream_read_complete, self);
+  
+ out:
+  if (local_error)
+    page_transition_take_error (self, local_error);
+}
+
+static void
+on_connection_state_notify (GSshConnection   *conn,
+                           GParamSpec         *pspec,
+                           gpointer            user_data)
+{
+  HotSshWindow *self = HOTSSH_WINDOW (user_data);
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+  GSshConnectionState new_state = gssh_connection_get_state (conn);
+
+  g_debug ("connection state: %u", new_state);
+
+  switch (new_state)
+    {
+    case GSSH_CONNECTION_STATE_DISCONNECTED:
+      page_transition (self, HOTSSH_WINDOW_PAGE_NEW_CONNECTION);
+      break;
+    case GSSH_CONNECTION_STATE_CONNECTING:
+    case GSSH_CONNECTION_STATE_HANDSHAKING:
+    case GSSH_CONNECTION_STATE_AUTHENTICATION_REQUIRED:
+    case GSSH_CONNECTION_STATE_ERROR:
+      page_transition (self, HOTSSH_WINDOW_PAGE_INTERSTITAL);
+      break;
+    case GSSH_CONNECTION_STATE_CONNECTED:
+      gssh_connection_open_shell_async (priv->connection, priv->cancellable,
+                                         on_open_shell_complete, self);
+      break;
+    }
+}
+
+static void
+on_password_auth_complete (GObject                *src,
+                          GAsyncResult           *res,
+                          gpointer                user_data)
+{
+  HotSshWindow *self = HOTSSH_WINDOW (user_data);
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+  GError *local_error = NULL;
+
+  priv->have_outstanding_auth = FALSE;
+
+  if (!gssh_connection_auth_password_finish ((GSshConnection*)src, res, &local_error))
+    goto out;
+
+  g_debug ("password auth complete");
+
+ out:
+  if (local_error)
+    page_transition_take_error (self, local_error);
+}
+
+static void
+iterate_authentication_modes (HotSshWindow          *self)
+{
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+  const char *const *authschemes =
+    gssh_connection_get_authentication_mechanisms (priv->connection);
+  const char *const*iter;
+  GError *local_error = NULL;
+
+  if (priv->have_outstanding_auth)
+    return;
+
+  for (iter = authschemes; iter && *iter; iter++)
+    {
+      const char *authscheme = *iter;
+      if (strcmp (authscheme, "password") == 0)
+       {
+         const char *password = gtk_entry_get_text ((GtkEntry*)priv->password_entry);
+         if (password && password[0])
+           {
+             gssh_connection_auth_password_async (priv->connection, password,
+                                                    priv->cancellable,
+                                                    on_password_auth_complete, self);
+             priv->have_outstanding_auth = TRUE;
+             break;
+           }
+       }
+    }
+
+  g_set_error (&local_error, G_IO_ERROR, G_IO_ERROR_FAILED,
+              "No more authentication mechanisms available");
+  page_transition_take_error (self, local_error);
+}
+
+static void
+on_connection_handshake (GObject         *object,
+                        GAsyncResult    *result,
+                        gpointer         user_data)
+{
+  HotSshWindow *self = HOTSSH_WINDOW (user_data);
+  GError *local_error = NULL;
+  GError **error = &local_error;
+
+  if (!gssh_connection_handshake_finish ((GSshConnection*)object, result, error))
+    goto out;
+
+  iterate_authentication_modes (self);
+
+ out:
+  if (local_error)
+    page_transition_take_error (self, local_error);
+}
+
+static void
+on_connect (GtkButton     *button,
+           HotSshWindow  *self)
+{
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+  GError *local_error = NULL;
+  GError **error = &local_error;
+  const char *hostname;
+  const char *username;
+
+  page_transition (self, HOTSSH_WINDOW_PAGE_INTERSTITAL);
+  gtk_notebook_set_current_page ((GtkNotebook*)priv->toplevel_notebook, 1);
+
+  hostname = gtk_entry_get_text (GTK_ENTRY (priv->host_entry));
+  username = gtk_entry_get_text (GTK_ENTRY (priv->username_entry));
+
+  g_clear_object (&priv->cancellable);
+  priv->cancellable = g_cancellable_new ();
+
+  g_clear_object (&priv->address);
+  priv->address = g_network_address_parse (hostname, 22, error);
+  if (!priv->address)
+    {
+      page_transition_take_error (self, local_error);
+      return;
+    }
+
+  g_clear_object (&priv->connection);
+  priv->connection = gssh_connection_new (priv->address, username); 
+  g_signal_connect_object (priv->connection, "notify::state",
+                          G_CALLBACK (on_connection_state_notify),
+                          self, 0);
+  gssh_connection_handshake_async (priv->connection, priv->cancellable,
+                                    on_connection_handshake, self);
+}
+
+static void
+on_disconnect (GtkButton     *button,
+              HotSshWindow  *self)
+{
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+  page_transition (self, HOTSSH_WINDOW_PAGE_NEW_CONNECTION);
+  gtk_notebook_set_current_page ((GtkNotebook*)priv->toplevel_notebook, 0);
+}
+
+static void
+process_write_queue (HotSshWindow        *self);
+
+static void
+on_ostream_write_complete (GObject           *src,
+                          GAsyncResult      *res,
+                          gpointer           user_data)
+{
+  HotSshWindow *self = user_data;
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+  gssize result;
+  GError *local_error = NULL;
+  GBytes *buf;
+  gsize bufsize;
+
+  priv->have_outstanding_write = FALSE;
+
+  result = g_output_stream_write_bytes_finish ((GOutputStream*)src, res, &local_error);
+  if (result < 0)
+    goto out;
+
+  buf = g_queue_pop_head (&priv->write_queue);
+  g_assert (buf != NULL);
+  bufsize = g_bytes_get_size (buf);
+  
+  if (result == bufsize)
+    ;
+  else 
+    {
+      GBytes *subbuf;
+      g_assert (result < bufsize);
+      subbuf = g_bytes_new_from_bytes (buf, result, bufsize - result);
+      g_queue_push_head (&priv->write_queue, subbuf);
+    }
+  
+  process_write_queue (self);
+
+ out:
+  if (local_error)
+    page_transition_take_error (self, local_error);
+}
+
+static void
+process_write_queue (HotSshWindow        *self)
+{
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+  if (!priv->have_outstanding_write && priv->write_queue.length > 0)
+    {
+      GOutputStream *ostream = g_io_stream_get_output_stream ((GIOStream*)priv->channel);
+      GBytes *buf = g_queue_peek_head (&priv->write_queue);
+
+      g_output_stream_write_bytes_async (ostream, buf, G_PRIORITY_DEFAULT,
+                                        priv->cancellable, on_ostream_write_complete, self);
+      priv->have_outstanding_write = TRUE;
+    }
+}
+
+static void
+on_terminal_commit (VteTerminal *vteterminal,
+                   gchar       *text,
+                   guint        size,
+                   gpointer     user_data) 
+{
+  HotSshWindow *self = user_data;
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+
+  g_queue_push_tail (&priv->write_queue, g_bytes_new (text, size));
+  process_write_queue (self);
+}
+
+static void
+submit_password (HotSshWindow *self)
+{
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+
+  g_debug ("password submit");
+  
+  gtk_widget_set_sensitive (priv->password_container, FALSE);
+
+  iterate_authentication_modes (self);
+}
+
+static void
+on_connect_cancel (GtkButton     *button,
+                  gpointer       user_data)
+{
+  HotSshWindow *self = user_data;
+  page_transition (self, HOTSSH_WINDOW_PAGE_NEW_CONNECTION);
+}
+
+static void
+hotssh_window_init (HotSshWindow *self)
+{
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+
+  gtk_widget_init_template (GTK_WIDGET (self));
+  priv->settings = g_settings_new ("org.gnome.hotssh");
+
+  g_signal_connect (priv->connect_button, "clicked", G_CALLBACK (on_connect), self);
+  g_signal_connect (priv->connect_cancel_button, "clicked", G_CALLBACK (on_connect_cancel), self);
+  g_signal_connect (priv->disconnect_button, "clicked", G_CALLBACK (on_disconnect), self);
+  g_signal_connect_swapped (priv->password_entry, "activate", G_CALLBACK (submit_password), self);
+  g_signal_connect_swapped (priv->password_submit, "clicked", G_CALLBACK (submit_password), self);
+
+  priv->terminal = vte_terminal_new ();
+  g_signal_connect ((GObject*)priv->terminal, "commit", G_CALLBACK (on_terminal_commit), self);
+  gtk_box_pack_start ((GtkBox*)priv->terminal_box, (GtkWidget*)priv->terminal, TRUE, TRUE, 0);
+  gtk_widget_show_all (priv->terminal_box);
+
+  g_queue_init (&priv->write_queue);
+}
+
+static void
+hotssh_window_dispose (GObject *object)
+{
+  HotSshWindow *self = HOTSSH_WINDOW (object);
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+
+  page_transition (self, HOTSSH_WINDOW_PAGE_NEW_CONNECTION);
+
+  g_clear_object (&priv->settings);
+
+  G_OBJECT_CLASS (hotssh_window_parent_class)->dispose (object);
+}
+
+static void
+hotssh_window_class_init (HotSshWindowClass *class)
+{
+  G_OBJECT_CLASS (class)->dispose = hotssh_window_dispose;
+
+  gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
+                                               "/org/gnome/hotssh/window.ui");
+
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshWindow, toplevel_notebook);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshWindow, host_entry);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshWindow, username_entry);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshWindow, connect_button);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshWindow, 
connection_text_container);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshWindow, connection_text);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshWindow, password_container);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshWindow, password_entry);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshWindow, password_submit);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshWindow, 
connect_cancel_button);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshWindow, disconnect_button);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), HotSshWindow, terminal_box);
+}
+
+HotSshWindow *
+hotssh_window_new (HotSshApp *app)
+{
+  return g_object_new (HOTSSH_TYPE_WINDOW, "application", app, NULL);
+}
+
+void
+hotssh_window_prefill (HotSshWindow  *self,
+                      const char  *host,
+                      const char  *username)
+{
+  HotSshWindowPrivate *priv = hotssh_window_get_instance_private (self);
+  if (host)
+    gtk_entry_set_text ((GtkEntry*)priv->host_entry, host);
+  if (username)
+    gtk_entry_set_text ((GtkEntry*)priv->username_entry, username);
+  reset_focus_state (self);
+}
diff --git a/src/hotssh-win.h b/src/hotssh-win.h
new file mode 100644
index 0000000..8e059ad
--- /dev/null
+++ b/src/hotssh-win.h
@@ -0,0 +1,37 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include "hotssh-app.h"
+
+#define HOTSSH_TYPE_WINDOW (hotssh_window_get_type ())
+#define HOTSSH_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), HOTSSH_TYPE_WINDOW, HotSshWindow))
+
+typedef struct _HotSshWindow         HotSshWindow;
+typedef struct _HotSshWindowClass    HotSshWindowClass;
+
+
+GType                   hotssh_window_get_type     (void);
+HotSshWindow       *hotssh_window_new          (HotSshApp *app);
+void hotssh_window_prefill (HotSshWindow  *win,
+                           const char  *host,
+                           const char  *username);
+
diff --git a/src/hotssh.gresource.xml b/src/hotssh.gresource.xml
new file mode 100644
index 0000000..0e6b2fc
--- /dev/null
+++ b/src/hotssh.gresource.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/hotssh">
+    <file preprocess="xml-stripblanks">window.ui</file>
+    <file preprocess="xml-stripblanks">app-menu.ui</file>
+    <file preprocess="xml-stripblanks">gears-menu.ui</file>
+    <file preprocess="xml-stripblanks">prefs.ui</file>
+  </gresource>
+</gresources>
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..62cfce6
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,28 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+#include <hotssh-app.h>
+
+int
+main (int argc, char *argv[])
+{
+  return g_application_run (G_APPLICATION (hotssh_app_new ()), argc, argv);
+}
diff --git a/src/org.gnome.hotssh.gschema.xml b/src/org.gnome.hotssh.gschema.xml
new file mode 100644
index 0000000..4ede234
--- /dev/null
+++ b/src/org.gnome.hotssh.gschema.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schemalist>
+  <schema path="/org/gnome/hotssh/" id="org.gnome.hotssh">
+    <key name="font" type="s">
+      <default>'Monospace 12'</default>
+      <summary>Font</summary>
+      <description>The font to be used for content.</description>
+    </key>
+    <key name="transition" type="s">
+      <choices>
+        <choice value='none'/>
+        <choice value='crossfade'/>
+        <choice value='slide-left-right'/>
+      </choices>
+      <default>'none'</default>
+      <summary>Transition</summary>
+      <description>The transition to use when switching tabs.</description>
+    </key>
+    <key name="show-words" type="b">
+      <default>false</default>
+      <summary>Show words</summary>
+      <description>Whether to show a word list in the sidebar</description>
+    </key>
+  </schema>
+</schemalist>
diff --git a/src/prefs.ui b/src/prefs.ui
new file mode 100644
index 0000000..fe70059
--- /dev/null
+++ b/src/prefs.ui
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.8 -->
+  <template class="HotSshPrefs" parent="GtkDialog">
+    <property name="title" translatable="yes">Preferences</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="vbox">
+        <child>
+          <object class="GtkGrid" id="grid">
+            <property name="visible">True</property>
+            <property name="margin">6</property>
+            <property name="row-spacing">12</property>
+            <property name="column-spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="fontlabel">
+                <property name="visible">True</property>
+                <property name="label">_Font:</property>
+                <property name="use-underline">True</property>
+                <property name="mnemonic-widget">font</property>
+                <property name="xalign">1</property>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkFontButton" id="font">
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="left-attach">1</property>
+                <property name="top-attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="transitionlabel">
+                <property name="visible">True</property>
+                <property name="label">_Transition:</property>
+                <property name="use-underline">True</property>
+                <property name="mnemonic-widget">transition</property>
+                <property name="xalign">1</property>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBoxText" id="transition">
+                <property name="visible">True</property>
+                <items>
+                  <item translatable="yes" id="none">None</item>
+                  <item translatable="yes" id="crossfade">Fade</item>
+                  <item translatable="yes" id="slide-left-right">Slide</item>
+                </items>
+              </object>
+              <packing>
+                <property name="left-attach">1</property>
+                <property name="top-attach">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="action_area">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkButton" id="close">
+                <signal name="clicked" handler="preferences_closed"/>
+                <property name="visible">True</property>
+                <property name="label">_Close</property>
+                <property name="use-underline">True</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/window.ui b/src/window.ui
new file mode 100644
index 0000000..2567569
--- /dev/null
+++ b/src/window.ui
@@ -0,0 +1,323 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.15.4 on Thu Sep 19 13:48:41 2013 -->
+<interface>
+  <!-- interface-requires gtk+ 3.10 -->
+  <template class="HotSshWindow" parent="GtkApplicationWindow">
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">HotSSH</property>
+    <property name="default_width">600</property>
+    <property name="default_height">400</property>
+    <child>
+      <object class="GtkNotebook" id="toplevel_notebook">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="show_tabs">False</property>
+        <child>
+          <object class="GtkBox" id="content_box">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkAlignment" id="alignment1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <child>
+                  <object class="GtkGrid" id="grid1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">center</property>
+                    <property name="valign">center</property>
+                    <child>
+                      <object class="GtkEntry" id="host_entry">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="halign">end</property>
+                        <property name="label" translatable="yes">Host: </property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="username_entry">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label5">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="halign">end</property>
+                        <property name="label" translatable="yes">Username: </property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="connect_button">
+                <property name="label" translatable="yes">Connect</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="halign">end</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">page 1</property>
+          </object>
+          <packing>
+            <property name="tab_fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="box1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkBox" id="box3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkAlignment" id="connection_text_container">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkLabel" id="connection_text">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Connecting...</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkBox" id="password_container">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">center</property>
+                    <child>
+                      <object class="GtkLabel" id="label6">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="halign">end</property>
+                        <property name="label" translatable="yes">Password:</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="password_entry">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="visibility">False</property>
+                        <property name="input_purpose">password</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="password_submit">
+                        <property name="label">gtk-connect</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="halign">center</property>
+                        <property name="valign">center</property>
+                        <property name="margin_left">8</property>
+                        <property name="use_stock">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="connect_cancel_button">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="halign">end</property>
+                <property name="use_stock">True</property>
+                <property name="image_position">right</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel" id="label2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">page 2</property>
+          </object>
+          <packing>
+            <property name="position">1</property>
+            <property name="tab_fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="terminal_outer_vbox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkBox" id="terminal_box">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox" id="box2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkStatusbar" id="connection_statusbar">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_left">10</property>
+                    <property name="margin_right">10</property>
+                    <property name="margin_top">6</property>
+                    <property name="margin_bottom">6</property>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">2</property>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="disconnect_button">
+                    <property name="label">gtk-disconnect</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_stock">True</property>
+                    <property name="yalign">0.64999997615814209</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel" id="label3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">page 3</property>
+          </object>
+          <packing>
+            <property name="position">2</property>
+            <property name="tab_fill">False</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>


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