[Pkg-samba-maint] r2701 - in trunk/samba-gtk: . common debian man meta python tools

jelmer at alioth.debian.org jelmer at alioth.debian.org
Tue Apr 14 15:00:12 UTC 2009


Author: jelmer
Date: 2009-04-14 15:00:11 +0000 (Tue, 14 Apr 2009)
New Revision: 2701

Added:
   trunk/samba-gtk/.bzrignore
   trunk/samba-gtk/.gitignore
   trunk/samba-gtk/INSTALL
   trunk/samba-gtk/LICENSE
   trunk/samba-gtk/Makefile
   trunk/samba-gtk/Makefile.settings.in
   trunk/samba-gtk/README
   trunk/samba-gtk/TODO
   trunk/samba-gtk/autogen.sh
   trunk/samba-gtk/common/
   trunk/samba-gtk/common/credentials.c
   trunk/samba-gtk/common/gtk-smb.c
   trunk/samba-gtk/common/gtk-smb.h
   trunk/samba-gtk/common/gtk_events.c
   trunk/samba-gtk/common/select.c
   trunk/samba-gtk/common/select.h
   trunk/samba-gtk/configure.ac
   trunk/samba-gtk/gepdump
   trunk/samba-gtk/gregedit
   trunk/samba-gtk/gtkldb
   trunk/samba-gtk/gtksamba.pc.in
   trunk/samba-gtk/install-sh
   trunk/samba-gtk/man/
   trunk/samba-gtk/man/gepdump.1.xml
   trunk/samba-gtk/man/gregedit.1.xml
   trunk/samba-gtk/man/gtkldb.1.xml
   trunk/samba-gtk/man/gwcrontab.1.xml
   trunk/samba-gtk/man/gwsvcctl.1.xml
   trunk/samba-gtk/meta/
   trunk/samba-gtk/meta/gepdump.desktop
   trunk/samba-gtk/meta/gregedit.desktop
   trunk/samba-gtk/meta/gwcrontab.desktop
   trunk/samba-gtk/meta/gwsam.desktop
   trunk/samba-gtk/meta/gwsvcctl.desktop
   trunk/samba-gtk/pysambagtk.c
   trunk/samba-gtk/python/
   trunk/samba-gtk/python/module.c
   trunk/samba-gtk/python/sambagtk.defs
   trunk/samba-gtk/python/sambagtk.override
   trunk/samba-gtk/tools/
   trunk/samba-gtk/tools/gwcrontab.c
   trunk/samba-gtk/tools/gwsam.c
   trunk/samba-gtk/tools/gwsam_user.c
   trunk/samba-gtk/tools/gwsvcctl.c
Modified:
   trunk/samba-gtk/debian/changelog
Log:
merge in current upstream sources.

Added: trunk/samba-gtk/.bzrignore
===================================================================
--- trunk/samba-gtk/.bzrignore	                        (rev 0)
+++ trunk/samba-gtk/.bzrignore	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,16 @@
+Makefile.settings
+aclocal.m4
+autom4te.cache
+config.log
+config.status
+configure
+gtksamba.pc
+man/*.1
+libsamba-gtk.so.0.0.1
+gepdump
+gwcrontab
+gregedit
+gwsam
+gwsvcctl
+*.so.*
+tags

Added: trunk/samba-gtk/.gitignore
===================================================================
--- trunk/samba-gtk/.gitignore	                        (rev 0)
+++ trunk/samba-gtk/.gitignore	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,21 @@
+aclocal.m4
+autom4te.cache
+config.log
+configure
+*~
+*.o
+tags
+libsamba-gtk.so.*
+gtksamba.pc
+gwcrontab
+gwsam
+gwsvcctl
+Makefile.settings
+config.status
+*.pyc
+config.h
+config.h.in
+*.po
+*.so
+man/*.1
+python/sambagtk.c

Added: trunk/samba-gtk/INSTALL
===================================================================
--- trunk/samba-gtk/INSTALL	                        (rev 0)
+++ trunk/samba-gtk/INSTALL	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,20 @@
+To build, you will need to have the following tools installed:
+
+ * GNU make
+ * A C99-compatible C compiler, preferably GCC
+ * the GTK+ 2.0 libraries, including development files
+ * Samba 4 libraries, including development files
+
+Make sure to point pkg-config at the right path, for example if samba is installed in /usr/local/samba/:
+
+$ export PKG_CONFIG_PATH=/usr/local/samba/lib/pkgconfig
+
+To build, simply run make:
+
+$ make
+
+This will take care of running the configure script as well, if necessary.
+
+To install, run "make install":
+
+$ make install

Added: trunk/samba-gtk/LICENSE
===================================================================
--- trunk/samba-gtk/LICENSE	                        (rev 0)
+++ trunk/samba-gtk/LICENSE	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,676 @@
+
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  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.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+ 
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey 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;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+  
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If 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 convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU 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 that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  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.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+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.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program 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, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU 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 Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+

Added: trunk/samba-gtk/Makefile
===================================================================
--- trunk/samba-gtk/Makefile	                        (rev 0)
+++ trunk/samba-gtk/Makefile	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,107 @@
+include Makefile.settings
+
+BINS = gwcrontab gwsam gwsvcctl 
+SCRIPTS = gtkldb gepdump gregedit
+gwcrontab_LIBS = $(DCERPC_ATSVC_LIBS)
+CFLAGS = $(GTK_CFLAGS) $(TALLOC_CFLAGS) $(DCERPC_CFLAGS) $(GENSEC_CFLAGS) -I. -Wall
+LIBS = $(GTK_LIBS) $(TALLOC_LIBS) $(DCERPC_LIBS) $(GENSEC_LIBS) $(DCERPC_SAMR_LIBS)
+# Should be determined by configure...
+SHLIBEXT = so
+
+LIB = libsamba-gtk.$(SHLIBEXT).0.0.1
+MANPAGES = man/gepdump.1 man/gwcrontab.1 man/gwsvcctl.1 man/gregedit.1 man/gtkldb.1
+HEADERS = $(wildcard common/*.h)
+SOVERSION = 0
+SONAME = libsamba-gtk.$(SHLIBEXT).$(SOVERSION)
+PYMODULES = sambagtk.$(SHLIBEXT)
+
+all:: $(BINS) $(LIB) $(SONAME) libsamba-gtk.$(SHLIBEXT) sambagtk.$(SHLIBEXT)
+
+Makefile: Makefile.settings
+
+install:: $(BINS) $(LIB) $(PYMODULES)
+	$(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(man1dir)
+	$(INSTALL) -m 0755 $(BINS) $(SCRIPTS) $(DESTDIR)$(bindir)
+	$(INSTALL) -m 0755 $(LIB) $(DESTDIR)$(libdir)
+	ln -fs $(LIB) $(DESTDIR)$(libdir)/libsamba-gtk.$(SHLIBEXT)
+	$(INSTALL) -d $(DESTDIR)$(pcdir)
+	$(INSTALL) -m 0644 gtksamba.pc $(DESTDIR)$(pcdir)
+	$(INSTALL) -d $(DESTDIR)$(appdir)
+	$(INSTALL) -m 0644 meta/* $(DESTDIR)$(appdir)
+	$(INSTALL) -d $(DESTDIR)$(includedir)
+	$(INSTALL) -m 0644 $(HEADERS) $(DESTDIR)$(includedir)
+	$(INSTALL) -m 0755 sambagtk.$(SHLIBEXT) $(DESTDIR)$(pythondir)
+
+install-doc:: doc
+	$(INSTALL) -m 0644 $(MANPAGES) $(DESTDIR)$(man1dir)
+
+configure: configure.ac
+	aclocal
+	autoconf -f
+
+check:: test
+
+%.desktop-validate: %.desktop
+	$(DESKTOP_VALIDATE) $<
+
+test:: $(patsubst %.desktop,%.desktop-validate,$(wildcard meta/*.desktop))
+
+Makefile.settings: configure
+	./configure
+
+$(LIB): $(patsubst %.c, %.po, $(wildcard common/*.c))
+	$(CC) -Wl,-soname=$(SONAME) -shared -o $@ $^ $(LIBS)
+
+$(SONAME): $(LIB)
+	ln -fs $< $@
+
+libsamba-gtk.$(SHLIBEXT): $(LIB)
+	ln -fs $< $@
+
+DEFS = `pkg-config --variable=defsdir pygtk-2.0`
+
+python/sambagtk.c: python/sambagtk.defs python/sambagtk.override
+	pygtk-codegen-2.0 --prefix sambagtk \
+		--register $(DEFS)/gdk-types.defs \
+		--register $(DEFS)/gtk-types.defs \
+		--override python/sambagtk.override \
+		$< > $@
+
+python/%.po: CFLAGS+=`$(PYTHON_CONFIG) --cflags` $(PYGTK_CFLAGS)
+
+sambagtk.$(SHLIBEXT): python/sambagtk.po python/module.po $(LIB)
+	$(CC) -shared -o $@ $^ `$(PYTHON_CONFIG) --libs` $(PYGTK_LIBS)
+
+%.o: %.c
+	$(CC) $(CFLAGS) -o $@ -c $<
+
+%.po: %.c
+	$(CC) $(CFLAGS) -fPIC -o $@ -c $<
+
+$(BINS): %: tools/%.o $(LIB)
+	$(CC) -o $@ $< $(LIB) $(LIBS) $($*_LIBS)
+
+install::
+
+clean::
+	rm -f $(BINS) $(LIB) *.$(SHLIBEXT) */*.o *.o */*.po *.po
+	rm -f python/sambagtk.c
+
+distclean:: clean
+	rm -rf autom4te.cache
+	rm -f config.log config.cache config.status
+	rm -f Makefile.settings
+
+dist:: configure distclean
+
+doc:: $(MANPAGES)
+
+DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
+
+.SUFFIXES: .1 .1.xml
+
+.1.xml.1:
+	$(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
+
+ctags:
+	ctags -R .

Added: trunk/samba-gtk/Makefile.settings.in
===================================================================
--- trunk/samba-gtk/Makefile.settings.in	                        (rev 0)
+++ trunk/samba-gtk/Makefile.settings.in	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,48 @@
+CC = @CC@
+CFLAGS = @CFLAGS@
+
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+
+TALLOC_CFLAGS = @TALLOC_CFLAGS@
+TALLOC_LIBS = @TALLOC_LIBS@
+
+DCERPC_CFLAGS = @DCERPC_CFLAGS@
+DCERPC_LIBS = @DCERPC_LIBS@
+
+DCERPC_SAMR_CFLAGS = @DCERPC_SAMR_CFLAGS@
+DCERPC_SAMR_LIBS = @DCERPC_SAMR_LIBS@
+
+DCERPC_ATSVC_CFLAGS = @DCERPC_ATSVC_CFLAGS@
+DCERPC_ATSVC_LIBS = @DCERPC_ATSVC_LIBS@
+
+GENSEC_CFLAGS = @GENSEC_CFLAGS@
+GENSEC_LIBS = @GENSEC_LIBS@
+
+REGISTRY_CFLAGS = @REGISTRY_CFLAGS@
+REGISTRY_LIBS = @REGISTRY_LIBS@
+
+XSLTPROC = @XSLTPROC@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+libdir = @libdir@
+pcdir = $(libdir)/pkgconfig
+
+datarootdir = @datarootdir@
+mandir = @mandir@
+man1dir = $(mandir)/man1
+appdir = $(datarootdir)/applications
+includedir = @includedir@/samba-4.0/gtk
+
+INSTALL = @INSTALL@
+
+DESKTOP_VALIDATE = @DESKTOP_VALIDATE@
+
+pythondir = @pythondir@
+PYTHON_CONFIG = @PYTHON_CONFIG@
+
+PYGTK_CFLAGS = @PYGTK_CFLAGS@
+PYGTK_LIBS = @PYGTK_LIBS@

Added: trunk/samba-gtk/README
===================================================================
--- trunk/samba-gtk/README	                        (rev 0)
+++ trunk/samba-gtk/README	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,22 @@
+This directory contains files for SMB-related Gtk Widgets 
+and helper functions and utilities (frontends) for various SMB 
+things.
+
+See the file INSTALL for information on how to build and install.
+
+Common code at the moment:
+GtkRpcBindingDialog - Gtk Dialog Window for obtaining user credentials and a RPC binding string
+GtkSelectDomainDialog - Gtk Dialog for selecting a domain
+GtkSelectHostDialog - Gtk Dialog for selecting a SMB host
+gtk_show_werror() - Show dialog box with a WERROR
+gtk_show_ntstatus() - Show dialog box with a NTSTATUS
+create_gtk_samba_about() - Shows about Window
+
+Utilities:
+gregedit - Gtk+ Registry Editor (RPC, NT4 files, W95 files, GConf)
+gwcrontab - View and edit 'cron/at'-like jobs using the atsvc service (needs a better name)
+
+Ideas for future utilities:
+- SAM editor
+- Eventlog viewer
+- policy editor

Added: trunk/samba-gtk/TODO
===================================================================
--- trunk/samba-gtk/TODO	                        (rev 0)
+++ trunk/samba-gtk/TODO	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1 @@
+- fix quite on closing main window

Added: trunk/samba-gtk/autogen.sh
===================================================================
--- trunk/samba-gtk/autogen.sh	                        (rev 0)
+++ trunk/samba-gtk/autogen.sh	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,4 @@
+#!/bin/sh
+aclocal
+autoheader
+autoconf -f


Property changes on: trunk/samba-gtk/autogen.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/samba-gtk/common/credentials.c
===================================================================
--- trunk/samba-gtk/common/credentials.c	                        (rev 0)
+++ trunk/samba-gtk/common/credentials.c	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,150 @@
+/* 
+   Unix SMB/CIFS implementation.
+
+   Copyright (C) Jelmer Vernooij 2005
+
+   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 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "common/gtk-smb.h"
+#include <credentials.h>
+#include "config.h"
+#ifndef HAVE_GNOME_KEYRING
+#include <gnome-keyring.h>
+#endif
+
+static void gtk_get_credentials(struct cli_credentials *credentials)
+{
+	const char *ret;
+	GtkWidget *dialog;
+	GtkWidget *label;
+	GtkWidget *table;
+	GtkWidget *entry_username;
+	GtkWidget *dialog_action_area1;
+	GtkWidget *cancelbutton1;
+	GtkWidget *okbutton1;
+	GtkWidget *anonymous;
+	const char *username;
+
+	dialog = gtk_dialog_new ();
+	gtk_window_set_title (GTK_WINDOW (dialog), "Credentials");
+	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+	gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
+
+	table = gtk_table_new(4, 2, FALSE);
+	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), table);
+
+	label = gtk_label_new ("Username:");
+
+	gtk_table_attach(GTK_TABLE(table),label,0,1,1,2,GTK_FILL,0,0,0);
+
+	entry_username = gtk_entry_new ();
+	gtk_table_attach(GTK_TABLE(table),entry_username,1,2,1,2,GTK_FILL,0,0,0);
+	gtk_entry_set_activates_default (GTK_ENTRY (entry_username), TRUE);
+
+	username = cli_credentials_get_unparsed_name(credentials, credentials);
+
+	if (credentials->username_obtained != CRED_UNINITIALISED && 
+	    username) {
+		gtk_entry_set_text(GTK_ENTRY(entry_username), username);
+	}
+
+#ifndef HAVE_GNOME_KEYRING
+	label = gtk_label_new ("Password:");
+
+	gtk_table_attach(GTK_TABLE(table),label,0,1,3,4,GTK_FILL,0,0,0);
+
+	entry_password = gtk_entry_new ();
+	gtk_table_attach(GTK_TABLE(table),entry_password,1,2,3,4,GTK_FILL,0,0,0);
+	gtk_entry_set_visibility (GTK_ENTRY (entry_password), FALSE);
+	gtk_entry_set_activates_default (GTK_ENTRY (entry_password), TRUE);
+	if (credentials->password_obtained != CRED_UNINITIALISED &&
+	    credentials->password_obtained != CRED_CALLBACK &&
+	    credentials->password) {
+		gtk_entry_set_text(GTK_ENTRY(entry_password), credentials->password);
+	}
+
+	anonymous = gtk_check_button_new_with_mnemonic("_Anonymous");
+	gtk_table_attach(GTK_TABLE(table),anonymous,0,2,4,5,GTK_FILL,0,0,0);
+#endif
+
+	dialog_action_area1 = GTK_DIALOG (dialog)->action_area;
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
+
+	cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
+	gtk_dialog_add_action_widget (GTK_DIALOG (dialog), cancelbutton1, GTK_RESPONSE_CANCEL);
+	GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
+
+	okbutton1 = gtk_button_new_from_stock ("gtk-ok");
+	gtk_dialog_add_action_widget (GTK_DIALOG (dialog), okbutton1, GTK_RESPONSE_OK);
+	GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
+
+	gtk_widget_show_all (dialog);
+
+    switch (gtk_dialog_run (GTK_DIALOG (dialog))) {
+	case GTK_RESPONSE_OK:
+		cli_credentials_parse_string(credentials, gtk_entry_get_text(GTK_ENTRY(entry_username)), CRED_CALLBACK_RESULT);
+#ifndef HAVE_GNOME_KEYRING
+		cli_credentials_set_password(credentials, gtk_entry_get_text(GTK_ENTRY(entry_password)), CRED_CALLBACK_RESULT);
+#endif
+
+		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(anonymous))) {
+			cli_credentials_set_anonymous(credentials);
+		}
+		break;
+	default:
+		ret = NULL;
+		break;
+	}
+
+	gtk_widget_destroy (dialog);
+}
+
+static const char *gtk_get_username(struct cli_credentials *credentials)
+{
+	gtk_get_credentials(credentials);
+	return credentials->username;
+}
+
+static const char *gtk_get_userpassword(struct cli_credentials *credentials)
+{
+	gtk_get_credentials(credentials);
+	return credentials->password;
+}
+
+static const char *gtk_get_domain(struct cli_credentials *credentials)
+{
+	gtk_get_credentials(credentials);
+	return credentials->domain;
+}
+
+#ifdef HAVE_GNOME_KEYRING
+static const char *keyring_get_password(struct cli_credentials *credentials)
+{
+	return NULL;
+}
+#endif
+
+void cli_credentials_set_gtk_callbacks(struct cli_credentials *cred)
+{
+	cli_credentials_set_username_callback(cred, gtk_get_username);
+	cli_credentials_set_domain_callback(cred, gtk_get_domain);
+	cli_credentials_set_password_callback(cred, gtk_get_userpassword);
+#ifdef HAVE_GNOME_KEYRING
+	cli_credentials_set_password_callback(cred, keyring_get_password);
+#endif
+}

Added: trunk/samba-gtk/common/gtk-smb.c
===================================================================
--- trunk/samba-gtk/common/gtk-smb.c	                        (rev 0)
+++ trunk/samba-gtk/common/gtk-smb.c	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,327 @@
+/* 
+   Unix SMB/CIFS implementation.
+   SMB-related GTK+ functions
+   
+   Copyright (C) Jelmer Vernooij 2004-2005
+
+   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 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#define _GNU_SOURCE
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <samba/version.h>
+#include "common/gtk-smb.h"
+#include "common/select.h"
+#include <dcerpc.h>
+#include <credentials.h>
+#include <charset.h>
+
+/** 
+ * Dialog error showing a WERROR
+ */
+void gtk_show_werror(GtkWidget *win, const char *message, WERROR err) 
+{
+	GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(win), 
+						    GTK_DIALOG_DESTROY_WITH_PARENT,
+						    GTK_MESSAGE_ERROR,
+    						    GTK_BUTTONS_CLOSE,
+						    "%s: %s\n", message?message: "Windows error",
+						    win_errstr(err));
+	gtk_dialog_run (GTK_DIALOG (dialog));
+ 	gtk_widget_destroy (dialog);
+}
+                   
+/** 
+ * GTK+ dialog showing a NTSTATUS error
+ */
+void gtk_show_ntstatus(GtkWidget *win, const char *message, NTSTATUS status) 
+{
+	GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(win), 
+						    GTK_DIALOG_DESTROY_WITH_PARENT,
+						    GTK_MESSAGE_ERROR,
+						    GTK_BUTTONS_CLOSE,
+						    "%s: %s\n", message?message:"Windows error",
+						    nt_errstr(status));
+	gtk_dialog_run (GTK_DIALOG (dialog));
+ 	gtk_widget_destroy (dialog);
+}
+
+static void on_browse_activate (GtkButton *button, gpointer user_data)
+{
+	GtkRpcBindingDialog *rbd = user_data;
+	GtkWidget *shd = gtk_select_host_dialog_new(rbd->sam_pipe);
+	if(gtk_dialog_run(GTK_DIALOG(shd)) == GTK_RESPONSE_ACCEPT) {
+		gtk_entry_set_text(GTK_ENTRY(rbd->entry_host), gtk_select_host_dialog_get_host(GTK_SELECT_HOST_DIALOG(shd)));
+	}
+	
+	gtk_widget_destroy(GTK_WIDGET(shd));
+}
+
+static void on_ncalrpc_toggled(GtkToggleButton *tb, GtkRpcBindingDialog *d)
+{
+	gtk_widget_set_sensitive(d->frame_host, !gtk_toggle_button_get_active(tb));
+}
+
+static void gtk_rpc_binding_dialog_init (GtkRpcBindingDialog *gtk_rpc_binding_dialog)
+{
+	GtkWidget *dialog_vbox1;
+	GtkWidget *vbox1;
+	GtkWidget *vbox6;
+	GtkWidget *frame_transport;
+	GtkWidget *label1;
+	GtkWidget *hbox1;
+	GtkWidget *lbl_name;
+	GtkWidget *label2;
+	GtkWidget *label3;
+	GtkWidget *frame_security;
+	GtkWidget *vbox2;
+	GtkWidget *btn_browse;
+	GtkWidget *dialog_action_area1;
+	GtkWidget *btn_cancel;
+	GtkWidget *btn_connect;
+	GSList *transport_smb_group = NULL;
+
+	gtk_rpc_binding_dialog->mem_ctx = talloc_init("gtk_rcp_binding_dialog");
+
+	gtk_window_set_title (GTK_WINDOW (gtk_rpc_binding_dialog), "Connect");
+
+	dialog_vbox1 = GTK_DIALOG (gtk_rpc_binding_dialog)->vbox;
+
+	vbox1 = gtk_vbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);
+
+	frame_transport = gtk_frame_new (NULL);
+	gtk_box_pack_start (GTK_BOX (vbox1), frame_transport, TRUE, TRUE, 0);
+
+	vbox6 = gtk_vbox_new (FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (frame_transport), vbox6);
+
+	gtk_rpc_binding_dialog->transport_ncalrpc = gtk_radio_button_new_with_mnemonic (NULL, "Local Host");
+	gtk_box_pack_start (GTK_BOX (vbox6), gtk_rpc_binding_dialog->transport_ncalrpc, FALSE, FALSE, 0);
+	gtk_radio_button_set_group (GTK_RADIO_BUTTON (gtk_rpc_binding_dialog->transport_ncalrpc), transport_smb_group);
+	transport_smb_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (gtk_rpc_binding_dialog->transport_ncalrpc));
+
+
+	gtk_rpc_binding_dialog->transport_smb = gtk_radio_button_new_with_mnemonic (NULL, "RPC over SMB over TCP/IP");
+	gtk_box_pack_start (GTK_BOX (vbox6), gtk_rpc_binding_dialog->transport_smb, FALSE, FALSE, 0);
+	gtk_radio_button_set_group (GTK_RADIO_BUTTON (gtk_rpc_binding_dialog->transport_smb), transport_smb_group);
+	transport_smb_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (gtk_rpc_binding_dialog->transport_smb));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_rpc_binding_dialog->transport_smb), TRUE);
+
+	gtk_rpc_binding_dialog->transport_tcp_ip = gtk_radio_button_new_with_mnemonic (NULL, "RPC over TCP/IP");
+	gtk_box_pack_start (GTK_BOX (vbox6), gtk_rpc_binding_dialog->transport_tcp_ip, FALSE, FALSE, 0);
+	gtk_radio_button_set_group (GTK_RADIO_BUTTON (gtk_rpc_binding_dialog->transport_tcp_ip), transport_smb_group);
+	transport_smb_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (gtk_rpc_binding_dialog->transport_tcp_ip));
+
+	label1 = gtk_label_new ("Transport");
+	gtk_frame_set_label_widget (GTK_FRAME (frame_transport), label1);
+
+	gtk_rpc_binding_dialog->frame_host = gtk_frame_new (NULL);
+	gtk_box_pack_start (GTK_BOX (vbox1), gtk_rpc_binding_dialog->frame_host, TRUE, TRUE, 0);
+
+	hbox1 = gtk_hbox_new (FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (gtk_rpc_binding_dialog->frame_host), hbox1);
+
+	lbl_name = gtk_label_new ("Name");
+	gtk_box_pack_start (GTK_BOX (hbox1), lbl_name, TRUE, TRUE, 0);
+
+	gtk_rpc_binding_dialog->entry_host = gtk_entry_new ();
+	gtk_box_pack_start (GTK_BOX (hbox1), gtk_rpc_binding_dialog->entry_host, TRUE, TRUE, 0);
+
+	if(gtk_rpc_binding_dialog->sam_pipe)
+	{
+		btn_browse = gtk_button_new_with_label ("Browse");
+		gtk_box_pack_start (GTK_BOX (hbox1), btn_browse, TRUE, TRUE, 0);
+
+		g_signal_connect ((gpointer) btn_browse, "pressed",
+						  G_CALLBACK (on_browse_activate),
+						  gtk_rpc_binding_dialog);
+	}
+
+	label2 = gtk_label_new ("Host");
+	gtk_frame_set_label_widget (GTK_FRAME (gtk_rpc_binding_dialog->frame_host), label2);
+
+	frame_security = gtk_frame_new (NULL);
+
+	label3 = gtk_label_new ("Security");
+	gtk_frame_set_label_widget (GTK_FRAME (frame_security), label3);
+
+	gtk_box_pack_start (GTK_BOX (vbox1), frame_security, TRUE, TRUE, 0);
+
+	vbox2 = gtk_vbox_new (FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (frame_security), vbox2);
+
+	gtk_rpc_binding_dialog->chk_sign = gtk_check_button_new_with_mnemonic ("S_ign");
+	gtk_box_pack_start (GTK_BOX (vbox2), gtk_rpc_binding_dialog->chk_sign, FALSE, FALSE, 0);
+
+	gtk_rpc_binding_dialog->chk_seal = gtk_check_button_new_with_mnemonic ("_Seal");
+	gtk_box_pack_start (GTK_BOX (vbox2), gtk_rpc_binding_dialog->chk_seal, FALSE, FALSE, 0);
+
+	dialog_action_area1 = GTK_DIALOG (gtk_rpc_binding_dialog)->action_area;
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
+
+	btn_cancel = gtk_button_new_from_stock ("gtk-cancel");
+	gtk_dialog_add_action_widget (GTK_DIALOG (gtk_rpc_binding_dialog), btn_cancel, GTK_RESPONSE_CANCEL);
+	GTK_WIDGET_SET_FLAGS (btn_cancel, GTK_CAN_DEFAULT);
+
+	btn_connect = gtk_button_new_with_mnemonic ("C_onnect");
+	gtk_dialog_add_action_widget (GTK_DIALOG (gtk_rpc_binding_dialog), btn_connect, GTK_RESPONSE_ACCEPT);
+	gtk_container_set_border_width (GTK_CONTAINER (btn_connect), 1);
+	GTK_WIDGET_SET_FLAGS (btn_connect, GTK_CAN_DEFAULT);
+
+	g_signal_connect ((gpointer) gtk_rpc_binding_dialog->transport_ncalrpc, "toggled",
+						  G_CALLBACK (on_ncalrpc_toggled),
+						  gtk_rpc_binding_dialog);
+
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(gtk_rpc_binding_dialog->transport_ncalrpc), TRUE);
+	gtk_widget_show_all(dialog_vbox1);
+
+	gtk_widget_grab_focus (btn_connect);
+	gtk_widget_grab_default (btn_connect);
+}
+
+GType gtk_rpc_binding_dialog_get_type (void)
+{
+  static GType mytype = 0;
+
+  if (!mytype)
+    {
+      static const GTypeInfo myinfo =
+      {
+	sizeof (GtkRpcBindingDialogClass),
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	sizeof(GtkRpcBindingDialog),
+	0,
+	(GInstanceInitFunc) gtk_rpc_binding_dialog_init,
+      };
+
+      mytype = g_type_register_static (GTK_TYPE_DIALOG, 
+		"GtkRpcBindingDialog", &myinfo, 0);
+    }
+
+  return mytype;
+}
+
+/**
+ * Create a new GTK+ dialog asking for binding information for 
+ * DCE/RPC
+ *
+ * Optionally gets a sam pipe that will be used to look up users
+ */
+GtkWidget *gtk_rpc_binding_dialog_new (struct dcerpc_pipe *sam_pipe)
+{
+	GtkRpcBindingDialog *d = SAMBAGTK_RPC_BINDING_DIALOG ( g_object_new (gtk_rpc_binding_dialog_get_type (), NULL));
+	d->sam_pipe = sam_pipe;
+	return GTK_WIDGET(d);
+}
+
+const char *gtk_rpc_binding_dialog_get_host(GtkRpcBindingDialog *d)
+{
+	return gtk_entry_get_text(GTK_ENTRY(d->entry_host));
+}
+
+struct dcerpc_binding *gtk_rpc_binding_dialog_get_binding(GtkRpcBindingDialog *d, TALLOC_CTX *mem_ctx)
+{
+	struct dcerpc_binding *binding = talloc(mem_ctx, struct dcerpc_binding);
+
+	ZERO_STRUCT(binding->object);
+
+	/* Format: TRANSPORT:host[\pipe\foo,foo,foo] */
+
+	binding->host = talloc_strdup(mem_ctx, gtk_entry_get_text(GTK_ENTRY(d->entry_host)));
+	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(d->transport_tcp_ip))) {
+		binding->transport = NCACN_IP_TCP;
+	} else if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(d->transport_ncalrpc))) {
+		binding->transport = NCALRPC;
+		binding->host = NULL;
+	} else {
+		binding->transport = NCACN_NP;
+	}
+
+	binding->options = NULL;
+	binding->flags = 0;
+	binding->endpoint = NULL;
+
+	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(d->chk_seal))) {
+		binding->flags |= DCERPC_SEAL;
+	}
+
+	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(d->chk_sign))) {
+		binding->flags |= DCERPC_SIGN;
+	}
+
+	return binding;
+}
+
+const char *gtk_rpc_binding_dialog_get_binding_string(GtkRpcBindingDialog *d)
+{
+	char *talloc_ret;
+	char *ret;
+	TALLOC_CTX *mem_ctx = talloc_new(NULL);
+	talloc_ret = dcerpc_binding_string(mem_ctx, gtk_rpc_binding_dialog_get_binding(d, mem_ctx));
+	ret = g_strdup(talloc_ret);
+	talloc_free(mem_ctx);
+	return ret;
+}
+
+GtkWidget *create_gtk_samba_about_dialog (const char *appname)
+{
+	GtkWidget *samba_about_dialog;
+	GtkWidget *dialog_vbox1;
+	GtkWidget *label1;
+	GtkWidget *label2;
+	GtkWidget *label3;
+	GtkWidget *label4;
+	GtkWidget *dialog_action_area1;
+	GtkWidget *okbutton1;
+
+	samba_about_dialog = gtk_dialog_new ();
+	gtk_window_set_title (GTK_WINDOW (samba_about_dialog), "About");
+
+	dialog_vbox1 = GTK_DIALOG (samba_about_dialog)->vbox;
+
+	/* FIXME image1 = create_pixmap (samba_about_dialog, "slmed.png");
+	   gtk_box_pack_start (GTK_BOX (dialog_vbox1), image1, TRUE, TRUE, 0);*/
+
+	label1 = gtk_label_new (appname);
+	gtk_box_pack_start (GTK_BOX (dialog_vbox1), label1, FALSE, FALSE, 0);
+
+	label2 = gtk_label_new (SAMBA_VERSION_STRING);
+	gtk_box_pack_start (GTK_BOX (dialog_vbox1), label2, FALSE, FALSE, 0);
+
+	label3 = gtk_label_new_with_mnemonic ("Part of Samba-GTK <http://wiki.samba.org/index.php/SambaGtk>");
+	gtk_box_pack_start (GTK_BOX (dialog_vbox1), label3, FALSE, FALSE, 0);
+
+	label4 = gtk_label_new ("\302\251 2004-2007 Jelmer Vernooij");
+	gtk_box_pack_start (GTK_BOX (dialog_vbox1), label4, FALSE, FALSE, 0);
+
+	dialog_action_area1 = GTK_DIALOG (samba_about_dialog)->action_area;
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
+
+	okbutton1 = gtk_button_new_from_stock ("gtk-ok");
+	gtk_dialog_add_action_widget (GTK_DIALOG (samba_about_dialog), okbutton1, GTK_RESPONSE_OK);
+	GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
+	gtk_widget_show_all(dialog_vbox1);
+
+	return samba_about_dialog;
+}

Added: trunk/samba-gtk/common/gtk-smb.h
===================================================================
--- trunk/samba-gtk/common/gtk-smb.h	                        (rev 0)
+++ trunk/samba-gtk/common/gtk-smb.h	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,82 @@
+/* 
+   Unix SMB/CIFS implementation.
+   SMB-related GTK+ functions
+   
+   Copyright (C) Jelmer Vernooij 2004
+
+   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 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __GTK_SMB_H__
+#define __GTK_SMB_H__
+
+#define GTK_DISABLE_DEPRECATED
+#include <gtk/gtk.h>
+#include <talloc.h>
+#include <stdbool.h>
+#include <core/ntstatus.h>
+#include <core/werror.h>
+
+typedef struct _GtkRpcBindingDialog GtkRpcBindingDialog;
+
+struct _GtkRpcBindingDialog 
+{
+	GtkDialog dialog;
+	GtkWidget *chk_sign;
+	GtkWidget *chk_seal;
+	GtkWidget *transport_tcp_ip;
+	GtkWidget *transport_ncalrpc;
+	GtkWidget *transport_smb;
+	GtkWidget *frame_host;
+	GtkWidget *entry_host;
+	GtkWidget *entry_username;
+	GtkWidget *entry_userdomain;
+	GtkWidget *entry_password;
+	GtkWidget *krb5_chk_button;
+	TALLOC_CTX *mem_ctx;
+	struct dcerpc_pipe *sam_pipe;
+};
+
+typedef struct _GtkRpcBindingDialogClass GtkRpcBindingDialogClass;
+
+struct _GtkRpcBindingDialogClass
+{
+	GtkDialogClass parent_class;
+};
+
+#define SAMBAGTK_TYPE_RPC_BINDING_DIALOG gtk_rpc_binding_dialog_get_type()
+
+#define SAMBAGTK_RPC_BINDING_DIALOG(obj)          G_TYPE_CHECK_INSTANCE_CAST(obj, gtk_rpc_binding_dialog_get_type (), GtkRpcBindingDialog)
+#define SAMBAGTK_RPC_BINDING_DIALOG_CLASS(klass)  G_TYPE_CHECK_INSTANCE_CAST(klass, gtk_rpc_binding_dialog_class_get_type (), GtkRpcBindingDialogClass)
+#define IS_SAMBAGTK_RPC_BINDING_DIALOG(obj)       G_TYPE_CHECK_INSTANCE_CAST(obj, gtk_rpc_binding_dialog_get_type ())
+
+/* subsystem prototypes */
+GtkWidget *create_gtk_samba_about_dialog (const char *appname);
+void gtk_show_ntstatus(GtkWidget *win, const char *, NTSTATUS status);
+GtkWidget *gtk_rpc_binding_dialog_new (struct dcerpc_pipe *sam_pipe);
+GType gtk_rpc_binding_dialog_get_type (void);
+struct dcerpc_binding *gtk_rpc_binding_dialog_get_binding(GtkRpcBindingDialog *d, TALLOC_CTX *mem_ctx);
+void gtk_show_werror(GtkWidget *win, const char *, WERROR err);
+const char *gtk_rpc_binding_dialog_get_binding_string(GtkRpcBindingDialog *d);
+const char *gtk_rpc_binding_dialog_get_host(GtkRpcBindingDialog *d);
+
+int gtk_event_loop(void);
+struct event_context;
+struct event_context *gtk_event_context(void);
+
+struct cli_credentials;
+void cli_credentials_set_gtk_callbacks(struct cli_credentials *creds);
+
+#endif

Added: trunk/samba-gtk/common/gtk_events.c
===================================================================
--- trunk/samba-gtk/common/gtk_events.c	                        (rev 0)
+++ trunk/samba-gtk/common/gtk_events.c	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,372 @@
+/* 
+   Unix SMB/CIFS implementation.
+
+   main select loop and event handling
+   
+   plugin for using a gtk application's event loop
+
+   Copyright (C) Stefan Metzmacher 2005
+   Copyright (C) Jelmer Vernooij 2009
+   
+   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 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <sys/time.h>
+#include <util.h>
+#include <tevent.h>
+#include <tevent_internal.h>
+
+#include "common/select.h"
+
+/* as gtk_main() doesn't take a parameter nor return one,
+   we need to have a global event context structure for our
+   gtk-based tools
+ */
+static struct tevent_context *gtk_event_context_global;
+
+static int gtk_event_context_destructor(struct tevent_context *ev)
+{
+	gtk_event_context_global = NULL;
+	return 0;
+}
+
+/*
+  create a gtk_event_context structure.
+*/
+static int gtk_event_context_init(struct tevent_context *ev)
+{
+	talloc_set_destructor(ev, gtk_event_context_destructor);
+	return 0;
+}
+
+struct gtk_tevent_fd {
+	bool running;
+	bool free_after_run;
+	GIOChannel *channel;
+	guint fd_id;
+};
+
+static gboolean gtk_event_fd_handler(GIOChannel *source, GIOCondition condition, gpointer data)
+{
+	struct tevent_fd *fde = talloc_get_type(data, struct tevent_fd);
+	struct gtk_tevent_fd *gtk_fd = talloc_get_type(fde->additional_data,
+						      struct gtk_tevent_fd);
+	int flags = 0;
+
+	if (condition & (G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP))
+		flags |= TEVENT_FD_READ;
+	if (condition & G_IO_OUT)
+		flags |= TEVENT_FD_WRITE;
+
+	gtk_fd->running = true;
+	fde->handler(fde->event_ctx, fde, flags, fde->private_data);
+	gtk_fd->running = false;
+
+	if (gtk_fd->free_after_run) {
+		talloc_free(fde);
+		return gtk_false();
+	}
+
+	return gtk_true();
+}
+
+/*
+  destroy an tevent_fd
+*/
+static int gtk_event_fd_destructor(struct tevent_fd *fde)
+{
+	struct gtk_tevent_fd *gtk_fd = talloc_get_type(fde->additional_data,
+						      struct gtk_tevent_fd);
+
+	if (gtk_fd->running) {
+		/* the event is running reject the talloc_free()
+		   as it's done by the gtk_event_timed_handler()
+		 */
+		gtk_fd->free_after_run = true;
+		return -1;
+	}
+
+	if (fde->flags) {
+		/* only if any flag is set we have really registered an event */
+		g_source_remove(gtk_fd->fd_id);
+	}
+	g_io_channel_unref(gtk_fd->channel);
+
+	return 0;
+}
+
+/*
+  add a fd based event
+  return NULL on failure (memory allocation error)
+*/
+static struct tevent_fd *gtk_event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
+				 	 int fd, uint16_t flags,
+				 	 tevent_fd_handler_t handler,
+				 	 void *private_data,
+					 const char *handler_location,
+					 const char *location)
+{
+	struct tevent_fd *fde;
+	struct gtk_tevent_fd *gtk_fd;
+	GIOChannel *channel;
+	guint fd_id = 0;
+	GIOCondition condition = 0;
+
+	fde = talloc(mem_ctx?mem_ctx:ev, struct tevent_fd);
+	if (!fde) return NULL;
+
+	gtk_fd = talloc(fde, struct gtk_tevent_fd);
+	if (gtk_fd == NULL) {
+		talloc_free(fde);
+		return NULL;
+	}
+
+	fde->event_ctx		= ev;
+	fde->fd			= fd;
+	fde->flags		= flags;
+	fde->handler		= handler;
+	fde->private_data	= private_data;
+	fde->additional_flags	= 0;
+	fde->additional_data	= gtk_fd;
+
+	channel = g_io_channel_unix_new(fde->fd);
+	if (channel == NULL) {
+		talloc_free(fde);
+		return NULL;
+	}
+
+	if (fde->flags & TEVENT_FD_READ)
+		condition |= (G_IO_IN | G_IO_ERR | G_IO_HUP);
+	if (fde->flags & TEVENT_FD_WRITE)
+		condition |= G_IO_OUT;
+
+	if (condition) {
+		/* only register the event when at least one flag is set
+		   as condition == 0 means wait for any event and is not the same
+		   as fde->flags == 0 !
+		*/
+		fd_id = g_io_add_watch(channel, condition, gtk_event_fd_handler, fde);
+	}
+
+	gtk_fd->running		= false;
+	gtk_fd->free_after_run	= false;
+	gtk_fd->channel		= channel;
+	gtk_fd->fd_id		= fd_id;
+
+	talloc_set_destructor(fde, gtk_event_fd_destructor);
+
+	return fde;
+}
+
+/*
+  return the fd event flags
+*/
+static uint16_t gtk_event_get_fd_flags(struct tevent_fd *fde)
+{
+	return fde->flags;
+}
+
+/*
+  set the fd event flags
+*/
+static void gtk_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
+{
+	struct gtk_tevent_fd *gtk_fd = talloc_get_type(fde->additional_data,
+						      struct gtk_tevent_fd);
+	GIOCondition condition = 0;
+
+	if (fde->flags == flags) return;
+
+	if (flags & TEVENT_FD_READ)
+		condition |= (G_IO_IN | G_IO_ERR | G_IO_HUP);
+	if (flags & TEVENT_FD_WRITE)
+		condition |= G_IO_OUT;
+
+	/* only register the event when at least one flag is set
+	   as condition == 0 means wait for any event and is not the same
+	   as fde->flags == 0 !
+	*/
+	if (fde->flags) {
+		g_source_remove(gtk_fd->fd_id);
+	}
+	if (condition) {
+		gtk_fd->fd_id = g_io_add_watch(gtk_fd->channel, condition, gtk_event_fd_handler, fde);
+	}
+
+	fde->flags = flags;
+}
+
+struct gtk_tevent_timer {
+	guint te_id;
+};
+
+/*
+  destroy a timed event
+*/
+static int gtk_event_timed_destructor(struct tevent_timer *te)
+{
+	struct gtk_tevent_timer *gtk_te = talloc_get_type(te->additional_data,
+							 struct gtk_tevent_timer);
+
+	g_source_remove(gtk_te->te_id);
+
+	return 0;
+}
+
+static int gtk_event_timed_deny_destructor(struct tevent_timer *te)
+{
+	return -1;
+}
+
+static gboolean gtk_event_timed_handler(gpointer data)
+{
+	struct tevent_timer *te = talloc_get_type(data, struct tevent_timer);
+	struct timeval t = timeval_current();
+
+	/* deny the handler to free the event */
+	talloc_set_destructor(te, gtk_event_timed_deny_destructor);
+	te->handler(te->event_ctx, te, t, te->private_data);
+
+	talloc_set_destructor(te, gtk_event_timed_destructor);
+	talloc_free(te);
+
+	/* return FALSE mean this event should be removed */
+	return gtk_false();
+}
+
+/*
+  add a timed event
+  return NULL on failure (memory allocation error)
+*/
+static struct tevent_timer *gtk_event_add_timed(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
+					       struct timeval next_event, 
+					       tevent_timer_handler_t handler, 
+					       void *private_data,
+						   const char *handler_name,
+						   const char *location) 
+{
+	struct tevent_timer *te;
+	struct gtk_tevent_timer *gtk_te;
+	struct timeval cur_tv, diff_tv;
+	guint timeout;
+
+	te = talloc(mem_ctx?mem_ctx:ev, struct tevent_timer);
+	if (te == NULL) return NULL;
+
+	gtk_te = talloc(te, struct gtk_tevent_timer);
+	if (gtk_te == NULL) {
+		talloc_free(te);
+		return NULL;
+	}
+
+	te->event_ctx		= ev;
+	te->next_event		= next_event;
+	te->handler		= handler;
+	te->private_data	= private_data;
+	te->additional_data	= gtk_te;
+
+	cur_tv			= timeval_current();
+	diff_tv			= timeval_until(&cur_tv, &next_event);
+	timeout			= ((diff_tv.tv_usec+999)/1000)+(diff_tv.tv_sec*1000);
+
+	gtk_te->te_id		= g_timeout_add(timeout, gtk_event_timed_handler, te);
+
+	talloc_set_destructor(te, gtk_event_timed_destructor);
+
+	return te;
+}
+
+/*
+  do a single event loop
+*/
+static int gtk_event_loop_once(struct tevent_context *ev)
+{
+	/*
+	 * gtk_main_iteration ()
+	 *
+	 * gboolean    gtk_main_iteration              (void);
+	 *
+	 * Runs a single iteration of the mainloop. If no events 
+	 * are waiting to be processed GTK+ will block until the
+	 * next event is noticed. If you don't want to block look
+	 * at gtk_main_iteration_do() or check if any events are
+	 * pending with gtk_events_pending() first.
+	 * 
+	 * Returns :	TRUE if gtk_main_quit() has been called for the innermost mainloop.
+	 */
+	gboolean ret;
+
+	ret = gtk_main_iteration();
+	if (ret == gtk_true()) {
+		return -1;
+	}
+
+	return 0;
+}
+
+/*
+  return with 0
+*/
+static int gtk_event_loop_wait(struct tevent_context *ev)
+{
+	/*
+	 * gtk_main ()
+	 * 
+	 * void        gtk_main                        (void);
+	 * 
+	 * Runs the main loop until gtk_main_quit() is called.
+	 * You can nest calls to gtk_main(). In that case
+	 * gtk_main_quit() will make the innermost invocation
+	 * of the main loop return. 
+	 */
+	gtk_main();
+	return 0;
+}
+
+static const struct tevent_ops gtk_event_ops = {
+	.context_init	= gtk_event_context_init,
+	.add_fd		= gtk_event_add_fd,
+	.get_fd_flags	= gtk_event_get_fd_flags,
+	.set_fd_flags	= gtk_event_set_fd_flags,
+	.add_timer	= gtk_event_add_timed,
+	.loop_once	= gtk_event_loop_once,
+	.loop_wait	= gtk_event_loop_wait,
+};
+
+int gtk_event_loop(void)
+{
+	int ret;
+
+	tevent_register_backend("gtk", &gtk_event_ops);
+
+	gtk_event_context_global = tevent_context_init_byname(NULL, "gtk");
+	if (!gtk_event_context_global) return -1;
+
+	ret = tevent_loop_wait(gtk_event_context_global);
+
+	talloc_free(gtk_event_context_global);
+
+	return ret;
+}
+
+struct tevent_context *gtk_event_context(void)
+{
+	return gtk_event_context_global;
+}

Added: trunk/samba-gtk/common/select.c
===================================================================
--- trunk/samba-gtk/common/select.c	                        (rev 0)
+++ trunk/samba-gtk/common/select.c	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,311 @@
+/* 
+   Unix SMB/CIFS implementation.
+   SMB-related GTK+ functions
+   
+   Copyright (C) Jelmer Vernooij 2004
+
+   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 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#define _GNU_SOURCE
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <gen_ndr/ndr_samr_c.h>
+#include "common/select.h"
+#include "common/gtk-smb.h"
+#include <credentials.h>
+
+/* GtkSelectDomainDialog */
+
+const char *gtk_select_domain_dialog_get_domain(GtkSelectDomainDialog *d)
+{
+	return gtk_entry_get_text(GTK_ENTRY(d->entry_domain));
+}
+
+static void gtk_select_domain_dialog_init (GtkSelectDomainDialog *select_domain_dialog)
+{
+	GtkWidget *dialog_vbox1;
+	GtkWidget *hbox1;
+	GtkWidget *label1;
+	GtkWidget *scrolledwindow1;
+	GtkWidget *dialog_action_area1;
+	GtkWidget *cancelbutton1;
+	GtkWidget *okbutton1;
+	GtkCellRenderer *renderer;
+	GtkTreeViewColumn *curcol;
+
+	gtk_window_set_title (GTK_WINDOW (select_domain_dialog), "Select Domain");
+
+	dialog_vbox1 = GTK_DIALOG (select_domain_dialog)->vbox;
+
+	hbox1 = gtk_hbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox1, TRUE, TRUE, 0);
+
+	label1 = gtk_label_new ("Domain:");
+	gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0);
+
+	select_domain_dialog->entry_domain = gtk_entry_new ();
+	gtk_box_pack_start (GTK_BOX (hbox1), select_domain_dialog->entry_domain, TRUE, TRUE, 0);
+
+	scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
+	gtk_box_pack_start (GTK_BOX (dialog_vbox1), scrolledwindow1, TRUE, TRUE, 0);
+
+	select_domain_dialog->list_domains = gtk_tree_view_new ();
+	gtk_container_add (GTK_CONTAINER (scrolledwindow1), select_domain_dialog->list_domains);
+
+	curcol = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title(curcol, "Name");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, TRUE);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(select_domain_dialog->list_domains), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 0);
+
+	select_domain_dialog->store_domains = gtk_list_store_new(1, G_TYPE_STRING);
+	gtk_tree_view_set_model(GTK_TREE_VIEW(select_domain_dialog->list_domains), GTK_TREE_MODEL(select_domain_dialog->store_domains));
+	g_object_unref(select_domain_dialog->store_domains);
+
+	dialog_action_area1 = GTK_DIALOG (select_domain_dialog)->action_area;
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
+
+	cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
+	gtk_dialog_add_action_widget (GTK_DIALOG (select_domain_dialog), cancelbutton1, GTK_RESPONSE_CANCEL);
+	GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
+
+	okbutton1 = gtk_button_new_from_stock ("gtk-ok");
+	gtk_dialog_add_action_widget (GTK_DIALOG (select_domain_dialog), okbutton1, GTK_RESPONSE_OK);
+	gtk_widget_show_all(dialog_vbox1);
+	GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
+}
+
+struct policy_handle gtk_select_domain_dialog_get_handle(GtkSelectDomainDialog *d)
+{
+	struct policy_handle h;
+	
+	
+	/* FIXME */
+	return h;
+}
+
+GType gtk_select_domain_dialog_get_type (void)
+{
+	static GType mytype = 0;
+
+	if (!mytype)
+	{
+		static const GTypeInfo myinfo =
+		{
+			sizeof (GtkSelectDomainDialogClass),
+			NULL,
+			NULL,
+			NULL,
+			NULL,
+			NULL,
+			sizeof(GtkSelectDomainDialog),
+			0,
+			(GInstanceInitFunc) gtk_select_domain_dialog_init,
+		};
+
+		mytype = g_type_register_static (GTK_TYPE_DIALOG,
+										 "GtkSelectDomainDialog", &myinfo, 0);
+	}
+
+	return mytype;
+}
+                                                                                                                             
+GtkWidget *gtk_select_domain_dialog_new (struct dcerpc_pipe *sam_pipe)
+{
+	GtkSelectDomainDialog *d = g_object_new(gtk_select_domain_dialog_get_type (), NULL);
+	NTSTATUS status;
+	struct samr_EnumDomains r;
+	struct samr_Connect cr;
+	struct samr_Close dr;
+	struct policy_handle handle;
+	uint32_t resume_handle = 0;
+	int i;
+	TALLOC_CTX *mem_ctx = talloc_init("gtk_select_domain_dialog_new");
+
+	d->sam_pipe = sam_pipe;
+
+	cr.in.system_name = 0;
+	cr.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
+	cr.out.connect_handle = &handle;
+
+	status = dcerpc_samr_Connect(sam_pipe, mem_ctx, &cr);
+	if (!NT_STATUS_IS_OK(status)) {
+		gtk_show_ntstatus(NULL, "Running Connect on SAMR", status);
+		talloc_free(mem_ctx);
+		return GTK_WIDGET(d);
+	}
+
+	r.in.connect_handle = &handle;
+	r.in.resume_handle = &resume_handle;
+	r.in.buf_size = (uint32_t)-1;
+	r.out.resume_handle = &resume_handle;
+
+	status = dcerpc_samr_EnumDomains(sam_pipe, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status)) {
+		gtk_show_ntstatus(NULL, "Enumerating domains", status);
+	} else if (r.out.sam != NULL) {
+		for (i=0;i<(*r.out.sam)->count;i++) {
+			GtkTreeIter iter;
+			gtk_list_store_append(d->store_domains, &iter);
+			gtk_list_store_set (d->store_domains, &iter, 0, (*r.out.sam)->entries[i].name.string, -1);
+		}
+	}
+
+	dr.in.handle = &handle;
+	dr.out.handle = &handle;
+
+	status = dcerpc_samr_Close(sam_pipe, mem_ctx, &dr);
+	if (!NT_STATUS_IS_OK(status)) {
+		gtk_show_ntstatus(NULL, "Closing SAMR connection", status);
+		talloc_free(mem_ctx);
+		return GTK_WIDGET ( d );
+	}
+
+	talloc_free(mem_ctx);
+
+	return GTK_WIDGET ( d );
+}
+
+
+/* GtkSelectHostDialog */
+const char *gtk_select_host_dialog_get_host (GtkSelectHostDialog *d)
+{
+	return gtk_entry_get_text(GTK_ENTRY(d->entry_host));
+}
+
+static void gtk_select_host_dialog_init (GtkSelectHostDialog *select_host_dialog)
+{
+	GtkWidget *dialog_vbox2;
+	GtkWidget *hbox2;
+	GtkWidget *label2;
+	GtkWidget *scrolledwindow2;
+	GtkWidget *dialog_action_area2;
+	GtkWidget *cancelbutton2;
+	GtkWidget *okbutton2;
+
+	gtk_window_set_title (GTK_WINDOW (select_host_dialog), "Select Host");
+
+	dialog_vbox2 = GTK_DIALOG (select_host_dialog)->vbox;
+
+	hbox2 = gtk_hbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (dialog_vbox2), hbox2, TRUE, TRUE, 0);
+
+	label2 = gtk_label_new ("Host");
+	gtk_box_pack_start (GTK_BOX (hbox2), label2, FALSE, FALSE, 0);
+
+	select_host_dialog->entry_host = gtk_entry_new ();
+	gtk_box_pack_start (GTK_BOX (hbox2), select_host_dialog->entry_host, TRUE, TRUE, 0);
+
+	scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
+	gtk_box_pack_start (GTK_BOX (dialog_vbox2), scrolledwindow2, TRUE, TRUE, 0);
+
+	select_host_dialog->tree_host = gtk_tree_view_new ();
+	gtk_container_add (GTK_CONTAINER (scrolledwindow2), select_host_dialog->tree_host);
+
+	select_host_dialog->store_host = gtk_tree_store_new(1, G_TYPE_STRING);
+	gtk_tree_view_set_model(GTK_TREE_VIEW(select_host_dialog->tree_host), GTK_TREE_MODEL(select_host_dialog->store_host));
+	g_object_unref(select_host_dialog->store_host); 
+
+	dialog_action_area2 = GTK_DIALOG (select_host_dialog)->action_area;
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area2), GTK_BUTTONBOX_END);
+
+	cancelbutton2 = gtk_button_new_from_stock ("gtk-cancel");
+	gtk_dialog_add_action_widget (GTK_DIALOG (select_host_dialog), cancelbutton2, GTK_RESPONSE_CANCEL);
+	GTK_WIDGET_SET_FLAGS (cancelbutton2, GTK_CAN_DEFAULT);
+
+	okbutton2 = gtk_button_new_from_stock ("gtk-ok");
+	gtk_widget_show_all (dialog_vbox2);
+	gtk_dialog_add_action_widget (GTK_DIALOG (select_host_dialog), okbutton2, GTK_RESPONSE_OK);
+	GTK_WIDGET_SET_FLAGS (okbutton2, GTK_CAN_DEFAULT);
+}
+
+GType gtk_select_host_dialog_get_type (void)
+{
+	static GType mytype = 0;
+
+	if (!mytype)
+	{
+		static const GTypeInfo myinfo =
+		{
+			sizeof (GtkSelectHostDialogClass),
+			NULL,
+			NULL,
+			NULL,
+			NULL,
+			NULL,
+			sizeof(GtkSelectHostDialog),
+			0,
+			(GInstanceInitFunc) gtk_select_host_dialog_init,
+		};
+
+		mytype = g_type_register_static (GTK_TYPE_DIALOG,
+										 "GtkSelectHostDialog", &myinfo, 0);
+	}
+
+	return mytype;
+}
+                                                                                                                             
+GtkWidget *gtk_select_host_dialog_new (struct dcerpc_pipe *sam_pipe)
+{
+        return GTK_WIDGET ( g_object_new (gtk_select_host_dialog_get_type (), NULL ));
+}
+
+/**
+ * Connect to a specific interface, but ask the user 
+ * for information not specified
+ */
+struct dcerpc_pipe *gtk_connect_rpc_interface(TALLOC_CTX *mem_ctx, 
+					      struct loadparm_context *lp_ctx,
+					      const struct ndr_interface_table *table)
+{
+	GtkRpcBindingDialog *d;
+	NTSTATUS status;
+	struct dcerpc_pipe *pipe;
+	struct cli_credentials *cred;
+	gint result;
+
+	d = SAMBAGTK_RPC_BINDING_DIALOG(gtk_rpc_binding_dialog_new(NULL));
+	result = gtk_dialog_run(GTK_DIALOG(d));
+
+	if (result != GTK_RESPONSE_ACCEPT) {
+		gtk_widget_destroy(GTK_WIDGET(d));
+		return NULL;
+	}
+
+	cred = cli_credentials_init(mem_ctx);
+	cli_credentials_guess(cred, lp_ctx);
+	cli_credentials_set_gtk_callbacks(cred);
+
+	status = dcerpc_pipe_connect_b(mem_ctx, &pipe,
+				       gtk_rpc_binding_dialog_get_binding(d, mem_ctx),
+				       table, cred, NULL, lp_ctx);
+
+	if(!NT_STATUS_IS_OK(status)) {
+		gtk_show_ntstatus(NULL, "While connecting to interface", status);
+		gtk_widget_destroy(GTK_WIDGET(d));
+		talloc_free(cred);
+		return NULL;
+	}
+
+	gtk_widget_destroy(GTK_WIDGET(d));
+	
+	talloc_free(cred);
+
+	return pipe;
+}

Added: trunk/samba-gtk/common/select.h
===================================================================
--- trunk/samba-gtk/common/select.h	                        (rev 0)
+++ trunk/samba-gtk/common/select.h	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,87 @@
+/* 
+   Unix SMB/CIFS implementation.
+   SMB-related GTK+ functions
+   
+   Copyright (C) Jelmer Vernooij 2004
+
+   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 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __GTK_SELECT_H__
+#define __GTK_SELECT_H__
+
+#define GTK_DISABLE_DEPRECATED
+#include <gtk/gtk.h>
+
+typedef struct _GtkSelectDomainDialog GtkSelectDomainDialog;
+
+struct _GtkSelectDomainDialog 
+{
+	GtkDialog dialog;
+	GtkWidget *entry_domain;
+	GtkWidget *list_domains;
+	GtkListStore *store_domains;
+	TALLOC_CTX *mem_ctx;
+	struct dcerpc_pipe *sam_pipe;
+};
+
+typedef struct _GtkSelectDomainDialogClass GtkSelectDomainDialogClass;
+
+struct _GtkSelectDomainDialogClass
+{
+	GtkDialogClass parent_class;
+};
+
+#define GTK_SELECT_DOMAIN_DIALOG(obj)          G_TYPE_CHECK_INSTANCE_CAST(obj, gtk_select_domain_dialog_get_type (), GtkSelectDomainDialog)
+#define GTK_SELECT_DOMAIN_DIALOG_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_select_domain_dialog_class_get_type (), GtkSelectDomainDialogClass)
+#define IS_GTK_SELECT_DOMAIN_DIALOG(obj)       GTK_CHECK_TYPE (obj, gtk_select_domain_dialog_get_type ())
+
+typedef struct _GtkSelectHostDialog GtkSelectHostDialog;
+
+struct _GtkSelectHostDialog 
+{
+	GtkDialog dialog;
+	GtkWidget *entry_host;
+	GtkWidget *tree_host;
+	GtkTreeStore *store_host;
+	struct dcerpc_pipe *sam_pipe;
+	TALLOC_CTX *mem_ctx;
+};
+
+typedef struct _GtkSelectHostDialogClass GtkSelectHostDialogClass;
+
+struct _GtkSelectHostDialogClass
+{
+	GtkDialogClass parent_class;
+};
+
+#define GTK_SELECT_HOST_DIALOG(obj)          G_TYPE_CHECK_INSTANCE_CAST(obj, gtk_select_host_dialog_get_type (), GtkSelectHostDialog)
+#define GTK_SELECT_HOST_DIALOG_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_select_host_dialog_class_get_type (), GtkSelectHostDialogClass)
+#define IS_GTK_SELECT_HOST_DIALOG(obj)       GTK_CHECK_TYPE (obj, gtk_select_host_dialog_get_type ())
+
+GtkWidget *gtk_select_domain_dialog_new (struct dcerpc_pipe *sam_pipe);
+GType gtk_select_domain_dialog_get_type (void);
+struct policy_handle gtk_select_domain_dialog_get_handle(GtkSelectDomainDialog *d);
+GtkWidget *gtk_select_host_dialog_new (struct dcerpc_pipe *sam_pipe);
+const char *gtk_select_host_dialog_get_host (GtkSelectHostDialog *d);
+GType gtk_select_host_dialog_get_type (void);
+
+struct ndr_interface_table;
+struct loadparm_context;
+struct dcerpc_pipe *gtk_connect_rpc_interface(TALLOC_CTX *mem_ctx, 
+					      struct loadparm_context *lp_ctx,
+					      const struct ndr_interface_table *table);
+
+#endif

Added: trunk/samba-gtk/configure.ac
===================================================================
--- trunk/samba-gtk/configure.ac	                        (rev 0)
+++ trunk/samba-gtk/configure.ac	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,46 @@
+AC_INIT(samba-gtk, 0.0.1, [jelmer at samba.org])
+AC_CONFIG_HEADER([config.h])
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PATH_PROG(XSLTPROC, xsltproc)
+AC_PATH_PROG(DESKTOP_VALIDATE, desktop-file-validate)
+
+PKG_CHECK_MODULES(GTK, [glib-2.0 gtk+-2.0 >= 2.4])
+PKG_CHECK_MODULES(TALLOC, [talloc])
+PKG_CHECK_MODULES(DCERPC, [dcerpc])
+PKG_CHECK_MODULES(GENSEC, [gensec])
+PKG_CHECK_MODULES(DCERPC_SAMR, [dcerpc_samr])
+PKG_CHECK_MODULES(DCERPC_ATSVC, [dcerpc_atsvc])
+PKG_CHECK_MODULES(REGISTRY, [registry])
+PKG_CHECK_MODULES(PYGTK, [pygtk-2.0])
+PKG_CHECK_MODULES(KEYRING, [gnome-keyring-1],
+				  [ AC_DEFINE(HAVE_GNOME_KEYRING, 1, [Whether GNOME keyring is available]) ])
+
+AC_ARG_VAR([PYTHON_VERSION],[The installed Python
+	version to use, for example '2.3'. This string 
+	will be appended to the Python interpreter
+	canonical name.])
+
+AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
+if test -z "$PYTHON"; then
+	AC_MSG_WARN([No python found])
+fi
+
+if test -z "$PYTHON_VERSION"; then 
+	AC_PATH_PROGS([PYTHON_CONFIG], [python2.6-config python2.5-config python2.4-config python-config])
+else 
+	AC_PATH_PROG([PYTHON_CONFIG], [python[$PYTHON_VERSION]-config])
+fi
+
+if test -z "$PYTHON_CONFIG"; then
+	AC_MSG_WARN([No python-config found])
+fi
+
+AC_MSG_CHECKING(python library directory)
+pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1, 0, '\\${prefix}')"`
+AC_MSG_RESULT($pythondir)
+
+AC_SUBST(pythondir)
+
+AC_CONFIG_FILES([Makefile.settings gtksamba.pc])
+AC_OUTPUT

Modified: trunk/samba-gtk/debian/changelog
===================================================================
--- trunk/samba-gtk/debian/changelog	2009-04-14 14:55:11 UTC (rev 2700)
+++ trunk/samba-gtk/debian/changelog	2009-04-14 15:00:11 UTC (rev 2701)
@@ -1,4 +1,4 @@
-samba-gtk (0.0.1~git20090125-1) experimental; urgency=low
+samba-gtk (0.0.1~bzr19-1) experimental; urgency=low
 
   * Initial release. (Closes: #413822)
 

Added: trunk/samba-gtk/gepdump
===================================================================
--- trunk/samba-gtk/gepdump	                        (rev 0)
+++ trunk/samba-gtk/gepdump	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,271 @@
+#!/usr/bin/python
+#   Unix SMB/CIFS implementation.
+#   GTK+ Endpoint Mapper frontend
+#   
+#   Copyright (C) Jelmer Vernooij 2004
+#
+#   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 3 of the License, or
+#   (at your option) any later version.
+#   
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#   
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software
+#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+# 
+# * Show: 
+# *  - RPC statistics
+# *  - Available interfaces
+# *   - Per interface: available endpoints
+# *   - Per interface auth details
+#
+
+import gtk, gobject
+import sambagtk
+from samba.dcerpc import mgmt, epmapper
+
+protocol_names = {
+    epmapper.EPM_PROTOCOL_UUID: "UUID",
+    epmapper.EPM_PROTOCOL_NCACN: "NCACN",
+    epmapper.EPM_PROTOCOL_NCALRPC: "NCALRPC",
+    epmapper.EPM_PROTOCOL_NCADG: "NCADG",
+    epmapper.EPM_PROTOCOL_IP: "IP",
+    epmapper.EPM_PROTOCOL_TCP: "TCP",
+    epmapper.EPM_PROTOCOL_NETBIOS: "NetBIOS",
+    epmapper.EPM_PROTOCOL_SMB: "SMB",
+    epmapper.EPM_PROTOCOL_PIPE: "PIPE",
+    epmapper.EPM_PROTOCOL_UNIX_DS: "Unix",
+}
+
+def get_protocol_name(protocol):
+    return protocol_names.get(protocol, "Unknown")
+
+
+class EndpointBrowser(gtk.Window):
+
+    def _on_quit1_activate (self, menuitem):
+        gtk.main_quit()
+
+    def _on_about1_activate(self, menuitem):
+        aboutwin = sambagtk.AboutDialog("gepdump")
+        aboutwin.run()
+        aboutwin.destroy()
+
+    def add_epm_entry(self, annotation, t):
+        bd = t.as_binding_string()
+        store_eps.append((0, annotation, 1, str(bd), 2, t))
+
+        for floor in t.floors:
+            if floor.lhs.protocol == EPM_PROTOCOL_UUID:
+                data = str(floor.get_lhs_data().uuid)
+            else:
+                data = floor.get_rhs_data()
+            
+            store_eps.append((0, get_protocol_name(floor.lhs.protocol), 1, data, -1))
+
+    def refresh_eps(self):
+        store_eps.clear()
+
+        handle = None
+        num_ents = max_ents = 10
+
+        while num_ents == max_ents:
+            (handle, num_ents, ents) = epmapper_pipe.Lookup(inquiry_type=0, 
+                object=uuid, interface_id=iface, vers_option=0, 
+                entry_handle=handle, max_ents=max_ents)
+            for ent in ents:
+                self.add_epm_entry(ent.annotation, ent.tower.tower)
+
+    def _on_refresh_clicked(self, btn):
+        self.refresh_eps()
+
+    def _on_connect_clicked(self, btn):
+        self._epmapper_pipe = sambagtk.RpcConnectDialog(epmapper.epmapper)
+
+        mnu_refresh.set_sensitive(True)
+
+        refresh_eps()
+
+        self._mgmt_pipe = mgmt.mgmt(self._epmapper_pipe)
+
+    def _on_eps_select(self, selection, model, path, path_currently_selected, data):
+        # Do an InqStats call
+        statistics = mgmt_pipe.inq_stats(max_count=MGMT_STATS_ARRAY_MAX_SIZE, 
+                                         unknown=0)
+
+        if statistics.count != MGMT_STATS_ARRAY_MAX_SIZE:
+            raise Exception("Unexpected array size %d" % statistics.count)
+
+        self._lbl_calls_in.set_text("%6d" % statistics[mgmt.MGMT_STATS_CALLS_IN])
+        self._lbl_calls_out.set_text("%6d" % statistics[mgmt.MGMT_STATS_CALLS_OUT])
+        self._lbl_pkts_in.set_text("%wd" % statistics[mgmt.MGMT_STATS_PKTS_IN])
+        self._lbl_pkts_out.set_text("%6d" % statistics[mgmt.MGMT_STATS_PKTS_OUT])
+
+        self._store_princ_names.clear()
+
+        for i in range(100):
+            princ_name = mgmt_pipe.inq_princ_name(authn_proto=i, princ_name_size=100)
+            name = gensec_get_name_by_authtype(i)
+            if name is not None:
+                protocol = "%u (%s)" % (i, name)
+            else:
+                protocol = "%u" % i
+
+            self._store_princ_names.append((0, protocol, 1, princ_name))
+
+        return True
+
+    def __init__(self):
+        super(EndpointBrowser, self).__init__()
+        self._create()
+
+    def _create(self):
+        accel_group = gtk.AccelGroup()
+
+        self.set_title("Gtk+ Endpoint Mapper Viewer")
+
+        vbox1 = gtk.VBox(False, 0)
+        vbox1.show()
+        self.add(vbox1)
+
+        menubar1 = gtk.MenuBar()
+        menubar1.show()
+        vbox1.pack_start(menubar1, False, False, 0)
+
+        menuitem1 = gtk.MenuItem ("_File")
+        menuitem1.show()
+        menubar1.add(menuitem1)
+
+        menuitem1_menu = gtk.Menu()
+        menuitem1.set_submenu (menuitem1_menu)
+
+        mnu_connect = gtk.MenuItem ("_Connect")
+        menuitem1_menu.add(mnu_connect)
+
+        mnu_refresh = gtk.MenuItem ("_Refresh")
+        menuitem1_menu.add(mnu_refresh)
+        mnu_refresh.set_sensitive(False)
+
+        quit1 = gtk.ImageMenuItem(gtk.STOCK_QUIT, accel_group)
+        menuitem1_menu.add(quit1)
+
+        menuitem4 = gtk.MenuItem ("_Help")
+        menubar1.add(menuitem4)
+
+        menuitem4_menu = gtk.Menu()
+        menuitem4.set_submenu (menuitem4_menu)
+
+        about1 = gtk.MenuItem ("_About")
+        menuitem4_menu.add(about1)
+
+        hbox2 = gtk.HBox(False, 0)
+        vbox1.add(hbox2)
+
+        scrolledwindow1 = gtk.ScrolledWindow(None, None)
+        hbox2.pack_start(scrolledwindow1, True, True, 0)
+
+        tree_eps = gtk.TreeView()
+
+        curcol = gtk.TreeViewColumn()
+        curcol.set_title("Name")
+        renderer = gtk.CellRendererText()
+        curcol.pack_start(renderer, True)
+
+        tree_eps.append_column(curcol)
+        curcol.add_attribute(renderer, "text", 0)
+
+        curcol = gtk.TreeViewColumn()
+        curcol.set_title("Binding String")
+        renderer = gtk.CellRendererText()
+        curcol.pack_start(renderer, True)
+        curcol.add_attribute(renderer, "text", 1)
+
+
+        tree_eps.append_column(curcol)
+
+        store_eps = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_POINTER)
+        tree_eps.set_model(store_eps)
+
+        scrolledwindow1.add(tree_eps)
+
+        tree_eps.get_selection().set_select_function(self._on_eps_select, None, None)
+
+        vbox2 = gtk.VBox(False, 0)
+        hbox2.add(vbox2)
+
+        frame1 = gtk.Frame("Interface")
+        vbox2.add(frame1)
+
+        vbox3 = gtk.VBox(False, 0)
+        frame1.add(vbox3)
+        lbl_iface_uuid = gtk.Label("")
+        vbox3.add(lbl_iface_uuid)
+        lbl_iface_version = gtk.Label("")
+        vbox3.add(lbl_iface_version)
+        lbl_iface_name = gtk.Label("")
+        vbox3.add(lbl_iface_name)
+
+        frame1 = gtk.Frame("Statistics")
+        vbox2.add(frame1)
+
+        table_statistics = gtk.Table(4, 2, True)
+        frame1.add(table_statistics)
+
+        table_statistics.attach(gtk.Label("Calls In: "), 0, 1, 0, 1)
+        lbl_calls_in = gtk.Label("")
+        table_statistics.attach(lbl_calls_in, 1, 2, 0, 1)
+        table_statistics.attach(gtk.Label("Calls Out: "), 0, 1, 1, 2)
+        lbl_calls_out = gtk.Label("")
+        table_statistics.attach(lbl_calls_out, 1, 2, 1, 2)
+        table_statistics.attach(gtk.Label("Packets In: "), 0, 1, 2, 3)
+        lbl_pkts_in = gtk.Label("")
+        table_statistics.attach(lbl_pkts_in, 1, 2, 2, 3)
+        table_statistics.attach(gtk.Label("Packets Out: "), 0, 1, 3, 4)
+        lbl_pkts_out = gtk.Label("")
+        table_statistics.attach(lbl_pkts_out, 1, 2, 3, 4)
+        
+        frame1 = gtk.Frame("Authentication")
+        vbox2.add(frame1)
+
+        self._treeview_princ_names = gtk.TreeView()
+
+        curcol = gtk.TreeViewColumn()
+        curcol.set_title("Protocol")
+        renderer = gtk.CellRendererText()
+        curcol.pack_start(renderer, True)
+        self._treeview_princ_names.append_column(curcol)
+        curcol.add_attribute(renderer, "text", 0)
+
+        curcol = gtk.TreeViewColumn()
+        curcol.set_title("Principal Name")
+        renderer = gtk.CellRendererText()
+        curcol.pack_start(renderer, True)
+        self._treeview_princ_names.append_column(curcol)
+        curcol.add_attribute(renderer, "text", 1)
+
+        frame1.add(self._treeview_princ_names)
+
+        self._store_princ_names = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_POINTER)
+        self._treeview_princ_names.set_model(self._store_princ_names)
+
+        statusbar = gtk.Statusbar()
+        vbox1.pack_start (statusbar, False, False, 0)
+
+        quit1.connect("activate", self._on_quit1_activate)
+        about1.connect("activate", self._on_about1_activate)
+        mnu_connect.connect ("activate", self._on_connect_clicked)
+        mnu_refresh.connect ("activate", self._on_refresh_clicked)
+
+        self.add_accel_group (accel_group)
+
+
+mainwin = EndpointBrowser()
+mainwin.show_all()
+gtk.main()


Property changes on: trunk/samba-gtk/gepdump
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/samba-gtk/gregedit
===================================================================
--- trunk/samba-gtk/gregedit	                        (rev 0)
+++ trunk/samba-gtk/gregedit	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,620 @@
+#!/usr/bin/python
+#
+#   Unix SMB/CIFS implementation.
+#   GTK+ registry frontend
+#   
+#   Copyright (C) Jelmer Vernooij 2004-2005
+#
+#   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 3 of the License, or
+#   (at your option) any later version.
+#   
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#   
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software
+#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+import gtk
+import sambagtk
+from samba import registry
+
+class FindDialog(gtk.Dialog):
+	def _create(self):
+		self.set_title("Find Key or Value")
+		self.set_resizable(False)
+		self.set_type_hint(GDK_WINDOW_TYPE_HINT_DIALOG)
+
+		dialog_vbox2 = GTK_DIALOG (FindDialog).vbox
+
+		vbox1 = gtk_vbox_new (False, 0)
+		gtk_box_pack_start (GTK_BOX (dialog_vbox2), vbox1, True, True, 0)
+
+		hbox1 = gtk.HBox(False, 0)
+		gtk_box_pack_start (GTK_BOX (vbox1), hbox1, True, True, 0)
+
+		label6 = gtk.Label("Find String")
+		gtk_box_pack_start (GTK_BOX (hbox1), label6, False, False, 0)
+
+		entry_pattern = gtk_entry_new ()
+		gtk_box_pack_start (GTK_BOX (hbox1), entry_pattern, True, True, 0)
+
+		frame3 = gtk_frame_new (NULL)
+		gtk_box_pack_start (GTK_BOX (vbox1), frame3, True, True, 0)
+		gtk_frame_set_shadow_type (GTK_FRAME (frame3), GTK_SHADOW_NONE)
+
+		alignment3 = gtk_alignment_new (0.5, 0.5, 1, 1)
+		gtk_container_add (GTK_CONTAINER (frame3), alignment3)
+		gtk_alignment_set_padding (GTK_ALIGNMENT (alignment3), 0, 0, 12, 0)
+
+		vbox2 = gtk_vbox_new (False, 0)
+		gtk_container_add (GTK_CONTAINER (alignment3), vbox2)
+
+		checkbutton1 = gtk_check_button_new_with_mnemonic ("_Key Names")
+		gtk_box_pack_start (GTK_BOX (vbox2), checkbutton1, False, False, 0)
+
+		checkbutton2 = gtk_check_button_new_with_mnemonic ("_Value Names")
+		gtk_box_pack_start (GTK_BOX (vbox2), checkbutton2, False, False, 0)
+
+		checkbutton3 = gtk_check_button_new_with_mnemonic ("Value _Data")
+		gtk_box_pack_start (GTK_BOX (vbox2), checkbutton3, False, False, 0)
+
+		label7 = gtk.Label("<b>Search in</b>")
+		gtk_frame_set_label_widget (GTK_FRAME (frame3), label7)
+		gtk_label_set_use_markup (GTK_LABEL (label7), True)
+
+		dialog_action_area2 = GTK_DIALOG (FindDialog).action_area
+		gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area2), GTK_BUTTONBOX_END)
+
+		cancelbutton2 = gtk_button_new_from_stock ("gtk-cancel")
+		gtk_dialog_add_action_widget (GTK_DIALOG (FindDialog), cancelbutton2, GTK_RESPONSE_CANCEL)
+		GTK_WIDGET_SET_FLAGS (cancelbutton2, GTK_CAN_DEFAULT)
+
+		okbutton2 = gtk_button_new_from_stock ("gtk-ok")
+		gtk_dialog_add_action_widget (GTK_DIALOG (FindDialog), okbutton2, GTK_RESPONSE_OK)
+		GTK_WIDGET_SET_FLAGS (okbutton2, GTK_CAN_DEFAULT)
+
+		gtk_widget_show_all (dialog_vbox2)
+
+		return FindDialog
+
+
+class SetValueDialog(gtk.Dialog):
+
+	def __init__(self):
+		super(SetValueDialog, self).__init__()
+		SetValueDialog = gtk_dialog_new ()
+		self.set_title("Set Registry Value")
+		self.set_position(GTK_WIN_POS_CENTER)
+		self.set_resizable(False)
+		self.set_type_hint(GDK_WINDOW_TYPE_HINT_DIALOG)
+
+		table1 = gtk_table_new (3, 2, False)
+		self.vbox.pack_start(table1, True, True, 0)
+
+		label3 = gtk.Label("Value name:")
+		table1.attach (label3, 0, 1, 0, 1,
+						GTK_FILL,
+						0, 0, 0)
+		label3.set_alignment (0, 0.5)
+
+		label4 = gtk.Label("Data Type:")
+		table1.attach (label4, 0, 1, 1, 2,
+						GTK_FILL, 0, 0, 0)
+		label4.set_alignment(0, 0.5)
+
+		label5 = gtk.Label("Data:")
+		table1.attach (label5, 0, 1, 2, 3,
+						GTK_FILL,
+						0, 0, 0)
+		label5.set_alignment(0, 0.5)
+
+		entry_name = entry_value_name = gtk.Entry()
+		table1.attach (entry_value_name, 1, 2, 0, 1,
+						GTK_EXPAND | GTK_FILL,
+						0, 0, 0)
+
+		entry_data = value_data = gtk_entry_new ()
+		table1.attach (value_data, 1, 2, 2, 3,
+						GTK_EXPAND | GTK_FILL,
+						0, 0, 0)
+
+		entry_type = combo_data_type = gtk.ComboBox()
+
+		gtk_combo_box_append_text((combo_data_type), "REG_NONE")
+		gtk_combo_box_append_text((combo_data_type), "REG_SZ")
+		gtk_combo_box_append_text((combo_data_type), "REG_EXPAND_SZ")
+		gtk_combo_box_append_text((combo_data_type), "REG_BINARY")
+		gtk_combo_box_append_text((combo_data_type), "REG_DWORD_LE")
+		gtk_combo_box_append_text((combo_data_type), "REG_DWORD_BE")
+
+		table1.attach (combo_data_type, 1, 2, 1, 2,
+						GTK_FILL,
+						GTK_FILL, 0, 0)
+
+		dialog_action_area1 = self.action_area
+		dialog_action_area1.set_layout(GTK_BUTTONBOX_END)
+
+		cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel")
+		gtk_dialog_add_action_widget (GTK_DIALOG (SetValueDialog), cancelbutton1, GTK_RESPONSE_CANCEL)
+		cancelbutton1.set_flags(GTK_CAN_DEFAULT)
+
+		okbutton1 = gtk_button_new_from_stock ("gtk-ok")
+		self.add_action_widget(okbutton1, GTK_RESPONSE_OK)
+		okbutton1.set_flags(GTK_CAN_DEFAULT)
+
+		gtk_widget_show_all(self.vbox)
+
+
+
+class NewKeyDialog(gtk.Dialog):
+	def __init__(self):
+		super(NewKeyDialog, self).__init__()
+		self.set_title("New Registry Key")
+		self.set_position(GTK_WIN_POS_CENTER)
+		self.set_resizable(False)
+		self.set_type_hint(GDK_WINDOW_TYPE_HINT_DIALOG)
+
+		dialog_vbox2 = self.vbox
+
+		hbox1 = gtk.HBox(False, 0)
+		dialog_vbox2.pack_start(hbox1, True, True, 0)
+
+		label6 = gtk.Label("Name:")
+		hbox1.pack_start(label6, False, False, 0)
+
+		entry_key_name = gtk.Entry()
+		hbox1.pack_start (entry_key_name, True, True, 0)
+
+		dialog_action_area2 = self.action_area
+		dialog_action_area2.set_layout(GTK_BUTTONBOX_END)
+
+		name_entry = entry_key_name
+
+		cancelbutton2 = gtk_button_new_from_stock ("gtk-cancel")
+		self.add_action_widget (cancelbutton2, GTK_RESPONSE_CANCEL)
+		cancelbutton2.set_flags(GTK_CAN_DEFAULT)
+
+		okbutton2 = gtk_button_new_from_stock ("gtk-ok")
+		self.add_action_widget (okbutton2, GTK_RESPONSE_OK)
+		okbutton2.set_flags(GTK_CAN_DEFAULT)
+
+		dialog_vbox2.show_all()
+
+
+def expand_key(treeview, parent, arg2):
+	firstiter = store_keys.iter_children(parent)
+
+	# See if this row has ever had a name gtk_tree_store_set()'ed to it.
+    #   	   If not, read the directory contents 
+	name = store_keys.get(firsiter, 0)
+
+	if name is not None:
+		return
+
+	k = store_keys.get(parent, 1)
+
+	for(i = 0; W_ERROR_IS_OK(error = reg_key_get_subkey_by_index( k, i, &subname, NULL, NULL)); i++) {
+		uint32_t count
+
+		reg_open_key(k, subname, &sub)
+
+		# Replace the blank child with the first directory entry
+        # You may be tempted to remove the blank child node and then 
+        # append a new one.  Don't.  If you remove the blank child 
+        # node GTK gets confused and won't expand the parent row. 
+
+		if i == 0:
+			iter = firstiter
+		else:
+			gtk_tree_store_append(store_keys, &iter, parent)
+		gtk_tree_store_set(store_keys, &iter, 
+						0, subname,
+						1, sub,
+						-1)
+		
+		if (W_ERROR_IS_OK(reg_key_get_info(sub, NULL, &count, NULL, NULL, NULL, NULL, NULL)) && count > 0) 
+			gtk_tree_store_append(store_keys, &tmpiter, &iter)
+	}
+
+	if (!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) { 
+		gtk_show_werror(mainwin, "While enumerating subkeys", error)
+	}
+
+	def load_hive(self, root, name):
+		store_vals.clear()
+
+		# Add the root */
+		store_keys.append(0, name or "", 1, root, -1)
+
+		save.set_sensitive(True)
+		save_as.set_sensitive(True)
+
+	def load_root(self):
+		if registry is None:
+			return
+		store_vals.clear()
+		store_keys.clear()
+
+		for (i = HKEY_CLASSES_ROOT; i <= HKEY_PERFORMANCE_NLSTEXT; i++):
+			if (!W_ERROR_IS_OK(reg_get_predefined_key(registry, i, &root))) { continue; }
+
+			self.load_hive(root, reg_get_predef_name(i))
+
+	def on_open_file_activate (self, menuitem):
+		openfilewin = create_openfilewin(NULL)
+
+		result = openfilewin.run()
+
+		if result == GTK_RESPONSE_ACCEPT:
+			filename = openfilewin.get_filename()
+			error = reg_open_hive(NULL, filename, NULL, NULL, gtk_event_context(), lp_ctx, &hive_root)
+
+			reg_root = reg_import_hive_key(registry, hive_root, -1, NULL)
+
+			mainwin.set_title("Registry Editor - %s" % filename)
+			store_keys.clear()
+			self.load_hive(reg_root, filename)
+
+		openfilewin.destroy()
+
+	def on_open_local_activate(self, menuitem):
+		registry = samba.registry.open_local()
+		self.load_root()
+
+	def on_open_remote_activate(self, menuitem):
+		rpcwin = RpcConnectDialog()
+		result = rpcwin.run()
+		
+		if result != GTK_RESPONSE_ACCEPT:
+			rpcwin.destroy()
+			return
+
+		creds = Credentials()
+		creds.guess(lp_ctx)
+		cli_credentials_set_gtk_callbacks(creds)
+
+		registry = samba.registry.open_remote(creds, lp_ctx, 
+					rpcwin.get_binding_string())
+
+		tmp = "Registry Editor - Remote Registry at %s" % rpcwin.get_host()
+		self.set_title (tmp)
+
+		self.load_root()
+
+		rpcwin.destroy()
+
+	def on_save_as_activate(self, menuitem):
+		error = WERR_OK
+		savefilewin = create_savefilewin(NULL)
+		result = savefilewin.run()
+		if result == GTK_RESPONSE_ACCEPT:
+		# FIXME:		error = reg_dump(registry, gtk_file_selection_get_filename(GTK_FILE_SELECTION(savefilewin))); 
+			if (!W_ERROR_IS_OK(error)) {
+				gtk_show_werror(mainwin, "Error while saving as", error)
+			}
+		savefilewin.destroy()
+
+	def on_quit_activate(self, menuitem):
+		gtk.main_quit()
+
+	def on_delete_value_activate(self, menuitem):
+		if tree_vals.get_selected() is None:
+			return
+
+		gtk_tree_model_get(store_vals, &iter, 0, &value, -1)
+		
+		reg_del_value(current_key, value)
+
+	def on_delete_key_activate(self, menuitem):
+
+		if (!gtk_tree_selection_get_selected (gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_keys)), NULL, &iter)) {
+			return
+		}
+
+		if (!gtk_tree_model_iter_parent(GTK_TREE_MODEL(store_keys), &parentiter, &iter)) {
+			return
+		}
+		
+		gtk_tree_model_get(GTK_TREE_MODEL(store_keys), &parentiter, 1, 
+						   &parent_key, -1)
+		
+		# FIXME 
+		# reg_key_del(parent_key, current_key->name); 
+
+	def on_add_key_activate(self, menuitem, user_data):
+		addwin = NewKeyDialog()
+		result = addwin.run()
+
+		if result == GTK_RESPONSE_OK:
+			newkey = reg_key_add_name(current_key, entry.get_text())
+
+		addwin.destroy()
+
+	def on_value_activate(self, treeview, arg1, arg2):
+		addwin = SetValueDialog(&entry_type, &entry_value)
+
+		iter = store_vals.get_iter(arg1)
+
+		valname = store_vals.get(iter, 0)
+		valdesc = store_vals.get(iter, 2)
+		valtype = store_vals.get(iter, 3)
+
+		addwin.entry_name.set_sensitive(False)
+		entry_name.set_text(valname)
+		entry_value.set_text(valdesc)
+		addwin.entry_type.set_active(valtype)
+		
+		result = addwin.run()
+		if result == GTK_RESPONSE_OK):
+			(data_type, data) = reg_string_to_val(str_regtype(entry_type.get_active(), entry_value.get_text())
+			
+			reg_val_set(current_key, entry_name.get_text(), data_type, data)
+		addwin.destroy()
+
+	def on_set_value_activate(self, menuitem, user_data):
+		addwin = SetValueDialog()
+		result = addwin.run()
+		if result == GTK_RESPONSE_OK:
+			(data_type, data) = reg_string_to_val(str_regtype(entry_type.get_active()), entry_value.get_text())
+			
+			reg_val_set(current_key, entry_name.get_text(), data_type, data)
+		addwin.destroy()
+
+	def on_find_activate(self, menuitem, user_data):
+		findwin = FindDialog()
+		# gint result = gtk_dialog_run(findwin)
+		# FIXME 
+		# gtk_widget_destroy(GTK_WIDGET(findwin))
+
+	def on_about_activate(self, menuitem):
+		aboutwin = sambagtk.AboutDialog("gregedit")
+		aboutwin.run()
+		aboutwin.destroy()
+
+	def on_key_activate(self, selection, model, path, path_currently_selected, data):
+		mnu_add_key.set_sensitive(!path_currently_selected)
+		mnu_set_value.set_sensitive(!path_currently_selected)
+		mnu_del_key.set_sensitive(!path_currently_selected)
+		mnu_del_value.set_sensitive(!path_currently_selected)
+		mnu_find.set_sensitive(!path_currently_selected)
+
+		if path_currently_selected:
+			current_key = None
+			return True
+
+		parent = store_keys.get_iter(path)
+		k = store_keys.get(parent, 1, -1)
+
+		current_key = k
+
+		if k is None:
+			return False
+
+		store_vals.clear()
+
+		for(i = 0; W_ERROR_IS_OK(error = reg_key_get_value_by_index(k, i, &valname, &valtype, &valdata)); i++) {
+			GtkTreeIter iter
+			gtk_list_store_append(store_vals, &iter)
+			gtk_list_store_set (store_vals, &iter, 
+					0, valname,
+					1, str_regtype(valtype),
+					2, reg_val_data_string(iconv_convenience, valtype, valdata),
+					3, valtype,
+					-1)
+		}
+
+		if (!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) {
+			 gtk_show_werror(mainwin, "Error while enumerating values",  error)
+			 return False
+		}
+		return True
+
+def create_mainwindow():
+	accel_group = gtk.AccelGroup()
+
+	mainwin = gtk_window_new (gtk.WINDOW_TOPLEVEL)
+	mainwin.set_title ("Registry editor")
+	mainwin.set_default_size (642, 562)
+
+	vbox1 = gtk_vbox_new (False, 0)
+	mainwin.add(vbox1)
+
+	menubar = gtk_menu_bar_new ()
+	vbox1.pack_start(menubar, False, False, 0)
+
+	menu_file = gtk_menu_item_new_with_mnemonic ("_File")
+	menubar.add(menu_file)
+
+	menu_file_menu = gtk_menu_new ()
+	menu_file.set_submenu (menu_file_menu)
+
+	open_local = gtk_menu_item_new_with_mnemonic ("Open _Local")
+	menu_file_menu.add( open_local)
+	open_local.connect("activate", self.on_open_local_activate)
+
+	open_remote = gtk_menu_item_new_with_mnemonic ("Open _Remote")
+	menu_file_menu.add(open_remote)
+
+	open_remote.connect("activate", self.on_open_remote_activate)
+
+	separatormenuitem1 = gtk_menu_item_new ()
+	menu_file_menu.add(separatormenuitem1)
+	separatormenuitem1.set_sensitive(False)
+
+	open_file = gtk_image_menu_item_new_with_mnemonic("Open _Hive File")
+	menu_file_menu.add(open_file)
+
+	open_file.connect("activate", self.on_open_file_activate)
+
+	separatormenuitem1 = gtk_menu_item_new ()
+	menu_file_menu.add(separatormenuitem1)
+	separatormenuitem1.set_sensitive(False)
+
+	save = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group)
+	save.set_sensitive(False)
+	menu_file_menu.add(save)
+
+	save_as = gtk_image_menu_item_new_from_stock ("gtk-save-as", accel_group)
+	save_as.set_sensitive(False )
+	menu_file_menu.add(save_as)
+
+	separatormenuitem1 = gtk_menu_item_new ()
+	menu_file_menu.add(separatormenuitem1)
+	separatormenuitem1.set_sensitive(False)
+
+	quit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group)
+	menu_file_menu.add(quit)
+
+	men_key = gtk_menu_item_new_with_mnemonic ("_Key")
+	menubar.add(men_key)
+
+	men_key_menu = gtk_menu_new ()
+	men_key.set_submenu(men_key_menu)
+
+	mnu_add_key = gtk_image_menu_item_new_with_mnemonic("Add _Subkey")
+	mnu_add_key.set_image(gtk_image_new_from_stock("gtk-add", GTK_ICON_SIZE_MENU))
+
+	mnu_add_key.set_sensitive(False)
+	men_key_menu.add(mnu_add_key)
+
+	mnu_set_value = gtk_image_menu_item_new_with_mnemonic("Set _Value")
+	mnu_set_value.set_sensitive(False)
+	mnu_set_value.set_image(gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU))
+	men_key_menu.add(mnu_set_value)
+
+	mnu_find = gtk_image_menu_item_new_from_stock ("gtk-find", accel_group)
+	mnu_find.set_sensitive(False)
+	men_key_menu.add(mnu_find)
+
+	mnu_del_key = gtk_image_menu_item_new_with_mnemonic ("Delete Key"); 
+	gtk_widget_set_sensitive(mnu_del_key, False)
+	mnu_del_value.set_image(gtk_image_new_from_stock ("gtk-delete", GTK_ICON_SIZE_MENU))
+	men_key_menu.add(mnu_del_key)
+
+	mnu_del_value = gtk_image_menu_item_new_with_mnemonic ("Delete Value"); 
+	mnu_del_value.set_sensitive(False)
+	mnu_del_value.set_image(gtk_image_new_from_stock ("gtk-delete", GTK_ICON_SIZE_MENU))
+	men_key_menu.add(mnu_del_value)
+
+	help = gtk_menu_item_new_with_mnemonic ("_Help")
+	menubar.add(help)
+
+	help_menu = gtk_menu_new ()
+	help.set_submenu(help_menu)
+
+	about = gtk_menu_item_new_with_mnemonic ("_About")
+	help_menu.add(about)
+
+	hbox1 = gtk.HBox(False, 0)
+	vbox1.pack_start(hbox1, True, True, 0)
+
+	scrolledwindow1 = gtk.ScrolledWindow(NULL, NULL)
+	hbox1.pack_start(scrolledwindow1, True, True, 0)
+
+	tree_keys = gtk.TreeView()
+
+	# Column names
+	curcol = gtk.TreeViewColumn()
+	curcol.set_title("Name")
+	renderer = gtk.CellRendererText()
+	curcol.pack_start(renderer, True)
+
+	tree_keys.append_column(curcol)
+
+	curcol.add_attribute(renderer, "text", 0)
+	scrolledwindow1.add(tree_keys)
+	store_keys = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_POINTER)
+	tree_keys.set_model(store_keys)
+
+	tree_keys.get_selection().set_select_function(on_key_activate)
+
+	tree_keys.connect("row-expanded", self.expand_key)
+
+	scrolledwindow2 = gtk.ScrolledWindow(None, None)
+	hbox1.pack_start(scrolledwindow2, True, True, 0)
+
+	tree_vals = gtk.TreeView()
+	# Column names
+
+	curcol = gtk.TreeViewColumn()
+	curcol.set_title("Name")
+	renderer = gtk.CellRendererText()
+	curcol.pack_start(renderer, True)
+	tree_vals.append_column(curcol)
+	curcol.add_attribute(renderer, "text", 0)
+
+	curcol = gtk.TreeViewColumn()
+	curcol.set_title("Type")
+	renderer = gtk.CellRendererText()
+	curcol.pack_start(renderer, True)
+	tree_vals.append_column(curcol)
+	curcol.add_attribute(renderer, "text", 1)
+
+	curcol = gtk.TreeViewColumn()
+	curcol.set_title("Value")
+	renderer = gtk.CellRendererText()
+	curcol.pack_start(renderer, True)
+	tree_vals.append_column(curcol)
+	curcol.add_attribute(renderer, "text", 2)
+
+	scrolledwindow2.add(tree_vals)
+
+	store_vals = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_INT)
+	tree_vals.set_model(store_vals)
+
+	statusbar = gtk.Statusbar()
+	vbox1.pack_start(statusbar, False, False, 0)
+	statusbar.set_has_resize_grip(False)
+
+	save_as.connect("activate", self.on_save_as_activate)
+	quit.connect("activate", self.on_quit_activate)
+	mnu_add_key.connect("activate", self.on_add_key_activate)
+	mnu_set_value.connect("activate", self.on_set_value_activate)
+	mnu_find.connect("activate", self.on_find_activate)
+	mnu_del_key.connect("activate", self.on_delete_key_activate)
+	mnu_del_value.connect("activate", self.on_delete_value_activate)
+	about.connect("activate", self.on_about_activate)
+	tree_vals.connect("row-activated", self.on_value_activate)
+
+	self.add_accel_group(accel_group)
+
+	return mainwin
+
+def create_openfilewin (parent):
+	openfilewin = gtk_file_chooser_dialog_new ("Select File", parent, GTK_FILE_CHOOSER_ACTION_OPEN,
+						   GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+						   GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+						   NULL)
+	openfilewin.set_border_width(10)
+
+	return openfilewin
+
+
+def create_savefilewin (parent):
+	savefilewin = gtk_file_selection_new ("Select File", parent, GTK_FILE_CHOOSER_ACTION_SAVE,
+						   GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+						   GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+						   NULL)
+
+	savefilewin.set_border_width(10)
+
+	return savefilewin
+
+	def load_defaults(self):
+		registry = samba.registry.open_local()
+		self.load_root()
+
+lp_ctx = loadparm_init()
+lp_load_default(lp_ctx)
+
+mainwin = RegistryEditor()
+mainwin.show_all()
+mainwin.load_defaults()
+
+gtk.main_loop()


Property changes on: trunk/samba-gtk/gregedit
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/samba-gtk/gtkldb
===================================================================
--- trunk/samba-gtk/gtkldb	                        (rev 0)
+++ trunk/samba-gtk/gtkldb	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,207 @@
+#!/usr/bin/python
+
+# Unix SMB/CIFS implementation.
+# Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2007
+#   
+# 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 3 of the License, or
+# (at your option) any later version.
+#   
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#   
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+"""Simple GTK+ frontend for LDB."""
+
+import gtk
+import gobject
+import ldb
+import os
+import sys
+
+class LdbURLDialog(gtk.Dialog):
+    """Dialog that prompts for a LDB URL.
+
+    Ideally this should remember LDB urls and list them in a combo box.
+    """
+    def __init__(self, parent=None):
+        """Create a new LdbURLDialog. 
+
+        :param parent: Parent window.
+        """
+        super(LdbURLDialog, self).__init__(parent=parent, 
+                buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)
+                )
+        self.vbox.add(gtk.Label("Enter URL:"))
+        self.url = gtk.Entry()
+        self.vbox.add(self.url)
+        self.show_all()
+
+    def get_url(self):
+        return self.url.get_text()
+
+
+def Ldb(url):
+    """Create a new LDB object.
+    
+    :param url: LDB URL to connect to.
+    """
+    ret = ldb.Ldb()
+    path = os.getenv("LDB_MODULES_PATH")
+    if path is not None:
+        ret.set_modules_dir(path)
+    ret.connect(url)
+    return ret
+
+
+class LdbBrowser(gtk.Window):
+    """GTK+ based LDB browser.
+    """
+    def set_ldb(self, ldb):
+        """Change the LDB object displayed.
+
+        Will refresh the window.
+        
+        :param ldb: New LDB object to use.
+        """
+        self.ldb = ldb
+        self.menu_disconnect.set_sensitive(True)
+        self._fill_tree()
+
+    def _cb_connect(self, button):
+        dialog = LdbURLDialog()
+        if dialog.run() == gtk.RESPONSE_OK:
+            self.set_ldb(Ldb(dialog.get_url()))
+        dialog.destroy()
+
+    def _cb_open(self, button):
+        dialog = gtk.FileChooserDialog(title="Please choose a file", 
+                                       parent=self,
+                                      buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK))
+        if dialog.run() == gtk.RESPONSE_OK:
+            self.set_ldb(Ldb(dialog.get_filename()))
+
+        dialog.destroy()
+
+    def _cb_disconnect(self, button):
+        self.treemodel.clear()
+        self.attributemodel.clear()
+        self.menu_disconnect.set_sensitive(False)
+        self.ldb = None
+
+    def _fill_tree(self, hide_special=False):
+        self.treemodel.clear()
+        paths = {}
+        def add_node(dn):
+            if dn.is_special() and hide_special:
+                return None
+            if paths.has_key(str(dn)):
+                return paths[str(dn)]
+            parent_dn = dn.parent()
+            text = str(dn)
+            if parent_dn is not None and str(parent_dn) != '':
+                parent = add_node(parent_dn)
+                text = text[:-len(str(parent_dn))].rstrip(",")
+            else:
+                parent = None
+            paths[str(dn)] = self.treemodel.append(parent, [text, dn])
+
+        for msg in self.ldb.search(None, ldb.SCOPE_SUBTREE, None, ["dn"]):
+            add_node(msg.dn)
+
+    def _toggle_special_entries(self, item):
+        self._fill_tree(item.get_active())
+
+    def _treeview_cursor_cb(self, item):
+        (model, iter) = item.get_selection().get_selected()
+        dn = model.get_value(iter, 1)
+        self.attributemodel.clear()
+        msg = self.ldb.search(dn, ldb.SCOPE_BASE)[0]
+        for name, el in msg.iteritems():
+            if name == "dn":
+                continue
+            for val in set(el):
+                self.attributemodel.append([name, val, el])
+
+    def __init__(self):
+        super(LdbBrowser, self).__init__()
+        vbox = gtk.VBox(spacing=0)
+        
+        # Menu
+        self.menu = gtk.MenuBar()
+        menuitem_db = gtk.MenuItem("_Database")
+        menu_db = gtk.Menu()
+        menuitem_db.set_submenu(menu_db)
+        self.menu.add(menuitem_db)
+
+        # Database menu
+        menu_connect = gtk.MenuItem("Connect to _URL...")
+        menu_connect.connect('activate', self._cb_connect)
+        menu_db.add(menu_connect)
+
+        menu_open = gtk.MenuItem("Open _File...")
+        menu_open.connect('activate', self._cb_open)
+        menu_db.add(menu_open)
+
+        self.menu_disconnect = gtk.MenuItem("_Disconnect")
+        self.menu_disconnect.connect('activate', self._cb_disconnect)
+        self.menu_disconnect.set_sensitive(False)
+        menu_db.add(self.menu_disconnect)
+
+        menu_db.add(gtk.SeparatorMenuItem())
+        menu_hide_special = gtk.CheckMenuItem("_Hide special entries")
+        menu_hide_special.connect('toggled', self._toggle_special_entries)
+        menu_db.add(menu_hide_special)
+
+        menu_db.add(gtk.SeparatorMenuItem())
+        menu_exit = gtk.ImageMenuItem(gtk.STOCK_QUIT)
+        menu_exit.connect('activate', lambda x: gtk.main_quit())
+
+        menu_db.add(menu_exit)
+
+        vbox.pack_start(self.menu, expand=False)
+
+        self.treeview = gtk.TreeView()
+        self.treemodel = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
+        self.treeview.set_model(self.treemodel)
+        self.treeview.set_headers_visible(False)
+        self.treeview.append_column(gtk.TreeViewColumn("_Dn", 
+                                    gtk.CellRendererText(), text=0))
+        self.treeview.connect("cursor-changed", self._treeview_cursor_cb)
+        self.attributeview = gtk.TreeView()
+        self.attributemodel = gtk.ListStore(str, str, gobject.TYPE_PYOBJECT)
+        self.attributeview.set_model(self.attributemodel)
+        self.attributeview.append_column(gtk.TreeViewColumn("_Name", 
+                                         gtk.CellRendererText(), text=0))
+        self.attributeview.append_column(gtk.TreeViewColumn("_Value", 
+                                         gtk.CellRendererText(), text=1))
+        pane = gtk.HPaned()
+        pane.set_position(200)
+        treeview_window = gtk.ScrolledWindow()
+        treeview_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+        treeview_window.add(self.treeview)
+        pane.pack1(treeview_window, resize=False, shrink=True)
+        attributeview_window = gtk.ScrolledWindow()
+        attributeview_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+        attributeview_window.add(self.attributeview)
+        pane.pack2(attributeview_window, shrink=True)
+        vbox.pack_start(pane, fill=True, expand=True)
+
+        self.statusbar = gtk.Statusbar()
+        vbox.pack_end(self.statusbar, expand=False)
+
+        self.add(vbox)
+        self.set_default_size(700, 500)
+        self.show_all()
+
+
+browser = LdbBrowser()
+if len(sys.argv) > 1:
+    browser.set_ldb(Ldb(sys.argv[1]))
+gtk.main()


Property changes on: trunk/samba-gtk/gtkldb
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/samba-gtk/gtksamba.pc.in
===================================================================
--- trunk/samba-gtk/gtksamba.pc.in	                        (rev 0)
+++ trunk/samba-gtk/gtksamba.pc.in	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gtksamba
+Description: Common Samba-related widgets for GTK+ applications
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lgtksamba
+Cflags: -I${includedir}  -DHAVE_IMMEDIATE_STRUCTURES=1

Added: trunk/samba-gtk/install-sh
===================================================================
--- trunk/samba-gtk/install-sh	                        (rev 0)
+++ trunk/samba-gtk/install-sh	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+	shift
+	shift
+	continue;;
+
+    -T) no_target_directory=true
+	shift
+	continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+	# When -t is used, the destination is already specified.
+	test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+	for arg
+	do
+          if test -n "$dstarg"; then
+	    # $@ is not empty: it contains at least $arg.
+	    set fnord "$@" "$dstarg"
+	    shift # fnord
+	  fi
+	  shift # arg
+	  dstarg=$arg
+	done
+	break;;
+  esac
+done
+
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dstarg: Is a directory" >&2
+	exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+	 '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+	# mkdir can fail with a `File exist' error in case several
+	# install-sh are creating the directory concurrently.  This
+	# is OK.
+	test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+	   # The rename failed, perhaps because mv can't rename something else
+	   # to itself, or perhaps because mv is so ancient that it does not
+	   # support -f.
+
+	   # Now remove or move aside any old file at destination location.
+	   # We try this two ways since rm can't unlink itself on some
+	   # systems and the destination file might be busy for other
+	   # reasons.  In this case, the final cleanup might fail but the new
+	   # file should still install successfully.
+	   {
+	     if test -f "$dstdir/$dstfile"; then
+	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+	       || {
+		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+		 (exit 1); exit 1
+	       }
+	     else
+	       :
+	     fi
+	   } &&
+
+	   # Now rename the file to the real destination.
+	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+	 }
+    }
+  fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:


Property changes on: trunk/samba-gtk/install-sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/samba-gtk/man/gepdump.1.xml
===================================================================
--- trunk/samba-gtk/man/gepdump.1.xml	                        (rev 0)
+++ trunk/samba-gtk/man/gepdump.1.xml	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
+				  
+<refentry id="gepdump.1">
+
+<refmeta>
+	<refentrytitle>gepdump</refentrytitle>
+	<manvolnum>1</manvolnum>
+</refmeta>
+
+
+<refnamediv>
+	<refname>gepdump</refname>
+	<refpurpose>Endpoint mapper viewer in GTK+</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+	<cmdsynopsis>
+		<command>gepdump</command>
+	</cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+	<title>DESCRIPTION</title>
+
+	<para>gepdump is a simple Gtk+-based DCE/RPC analysis tool that is 
+capable of showing the endpoints on a remote host and which interfaces are 
+available over those endpoints. It also features the ability to look up statistics for each interface.</para>
+
+</refsect1>
+
+<refsect1>
+	<title>VERSION</title>
+
+	<para>This man page is correct for version 4.0 of the Samba suite.</para>
+</refsect1>
+
+<refsect1>
+	<title>SEE ALSO</title>
+
+	<para>gregedit</para>
+
+</refsect1>
+
+<refsect1>
+	<title>AUTHOR</title>
+
+	<para>This utility is part of the <ulink url="http://www.samba.org/">Samba</ulink> suite, which is developed by the global <ulink url="http://www.samba.org/samba/team/">Samba Team</ulink>.</para>
+
+	<para>This manpage and gepdump were written by Jelmer Vernooij. </para>
+	
+</refsect1>
+
+</refentry>

Added: trunk/samba-gtk/man/gregedit.1.xml
===================================================================
--- trunk/samba-gtk/man/gregedit.1.xml	                        (rev 0)
+++ trunk/samba-gtk/man/gregedit.1.xml	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
+				  
+<refentry id="gregedit.1">
+
+<refmeta>
+	<refentrytitle>gregedit</refentrytitle>
+	<manvolnum>1</manvolnum>
+</refmeta>
+
+
+<refnamediv>
+	<refname>gregedit</refname>
+	<refpurpose>Windows registry file viewer for GTK+</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+	<cmdsynopsis>
+		<command>gregedit</command>
+		<arg choice="opt">--help</arg>
+		<arg choice="opt">--backend=BACKEND</arg>
+		<arg choice="opt">--credentials=CREDENTIALS</arg>
+		<arg choice="opt">location</arg>
+	</cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+	<title>DESCRIPTION</title>
+
+	<para>gregedit is a GTK+ frontend to the Windows registry file support 
+		in Samba4. It currently supports NT4 file, 9x file, gconf, remote 
+		Windows registries and a file system backend. 
+	</para>
+
+	<para>gregedit tries to imitate the Windows regedit.exe program as much 
+		as possible.</para>
+
+</refsect1>
+
+
+<refsect1>
+	<title>OPTIONS</title>
+
+	<variablelist>
+		<varlistentry>
+		<term>--help</term>
+		<listitem><para>
+		Show list of available options.</para></listitem>
+		</varlistentry>
+		
+		<varlistentry>
+			<term>--backend BACKEND</term>
+			<listitem><para>Name of backend to load. Possible values are: 
+					w95, nt4, gconf, dir and rpc. The default is <emphasis>dir</emphasis>.
+		</para></listitem>
+		</varlistentry>
+		
+		<varlistentry>
+		<term>--credentials=CREDENTIALS</term>
+		<listitem><para>
+				Credentials to use, if any. Password should be separated from user name by a percent sign.</para></listitem>
+		</varlistentry>
+	</variablelist>
+</refsect1>
+
+<refsect1>
+	<title>VERSION</title>
+
+	<para>This man page is correct for version 4.0 of the Samba suite.</para>
+</refsect1>
+
+<refsect1>
+	<title>SEE ALSO</title>
+
+</refsect1>
+
+<refsect1>
+	<title>AUTHOR</title>
+
+	<para>This utility is part of the <ulink url="http://www.samba.org/">Samba</ulink> suite, which is developed by the global <ulink url="http://www.samba.org/samba/team/">Samba Team</ulink>.</para>
+
+	<para>This manpage and gregedit were written by Jelmer Vernooij. </para>
+	
+</refsect1>
+
+</refentry>

Added: trunk/samba-gtk/man/gtkldb.1.xml
===================================================================
--- trunk/samba-gtk/man/gtkldb.1.xml	                        (rev 0)
+++ trunk/samba-gtk/man/gtkldb.1.xml	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
+				  
+<refentry id="gtkldb.1">
+
+<refmeta>
+	<refentrytitle>gtkldb</refentrytitle>
+	<manvolnum>1</manvolnum>
+</refmeta>
+
+
+<refnamediv>
+	<refname>gtkldb</refname>
+	<refpurpose>GTK+ browser for LDB databases</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+	<cmdsynopsis>
+		<command>gtkldb</command>
+		<arg choice="opt">--help</arg>
+	</cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+	<title>DESCRIPTION</title>
+
+	<para>gtkldb is a simple LDB database browser for GTK+. LDB is a 
+		lightweight database library with an API similar to LDAP. 
+	</para>
+
+</refsect1>
+
+
+<refsect1>
+	<title>OPTIONS</title>
+
+	<variablelist>
+		<varlistentry>
+		<term>--help</term>
+		<listitem><para>
+		Show list of available options.</para></listitem>
+		</varlistentry>
+	</variablelist>
+</refsect1>
+
+<refsect1>
+	<title>SEE ALSO</title>
+
+</refsect1>
+
+<refsect1>
+	<title>AUTHOR</title>
+
+	<para>LDB was written by Andrew Tridgell, Simo Sorce and others. The Python 
+		bindings for LDB and gtkldb were written by Jelmer Vernooij.</para>
+	
+</refsect1>
+
+</refentry>

Added: trunk/samba-gtk/man/gwcrontab.1.xml
===================================================================
--- trunk/samba-gtk/man/gwcrontab.1.xml	                        (rev 0)
+++ trunk/samba-gtk/man/gwcrontab.1.xml	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
+				  
+<refentry id="gwcrontab.1">
+
+<refmeta>
+	<refentrytitle>gwcrontab</refentrytitle>
+	<manvolnum>1</manvolnum>
+</refmeta>
+
+
+<refnamediv>
+	<refname>gwcrontab</refname>
+	<refpurpose>Task planning frontend for DCE/RPC</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+	<cmdsynopsis>
+		<command>gwcrontab</command>
+	</cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+	<title>DESCRIPTION</title>
+
+	<para>gwcrontab is a simple remote frontend to the Windows atsvc service. This service performs the same tasks as <emphasis>at</emphasis> and <emphasis>cron</emphasis> do on POSIX systems. </para>
+
+	<para>The GUI is aimed to look similar to the "Planning Tasks" application in Windows.</para>
+
+</refsect1>
+
+<refsect1>
+	<title>VERSION</title>
+
+	<para>This man page is correct for version 4.0 of the Samba suite.</para>
+</refsect1>
+
+<refsect1>
+	<title>AUTHOR</title>
+
+	<para>This utility is part of the <ulink url="http://www.samba.org/">Samba</ulink> suite, which is developed by the global <ulink url="http://www.samba.org/samba/team/">Samba Team</ulink>.</para>
+
+	<para>This manpage and gwcrontab were written by Jelmer Vernooij. </para>
+	
+</refsect1>
+
+</refentry>

Added: trunk/samba-gtk/man/gwsvcctl.1.xml
===================================================================
--- trunk/samba-gtk/man/gwsvcctl.1.xml	                        (rev 0)
+++ trunk/samba-gtk/man/gwsvcctl.1.xml	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
+				  
+<refentry id="gwsvcctl.1">
+
+<refmeta>
+	<refentrytitle>gwsvcctl</refentrytitle>
+	<manvolnum>1</manvolnum>
+</refmeta>
+
+
+<refnamediv>
+	<refname>gwsvcctl</refname>
+	<refpurpose>Task planning frontend for DCE/RPC</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+	<cmdsynopsis>
+		<command>gwsvcctl</command>
+	</cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+	<title>DESCRIPTION</title>
+
+	<para>gwsvcctl is a simple remote frontend to the Windows srvsvc service. 
+		This service allows restarting, stop and starting remote services.
+	</para>
+
+</refsect1>
+
+<refsect1>
+	<title>VERSION</title>
+
+	<para>This man page is correct for version 4.0 of the Samba suite.</para>
+</refsect1>
+
+<refsect1>
+	<title>AUTHOR</title>
+
+	<para>This utility is part of the <ulink url="http://www.samba.org/">Samba</ulink> suite, which is developed by the global <ulink url="http://www.samba.org/samba/team/">Samba Team</ulink>.</para>
+
+	<para>This manpage and gwsvcctl were written by Jelmer Vernooij. </para>
+	
+</refsect1>
+
+</refentry>

Added: trunk/samba-gtk/meta/gepdump.desktop
===================================================================
--- trunk/samba-gtk/meta/gepdump.desktop	                        (rev 0)
+++ trunk/samba-gtk/meta/gepdump.desktop	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=DCE/RPC Endpoint Dumper
+Comment=Show DCE/RPC endpoint mapper
+Exec=gepdump
+#Icon=media-player-48.png
+Type=Application
+Terminal=false
+Categories=GNOME;GTK;RemoteAccess;Profiling;Utility;Network;
+StartupNotify=true

Added: trunk/samba-gtk/meta/gregedit.desktop
===================================================================
--- trunk/samba-gtk/meta/gregedit.desktop	                        (rev 0)
+++ trunk/samba-gtk/meta/gregedit.desktop	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Registry Editor
+Comment=Edit Windows-Style Registry files
+Exec=gregedit
+#Icon=media-player-48.png
+Terminal=false
+Type=Application
+Categories=GNOME;GTK;RemoteAccess;Utility;
+StartupNotify=true

Added: trunk/samba-gtk/meta/gwcrontab.desktop
===================================================================
--- trunk/samba-gtk/meta/gwcrontab.desktop	                        (rev 0)
+++ trunk/samba-gtk/meta/gwcrontab.desktop	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=Windows Job Scheduler
+Comment=View and plan jobs on remote Windows hosts
+Exec=gwcrontab
+Terminal=false
+Type=Application
+Categories=GNOME;GTK;RemoteAccess;Utility;
+StartupNotify=true

Added: trunk/samba-gtk/meta/gwsam.desktop
===================================================================
--- trunk/samba-gtk/meta/gwsam.desktop	                        (rev 0)
+++ trunk/samba-gtk/meta/gwsam.desktop	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Windows User Manager
+Comment=Manage user, group and aliases on a remote Windows machine
+Exec=gwsam
+#Icon=media-player-48.png
+Type=Application
+Terminal=false
+Categories=GNOME;GTK;RemoteAccess;System;Utility;
+StartupNotify=true

Added: trunk/samba-gtk/meta/gwsvcctl.desktop
===================================================================
--- trunk/samba-gtk/meta/gwsvcctl.desktop	                        (rev 0)
+++ trunk/samba-gtk/meta/gwsvcctl.desktop	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=Control Windows Services
+Comment=Stop, start and view status of services on a remote Windows host
+Exec=gwsvcctl
+Terminal=false
+Type=Application
+Categories=GNOME;GTK;RemoteAccess;System;Network;Utility;
+StartupNotify=true

Added: trunk/samba-gtk/pysambagtk.c
===================================================================
--- trunk/samba-gtk/pysambagtk.c	                        (rev 0)
+++ trunk/samba-gtk/pysambagtk.c	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,104 @@
+/* -- THIS FILE IS GENERATED - DO NOT EDIT *//* -*- Mode: C; c-basic-offset: 4 -*- */
+
+#include <Python.h>
+
+
+
+#line 3 "pysambagtk.override"
+#include <Python.h>
+#include <pygobject.h>
+
+#include "common/gtk-smb.h"
+#line 13 "pysambagtk.c"
+
+
+/* ---------- types from other modules ---------- */
+static PyTypeObject *_PyGtkDialog_Type;
+#define PyGtkDialog_Type (*_PyGtkDialog_Type)
+
+
+/* ---------- forward type declarations ---------- */
+PyTypeObject G_GNUC_INTERNAL PyGtkRpcBindingDialog_Type;
+
+#line 24 "pysambagtk.c"
+
+
+
+/* ----------- GtkRpcBindingDialog ----------- */
+
+PyTypeObject G_GNUC_INTERNAL PyGtkRpcBindingDialog_Type = {
+    PyObject_HEAD_INIT(NULL)
+    0,                                 /* ob_size */
+    "sambagtk.RpcConnectDialog",                   /* tp_name */
+    sizeof(PyGObject),          /* tp_basicsize */
+    0,                                 /* tp_itemsize */
+    /* methods */
+    (destructor)0,        /* tp_dealloc */
+    (printfunc)0,                      /* tp_print */
+    (getattrfunc)0,       /* tp_getattr */
+    (setattrfunc)0,       /* tp_setattr */
+    (cmpfunc)0,           /* tp_compare */
+    (reprfunc)0,             /* tp_repr */
+    (PyNumberMethods*)0,     /* tp_as_number */
+    (PySequenceMethods*)0, /* tp_as_sequence */
+    (PyMappingMethods*)0,   /* tp_as_mapping */
+    (hashfunc)0,             /* tp_hash */
+    (ternaryfunc)0,          /* tp_call */
+    (reprfunc)0,              /* tp_str */
+    (getattrofunc)0,     /* tp_getattro */
+    (setattrofunc)0,     /* tp_setattro */
+    (PyBufferProcs*)0,  /* tp_as_buffer */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,                      /* tp_flags */
+    NULL,                        /* Documentation string */
+    (traverseproc)0,     /* tp_traverse */
+    (inquiry)0,             /* tp_clear */
+    (richcmpfunc)0,   /* tp_richcompare */
+    offsetof(PyGObject, weakreflist),             /* tp_weaklistoffset */
+    (getiterfunc)0,          /* tp_iter */
+    (iternextfunc)0,     /* tp_iternext */
+    (struct PyMethodDef*)NULL, /* tp_methods */
+    (struct PyMemberDef*)0,              /* tp_members */
+    (struct PyGetSetDef*)0,  /* tp_getset */
+    NULL,                              /* tp_base */
+    NULL,                              /* tp_dict */
+    (descrgetfunc)0,    /* tp_descr_get */
+    (descrsetfunc)0,    /* tp_descr_set */
+    offsetof(PyGObject, inst_dict),                 /* tp_dictoffset */
+    (initproc)0,             /* tp_init */
+    (allocfunc)0,           /* tp_alloc */
+    (newfunc)0,               /* tp_new */
+    (freefunc)0,             /* tp_free */
+    (inquiry)0              /* tp_is_gc */
+};
+
+
+
+/* ----------- functions ----------- */
+
+const PyMethodDef sambagtk_functions[] = {
+    { NULL, NULL, 0, NULL }
+};
+
+/* initialise stuff extension classes */
+void
+sambagtk_register_classes(PyObject *d)
+{
+    PyObject *module;
+
+    if ((module = PyImport_ImportModule("gtk")) != NULL) {
+        _PyGtkDialog_Type = (PyTypeObject *)PyObject_GetAttrString(module, "Dialog");
+        if (_PyGtkDialog_Type == NULL) {
+            PyErr_SetString(PyExc_ImportError,
+                "cannot import name Dialog from gtk");
+            return ;
+        }
+    } else {
+        PyErr_SetString(PyExc_ImportError,
+            "could not import gtk");
+        return ;
+    }
+
+
+#line 103 "pysambagtk.c"
+    pygobject_register_class(d, "GtkRpcBindingDialog", gtk_rpc_binding_dialog_get_type(), &PyGtkRpcBindingDialog_Type, Py_BuildValue("(O)", &PyGtkDialog_Type));
+}

Added: trunk/samba-gtk/python/module.c
===================================================================
--- trunk/samba-gtk/python/module.c	                        (rev 0)
+++ trunk/samba-gtk/python/module.c	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,18 @@
+#include "pygobject.h"
+
+extern PyMethodDef sambagtk_functions[];
+
+void sambagtk_register_classes(PyObject *d);
+
+void initsambagtk(void)
+{
+	PyObject *m, *d;
+
+	init_pygobject();
+
+
+	m = Py_InitModule("sambagtk", sambagtk_functions);
+	d = PyModule_GetDict(m);
+
+	sambagtk_register_classes(d);
+}

Added: trunk/samba-gtk/python/sambagtk.defs
===================================================================
--- trunk/samba-gtk/python/sambagtk.defs	                        (rev 0)
+++ trunk/samba-gtk/python/sambagtk.defs	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,43 @@
+;; vim: ft=scheme 
+; object definitions ...
+(define-object RpcConnectDialog
+  (in-module "SambaGtk")
+  (parent "GtkDialog")
+  (c-name "GtkRpcBindingDialog")
+  (gtype-id "SAMBAGTK_TYPE_RPC_BINDING_DIALOG")
+)
+
+(define-function gtk_rpc_binding_dialog_get_type
+ (c-name "gtk_rpc_binding_dialog_get_type")
+ (return-type "GType")
+)
+
+
+(define-method get_host
+ (of-object "GtkRpcBindingDialog")
+ (c-name "gtk_rpc_binding_dialog_get_host")
+ (return-type "const-gchar*")
+)
+
+(define-method get_binding_string
+ (of-object "GtkRpcBindingDialog")
+ (c-name "gtk_rpc_binding_dialog_get_binding_string")
+ (return-type "const-gchar*")
+)
+
+(define-function AboutDialog
+  (c-name "create_gtk_samba_about_dialog")
+  (return-type "GtkAboutDialog*")
+  (parameters
+   '("const-char*" "appname")
+  )
+)
+
+(define-function gtk_rpc_binding_dialog_new
+  (c-name "gtk_rpc_binding_dialog_new")
+  (is-constructor-of "GtkRpcBindingDialog")
+  (return-type "GtkRpcBindingDialog*")
+  (parameters
+    '("struct-dcerpc_pipe*" "samr_pipe")
+  )
+)

Added: trunk/samba-gtk/python/sambagtk.override
===================================================================
--- trunk/samba-gtk/python/sambagtk.override	                        (rev 0)
+++ trunk/samba-gtk/python/sambagtk.override	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,14 @@
+%%
+headers
+#include <Python.h>
+#include <pygobject.h>
+
+#include "common/gtk-smb.h"
+%%
+modulename sambagtk
+%%
+import gtk.Dialog as PyGtkDialog_Type
+%%
+ignore-glib
+  *_get_type
+%%

Added: trunk/samba-gtk/tools/gwcrontab.c
===================================================================
--- trunk/samba-gtk/tools/gwcrontab.c	                        (rev 0)
+++ trunk/samba-gtk/tools/gwcrontab.c	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,468 @@
+/* 
+   Unix SMB/CIFS implementation.
+   GTK+ Windows crontab frontend
+   
+   Copyright (C) Jelmer Vernooij 2004
+
+   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 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#define _GNU_SOURCE
+#include <stdbool.h>
+#include <gen_ndr/ndr_atsvc_c.h>
+#include "common/gtk-smb.h"
+#include "common/select.h"
+#include <credentials.h>
+#include <param.h>
+#include <util/debug.h>
+
+static struct dcerpc_pipe *at_pipe = NULL;
+static GtkWidget *mainwin;
+static GtkListStore *store_jobs;
+static GtkWidget *tasks;
+static GtkWidget *new_task;
+static GtkWidget *entry_cmd;
+static GtkWidget *entry_repeat_weekly;
+static GtkWidget *entry_repeat_monthly;
+static GtkWidget *delete;
+struct loadparm_context *lp_ctx = NULL;
+
+static void update_joblist(void)
+{
+	TALLOC_CTX *mem_ctx = talloc_init("update_joblist");
+	NTSTATUS status;
+	struct atsvc_JobEnum r;
+	struct atsvc_enum_ctr ctr;
+	int i;
+	uint32_t resume_handle = 0;
+
+	gtk_list_store_clear(store_jobs);
+
+	ctr.entries_read = 0;
+	ctr.first_entry = NULL;
+	r.in.servername = dcerpc_server_name(at_pipe);
+	r.in.ctr = r.out.ctr = &ctr;
+	r.in.preferred_max_len = 0xffffffff;
+	r.in.resume_handle = r.out.resume_handle = &resume_handle;
+
+	status = dcerpc_atsvc_JobEnum(at_pipe, mem_ctx, &r);
+	if(!NT_STATUS_IS_OK(status)) {
+		gtk_show_ntstatus(mainwin, "Error while enumerating first job", status);
+		return;
+	}
+
+       	for (i = 0; i < r.out.ctr->entries_read; i++) {
+                GtkTreeIter iter;
+                gtk_list_store_append(store_jobs, &iter);
+                gtk_list_store_set (store_jobs, &iter, 
+			0, r.out.ctr->first_entry[i].flags,
+			1, r.out.ctr->first_entry[i].job_id, 
+			2, r.out.ctr->first_entry[i].days_of_week, /*FIXME: Nicer format */
+			3, r.out.ctr->first_entry[i].job_time, /* FIXME: Nicer format */
+			4, r.out.ctr->first_entry[i].command,
+                        -1);
+
+	}
+	talloc_free(mem_ctx);
+}
+
+static void on_job_select(GtkTreeSelection *sel, gpointer data)
+{
+	gtk_widget_set_sensitive(delete, gtk_tree_selection_get_selected(sel, NULL, NULL));
+}
+
+
+static void on_connect_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	at_pipe = gtk_connect_rpc_interface(talloc_autofree_context(), lp_ctx, &ndr_table_atsvc);
+
+	if (!at_pipe)
+		return;
+
+	gtk_widget_set_sensitive (new_task, TRUE);
+	update_joblist();
+}
+
+static void on_quit_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	talloc_free(at_pipe);
+	gtk_main_quit();
+}
+
+static GtkWidget* create_new_job_dialog (void);
+
+void on_new_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+	GtkWidget *d = create_new_job_dialog();
+	gint result = gtk_dialog_run(GTK_DIALOG(d));
+	struct atsvc_JobAdd r;
+	struct atsvc_JobInfo job;
+	NTSTATUS status;
+	TALLOC_CTX *mem_ctx;
+	switch(result) {
+		case GTK_RESPONSE_OK:
+			break;
+		default:
+			gtk_widget_destroy(d);
+		        return;
+	}
+	mem_ctx = talloc_init("add_job");
+
+	job.job_time = 0; /* FIXME */
+	job.days_of_month = 0; /* FIXME */
+	job.days_of_week = 0; /* FIXME */
+	job.flags = 0; /* FIXME */
+	job.command = gtk_entry_get_text(GTK_ENTRY(entry_cmd));
+	r.in.servername = dcerpc_server_name(at_pipe);
+	r.in.job_info = &job;
+
+	status = dcerpc_atsvc_JobAdd(at_pipe, mem_ctx, &r);
+	if(!NT_STATUS_IS_OK(status)) {
+		talloc_free(mem_ctx);
+		gtk_show_ntstatus(mainwin, "Error while adding job", status);
+		return;
+	}
+	
+	talloc_free(mem_ctx);
+	gtk_widget_destroy(d);
+	
+	d = gtk_message_dialog_new (GTK_WINDOW(mainwin), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Job Id: %d", *r.out.job_id);
+	gtk_dialog_run(GTK_DIALOG(d));
+	gtk_widget_destroy(d);
+	update_joblist();
+}
+
+
+void on_delete_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tasks));
+	GtkTreeModel *model = GTK_TREE_MODEL(store_jobs);
+	GtkTreeIter iter;
+	gint id;
+
+	if (gtk_tree_selection_get_selected (sel, &model, &iter))
+	{
+		struct atsvc_JobDel r;
+		TALLOC_CTX *mem_ctx;
+		NTSTATUS status;
+		gtk_tree_model_get (model, &iter, 1, &id, -1);
+
+		r.in.servername = dcerpc_server_name(at_pipe);
+		r.in.min_job_id = r.in.max_job_id = id;
+
+		mem_ctx = talloc_init("del_job");
+		status = dcerpc_atsvc_JobDel(at_pipe, mem_ctx, &r);
+		talloc_free(mem_ctx);
+		if(!NT_STATUS_IS_OK(status)) {
+			gtk_show_ntstatus(mainwin, "Error deleting job", status);
+			return;
+		}
+
+		update_joblist();
+	}
+}
+
+
+static void on_about_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	GtkDialog *aboutwin = GTK_DIALOG(create_gtk_samba_about_dialog("gwcrontab"));
+	gtk_dialog_run(aboutwin);
+	gtk_widget_destroy(GTK_WIDGET(aboutwin));
+}
+
+static GtkWidget* create_mainwindow (void)
+{
+	GtkWidget *mainwindow;
+	GtkWidget *vbox;
+	GtkWidget *menubar;
+	GtkWidget *menuitem4;
+	GtkWidget *menuitem4_menu;
+	GtkWidget *mnu_connect;
+	GtkWidget *separatormenuitem1;
+	GtkWidget *quit;
+	GtkWidget *task;
+	GtkWidget *task_menu;
+	GtkCellRenderer *renderer;
+	GtkTreeViewColumn *curcol;
+	GtkWidget *menuitem7;
+	GtkWidget *menuitem7_menu;
+	GtkWidget *about;
+	GtkWidget *scrolledwindow;
+	GtkWidget *statusbar;
+	GtkAccelGroup *accel_group;
+
+	accel_group = gtk_accel_group_new ();
+
+	mainwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	gtk_window_set_default_size (GTK_WINDOW (mainwindow), 642, 562);
+	gtk_window_set_title (GTK_WINDOW (mainwindow), "Task Scheduler");
+
+	vbox = gtk_vbox_new (FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (mainwindow), vbox);
+
+	menubar = gtk_menu_bar_new ();
+	gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE, 0);
+
+	menuitem4 = gtk_menu_item_new_with_mnemonic ("_File");
+	gtk_container_add (GTK_CONTAINER (menubar), menuitem4);
+
+	menuitem4_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem4), menuitem4_menu);
+
+	mnu_connect = gtk_menu_item_new_with_mnemonic ("_Connect");
+	gtk_container_add (GTK_CONTAINER (menuitem4_menu), mnu_connect);
+	g_signal_connect ((gpointer) mnu_connect, "activate",
+	  G_CALLBACK (on_connect_activate), NULL);
+
+	separatormenuitem1 = gtk_separator_menu_item_new ();
+	gtk_container_add (GTK_CONTAINER (menuitem4_menu), separatormenuitem1);
+	gtk_widget_set_sensitive (separatormenuitem1, FALSE);
+
+	quit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
+	gtk_container_add (GTK_CONTAINER (menuitem4_menu), quit);
+
+	task = gtk_menu_item_new_with_mnemonic ("_Task");
+	gtk_container_add (GTK_CONTAINER (menubar), task);
+
+	task_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (task), task_menu);
+
+	new_task = gtk_menu_item_new_with_mnemonic ("_New");
+	gtk_container_add (GTK_CONTAINER (task_menu), new_task);
+	gtk_widget_set_sensitive (new_task, FALSE);
+
+	delete = gtk_menu_item_new_with_mnemonic ("_Delete");
+	gtk_widget_set_sensitive(delete, FALSE);
+	gtk_container_add (GTK_CONTAINER (task_menu), delete);
+
+	menuitem7 = gtk_menu_item_new_with_mnemonic ("_Help");
+	gtk_container_add (GTK_CONTAINER (menubar), menuitem7);
+
+	menuitem7_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem7), menuitem7_menu);
+
+	about = gtk_menu_item_new_with_mnemonic ("_About");
+	gtk_container_add (GTK_CONTAINER (menuitem7_menu), about);
+
+	scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+	gtk_box_pack_start (GTK_BOX (vbox), scrolledwindow, TRUE, TRUE, 0);
+
+	tasks = gtk_tree_view_new ();
+
+	curcol = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title(curcol, "Status");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, true);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(tasks), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 0);
+
+	curcol = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title(curcol, "ID");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, true);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(tasks), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 1);
+
+	curcol = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title(curcol, "Day");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, true);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(tasks), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 2);
+
+	curcol = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title(curcol, "Time");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, true);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(tasks), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 3);
+
+	curcol = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title(curcol, "Command Line");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, true);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(tasks), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 4);
+
+	store_jobs = gtk_list_store_new(5, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING);
+	gtk_tree_view_set_model(GTK_TREE_VIEW(tasks), GTK_TREE_MODEL(store_jobs));
+	g_object_unref(store_jobs);
+
+	gtk_container_add (GTK_CONTAINER (scrolledwindow), tasks);
+
+	g_signal_connect (gtk_tree_view_get_selection(GTK_TREE_VIEW(tasks)) , "changed", G_CALLBACK (on_job_select), NULL);
+
+	statusbar = gtk_statusbar_new ();
+	gtk_box_pack_start (GTK_BOX (vbox), statusbar, FALSE, FALSE, 0);
+
+
+	g_signal_connect ((gpointer) quit, "activate",
+	  G_CALLBACK (on_quit_activate), NULL);
+	g_signal_connect ((gpointer) new_task, "activate",
+	  G_CALLBACK (on_new_activate), NULL);
+	g_signal_connect ((gpointer) delete, "activate",
+	  G_CALLBACK (on_delete_activate), NULL);
+	g_signal_connect ((gpointer) about, "activate",
+	  G_CALLBACK (on_about_activate), NULL);
+
+	gtk_window_add_accel_group (GTK_WINDOW (mainwindow), accel_group);
+
+	return mainwindow;
+}
+
+void on_chk_weekly_toggled(GtkToggleButton *togglebutton, gpointer user_data)
+{
+	gtk_widget_set_sensitive(entry_repeat_weekly, gtk_toggle_button_get_active(togglebutton));
+}
+
+
+void on_chk_monthly_toggled(GtkToggleButton *togglebutton, gpointer user_data)
+{
+	gtk_widget_set_sensitive(entry_repeat_monthly, gtk_toggle_button_get_active(togglebutton));
+}
+
+
+static GtkWidget *create_new_job_dialog (void)
+{
+	GtkWidget *new_job_dialog;
+	GtkWidget *dialog_vbox1;
+	GtkWidget *frame1;
+	GtkWidget *table1;
+	GtkWidget *label4;
+	GtkWidget *cal_day;
+	GtkWidget *label3;
+	GtkWidget *entry_time;
+	GtkWidget *chk_weekly;
+	GtkWidget *chk_monthly;
+	GtkWidget *label1;
+	GtkWidget *frame2;
+	GtkWidget *hbox1;
+	GtkWidget *label5;
+	GtkWidget *label2;
+	GtkWidget *dialog_action_area1;
+	GtkWidget *cancelbutton1;
+	GtkWidget *okbutton1;
+
+	new_job_dialog = gtk_dialog_new ();
+	gtk_window_set_title (GTK_WINDOW (new_job_dialog), "New job");
+
+	dialog_vbox1 = GTK_DIALOG (new_job_dialog)->vbox;
+
+	frame1 = gtk_frame_new (NULL);
+	gtk_box_pack_start (GTK_BOX (dialog_vbox1), frame1, TRUE, TRUE, 0);
+
+	table1 = gtk_table_new (4, 2, FALSE);
+	gtk_container_add (GTK_CONTAINER (frame1), table1);
+
+	label4 = gtk_label_new ("Time:");
+	gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 1, 2,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
+
+	cal_day = gtk_calendar_new ();
+	gtk_table_attach (GTK_TABLE (table1), cal_day, 1, 2, 0, 1,
+					  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+					  (GtkAttachOptions) (GTK_FILL), 0, 0);
+	gtk_calendar_set_display_options (GTK_CALENDAR (cal_day),
+					  GTK_CALENDAR_SHOW_HEADING
+					  | GTK_CALENDAR_SHOW_DAY_NAMES);
+
+	label3 = gtk_label_new ("Date");
+	gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 0, 1,
+					  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);
+
+	entry_time = gtk_entry_new ();
+	gtk_table_attach (GTK_TABLE (table1), entry_time, 1, 2, 1, 2,
+					  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	chk_weekly = gtk_check_button_new_with_mnemonic ("Repeat weekly");
+	gtk_table_attach (GTK_TABLE (table1), chk_weekly, 0, 1, 2, 3,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	entry_repeat_weekly = gtk_entry_new ();
+	gtk_table_attach (GTK_TABLE (table1), entry_repeat_weekly, 1, 2, 2, 3,
+					  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	chk_monthly = gtk_check_button_new_with_mnemonic ("Repeat monthly");
+	gtk_table_attach (GTK_TABLE (table1), chk_monthly, 0, 1, 3, 4,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	entry_repeat_monthly = gtk_entry_new ();
+	gtk_table_attach (GTK_TABLE (table1), entry_repeat_monthly, 1, 2, 3, 4,
+					  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	label1 = gtk_label_new ("Moment");
+	gtk_frame_set_label_widget (GTK_FRAME (frame1), label1);
+
+	frame2 = gtk_frame_new (NULL);
+	gtk_box_pack_start (GTK_BOX (dialog_vbox1), frame2, TRUE, TRUE, 0);
+
+	hbox1 = gtk_hbox_new (FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (frame2), hbox1);
+
+	label5 = gtk_label_new ("Command to execute");
+	gtk_box_pack_start (GTK_BOX (hbox1), label5, TRUE, TRUE, 0);
+
+	entry_cmd = gtk_entry_new ();
+	gtk_box_pack_start (GTK_BOX (hbox1), entry_cmd, TRUE, TRUE, 0);
+
+	label2 = gtk_label_new ("Command");
+	gtk_frame_set_label_widget (GTK_FRAME (frame2), label2);
+
+	dialog_action_area1 = GTK_DIALOG (new_job_dialog)->action_area;
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
+
+	cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
+	gtk_dialog_add_action_widget (GTK_DIALOG (new_job_dialog), cancelbutton1, GTK_RESPONSE_CANCEL);
+	GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
+
+	okbutton1 = gtk_button_new_from_stock ("gtk-ok");
+	gtk_dialog_add_action_widget (GTK_DIALOG (new_job_dialog), okbutton1, GTK_RESPONSE_OK);
+	GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
+
+	g_signal_connect ((gpointer) chk_weekly, "toggled",
+					  G_CALLBACK (on_chk_weekly_toggled),
+					  NULL);
+	g_signal_connect ((gpointer) chk_monthly, "toggled",
+					  G_CALLBACK (on_chk_monthly_toggled),
+					  NULL);
+
+	return new_job_dialog;
+}
+
+
+int main(int argc, char **argv)
+{
+	lp_ctx = loadparm_init(NULL);
+	lp_load_default(lp_ctx);
+
+	setup_logging(argv[0], DEBUG_STDERR);
+
+	dcerpc_init(lp_ctx);
+
+	gtk_init(&argc, &argv);
+	mainwin = create_mainwindow();
+	gtk_widget_show_all(mainwin);
+
+	return gtk_event_loop();
+}

Added: trunk/samba-gtk/tools/gwsam.c
===================================================================
--- trunk/samba-gtk/tools/gwsam.c	                        (rev 0)
+++ trunk/samba-gtk/tools/gwsam.c	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,448 @@
+/* 
+   Unix SMB/CIFS implementation.
+   GTK+ SAM frontend
+   
+   Copyright (C) Jelmer Vernooij 2004
+
+   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 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#define _GNU_SOURCE
+#include <stdbool.h>
+#include <gen_ndr/ndr_samr_c.h>
+#include "common/select.h"
+#include "common/gtk-smb.h"
+#include <credentials.h>
+#include <param.h>
+#include <util/debug.h>
+
+struct policy_handle sam_handle;
+struct dcerpc_pipe *sam_pipe = NULL;
+static struct policy_handle domain_handle;
+GtkWidget *mainwin;
+GtkWidget *seldomain;
+GtkListStore *store_users;
+GtkListStore *store_groups;
+static GtkWidget *mnu_disconnect;
+struct loadparm_context *lp_ctx;
+
+static void update_grouplist(void)
+{
+	if(!sam_pipe) return;
+	//FIXME
+}
+
+static void update_userlist(void)
+{
+	NTSTATUS status;
+	struct samr_EnumDomainUsers r;
+	uint32_t resume_handle=0;
+	int i;
+	TALLOC_CTX *mem_ctx;
+
+	if(!sam_pipe) return;
+
+	gtk_list_store_clear(store_users);
+
+	mem_ctx = talloc_init("update_userlist");
+	r.in.domain_handle = &domain_handle;
+	r.in.resume_handle = &resume_handle;
+	r.in.acct_flags = 0;
+	r.in.max_size = (uint32_t)100;
+	r.out.resume_handle = &resume_handle;
+
+	status = dcerpc_samr_EnumDomainUsers(sam_pipe, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status)) {
+		gtk_show_ntstatus(mainwin, "While enumerating domain users", status);
+		talloc_free(mem_ctx);
+		return;
+	}
+
+	if (!*r.out.sam || (*r.out.sam)->count == 0) {
+		talloc_free(mem_ctx);
+		return;
+	}
+
+	for (i=0;i<(*r.out.sam)->count;i++) {
+                GtkTreeIter iter;
+                gtk_list_store_append(store_users, &iter);
+                gtk_list_store_set (store_users, &iter, 
+			0, (*r.out.sam)->entries[i].name.string,
+			1, (*r.out.sam)->entries[i].name.string,
+			2, 0, -1);
+
+		/* FIXME: Query user info */
+
+		//		if (!test_OpenUser(sam_pipe, mem_ctx, &sam_handle, r.out.sam->entries[i].idx)) {
+		//			ret = false;
+		//		}
+	}
+	talloc_free(mem_ctx);
+}
+
+static void on_new1_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	/* FIXME */
+}
+
+static void on_select_domain_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	GtkSelectDomainDialog *d;
+	gint result;
+	d = GTK_SELECT_DOMAIN_DIALOG(gtk_select_domain_dialog_new(sam_pipe));
+	result = gtk_dialog_run(GTK_DIALOG(d));
+	switch(result) {
+	case GTK_RESPONSE_OK:
+		break;
+	default:
+		gtk_widget_destroy(GTK_WIDGET(d));
+		return;
+	}
+	domain_handle = gtk_select_domain_dialog_get_handle(d);
+
+	update_userlist();
+	update_grouplist();
+
+	gtk_widget_destroy(GTK_WIDGET(d));
+}
+
+static void connect_sam(void)
+{
+	struct samr_Connect r;
+	TALLOC_CTX *mem_ctx;
+	NTSTATUS status;
+
+	mem_ctx = talloc_init("gwsam_connect");
+
+	sam_pipe = gtk_connect_rpc_interface(talloc_autofree_context(), lp_ctx, &ndr_table_samr);
+
+	if (!sam_pipe)
+		return;
+
+	r.in.system_name = 0;
+	r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
+	r.out.connect_handle = &sam_handle;
+
+	status = dcerpc_samr_Connect(sam_pipe, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status)) {
+		gtk_show_ntstatus(mainwin, "While running connect on SAMR", status);
+		sam_pipe = NULL;
+		talloc_free(mem_ctx);
+		return;
+	}
+
+	gtk_widget_set_sensitive (seldomain, TRUE);
+	gtk_widget_set_sensitive (mnu_disconnect, TRUE);
+
+	sam_pipe = talloc_reference(talloc_autofree_context(), sam_pipe);
+	talloc_free(mem_ctx);
+}
+
+static void on_connect_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+	connect_sam();
+	/* FIXME: Connect to default domain */
+}
+
+static void on_disconnect_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+	gtk_widget_set_sensitive (mnu_disconnect, FALSE);
+}
+
+static void on_quit_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+	talloc_free(sam_pipe);
+
+	gtk_main_quit();
+}
+
+static void on_account_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	//FIXME
+}
+
+
+static void on_user_rights_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	//FIXME
+}
+
+
+static void on_audit_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	//FIXME
+}
+
+
+static void on_trust_relations_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	//FIXME
+}
+
+
+static void on_refresh_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	update_userlist();
+	update_grouplist();
+}
+
+
+static void on_about_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	GtkDialog *aboutwin = GTK_DIALOG(create_gtk_samba_about_dialog("gwsam"));
+	gtk_dialog_run(aboutwin);
+	gtk_widget_destroy(GTK_WIDGET(aboutwin));
+}
+
+static GtkWidget* create_mainwindow (void)
+{
+	GtkWidget *vbox1;
+	GtkWidget *mnu_connect;
+	GtkWidget *menubar;
+	GtkWidget *menuitem1;
+	GtkWidget *menuitem1_menu;
+	GtkWidget *new1;
+	GtkWidget *separatormenuitem1;
+	GtkWidget *quit;
+	GtkCellRenderer *renderer;
+	GtkTreeViewColumn *curcol;
+	GtkWidget *policies;
+	GtkWidget *policies_menu;
+	GtkWidget *account;
+	GtkWidget *user_rights;
+	GtkWidget *audit;
+	GtkWidget *separator1;
+	GtkWidget *trust_relations;
+	GtkWidget *menuitem3;
+	GtkWidget *menuitem3_menu;
+	GtkWidget *refresh;
+	GtkWidget *menuitem4;
+	GtkWidget *menuitem4_menu;
+	GtkWidget *about;
+	GtkWidget *vpaned;
+	GtkWidget *scrolledwindow1;
+	GtkWidget *user_list;
+	GtkWidget *scrolledwindow2;
+	GtkWidget *group_list;
+	GtkWidget *statusbar;
+	GtkAccelGroup *accel_group;
+
+	accel_group = gtk_accel_group_new ();
+
+	mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	gtk_window_set_default_size (GTK_WINDOW (mainwin), 642, 562);
+	gtk_window_set_title (GTK_WINDOW (mainwin), "User Manager");
+
+	vbox1 = gtk_vbox_new (FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (mainwin), vbox1);
+
+	menubar = gtk_menu_bar_new ();
+	gtk_box_pack_start (GTK_BOX (vbox1), menubar, FALSE, FALSE, 0);
+
+	menuitem1 = gtk_menu_item_new_with_mnemonic ("_File");
+	gtk_container_add (GTK_CONTAINER (menubar), menuitem1);
+
+	menuitem1_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem1), menuitem1_menu);
+
+	mnu_connect = gtk_menu_item_new_with_mnemonic ("_Connect");
+	gtk_container_add (GTK_CONTAINER (menuitem1_menu), mnu_connect);
+
+	mnu_disconnect = gtk_menu_item_new_with_mnemonic ("_Disconnect");
+	gtk_widget_set_sensitive (mnu_disconnect, FALSE);
+	gtk_container_add (GTK_CONTAINER (menuitem1_menu), mnu_disconnect);
+
+	seldomain = gtk_menu_item_new_with_mnemonic("_Select Domain");
+	gtk_widget_set_sensitive (seldomain, FALSE);
+	gtk_container_add (GTK_CONTAINER (menuitem1_menu), seldomain);
+
+	separatormenuitem1 = gtk_separator_menu_item_new ();
+	gtk_container_add (GTK_CONTAINER (menuitem1_menu), separatormenuitem1);
+	gtk_widget_set_sensitive (separatormenuitem1, FALSE);
+
+	quit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
+	gtk_container_add (GTK_CONTAINER (menuitem1_menu), quit);
+
+	menuitem1 = gtk_menu_item_new_with_mnemonic ("_User");
+	gtk_container_add (GTK_CONTAINER (menubar), menuitem1);
+	gtk_widget_set_sensitive (menuitem1, FALSE);
+
+	menuitem1_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem1), menuitem1_menu);
+
+	new1 = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group);
+	gtk_container_add (GTK_CONTAINER (menuitem1_menu), new1);
+
+	policies = gtk_menu_item_new_with_mnemonic ("_Policies");
+	gtk_container_add (GTK_CONTAINER (menubar), policies);
+	gtk_widget_set_sensitive (policies, FALSE);
+
+	policies_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (policies), policies_menu);
+
+	account = gtk_menu_item_new_with_mnemonic ("_Account...");
+	gtk_container_add (GTK_CONTAINER (policies_menu), account);
+
+	user_rights = gtk_menu_item_new_with_mnemonic ("_User Rights...");
+	gtk_container_add (GTK_CONTAINER (policies_menu), user_rights);
+
+	audit = gtk_menu_item_new_with_mnemonic ("A_udit...");
+	gtk_container_add (GTK_CONTAINER (policies_menu), audit);
+
+	separator1 = gtk_separator_menu_item_new ();
+	gtk_container_add (GTK_CONTAINER (policies_menu), separator1);
+	gtk_widget_set_sensitive (separator1, FALSE);
+
+	trust_relations = gtk_menu_item_new_with_mnemonic ("_Trust relations");
+	gtk_container_add (GTK_CONTAINER (policies_menu), trust_relations);
+
+	menuitem3 = gtk_menu_item_new_with_mnemonic ("_View");
+	gtk_container_add (GTK_CONTAINER (menubar), menuitem3);
+
+	menuitem3_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem3), menuitem3_menu);
+
+	refresh = gtk_image_menu_item_new_from_stock ("gtk-refresh", accel_group);
+	gtk_container_add (GTK_CONTAINER (menuitem3_menu), refresh);
+	gtk_widget_set_sensitive (refresh, FALSE);
+
+	menuitem4 = gtk_menu_item_new_with_mnemonic ("_Help");
+	gtk_container_add (GTK_CONTAINER (menubar), menuitem4);
+
+	menuitem4_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem4), menuitem4_menu);
+
+	about = gtk_menu_item_new_with_mnemonic ("_About");
+	gtk_container_add (GTK_CONTAINER (menuitem4_menu), about);
+
+	vpaned = gtk_vpaned_new ();
+	gtk_box_pack_start (GTK_BOX (vbox1), vpaned, TRUE, TRUE, 0);
+
+	scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
+	gtk_paned_pack1 (GTK_PANED (vpaned), scrolledwindow1, FALSE, TRUE);
+
+	user_list = gtk_tree_view_new ();
+	gtk_container_add (GTK_CONTAINER (scrolledwindow1), user_list);
+
+	curcol = gtk_tree_view_column_new();
+	gtk_tree_view_column_set_title(curcol, "Name");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, true);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(user_list), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 0);
+
+	curcol = gtk_tree_view_column_new();
+	gtk_tree_view_column_set_title(curcol, "Description");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, true);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(user_list), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 1);
+
+	curcol = gtk_tree_view_column_new();
+	gtk_tree_view_column_set_title(curcol, "RID");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, true);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(user_list), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 1);
+
+	store_users = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
+	gtk_tree_view_set_model(GTK_TREE_VIEW(user_list), GTK_TREE_MODEL(store_users));
+
+	scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
+	gtk_paned_pack2 (GTK_PANED (vpaned), scrolledwindow2, TRUE, TRUE);
+
+	group_list = gtk_tree_view_new ();
+	gtk_container_add (GTK_CONTAINER (scrolledwindow2), group_list);
+
+	curcol = gtk_tree_view_column_new();
+	gtk_tree_view_column_set_title(curcol, "Name");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, true);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(group_list), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 0);
+
+	curcol = gtk_tree_view_column_new();
+	gtk_tree_view_column_set_title(curcol, "Description");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, true);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(group_list), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 1);
+
+	curcol = gtk_tree_view_column_new();
+	gtk_tree_view_column_set_title(curcol, "RID");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, true);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(group_list), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 1);
+
+	store_groups = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
+	gtk_tree_view_set_model(GTK_TREE_VIEW(group_list), GTK_TREE_MODEL(store_groups));
+
+	statusbar = gtk_statusbar_new ();
+	gtk_box_pack_start (GTK_BOX (vbox1), statusbar, FALSE, FALSE, 0);
+
+	g_signal_connect ((gpointer) new1, "activate",
+					  G_CALLBACK (on_new1_activate),
+					  NULL);
+	g_signal_connect ((gpointer) seldomain, "activate",
+					  G_CALLBACK (on_select_domain_activate),
+					  NULL);
+	g_signal_connect ((gpointer) mnu_connect, "activate",
+					  G_CALLBACK (on_connect_activate),
+					  NULL);
+	g_signal_connect ((gpointer) mnu_disconnect, "activate",
+					  G_CALLBACK (on_disconnect_activate),
+					  NULL);
+	g_signal_connect ((gpointer) quit, "activate",
+					  G_CALLBACK (on_quit_activate),
+					  NULL);
+	g_signal_connect ((gpointer) account, "activate",
+					  G_CALLBACK (on_account_activate),
+					  NULL);
+	g_signal_connect ((gpointer) user_rights, "activate",
+					  G_CALLBACK (on_user_rights_activate),
+					  NULL);
+	g_signal_connect ((gpointer) audit, "activate",
+					  G_CALLBACK (on_audit_activate),
+					  NULL);
+	g_signal_connect ((gpointer) trust_relations, "activate",
+					  G_CALLBACK (on_trust_relations_activate),
+					  NULL);
+	g_signal_connect ((gpointer) refresh, "activate",
+					  G_CALLBACK (on_refresh_activate),
+					  NULL);
+	g_signal_connect ((gpointer) about, "activate",
+					  G_CALLBACK (on_about_activate),
+					  NULL);
+
+	gtk_window_add_accel_group (GTK_WINDOW (mainwin), accel_group);
+
+	return mainwin;
+}
+
+int main(int argc, char **argv)
+{
+	lp_ctx = loadparm_init(NULL);
+	lp_load_default(lp_ctx);
+	setup_logging(argv[0], DEBUG_STDERR);
+
+	dcerpc_init(lp_ctx);
+
+	gtk_init(&argc, &argv);
+	mainwin = create_mainwindow();
+	gtk_widget_show_all(mainwin);
+
+	return gtk_event_loop();
+}

Added: trunk/samba-gtk/tools/gwsam_user.c
===================================================================
--- trunk/samba-gtk/tools/gwsam_user.c	                        (rev 0)
+++ trunk/samba-gtk/tools/gwsam_user.c	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,291 @@
+/* 
+   Unix SMB/CIFS implementation.
+   GTK+ SAM frontend
+   
+   Copyright (C) Jelmer Vernooij 2004
+
+   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 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "gtk/common/gtk-smb.h"
+
+GtkWidget* create_user_edit_dialog (void)
+{
+	GtkWidget *user_edit_dialog;
+	GtkWidget *dialog_vbox1;
+	GtkWidget *notebook;
+	GtkWidget *table1;
+	GtkWidget *label4;
+	GtkWidget *label5;
+	GtkWidget *label6;
+	GtkWidget *label7;
+	int i;
+	GtkWidget *label8;
+	GtkWidget *chk_mustchange;
+	GtkWidget *entry_fullname;
+	GtkWidget *entry_description;
+	GtkWidget *lbl_username;
+	GtkWidget *entry_password;
+	GtkWidget *entry_confirm_password;
+	GtkWidget *chk_cannotchange;
+	GtkWidget *chk_cannotexpire;
+	GtkWidget *chk_disabled;
+	GtkWidget *chk_lockedout;
+	GtkWidget *label1;
+	GtkWidget *hbox1;
+	GtkWidget *scrolledwindow3;
+	GtkWidget *treeview3;
+	GtkWidget *vbox2;
+	GtkWidget *btn_groupadd;
+	GtkWidget *btn_groupdel;
+	GtkWidget *scrolledwindow4;
+	GtkWidget *treeview4;
+	GtkWidget *label2;
+	GtkWidget *vbox3;
+	GtkWidget *frame1;
+	GtkWidget *table2;
+	GtkWidget *label12;
+	GtkWidget *label13;
+	GtkWidget *entry_profilepath;
+	GtkWidget *entry_scriptname;
+	GtkWidget *label10;
+	GtkWidget *frame2;
+	GtkWidget *table3;
+	GtkWidget *label14;
+	GtkWidget *entry_homedir;
+	GtkWidget *chk_mapdrive;
+	GtkWidget *combo_homedrive;
+	GtkWidget *label11;
+	GtkWidget *label3;
+	GtkWidget *dialog_action_area1;
+	GtkWidget *cancelbutton1;
+	GtkWidget *applybutton1;
+	GtkWidget *okbutton1;
+
+	user_edit_dialog = gtk_dialog_new ();
+	gtk_window_set_title (GTK_WINDOW (user_edit_dialog), "Edit User");
+
+	dialog_vbox1 = GTK_DIALOG (user_edit_dialog)->vbox;
+
+	notebook = gtk_notebook_new ();
+	gtk_box_pack_start (GTK_BOX (dialog_vbox1), notebook, TRUE, TRUE, 0);
+
+	table1 = gtk_table_new (10, 2, FALSE);
+	gtk_container_add (GTK_CONTAINER (notebook), table1);
+
+	label4 = gtk_label_new ("Username");
+	gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 0, 1,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
+
+	label5 = gtk_label_new ("Full name");
+	gtk_table_attach (GTK_TABLE (table1), label5, 0, 1, 1, 2,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);
+
+	label6 = gtk_label_new ("Description");
+	gtk_table_attach (GTK_TABLE (table1), label6, 0, 1, 2, 3,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);
+
+	label7 = gtk_label_new ("Password");
+	gtk_table_attach (GTK_TABLE (table1), label7, 0, 1, 3, 4,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);
+
+	label8 = gtk_label_new ("Confirm password");
+	gtk_table_attach (GTK_TABLE (table1), label8, 0, 1, 4, 5,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);
+
+	chk_mustchange = gtk_check_button_new_with_mnemonic ("_User Must Change Password at Next Logon");
+	gtk_table_attach (GTK_TABLE (table1), chk_mustchange, 1, 2, 5, 6,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	entry_fullname = gtk_entry_new ();
+	gtk_table_attach (GTK_TABLE (table1), entry_fullname, 1, 2, 1, 2,
+					  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	entry_description = gtk_entry_new ();
+	gtk_table_attach (GTK_TABLE (table1), entry_description, 1, 2, 2, 3,
+					  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	lbl_username = gtk_label_new ("");
+	gtk_table_attach (GTK_TABLE (table1), lbl_username, 1, 2, 0, 1,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (lbl_username), 0, 0.5);
+
+	entry_password = gtk_entry_new ();
+	gtk_table_attach (GTK_TABLE (table1), entry_password, 1, 2, 3, 4,
+					  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	entry_confirm_password = gtk_entry_new ();
+	gtk_table_attach (GTK_TABLE (table1), entry_confirm_password, 1, 2, 4, 5,
+					  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	chk_cannotchange = gtk_check_button_new_with_mnemonic ("User Cannot Change Password");
+	gtk_table_attach (GTK_TABLE (table1), chk_cannotchange, 1, 2, 6, 7,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	chk_cannotexpire = gtk_check_button_new_with_mnemonic ("Password Never Expires");
+	gtk_table_attach (GTK_TABLE (table1), chk_cannotexpire, 1, 2, 7, 8,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	chk_disabled = gtk_check_button_new_with_mnemonic ("Account Disabled");
+	gtk_table_attach (GTK_TABLE (table1), chk_disabled, 1, 2, 8, 9,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	chk_lockedout = gtk_check_button_new_with_mnemonic ("Account Locked Out");
+	gtk_table_attach (GTK_TABLE (table1), chk_lockedout, 1, 2, 9, 10,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	label1 = gtk_label_new ("Main");
+	gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 0), label1);
+
+	hbox1 = gtk_hbox_new (FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (notebook), hbox1);
+
+	scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);
+	gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow3, TRUE, TRUE, 0);
+
+	treeview3 = gtk_tree_view_new ();
+	gtk_container_add (GTK_CONTAINER (scrolledwindow3), treeview3);
+
+	vbox2 = gtk_vbox_new (TRUE, 0);
+	gtk_box_pack_start (GTK_BOX (hbox1), vbox2, TRUE, TRUE, 0);
+
+	btn_groupadd = gtk_button_new_from_stock ("gtk-add");
+	gtk_box_pack_start (GTK_BOX (vbox2), btn_groupadd, FALSE, FALSE, 0);
+
+	btn_groupdel = gtk_button_new_from_stock ("gtk-remove");
+	gtk_box_pack_start (GTK_BOX (vbox2), btn_groupdel, FALSE, FALSE, 0);
+
+	scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL);
+	gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow4, TRUE, TRUE, 0);
+
+	treeview4 = gtk_tree_view_new ();
+	gtk_container_add (GTK_CONTAINER (scrolledwindow4), treeview4);
+
+	label2 = gtk_label_new ("Groups");
+	gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 1), label2);
+
+	vbox3 = gtk_vbox_new (FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (notebook), vbox3);
+
+	frame1 = gtk_frame_new (NULL);
+	gtk_box_pack_start (GTK_BOX (vbox3), frame1, TRUE, TRUE, 0);
+
+	table2 = gtk_table_new (2, 2, FALSE);
+	gtk_container_add (GTK_CONTAINER (frame1), table2);
+
+	label12 = gtk_label_new ("User Profile Path:");
+	gtk_table_attach (GTK_TABLE (table2), label12, 0, 1, 0, 1,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label12), 0, 0.5);
+
+	label13 = gtk_label_new ("Logon Script Name:");
+	gtk_table_attach (GTK_TABLE (table2), label13, 0, 1, 1, 2,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label13), 0, 0.5);
+
+	entry_profilepath = gtk_entry_new ();
+	gtk_table_attach (GTK_TABLE (table2), entry_profilepath, 1, 2, 0, 1,
+					  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	entry_scriptname = gtk_entry_new ();
+	gtk_table_attach (GTK_TABLE (table2), entry_scriptname, 1, 2, 1, 2,
+					  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	label10 = gtk_label_new ("User Profiles");
+	gtk_frame_set_label_widget (GTK_FRAME (frame1), label10);
+
+	frame2 = gtk_frame_new (NULL);
+	gtk_box_pack_start (GTK_BOX (vbox3), frame2, TRUE, TRUE, 0);
+
+	table3 = gtk_table_new (2, 2, FALSE);
+	gtk_container_add (GTK_CONTAINER (frame2), table3);
+
+	label14 = gtk_label_new ("Path");
+	gtk_table_attach (GTK_TABLE (table3), label14, 0, 1, 0, 1,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label14), 0, 0.5);
+
+	entry_homedir = gtk_entry_new ();
+	gtk_table_attach (GTK_TABLE (table3), entry_homedir, 1, 2, 0, 1,
+					  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	chk_mapdrive = gtk_check_button_new_with_mnemonic ("Map homedir to drive");
+	gtk_table_attach (GTK_TABLE (table3), chk_mapdrive, 0, 1, 1, 2,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (0), 0, 0);
+
+	combo_homedrive = gtk_combo_box_new();
+	gtk_table_attach (GTK_TABLE (table3), combo_homedrive, 1, 2, 1, 2,
+					  (GtkAttachOptions) (GTK_FILL),
+					  (GtkAttachOptions) (GTK_FILL), 0, 0);
+	for(i = 'C'; i <= 'Z'; i++)
+	{
+		char drive[3];
+		snprintf(drive, 3, "%c:", i);
+		gtk_combo_box_append_text (GTK_COMBO_BOX (combo_homedrive), drive);
+	}
+
+	label11 = gtk_label_new ("Home Directory");
+	gtk_frame_set_label_widget (GTK_FRAME (frame2), label11);
+
+	label3 = gtk_label_new ("Profile");
+	gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 2), label3);
+
+	dialog_action_area1 = GTK_DIALOG (user_edit_dialog)->action_area;
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
+
+	cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
+	gtk_dialog_add_action_widget (GTK_DIALOG (user_edit_dialog), cancelbutton1, GTK_RESPONSE_CANCEL);
+	GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
+
+	applybutton1 = gtk_button_new_from_stock ("gtk-apply");
+	gtk_dialog_add_action_widget (GTK_DIALOG (user_edit_dialog), applybutton1, GTK_RESPONSE_APPLY);
+	GTK_WIDGET_SET_FLAGS (applybutton1, GTK_CAN_DEFAULT);
+
+	okbutton1 = gtk_button_new_from_stock ("gtk-ok");
+	gtk_dialog_add_action_widget (GTK_DIALOG (user_edit_dialog), okbutton1, GTK_RESPONSE_OK);
+	GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
+
+	gtk_widget_show_all(dialog_vbox1);
+
+	return user_edit_dialog;
+}

Added: trunk/samba-gtk/tools/gwsvcctl.c
===================================================================
--- trunk/samba-gtk/tools/gwsvcctl.c	                        (rev 0)
+++ trunk/samba-gtk/tools/gwsvcctl.c	2009-04-14 15:00:11 UTC (rev 2701)
@@ -0,0 +1,223 @@
+/* 
+   Unix SMB/CIFS implementation.
+   GTK+ Windows services management
+   
+   Copyright (C) Jelmer Vernooij 2006
+
+   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 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#define _GNU_SOURCE
+#include <stdbool.h>
+#include <gen_ndr/ndr_svcctl_c.h>
+#include "common/gtk-smb.h"
+#include <credentials.h>
+#include "common/select.h"
+#include <samba/popt.h>
+#include <param.h>
+#include <util/debug.h>
+
+static struct dcerpc_pipe *svcctl_pipe = NULL;
+static GtkWidget *mainwin;
+static GtkListStore *store_services;
+static GtkWidget *services;
+static GtkWidget *new_service, *delete_service, *edit_service, *start_service, *stop_service;
+static struct loadparm_context *lp_ctx = NULL;
+
+static void on_connect_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	TALLOC_CTX *mem_ctx = talloc_init("gwsvcctl_connect");
+
+	svcctl_pipe = gtk_connect_rpc_interface(mem_ctx, lp_ctx, &ndr_table_svcctl);
+	if (svcctl_pipe == NULL)
+		return;
+
+	gtk_widget_set_sensitive (new_service, TRUE);
+
+	/* FIXME: Fetch list of services and display */
+}
+
+static void on_quit_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	talloc_free(svcctl_pipe);
+	gtk_main_quit();
+}
+
+static void on_about_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	GtkDialog *aboutwin = GTK_DIALOG(create_gtk_samba_about_dialog("gwcrontab"));
+	gtk_dialog_run(aboutwin);
+	gtk_widget_destroy(GTK_WIDGET(aboutwin));
+}
+
+static GtkWidget* create_mainwindow (void)
+{
+	GtkWidget *mainwindow;
+	GtkWidget *vbox;
+	GtkWidget *menubar;
+	GtkWidget *menuitem4;
+	GtkWidget *menuitem4_menu;
+	GtkWidget *mnu_connect;
+	GtkWidget *separatormenuitem1;
+	GtkWidget *quit;
+	GtkWidget *service;
+	GtkWidget *service_menu;
+	GtkCellRenderer *renderer;
+	GtkTreeViewColumn *curcol;
+	GtkWidget *menuitem7;
+	GtkWidget *menuitem7_menu;
+	GtkWidget *about;
+	GtkWidget *scrolledwindow;
+	GtkWidget *statusbar;
+	GtkAccelGroup *accel_group;
+
+	accel_group = gtk_accel_group_new ();
+
+	mainwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	gtk_window_set_default_size (GTK_WINDOW (mainwindow), 642, 562);
+	gtk_window_set_title (GTK_WINDOW (mainwindow), "Service Management");
+
+	vbox = gtk_vbox_new (FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (mainwindow), vbox);
+
+	menubar = gtk_menu_bar_new ();
+	gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE, 0);
+
+	menuitem4 = gtk_menu_item_new_with_mnemonic ("_File");
+	gtk_container_add (GTK_CONTAINER (menubar), menuitem4);
+
+	menuitem4_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem4), menuitem4_menu);
+
+	mnu_connect = gtk_menu_item_new_with_mnemonic ("_Connect");
+	gtk_container_add (GTK_CONTAINER (menuitem4_menu), mnu_connect);
+	g_signal_connect ((gpointer) mnu_connect, "activate",
+	  G_CALLBACK (on_connect_activate), NULL);
+
+	separatormenuitem1 = gtk_separator_menu_item_new ();
+	gtk_container_add (GTK_CONTAINER (menuitem4_menu), separatormenuitem1);
+	gtk_widget_set_sensitive (separatormenuitem1, FALSE);
+
+	quit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
+	gtk_container_add (GTK_CONTAINER (menuitem4_menu), quit);
+
+	service = gtk_menu_item_new_with_mnemonic ("_Service");
+	gtk_container_add (GTK_CONTAINER (menubar), service);
+
+	service_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (service), service_menu);
+
+	new_service = gtk_menu_item_new_with_mnemonic ("_New");
+	gtk_container_add (GTK_CONTAINER (service_menu), new_service);
+	gtk_widget_set_sensitive (new_service, FALSE);
+
+	start_service = gtk_menu_item_new_with_mnemonic ("_Start");
+	gtk_container_add (GTK_CONTAINER (service_menu), start_service);
+	gtk_widget_set_sensitive (start_service, FALSE);
+
+	stop_service = gtk_menu_item_new_with_mnemonic ("St_op");
+	gtk_container_add (GTK_CONTAINER (service_menu), stop_service);
+	gtk_widget_set_sensitive (stop_service, FALSE);
+
+	edit_service = gtk_menu_item_new_with_mnemonic ("_Edit");
+	gtk_container_add (GTK_CONTAINER (service_menu), edit_service);
+	gtk_widget_set_sensitive (edit_service, FALSE);
+
+	delete_service = gtk_menu_item_new_with_mnemonic ("_Delete");
+	gtk_widget_set_sensitive(delete_service, FALSE);
+	gtk_container_add (GTK_CONTAINER (service_menu), delete_service);
+
+	menuitem7 = gtk_menu_item_new_with_mnemonic ("_Help");
+	gtk_container_add (GTK_CONTAINER (menubar), menuitem7);
+
+	menuitem7_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem7), menuitem7_menu);
+
+	about = gtk_menu_item_new_with_mnemonic ("_About");
+	gtk_container_add (GTK_CONTAINER (menuitem7_menu), about);
+
+	scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+	gtk_box_pack_start (GTK_BOX (vbox), scrolledwindow, TRUE, TRUE, 0);
+
+	services = gtk_tree_view_new ();
+
+	curcol = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title(curcol, "Status");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, TRUE);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(services), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 0);
+
+	curcol = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title(curcol, "ID");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, TRUE);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(services), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 1);
+
+	curcol = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title(curcol, "Day");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, TRUE);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(services), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 2);
+
+	curcol = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title(curcol, "Time");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, TRUE);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(services), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 3);
+
+	curcol = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_title(curcol, "Command Line");
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(curcol, renderer, TRUE);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(services), curcol);
+	gtk_tree_view_column_add_attribute(curcol, renderer, "text", 4);
+
+	store_services = gtk_list_store_new(5, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING);
+	gtk_tree_view_set_model(GTK_TREE_VIEW(services), GTK_TREE_MODEL(store_services));
+	g_object_unref(store_services);
+
+	gtk_container_add (GTK_CONTAINER (scrolledwindow), services);
+
+	statusbar = gtk_statusbar_new ();
+	gtk_box_pack_start (GTK_BOX (vbox), statusbar, FALSE, FALSE, 0);
+
+	g_signal_connect ((gpointer) quit, "activate",
+	  G_CALLBACK (on_quit_activate), NULL);
+	g_signal_connect ((gpointer) about, "activate",
+	  G_CALLBACK (on_about_activate), NULL);
+
+	gtk_window_add_accel_group (GTK_WINDOW (mainwindow), accel_group);
+
+	return mainwindow;
+}
+
+int main(int argc, char **argv)
+{
+	lp_ctx = loadparm_init(NULL);
+	lp_load_default(lp_ctx);
+	setup_logging(argv[0], DEBUG_STDERR);
+
+	dcerpc_init(lp_ctx);
+
+	gtk_init(&argc, &argv);
+	mainwin = create_mainwindow();
+	gtk_widget_show_all(mainwin);
+
+	return gtk_event_loop();
+}




More information about the Pkg-samba-maint mailing list