commit 1ed14a04642606304b9edf802f94603463cc471a Author: alex-sh Date: Sat Dec 21 13:01:26 2013 +0000 Imported gtk2_prefs 0.4.1 with minor modifications in copyright headers (upadated emails). diff --git a/gtk2_prefs/trunk/gtk2_prefs/AUTHORS b/gtk2_prefs/trunk/gtk2_prefs/AUTHORS new file mode 100644 index 00000000..e6afde44 --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/AUTHORS @@ -0,0 +1 @@ +Alexander Shaduri diff --git a/gtk2_prefs/trunk/gtk2_prefs/COPYING b/gtk2_prefs/trunk/gtk2_prefs/COPYING new file mode 100644 index 00000000..5b6e7c66 --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/gtk2_prefs/trunk/gtk2_prefs/ChangeLog b/gtk2_prefs/trunk/gtk2_prefs/ChangeLog new file mode 100644 index 00000000..28eaaafa --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/ChangeLog @@ -0,0 +1,19 @@ + +Version 0.4.1 08 Aug 2005 + Ability to toggle between all users / current user. + +Version 0.4.0 30 May 2005 + Redesign for better GNOME HIG compatibility (based on ideas by Christian Storgaard). + Added option for using theme default font. + Minor improvements in RPM spec file (based on Pascal Bleser's package). + GTK >= 2.4.0 is required now. + +Version 0.3.2 19 Apr 2005 + Added RPM spec file. + +Version 0.3.1 17 Jun 2004 + Remove unneeded mingw dependancy for win32. + +Version 0.3.0 12 Jun 2004 + GTK 2.4 compatibility + diff --git a/gtk2_prefs/trunk/gtk2_prefs/Makefile.am b/gtk2_prefs/trunk/gtk2_prefs/Makefile.am new file mode 100644 index 00000000..02520f20 --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/Makefile.am @@ -0,0 +1,5 @@ +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign 1.4 + +SUBDIRS = src diff --git a/gtk2_prefs/trunk/gtk2_prefs/README b/gtk2_prefs/trunk/gtk2_prefs/README new file mode 100644 index 00000000..96827d9b --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/README @@ -0,0 +1,13 @@ + +gtk2_prefs: +GTK+ version 2 preference utility - theme and font switcher +by Alexander Shaduri + +The latest version may be obtained at +http://members.lycos.co.uk/alexv6 + +You will need at least GTK+ version 2.4.0 for installation. + +For more information about GTK+ visit http://www.gtk.org + + diff --git a/gtk2_prefs/trunk/gtk2_prefs/autogen.sh b/gtk2_prefs/trunk/gtk2_prefs/autogen.sh new file mode 100755 index 00000000..94fac8b0 --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/autogen.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +echo "Building configure..." +autoreconf --install + +rm -f config.cache + +echo +echo 'run "./configure ; make ; make install"' +echo + diff --git a/gtk2_prefs/trunk/gtk2_prefs/configure.in b/gtk2_prefs/trunk/gtk2_prefs/configure.in new file mode 100644 index 00000000..cdb4f3c9 --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/configure.in @@ -0,0 +1,36 @@ +AC_INIT(configure.in) + +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(gtk2_prefs, 0.4.1) + +AC_LANG_CPLUSPLUS +AC_PROG_CXX +AM_PROG_LIBTOOL + + +dnl ------------------------------ +pkg_modules="gtk+-2.0 >= 2.4.0" + +PKG_CHECK_MODULES(PACKAGE, [$pkg_modules]) + +dnl AC_SUBST(PACKAGE_CFLAGS) +dnl AC_SUBST(PACKAGE_LIBS) + +LIBS="$LIBS $PACKAGE_LIBS " +CFLAGS="$CFLAGS $PACKAGE_CFLAGS " +CXXFLAGS="$CXXFLAGS $PACKAGE_CFLAGS " + +dnl ------------------------------ + +all_libraries="$all_libraries $LIBS $USER_LDFLAGS" +all_includes="$all_includes $CXXFLAGS $USER_INCLUDES" + +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +dnl ------------------------------ + +AC_CONFIG_FILES([ gtk2_prefs.spec ]) + +AC_OUTPUT(Makefile src/Makefile) + diff --git a/gtk2_prefs/trunk/gtk2_prefs/gtk2_prefs.kdevelop b/gtk2_prefs/trunk/gtk2_prefs/gtk2_prefs.kdevelop new file mode 100644 index 00000000..d991f09f --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/gtk2_prefs.kdevelop @@ -0,0 +1,208 @@ + + + + Alex Shaduri + ashaduri 'at' gmail.com + 0.4.1 + KDevAutoProject + C++ + + C++ + Code + + . + false + + + + gtk2_prefs + + + + + src/gtk2_prefs + win32 + + + + false + executable + / + + true + + + /10/devel/projects/gtk2_prefs/current/gtk2_prefs/win32 + false + false + false + + + + optimized + kdevgccoptions + kdevgppoptions + kdevg77options + -O2 -g0 + + + --enable-debug=full + debug + kdevgccoptions + kdevgppoptions + kdevg77options + -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Wmissing-prototypes -ggdb -DDEBUG -fno-exceptions -fno-rtti -pthread -D_THREAD_SAFE -O0 -g2 + + + -pthread + + + + -ggdb -DDEBUG -pthread -D_THREAD_SAFE -O0 -g + + + + --target=i386-mingw32 --host=i386-mingw32 --build=i686-linux PKG_CONFIG_PATH=/target/lib/pkgconfig PKG_CONFIG_LIBDIR=/target/lib PATH="/opt/local/cross-tools/bin:/target/bin:$PATH" + win32 + + + -march=i586 -s -mms-bitfields -mthreads + kdevgccoptions + kdevgppoptions + kdevg77options + "i386-mingw32-gcc -mms-bitfields" + "i386-mingw32-g++ -mms-bitfields" + + -march=i586 -mms-bitfields -mwindows -O3 -g0 -s + -g0 -O3 -march=i586 -fno-rtti -mwindows -Wall -Wcast-align -Wcast-qual -Wconversion -Wctor-dtor-privacy -Wfloat-equal -Wnon-virtual-dtor -Woverloaded-virtual -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-compare -Wsign-promo -Wundef -Wwrite-strings + + + + + + + + + + true + 1 + false + + + + + + + + + + + + + + + false + false + + + *.o,*.lo,CVS + false + + + + + .h + .cpp + + + + + true + true + true + true + true + true + true + 250 + 400 + 250 + false + 0 + true + true + false + std=_GLIBCXX_STD;__gnu_cxx=std + true + false + false + false + false + true + true + false + .; + + + + + set + m_,_ + theValue + true + true + + + false + 3 + 3 + /usr/lib/qt3 + EmbeddedKDevDesigner + /usr/lib/qt3/bin/qmake + /usr/lib/qt3/bin/designer + + + + false + true + Vertical + + + + + + + + + + + true + false + false + false + + + true + true + 10 + + + + + html/ + html/ + + + + + + + + + + + + + + + diff --git a/gtk2_prefs/trunk/gtk2_prefs/gtk2_prefs.spec.in b/gtk2_prefs/trunk/gtk2_prefs/gtk2_prefs.spec.in new file mode 100644 index 00000000..3c9f009b --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/gtk2_prefs.spec.in @@ -0,0 +1,59 @@ + +Summary: GTK2 theme and font selection utility +Name: gtk2_prefs +Version: @VERSION@ +Release: 1ash +License: GPL2 +Vendor: Alexander Shaduri +Source: gtk2_prefs-%{version}.tar.bz2 +Url: http://members.lycos.co.uk/alexv6 +Packager: Alexander Shaduri +Group: System/GUI/GNOME +Requires: gtk2 >= 2.4.0, glib2, libstdc++ +BuildRequires: gtk2, gtk2-devel >= 2.4.0, pkgconfig, gcc-c++, libstdc++, libstdc++-devel, gcc-c++ +BuildRequires: autoconf, automake, libtool +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +A small utility to select themes and fonts for GTK+ version 2. + + +%prep + +%setup -q + +./autogen.sh +%configure + +%build +# Setup for parallel builds +numprocs=`egrep -c ^cpu[0-9]+ /proc/stat || :` +if [ "$numprocs" = "0" ]; then + numprocs=1 +fi + +make -j$numprocs + +%install +#make install-strip DESTDIR=$RPM_BUILD_ROOT +%makeinstall + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root) + +%attr(0755,root,root) %{_bindir}/gtk2_prefs +# %doc %{_docdir}/gtk2_prefs-@VERSION@ +%doc AUTHORS ChangeLog README NEWS TODO + + +%changelog +* Mon May 30 2005 Alexander Shaduri +Minor improvements (based on Pascal Bleser's package). + +* Tue Apr 19 2005 Alexander Shaduri +Initial package release. + + diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/Makefile.am b/gtk2_prefs/trunk/gtk2_prefs/src/Makefile.am new file mode 100644 index 00000000..200caa0c --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/Makefile.am @@ -0,0 +1,11 @@ +bin_PROGRAMS = gtk2_prefs + + +# set the include path found by configure +INCLUDES= $(all_includes) + +# the library search path. +gtk2_prefs_LDFLAGS = $(all_libraries) +gtk2_prefs_SOURCES = callbacks.cpp interface.cpp main.cpp support.cpp \ + win32util.cpp +noinst_HEADERS = callbacks.h interface.h main.h support.h win32util.h diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/callbacks.cpp b/gtk2_prefs/trunk/gtk2_prefs/src/callbacks.cpp new file mode 100644 index 00000000..9cc5c928 --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/callbacks.cpp @@ -0,0 +1,224 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include "callbacks.h" +#include "interface.h" +#include "support.h" + +#include "main.h" + + + +extern GtkWidget* g_main_window; + +void +on_main_showpreviewtoggle_toggled (GtkToggleButton *togglebutton, + gpointer user_data) +{ + if (gtk_toggle_button_get_active (togglebutton)) { + gtk_widget_show(lookup_widget(g_main_window, "main_previewhbox")); + gtk_button_set_label(GTK_BUTTON(togglebutton), "Hide preview <<"); + gtk_window_resize(GTK_WINDOW(g_main_window), 700, 330); + } else { + gtk_widget_hide(lookup_widget(g_main_window, "main_previewhbox")); + gtk_button_set_label(GTK_BUTTON(togglebutton), "Show preview >>"); + gtk_window_resize(GTK_WINDOW(g_main_window), 300, 330); + } + +} + + +/* +extern GtkWidget* g_fontsel_dialog; + + +void +on_fontsel_dialog_response (GtkDialog *dialog, + gint id, + gpointer user_data) +{ + + switch(id) { + case GTK_RESPONSE_OK: + { + const char* font = gtk_font_selection_dialog_get_font_name (GTK_FONT_SELECTION_DIALOG(dialog)); + std::string f = (font ? font : ""); + set_theme(get_selected_theme(), f); + break; + } +// case GTK_RESPONSE_CANCEL: +// gtk_widget_destroy(g_fontsel_dialog); +// g_fontsel_dialog = 0; +// return; + + } + gtk_widget_destroy(g_fontsel_dialog); + g_fontsel_dialog = 0; + +} + + +gboolean +on_fontsel_dialog_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data) +{ + gtk_widget_destroy(g_fontsel_dialog); + g_fontsel_dialog = 0; + + return FALSE; +} + + +void +on_main_fontselectbutton_clicked (GtkButton *button, + gpointer user_data) +{ + g_fontsel_dialog = create_fontsel_dialog(); + gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(g_fontsel_dialog), get_current_font().c_str()); + gtk_widget_show(g_fontsel_dialog); +} +*/ + + + + + +void +on_main_ok_button_clicked (GtkButton *button, + gpointer user_data) +{ + if (save_current_theme()) + gtk_main_quit(); +} + + +void +on_main_cancel_button_clicked (GtkButton *button, + gpointer user_data) +{ + gtk_main_quit(); +} + + +void +on_main_reset_button_clicked (GtkButton *button, + gpointer user_data) +{ + set_theme(get_orig_theme(), get_orig_font()); +} + + +gboolean +on_main_window_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data) +{ + program_shutdown(); + return true; +} + + +void +on_main_use_default_font_radio_toggled (GtkToggleButton *togglebutton, + gpointer user_data) +{ + bool default_font = gtk_toggle_button_get_active(togglebutton); + + gtk_widget_set_sensitive(lookup_widget(g_main_window, "main_font_selector_button"), !default_font); + + apply_theme(get_selected_theme(), get_selected_font()); +} + + +void +on_main_font_selector_button_font_set (GtkFontButton *fontbutton, + gpointer user_data) +{ + apply_theme(get_selected_theme(), get_selected_font()); +} + + +void +on_new2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_open2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_save2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_save_as2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_quit2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_cut2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_copy2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_paste2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_delete2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_about2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/callbacks.h b/gtk2_prefs/trunk/gtk2_prefs/src/callbacks.h new file mode 100644 index 00000000..5759aebc --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/callbacks.h @@ -0,0 +1,71 @@ +#include + + +void +on_main_showpreviewtoggle_toggled (GtkToggleButton *togglebutton, + gpointer user_data); + +void +on_main_ok_button_clicked (GtkButton *button, + gpointer user_data); + +void +on_main_cancel_button_clicked (GtkButton *button, + gpointer user_data); + +void +on_main_reset_button_clicked (GtkButton *button, + gpointer user_data); + +gboolean +on_main_window_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +void +on_main_use_default_font_radio_toggled (GtkToggleButton *togglebutton, + gpointer user_data); + +void +on_main_font_selector_button_font_set (GtkFontButton *fontbutton, + gpointer user_data); + +void +on_new2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_open2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_save2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_save_as2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_quit2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_cut2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_copy2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_paste2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_delete2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_about2_activate (GtkMenuItem *menuitem, + gpointer user_data); diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/gtk2_prefs.glade b/gtk2_prefs/trunk/gtk2_prefs/src/gtk2_prefs.glade new file mode 100644 index 00000000..7b2c43e9 --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/gtk2_prefs.glade @@ -0,0 +1,1358 @@ + + + + + + + True + Gtk2 Theme Selector + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + + + + + 310 + 320 + True + False + 0 + + + + 3 + True + False + 0 + + + + True + False + 0 + + + + True + 0 + 0.5 + GTK_SHADOW_NONE + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + True + False + False + False + True + + + + + + + + + + True + <b>Theme</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + True + 0 + 0.5 + GTK_SHADOW_NONE + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + False + 0 + + + + True + False + 0 + + + + True + False + 0 + + + + True + True + Use theme default font + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + True + Use custom font: + True + GTK_RELIEF_NORMAL + True + True + False + True + main_use_default_font_radio + + + 0 + False + False + + + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + False + 0 + + + + True + False + 0 + + + + True + False + 0 + + + + True + True + True + True + False + False + True + + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + False + False + + + + + + + 0 + True + True + + + + + 0 + True + True + + + + + 0 + False + False + + + + + + + + + + True + <b>Font</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 9 + False + False + + + + + + True + False + 0 + + + + True + False + 0 + + + + True + If this is enabled, the program will update the system-wide configuration file. NOT RECOMMENDED! + True + Apply settings system-wide + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 12 + False + False + + + + + + True + True + Show preview >> + True + GTK_RELIEF_NORMAL + True + False + False + + + + 2 + False + False + GTK_PACK_END + + + + + 0 + True + True + + + + + 0 + False + False + + + + + + True + GTK_BUTTONBOX_DEFAULT_STYLE + 0 + + + 0 + False + False + + + + + + True + False + 0 + + + + True + False + 0 + + + + True + gtk-dialog-info + 3 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + You should restart your programs +for this change to take effect. + False + False + GTK_JUSTIFY_LEFT + True + False + 0 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + 0 + True + False + + + + + 6 + False + True + + + + + + True + False + 0 + + + + 4 + True + True + 0 + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + + + + 4 + True + True + GTK_PACK_END + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + + + + 4 + True + True + GTK_PACK_END + + + + + + True + True + GTK_RELIEF_NORMAL + True + + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-revert-to-saved + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Reset + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + 4 + True + True + GTK_PACK_END + + + + + 0 + False + False + + + + + 0 + False + False + + + + + 0 + True + True + + + + + + False + 0 + + + + True + + + 4 + False + True + + + + + + 3 + True + 0 + 0.5 + GTK_SHADOW_NONE + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 0 + 0 + + + + True + False + 0 + + + + True + True + True + True + GTK_POS_TOP + False + False + + + + 5 + True + 3 + 3 + False + 0 + 0 + + + + True + False + 4 + + + + True + True + check button 1 + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + check button 2 + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + button + True + GTK_RELIEF_NORMAL + True + + + 0 + False + False + + + + + + True + True + toggle button + True + GTK_RELIEF_NORMAL + True + False + False + + + 0 + False + False + + + + + + True + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 0 0 100 1 10 10 + + + 0 + False + False + + + + + 0 + 1 + 0 + 1 + + + + + + True + False + 4 + + + + True + + + + True + _File + True + + + + + + + True + gtk-new + True + + + + + + + True + gtk-open + True + + + + + + + True + gtk-save + True + + + + + + + True + gtk-save-as + True + + + + + + + True + + + + + + True + gtk-quit + True + + + + + + + + + + + True + _Edit + True + + + + + + + True + gtk-cut + True + + + + + + + True + gtk-copy + True + + + + + + + True + gtk-paste + True + + + + + + + True + gtk-delete + True + + + + + + + + + + + True + _Help + True + + + + + + + True + _About + True + + + + + + + + + + 0 + False + False + + + + + + True + item 1 +item 2 +item 3 + + + 0 + False + False + + + + + + 80 + 25 + True + item 1 +item 2 +item 3 + + + 0 + False + False + + + + + + True + True + True + GTK_POS_TOP + 0 + GTK_UPDATE_CONTINUOUS + False + 15 0 50 1 0 0 + + + 0 + True + True + + + + + 2 + 3 + 0 + 1 + fill + + + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + True + True + + + + + 2 + 3 + 1 + 2 + fill + fill + + + + + + 6 + 20 + True + True + + + 1 + 3 + 2 + 3 + fill + + + + + + + 80 + 20 + True + GTK_PROGRESS_LEFT_TO_RIGHT + 0.560000002384 + 0.10000000149 + 56% + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + + + 1 + 2 + 0 + 2 + 5 + fill + fill + + + + + + True + 0.5 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + 5 + True + False + 0 + + + + True + True + radio 1 + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + radio 2 + True + GTK_RELIEF_NORMAL + True + False + False + True + radiobutton1 + + + 0 + False + False + + + + + + True + True + radio 3 + True + GTK_RELIEF_NORMAL + True + False + False + True + radiobutton1 + + + 0 + False + False + + + + + + + + True + frame + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 1 + 0 + + + label_item + + + + + 0 + 1 + 1 + 2 + expand + + + + + False + True + + + + + + True + Common widgets + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_WORD + True + 0 + 0 + 0 + 8 + 8 + 0 + You can type some text here. +You can also click the right mouse button for a popup menu. + + + + + False + True + + + + + + True + Text area + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + False + 0 + + + + 7 + True + False + 0 + + + + True + + False + False + GTK_JUSTIFY_LEFT + True + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + 0 + True + True + + + + + False + True + + + + + + True + About + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + 0 + True + True + + + + + + + + + + True + <b>Preview</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + + diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/gtk2_prefs.gladep b/gtk2_prefs/trunk/gtk2_prefs/src/gtk2_prefs.gladep new file mode 100644 index 00000000..82b6958d --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/gtk2_prefs.gladep @@ -0,0 +1,16 @@ + + + + + gtk2_prefs + gtk2_prefs + + FALSE + FALSE + TRUE + FALSE + FALSE + FALSE + interface.cpp + callbacks.cpp + diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/interface.cpp b/gtk2_prefs/trunk/gtk2_prefs/src/interface.cpp new file mode 100644 index 00000000..afa96387 --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/interface.cpp @@ -0,0 +1,834 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#include "callbacks.h" +#include "interface.h" +#include "support.h" + +#define GLADE_HOOKUP_OBJECT(component,widget,name) \ + g_object_set_data_full (G_OBJECT (component), name, \ + gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) + +#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ + g_object_set_data (G_OBJECT (component), name, widget) + +GtkWidget* +create_main_window (void) +{ + GtkWidget *main_window; + GtkWidget *main_hbox; + GtkWidget *vbox1; + GtkWidget *hbox1; + GtkWidget *frame2; + GtkWidget *alignment3; + GtkWidget *scrolledwindow3; + GtkWidget *main_themelist; + GtkWidget *label1234; + GtkWidget *frame3; + GtkWidget *alignment4; + GtkWidget *vbox7; + GtkWidget *hbox8; + GtkWidget *vbox9; + GtkWidget *main_use_default_font_radio; + GSList *main_use_default_font_radio_group = NULL; + GtkWidget *main_use_custom_font_radio; + GtkWidget *alignment5; + GtkWidget *vbox10; + GtkWidget *hbox9; + GtkWidget *vbox11; + GtkWidget *main_font_selector_button; + GtkWidget *label669; + GtkWidget *vbox13; + GtkWidget *hbox6666; + GtkWidget *main_use_system_config_checkbutton; + GtkWidget *main_showpreviewtoggle; + GtkWidget *hbuttonbox1; + GtkWidget *hbox7; + GtkWidget *hbox6665; + GtkWidget *image2; + GtkWidget *label2; + GtkWidget *vbox6; + GtkWidget *hbox5; + GtkWidget *main_ok_button; + GtkWidget *main_cancel_button; + GtkWidget *main_reset_button; + GtkWidget *alignment2; + GtkWidget *hbox6; + GtkWidget *image1; + GtkWidget *label667; + GtkWidget *main_previewhbox; + GtkWidget *vseparator2; + GtkWidget *frame4; + GtkWidget *alignment6; + GtkWidget *vbox12; + GtkWidget *main_previewbook; + GtkWidget *table1; + GtkWidget *vbox2; + GtkWidget *checkbutton1; + GtkWidget *checkbutton2; + GtkWidget *button4; + GtkWidget *togglebutton1; + GtkObject *spinbutton1_adj; + GtkWidget *spinbutton1; + GtkWidget *vbox4; + GtkWidget *menubar2; + GtkWidget *menuitem5; + GtkWidget *menuitem5_menu; + GtkWidget *new2; + GtkWidget *open2; + GtkWidget *save2; + GtkWidget *save_as2; + GtkWidget *separatormenuitem2; + GtkWidget *quit2; + GtkWidget *menuitem6; + GtkWidget *menuitem6_menu; + GtkWidget *cut2; + GtkWidget *copy2; + GtkWidget *paste2; + GtkWidget *delete2; + GtkWidget *menuitem8; + GtkWidget *menuitem8_menu; + GtkWidget *about2; + GtkWidget *combobox1; + GtkWidget *comboboxentry1; + GtkWidget *hscale1; + GtkWidget *scrolledwindow1; + GtkWidget *preview_treeview; + GtkWidget *statusbar1; + GtkWidget *progressbar1; + GtkWidget *vseparator1; + GtkWidget *frame1; + GtkWidget *vbox3; + GtkWidget *radiobutton1; + GSList *radiobutton1_group = NULL; + GtkWidget *radiobutton2; + GtkWidget *radiobutton3; + GtkWidget *label6; + GtkWidget *label4; + GtkWidget *scrolledwindow2; + GtkWidget *textview1; + GtkWidget *label5; + GtkWidget *vbox5; + GtkWidget *hbox4; + GtkWidget *about_label; + GtkWidget *label666; + GtkWidget *label670; + GtkAccelGroup *accel_group; + GtkTooltips *tooltips; + + tooltips = gtk_tooltips_new (); + + accel_group = gtk_accel_group_new (); + + main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_set_name (main_window, "main_window"); + gtk_window_set_title (GTK_WINDOW (main_window), "Gtk2 Theme Selector"); + + main_hbox = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (main_hbox, "main_hbox"); + gtk_widget_show (main_hbox); + gtk_container_add (GTK_CONTAINER (main_window), main_hbox); + gtk_widget_set_size_request (main_hbox, 310, 320); + + vbox1 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox1, "vbox1"); + gtk_widget_show (vbox1); + gtk_box_pack_start (GTK_BOX (main_hbox), vbox1, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), 3); + + hbox1 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox1, "hbox1"); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0); + + frame2 = gtk_frame_new (NULL); + gtk_widget_set_name (frame2, "frame2"); + gtk_widget_show (frame2); + gtk_box_pack_start (GTK_BOX (hbox1), frame2, TRUE, TRUE, 0); + gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_NONE); + + alignment3 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_widget_set_name (alignment3, "alignment3"); + gtk_widget_show (alignment3); + gtk_container_add (GTK_CONTAINER (frame2), alignment3); + gtk_alignment_set_padding (GTK_ALIGNMENT (alignment3), 0, 0, 12, 0); + + scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_set_name (scrolledwindow3, "scrolledwindow3"); + gtk_widget_show (scrolledwindow3); + gtk_container_add (GTK_CONTAINER (alignment3), scrolledwindow3); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_SHADOW_IN); + + main_themelist = gtk_tree_view_new (); + gtk_widget_set_name (main_themelist, "main_themelist"); + gtk_widget_show (main_themelist); + gtk_container_add (GTK_CONTAINER (scrolledwindow3), main_themelist); + GTK_WIDGET_SET_FLAGS (main_themelist, GTK_CAN_DEFAULT); + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (main_themelist), FALSE); + + label1234 = gtk_label_new ("Theme"); + gtk_widget_set_name (label1234, "label1234"); + gtk_widget_show (label1234); + gtk_frame_set_label_widget (GTK_FRAME (frame2), label1234); + gtk_label_set_use_markup (GTK_LABEL (label1234), TRUE); + + frame3 = gtk_frame_new (NULL); + gtk_widget_set_name (frame3, "frame3"); + gtk_widget_show (frame3); + gtk_box_pack_start (GTK_BOX (vbox1), frame3, FALSE, FALSE, 9); + gtk_frame_set_shadow_type (GTK_FRAME (frame3), GTK_SHADOW_NONE); + + alignment4 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_widget_set_name (alignment4, "alignment4"); + gtk_widget_show (alignment4); + gtk_container_add (GTK_CONTAINER (frame3), alignment4); + gtk_alignment_set_padding (GTK_ALIGNMENT (alignment4), 0, 0, 12, 0); + + vbox7 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox7, "vbox7"); + gtk_widget_show (vbox7); + gtk_container_add (GTK_CONTAINER (alignment4), vbox7); + + hbox8 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox8, "hbox8"); + gtk_widget_show (hbox8); + gtk_box_pack_start (GTK_BOX (vbox7), hbox8, FALSE, FALSE, 0); + + vbox9 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox9, "vbox9"); + gtk_widget_show (vbox9); + gtk_box_pack_start (GTK_BOX (hbox8), vbox9, TRUE, TRUE, 0); + + main_use_default_font_radio = gtk_radio_button_new_with_mnemonic (NULL, "Use theme default font"); + gtk_widget_set_name (main_use_default_font_radio, "main_use_default_font_radio"); + gtk_widget_show (main_use_default_font_radio); + gtk_box_pack_start (GTK_BOX (vbox9), main_use_default_font_radio, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (main_use_default_font_radio), main_use_default_font_radio_group); + main_use_default_font_radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (main_use_default_font_radio)); + + main_use_custom_font_radio = gtk_radio_button_new_with_mnemonic (NULL, "Use custom font:"); + gtk_widget_set_name (main_use_custom_font_radio, "main_use_custom_font_radio"); + gtk_widget_show (main_use_custom_font_radio); + gtk_box_pack_start (GTK_BOX (vbox9), main_use_custom_font_radio, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (main_use_custom_font_radio), main_use_default_font_radio_group); + main_use_default_font_radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (main_use_custom_font_radio)); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (main_use_custom_font_radio), TRUE); + + alignment5 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_widget_set_name (alignment5, "alignment5"); + gtk_widget_show (alignment5); + gtk_box_pack_start (GTK_BOX (vbox9), alignment5, TRUE, TRUE, 0); + gtk_alignment_set_padding (GTK_ALIGNMENT (alignment5), 0, 0, 12, 0); + + vbox10 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox10, "vbox10"); + gtk_widget_show (vbox10); + gtk_container_add (GTK_CONTAINER (alignment5), vbox10); + + hbox9 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox9, "hbox9"); + gtk_widget_show (hbox9); + gtk_box_pack_start (GTK_BOX (vbox10), hbox9, FALSE, FALSE, 0); + + vbox11 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox11, "vbox11"); + gtk_widget_show (vbox11); + gtk_box_pack_start (GTK_BOX (hbox9), vbox11, TRUE, TRUE, 0); + + main_font_selector_button = gtk_font_button_new (); + gtk_widget_set_name (main_font_selector_button, "main_font_selector_button"); + gtk_widget_show (main_font_selector_button); + gtk_box_pack_start (GTK_BOX (vbox11), main_font_selector_button, FALSE, FALSE, 0); + + label669 = gtk_label_new ("Font"); + gtk_widget_set_name (label669, "label669"); + gtk_widget_show (label669); + gtk_frame_set_label_widget (GTK_FRAME (frame3), label669); + gtk_label_set_use_markup (GTK_LABEL (label669), TRUE); + + vbox13 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox13, "vbox13"); + gtk_widget_show (vbox13); + gtk_box_pack_start (GTK_BOX (vbox1), vbox13, FALSE, FALSE, 0); + + hbox6666 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox6666, "hbox6666"); + gtk_widget_show (hbox6666); + gtk_box_pack_start (GTK_BOX (vbox13), hbox6666, TRUE, TRUE, 0); + + main_use_system_config_checkbutton = gtk_check_button_new_with_mnemonic ("Apply for all users"); + gtk_widget_set_name (main_use_system_config_checkbutton, "main_use_system_config_checkbutton"); + gtk_widget_show (main_use_system_config_checkbutton); + gtk_box_pack_start (GTK_BOX (hbox6666), main_use_system_config_checkbutton, FALSE, FALSE, 12); + gtk_tooltips_set_tip (tooltips, main_use_system_config_checkbutton, "If this is enabled, the program will update the system-wide configuration file. NOT RECOMMENDED!", NULL); + + main_showpreviewtoggle = gtk_toggle_button_new_with_mnemonic ("Show preview >>"); + gtk_widget_set_name (main_showpreviewtoggle, "main_showpreviewtoggle"); + gtk_widget_show (main_showpreviewtoggle); + gtk_box_pack_end (GTK_BOX (hbox6666), main_showpreviewtoggle, FALSE, FALSE, 2); + + hbuttonbox1 = gtk_hbutton_box_new (); + gtk_widget_set_name (hbuttonbox1, "hbuttonbox1"); + gtk_widget_show (hbuttonbox1); + gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, FALSE, FALSE, 0); + + hbox7 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox7, "hbox7"); + gtk_widget_show (hbox7); + gtk_box_pack_start (GTK_BOX (vbox1), hbox7, FALSE, TRUE, 6); + + hbox6665 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox6665, "hbox6665"); + gtk_widget_show (hbox6665); + gtk_box_pack_start (GTK_BOX (hbox7), hbox6665, TRUE, FALSE, 0); + + image2 = gtk_image_new_from_stock ("gtk-dialog-info", GTK_ICON_SIZE_LARGE_TOOLBAR); + gtk_widget_set_name (image2, "image2"); + gtk_widget_show (image2); + gtk_box_pack_start (GTK_BOX (hbox6665), image2, FALSE, FALSE, 0); + + label2 = gtk_label_new ("You should restart your programs\nfor this change to take effect."); + gtk_widget_set_name (label2, "label2"); + gtk_widget_show (label2); + gtk_box_pack_start (GTK_BOX (hbox6665), label2, FALSE, FALSE, 0); + gtk_label_set_line_wrap (GTK_LABEL (label2), TRUE); + gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5); + + vbox6 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox6, "vbox6"); + gtk_widget_show (vbox6); + gtk_box_pack_start (GTK_BOX (vbox1), vbox6, FALSE, FALSE, 0); + + hbox5 = gtk_hbox_new (TRUE, 0); + gtk_widget_set_name (hbox5, "hbox5"); + gtk_widget_show (hbox5); + gtk_box_pack_start (GTK_BOX (vbox6), hbox5, FALSE, FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox5), 4); + + main_ok_button = gtk_button_new_from_stock ("gtk-ok"); + gtk_widget_set_name (main_ok_button, "main_ok_button"); + gtk_widget_show (main_ok_button); + gtk_box_pack_end (GTK_BOX (hbox5), main_ok_button, TRUE, TRUE, 4); + GTK_WIDGET_SET_FLAGS (main_ok_button, GTK_CAN_DEFAULT); + + main_cancel_button = gtk_button_new_from_stock ("gtk-cancel"); + gtk_widget_set_name (main_cancel_button, "main_cancel_button"); + gtk_widget_show (main_cancel_button); + gtk_box_pack_end (GTK_BOX (hbox5), main_cancel_button, TRUE, TRUE, 4); + GTK_WIDGET_SET_FLAGS (main_cancel_button, GTK_CAN_DEFAULT); + + main_reset_button = gtk_button_new (); + gtk_widget_set_name (main_reset_button, "main_reset_button"); + gtk_widget_show (main_reset_button); + gtk_box_pack_end (GTK_BOX (hbox5), main_reset_button, TRUE, TRUE, 4); + + alignment2 = gtk_alignment_new (0.5, 0.5, 0, 0); + gtk_widget_set_name (alignment2, "alignment2"); + gtk_widget_show (alignment2); + gtk_container_add (GTK_CONTAINER (main_reset_button), alignment2); + + hbox6 = gtk_hbox_new (FALSE, 2); + gtk_widget_set_name (hbox6, "hbox6"); + gtk_widget_show (hbox6); + gtk_container_add (GTK_CONTAINER (alignment2), hbox6); + + image1 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_BUTTON); + gtk_widget_set_name (image1, "image1"); + gtk_widget_show (image1); + gtk_box_pack_start (GTK_BOX (hbox6), image1, FALSE, FALSE, 0); + + label667 = gtk_label_new_with_mnemonic ("_Reset"); + gtk_widget_set_name (label667, "label667"); + gtk_widget_show (label667); + gtk_box_pack_start (GTK_BOX (hbox6), label667, FALSE, FALSE, 0); + + main_previewhbox = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (main_previewhbox, "main_previewhbox"); + gtk_box_pack_start (GTK_BOX (main_hbox), main_previewhbox, TRUE, TRUE, 0); + + vseparator2 = gtk_vseparator_new (); + gtk_widget_set_name (vseparator2, "vseparator2"); + gtk_widget_show (vseparator2); + gtk_box_pack_start (GTK_BOX (main_previewhbox), vseparator2, FALSE, TRUE, 4); + + frame4 = gtk_frame_new (NULL); + gtk_widget_set_name (frame4, "frame4"); + gtk_widget_show (frame4); + gtk_box_pack_start (GTK_BOX (main_previewhbox), frame4, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (frame4), 3); + gtk_frame_set_shadow_type (GTK_FRAME (frame4), GTK_SHADOW_NONE); + + alignment6 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_widget_set_name (alignment6, "alignment6"); + gtk_widget_show (alignment6); + gtk_container_add (GTK_CONTAINER (frame4), alignment6); + + vbox12 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox12, "vbox12"); + gtk_widget_show (vbox12); + gtk_container_add (GTK_CONTAINER (alignment6), vbox12); + + main_previewbook = gtk_notebook_new (); + gtk_widget_set_name (main_previewbook, "main_previewbook"); + gtk_widget_show (main_previewbook); + gtk_box_pack_start (GTK_BOX (vbox12), main_previewbook, TRUE, TRUE, 0); + + table1 = gtk_table_new (3, 3, FALSE); + gtk_widget_set_name (table1, "table1"); + gtk_widget_show (table1); + gtk_container_add (GTK_CONTAINER (main_previewbook), table1); + gtk_container_set_border_width (GTK_CONTAINER (table1), 5); + + vbox2 = gtk_vbox_new (FALSE, 4); + gtk_widget_set_name (vbox2, "vbox2"); + gtk_widget_show (vbox2); + gtk_table_attach (GTK_TABLE (table1), vbox2, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); + + checkbutton1 = gtk_check_button_new_with_mnemonic ("check button 1"); + gtk_widget_set_name (checkbutton1, "checkbutton1"); + gtk_widget_show (checkbutton1); + gtk_box_pack_start (GTK_BOX (vbox2), checkbutton1, FALSE, FALSE, 0); + + checkbutton2 = gtk_check_button_new_with_mnemonic ("check button 2"); + gtk_widget_set_name (checkbutton2, "checkbutton2"); + gtk_widget_show (checkbutton2); + gtk_box_pack_start (GTK_BOX (vbox2), checkbutton2, FALSE, FALSE, 0); + + button4 = gtk_button_new_with_mnemonic ("button"); + gtk_widget_set_name (button4, "button4"); + gtk_widget_show (button4); + gtk_box_pack_start (GTK_BOX (vbox2), button4, FALSE, FALSE, 0); + + togglebutton1 = gtk_toggle_button_new_with_mnemonic ("toggle button"); + gtk_widget_set_name (togglebutton1, "togglebutton1"); + gtk_widget_show (togglebutton1); + gtk_box_pack_start (GTK_BOX (vbox2), togglebutton1, FALSE, FALSE, 0); + + spinbutton1_adj = gtk_adjustment_new (0, 0, 100, 1, 10, 10); + spinbutton1 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton1_adj), 1, 0); + gtk_widget_set_name (spinbutton1, "spinbutton1"); + gtk_widget_show (spinbutton1); + gtk_box_pack_start (GTK_BOX (vbox2), spinbutton1, FALSE, FALSE, 0); + + vbox4 = gtk_vbox_new (FALSE, 4); + gtk_widget_set_name (vbox4, "vbox4"); + gtk_widget_show (vbox4); + gtk_table_attach (GTK_TABLE (table1), vbox4, 2, 3, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + + menubar2 = gtk_menu_bar_new (); + gtk_widget_set_name (menubar2, "menubar2"); + gtk_widget_show (menubar2); + gtk_box_pack_start (GTK_BOX (vbox4), menubar2, FALSE, FALSE, 0); + + menuitem5 = gtk_menu_item_new_with_mnemonic ("_File"); + gtk_widget_set_name (menuitem5, "menuitem5"); + gtk_widget_show (menuitem5); + gtk_container_add (GTK_CONTAINER (menubar2), menuitem5); + + menuitem5_menu = gtk_menu_new (); + gtk_widget_set_name (menuitem5_menu, "menuitem5_menu"); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem5), menuitem5_menu); + + new2 = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group); + gtk_widget_set_name (new2, "new2"); + gtk_widget_show (new2); + gtk_container_add (GTK_CONTAINER (menuitem5_menu), new2); + + open2 = gtk_image_menu_item_new_from_stock ("gtk-open", accel_group); + gtk_widget_set_name (open2, "open2"); + gtk_widget_show (open2); + gtk_container_add (GTK_CONTAINER (menuitem5_menu), open2); + + save2 = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group); + gtk_widget_set_name (save2, "save2"); + gtk_widget_show (save2); + gtk_container_add (GTK_CONTAINER (menuitem5_menu), save2); + + save_as2 = gtk_image_menu_item_new_from_stock ("gtk-save-as", accel_group); + gtk_widget_set_name (save_as2, "save_as2"); + gtk_widget_show (save_as2); + gtk_container_add (GTK_CONTAINER (menuitem5_menu), save_as2); + + separatormenuitem2 = gtk_separator_menu_item_new (); + gtk_widget_set_name (separatormenuitem2, "separatormenuitem2"); + gtk_widget_show (separatormenuitem2); + gtk_container_add (GTK_CONTAINER (menuitem5_menu), separatormenuitem2); + gtk_widget_set_sensitive (separatormenuitem2, FALSE); + + quit2 = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group); + gtk_widget_set_name (quit2, "quit2"); + gtk_widget_show (quit2); + gtk_container_add (GTK_CONTAINER (menuitem5_menu), quit2); + + menuitem6 = gtk_menu_item_new_with_mnemonic ("_Edit"); + gtk_widget_set_name (menuitem6, "menuitem6"); + gtk_widget_show (menuitem6); + gtk_container_add (GTK_CONTAINER (menubar2), menuitem6); + + menuitem6_menu = gtk_menu_new (); + gtk_widget_set_name (menuitem6_menu, "menuitem6_menu"); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem6), menuitem6_menu); + + cut2 = gtk_image_menu_item_new_from_stock ("gtk-cut", accel_group); + gtk_widget_set_name (cut2, "cut2"); + gtk_widget_show (cut2); + gtk_container_add (GTK_CONTAINER (menuitem6_menu), cut2); + + copy2 = gtk_image_menu_item_new_from_stock ("gtk-copy", accel_group); + gtk_widget_set_name (copy2, "copy2"); + gtk_widget_show (copy2); + gtk_container_add (GTK_CONTAINER (menuitem6_menu), copy2); + + paste2 = gtk_image_menu_item_new_from_stock ("gtk-paste", accel_group); + gtk_widget_set_name (paste2, "paste2"); + gtk_widget_show (paste2); + gtk_container_add (GTK_CONTAINER (menuitem6_menu), paste2); + + delete2 = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group); + gtk_widget_set_name (delete2, "delete2"); + gtk_widget_show (delete2); + gtk_container_add (GTK_CONTAINER (menuitem6_menu), delete2); + + menuitem8 = gtk_menu_item_new_with_mnemonic ("_Help"); + gtk_widget_set_name (menuitem8, "menuitem8"); + gtk_widget_show (menuitem8); + gtk_container_add (GTK_CONTAINER (menubar2), menuitem8); + + menuitem8_menu = gtk_menu_new (); + gtk_widget_set_name (menuitem8_menu, "menuitem8_menu"); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem8), menuitem8_menu); + + about2 = gtk_menu_item_new_with_mnemonic ("_About"); + gtk_widget_set_name (about2, "about2"); + gtk_widget_show (about2); + gtk_container_add (GTK_CONTAINER (menuitem8_menu), about2); + + combobox1 = gtk_combo_box_new_text (); + gtk_widget_set_name (combobox1, "combobox1"); + gtk_widget_show (combobox1); + gtk_box_pack_start (GTK_BOX (vbox4), combobox1, FALSE, FALSE, 0); + gtk_combo_box_append_text (GTK_COMBO_BOX (combobox1), "item 1"); + gtk_combo_box_append_text (GTK_COMBO_BOX (combobox1), "item 2"); + gtk_combo_box_append_text (GTK_COMBO_BOX (combobox1), "item 3"); + + comboboxentry1 = gtk_combo_box_entry_new_text (); + gtk_widget_set_name (comboboxentry1, "comboboxentry1"); + gtk_widget_show (comboboxentry1); + gtk_box_pack_start (GTK_BOX (vbox4), comboboxentry1, FALSE, FALSE, 0); + gtk_widget_set_size_request (comboboxentry1, 80, 25); + gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1), "item 1"); + gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1), "item 2"); + gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1), "item 3"); + + hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (15, 0, 50, 1, 0, 0))); + gtk_widget_set_name (hscale1, "hscale1"); + gtk_widget_show (hscale1); + gtk_box_pack_start (GTK_BOX (vbox4), hscale1, TRUE, TRUE, 0); + gtk_scale_set_digits (GTK_SCALE (hscale1), 0); + + scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_set_name (scrolledwindow1, "scrolledwindow1"); + gtk_widget_show (scrolledwindow1); + gtk_table_attach (GTK_TABLE (table1), scrolledwindow1, 2, 3, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + + preview_treeview = gtk_tree_view_new (); + gtk_widget_set_name (preview_treeview, "preview_treeview"); + gtk_widget_show (preview_treeview); + gtk_container_add (GTK_CONTAINER (scrolledwindow1), preview_treeview); + gtk_tree_view_set_reorderable (GTK_TREE_VIEW (preview_treeview), TRUE); + + statusbar1 = gtk_statusbar_new (); + gtk_widget_set_name (statusbar1, "statusbar1"); + gtk_widget_show (statusbar1); + gtk_table_attach (GTK_TABLE (table1), statusbar1, 1, 3, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_size_request (statusbar1, 6, 20); + + progressbar1 = gtk_progress_bar_new (); + gtk_widget_set_name (progressbar1, "progressbar1"); + gtk_widget_show (progressbar1); + gtk_table_attach (GTK_TABLE (table1), progressbar1, 0, 1, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_size_request (progressbar1, 80, 20); + gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progressbar1), 0.56); + gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progressbar1), "56%"); + + vseparator1 = gtk_vseparator_new (); + gtk_widget_set_name (vseparator1, "vseparator1"); + gtk_widget_show (vseparator1); + gtk_table_attach (GTK_TABLE (table1), vseparator1, 1, 2, 0, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 5, 0); + + frame1 = gtk_frame_new (NULL); + gtk_widget_set_name (frame1, "frame1"); + gtk_widget_show (frame1); + gtk_table_attach (GTK_TABLE (table1), frame1, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND), 0, 0); + gtk_frame_set_label_align (GTK_FRAME (frame1), 0.5, 0.5); + + vbox3 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox3, "vbox3"); + gtk_widget_show (vbox3); + gtk_container_add (GTK_CONTAINER (frame1), vbox3); + gtk_container_set_border_width (GTK_CONTAINER (vbox3), 5); + + radiobutton1 = gtk_radio_button_new_with_mnemonic (NULL, "radio 1"); + gtk_widget_set_name (radiobutton1, "radiobutton1"); + gtk_widget_show (radiobutton1); + gtk_box_pack_start (GTK_BOX (vbox3), radiobutton1, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton1), radiobutton1_group); + radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton1)); + + radiobutton2 = gtk_radio_button_new_with_mnemonic (NULL, "radio 2"); + gtk_widget_set_name (radiobutton2, "radiobutton2"); + gtk_widget_show (radiobutton2); + gtk_box_pack_start (GTK_BOX (vbox3), radiobutton2, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton2), radiobutton1_group); + radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton2)); + + radiobutton3 = gtk_radio_button_new_with_mnemonic (NULL, "radio 3"); + gtk_widget_set_name (radiobutton3, "radiobutton3"); + gtk_widget_show (radiobutton3); + gtk_box_pack_start (GTK_BOX (vbox3), radiobutton3, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton3), radiobutton1_group); + radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton3)); + + label6 = gtk_label_new ("frame"); + gtk_widget_set_name (label6, "label6"); + gtk_widget_show (label6); + gtk_frame_set_label_widget (GTK_FRAME (frame1), label6); + gtk_misc_set_padding (GTK_MISC (label6), 1, 0); + + label4 = gtk_label_new ("Common widgets"); + gtk_widget_set_name (label4, "label4"); + gtk_widget_show (label4); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (main_previewbook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (main_previewbook), 0), label4); + + scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_set_name (scrolledwindow2, "scrolledwindow2"); + gtk_widget_show (scrolledwindow2); + gtk_container_add (GTK_CONTAINER (main_previewbook), scrolledwindow2); + + textview1 = gtk_text_view_new (); + gtk_widget_set_name (textview1, "textview1"); + gtk_widget_show (textview1); + gtk_container_add (GTK_CONTAINER (scrolledwindow2), textview1); + gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview1), GTK_WRAP_WORD); + gtk_text_view_set_left_margin (GTK_TEXT_VIEW (textview1), 8); + gtk_text_view_set_right_margin (GTK_TEXT_VIEW (textview1), 8); + gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview1)), "You can type some text here.\nYou can also click the right mouse button for a popup menu.", -1); + + label5 = gtk_label_new ("Text area"); + gtk_widget_set_name (label5, "label5"); + gtk_widget_show (label5); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (main_previewbook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (main_previewbook), 1), label5); + + vbox5 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox5, "vbox5"); + gtk_widget_show (vbox5); + gtk_container_add (GTK_CONTAINER (main_previewbook), vbox5); + + hbox4 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox4, "hbox4"); + gtk_widget_show (hbox4); + gtk_box_pack_start (GTK_BOX (vbox5), hbox4, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox4), 7); + + about_label = gtk_label_new (""); + gtk_widget_set_name (about_label, "about_label"); + gtk_widget_show (about_label); + gtk_box_pack_start (GTK_BOX (hbox4), about_label, FALSE, FALSE, 0); + gtk_label_set_line_wrap (GTK_LABEL (about_label), TRUE); + + label666 = gtk_label_new ("About"); + gtk_widget_set_name (label666, "label666"); + gtk_widget_show (label666); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (main_previewbook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (main_previewbook), 2), label666); + + label670 = gtk_label_new ("Preview"); + gtk_widget_set_name (label670, "label670"); + gtk_widget_show (label670); + gtk_frame_set_label_widget (GTK_FRAME (frame4), label670); + gtk_label_set_use_markup (GTK_LABEL (label670), TRUE); + + g_signal_connect ((gpointer) main_window, "delete_event", + G_CALLBACK (on_main_window_delete_event), + NULL); + g_signal_connect ((gpointer) main_use_default_font_radio, "toggled", + G_CALLBACK (on_main_use_default_font_radio_toggled), + NULL); + g_signal_connect ((gpointer) main_font_selector_button, "font_set", + G_CALLBACK (on_main_font_selector_button_font_set), + NULL); + g_signal_connect ((gpointer) main_showpreviewtoggle, "toggled", + G_CALLBACK (on_main_showpreviewtoggle_toggled), + NULL); + g_signal_connect ((gpointer) main_ok_button, "clicked", + G_CALLBACK (on_main_ok_button_clicked), + NULL); + g_signal_connect ((gpointer) main_cancel_button, "clicked", + G_CALLBACK (on_main_cancel_button_clicked), + NULL); + g_signal_connect ((gpointer) main_reset_button, "clicked", + G_CALLBACK (on_main_reset_button_clicked), + NULL); + g_signal_connect ((gpointer) new2, "activate", + G_CALLBACK (on_new2_activate), + NULL); + g_signal_connect ((gpointer) open2, "activate", + G_CALLBACK (on_open2_activate), + NULL); + g_signal_connect ((gpointer) save2, "activate", + G_CALLBACK (on_save2_activate), + NULL); + g_signal_connect ((gpointer) save_as2, "activate", + G_CALLBACK (on_save_as2_activate), + NULL); + g_signal_connect ((gpointer) quit2, "activate", + G_CALLBACK (on_quit2_activate), + NULL); + g_signal_connect ((gpointer) cut2, "activate", + G_CALLBACK (on_cut2_activate), + NULL); + g_signal_connect ((gpointer) copy2, "activate", + G_CALLBACK (on_copy2_activate), + NULL); + g_signal_connect ((gpointer) paste2, "activate", + G_CALLBACK (on_paste2_activate), + NULL); + g_signal_connect ((gpointer) delete2, "activate", + G_CALLBACK (on_delete2_activate), + NULL); + g_signal_connect ((gpointer) about2, "activate", + G_CALLBACK (on_about2_activate), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (main_window, main_window, "main_window"); + GLADE_HOOKUP_OBJECT (main_window, main_hbox, "main_hbox"); + GLADE_HOOKUP_OBJECT (main_window, vbox1, "vbox1"); + GLADE_HOOKUP_OBJECT (main_window, hbox1, "hbox1"); + GLADE_HOOKUP_OBJECT (main_window, frame2, "frame2"); + GLADE_HOOKUP_OBJECT (main_window, alignment3, "alignment3"); + GLADE_HOOKUP_OBJECT (main_window, scrolledwindow3, "scrolledwindow3"); + GLADE_HOOKUP_OBJECT (main_window, main_themelist, "main_themelist"); + GLADE_HOOKUP_OBJECT (main_window, label1234, "label1234"); + GLADE_HOOKUP_OBJECT (main_window, frame3, "frame3"); + GLADE_HOOKUP_OBJECT (main_window, alignment4, "alignment4"); + GLADE_HOOKUP_OBJECT (main_window, vbox7, "vbox7"); + GLADE_HOOKUP_OBJECT (main_window, hbox8, "hbox8"); + GLADE_HOOKUP_OBJECT (main_window, vbox9, "vbox9"); + GLADE_HOOKUP_OBJECT (main_window, main_use_default_font_radio, "main_use_default_font_radio"); + GLADE_HOOKUP_OBJECT (main_window, main_use_custom_font_radio, "main_use_custom_font_radio"); + GLADE_HOOKUP_OBJECT (main_window, alignment5, "alignment5"); + GLADE_HOOKUP_OBJECT (main_window, vbox10, "vbox10"); + GLADE_HOOKUP_OBJECT (main_window, hbox9, "hbox9"); + GLADE_HOOKUP_OBJECT (main_window, vbox11, "vbox11"); + GLADE_HOOKUP_OBJECT (main_window, main_font_selector_button, "main_font_selector_button"); + GLADE_HOOKUP_OBJECT (main_window, label669, "label669"); + GLADE_HOOKUP_OBJECT (main_window, vbox13, "vbox13"); + GLADE_HOOKUP_OBJECT (main_window, hbox6666, "hbox6666"); + GLADE_HOOKUP_OBJECT (main_window, main_use_system_config_checkbutton, "main_use_system_config_checkbutton"); + GLADE_HOOKUP_OBJECT (main_window, main_showpreviewtoggle, "main_showpreviewtoggle"); + GLADE_HOOKUP_OBJECT (main_window, hbuttonbox1, "hbuttonbox1"); + GLADE_HOOKUP_OBJECT (main_window, hbox7, "hbox7"); + GLADE_HOOKUP_OBJECT (main_window, hbox6665, "hbox6665"); + GLADE_HOOKUP_OBJECT (main_window, image2, "image2"); + GLADE_HOOKUP_OBJECT (main_window, label2, "label2"); + GLADE_HOOKUP_OBJECT (main_window, vbox6, "vbox6"); + GLADE_HOOKUP_OBJECT (main_window, hbox5, "hbox5"); + GLADE_HOOKUP_OBJECT (main_window, main_ok_button, "main_ok_button"); + GLADE_HOOKUP_OBJECT (main_window, main_cancel_button, "main_cancel_button"); + GLADE_HOOKUP_OBJECT (main_window, main_reset_button, "main_reset_button"); + GLADE_HOOKUP_OBJECT (main_window, alignment2, "alignment2"); + GLADE_HOOKUP_OBJECT (main_window, hbox6, "hbox6"); + GLADE_HOOKUP_OBJECT (main_window, image1, "image1"); + GLADE_HOOKUP_OBJECT (main_window, label667, "label667"); + GLADE_HOOKUP_OBJECT (main_window, main_previewhbox, "main_previewhbox"); + GLADE_HOOKUP_OBJECT (main_window, vseparator2, "vseparator2"); + GLADE_HOOKUP_OBJECT (main_window, frame4, "frame4"); + GLADE_HOOKUP_OBJECT (main_window, alignment6, "alignment6"); + GLADE_HOOKUP_OBJECT (main_window, vbox12, "vbox12"); + GLADE_HOOKUP_OBJECT (main_window, main_previewbook, "main_previewbook"); + GLADE_HOOKUP_OBJECT (main_window, table1, "table1"); + GLADE_HOOKUP_OBJECT (main_window, vbox2, "vbox2"); + GLADE_HOOKUP_OBJECT (main_window, checkbutton1, "checkbutton1"); + GLADE_HOOKUP_OBJECT (main_window, checkbutton2, "checkbutton2"); + GLADE_HOOKUP_OBJECT (main_window, button4, "button4"); + GLADE_HOOKUP_OBJECT (main_window, togglebutton1, "togglebutton1"); + GLADE_HOOKUP_OBJECT (main_window, spinbutton1, "spinbutton1"); + GLADE_HOOKUP_OBJECT (main_window, vbox4, "vbox4"); + GLADE_HOOKUP_OBJECT (main_window, menubar2, "menubar2"); + GLADE_HOOKUP_OBJECT (main_window, menuitem5, "menuitem5"); + GLADE_HOOKUP_OBJECT (main_window, menuitem5_menu, "menuitem5_menu"); + GLADE_HOOKUP_OBJECT (main_window, new2, "new2"); + GLADE_HOOKUP_OBJECT (main_window, open2, "open2"); + GLADE_HOOKUP_OBJECT (main_window, save2, "save2"); + GLADE_HOOKUP_OBJECT (main_window, save_as2, "save_as2"); + GLADE_HOOKUP_OBJECT (main_window, separatormenuitem2, "separatormenuitem2"); + GLADE_HOOKUP_OBJECT (main_window, quit2, "quit2"); + GLADE_HOOKUP_OBJECT (main_window, menuitem6, "menuitem6"); + GLADE_HOOKUP_OBJECT (main_window, menuitem6_menu, "menuitem6_menu"); + GLADE_HOOKUP_OBJECT (main_window, cut2, "cut2"); + GLADE_HOOKUP_OBJECT (main_window, copy2, "copy2"); + GLADE_HOOKUP_OBJECT (main_window, paste2, "paste2"); + GLADE_HOOKUP_OBJECT (main_window, delete2, "delete2"); + GLADE_HOOKUP_OBJECT (main_window, menuitem8, "menuitem8"); + GLADE_HOOKUP_OBJECT (main_window, menuitem8_menu, "menuitem8_menu"); + GLADE_HOOKUP_OBJECT (main_window, about2, "about2"); + GLADE_HOOKUP_OBJECT (main_window, combobox1, "combobox1"); + GLADE_HOOKUP_OBJECT (main_window, comboboxentry1, "comboboxentry1"); + GLADE_HOOKUP_OBJECT (main_window, hscale1, "hscale1"); + GLADE_HOOKUP_OBJECT (main_window, scrolledwindow1, "scrolledwindow1"); + GLADE_HOOKUP_OBJECT (main_window, preview_treeview, "preview_treeview"); + GLADE_HOOKUP_OBJECT (main_window, statusbar1, "statusbar1"); + GLADE_HOOKUP_OBJECT (main_window, progressbar1, "progressbar1"); + GLADE_HOOKUP_OBJECT (main_window, vseparator1, "vseparator1"); + GLADE_HOOKUP_OBJECT (main_window, frame1, "frame1"); + GLADE_HOOKUP_OBJECT (main_window, vbox3, "vbox3"); + GLADE_HOOKUP_OBJECT (main_window, radiobutton1, "radiobutton1"); + GLADE_HOOKUP_OBJECT (main_window, radiobutton2, "radiobutton2"); + GLADE_HOOKUP_OBJECT (main_window, radiobutton3, "radiobutton3"); + GLADE_HOOKUP_OBJECT (main_window, label6, "label6"); + GLADE_HOOKUP_OBJECT (main_window, label4, "label4"); + GLADE_HOOKUP_OBJECT (main_window, scrolledwindow2, "scrolledwindow2"); + GLADE_HOOKUP_OBJECT (main_window, textview1, "textview1"); + GLADE_HOOKUP_OBJECT (main_window, label5, "label5"); + GLADE_HOOKUP_OBJECT (main_window, vbox5, "vbox5"); + GLADE_HOOKUP_OBJECT (main_window, hbox4, "hbox4"); + GLADE_HOOKUP_OBJECT (main_window, about_label, "about_label"); + GLADE_HOOKUP_OBJECT (main_window, label666, "label666"); + GLADE_HOOKUP_OBJECT (main_window, label670, "label670"); + GLADE_HOOKUP_OBJECT_NO_REF (main_window, tooltips, "tooltips"); + + gtk_widget_grab_default (main_themelist); + gtk_window_add_accel_group (GTK_WINDOW (main_window), accel_group); + + return main_window; +} + diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/interface.h b/gtk2_prefs/trunk/gtk2_prefs/src/interface.h new file mode 100644 index 00000000..11c79152 --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/interface.h @@ -0,0 +1,5 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +GtkWidget* create_main_window (void); diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/main.cpp b/gtk2_prefs/trunk/gtk2_prefs/src/main.cpp new file mode 100644 index 00000000..2048adef --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/main.cpp @@ -0,0 +1,603 @@ +/*************************************************************************** + main.cpp - description + ------------------- + begin : Wed Jan 1 19:06:46 GMT+4 2003 + copyright : (C) 2003 - 2005 by Alexander Shaduri + email : ashaduri '@' gmail.com + ***************************************************************************/ + + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include + +#ifdef _WIN32 +#include "win32util.h" +#include +#else +#include +#endif + +#include + +#include "interface.h" +#include "callbacks.h" +#include "support.h" + +#include "main.h" + + +// ------------------------------------------------------ + + + +GtkWidget* g_main_window = 0; +// GtkWidget* g_fontsel_dialog = 0; + + +static std::string s_tmp_file; + + + +// ------------------------------------------------------ + + + +static std::string gchar_to_string(gchar* gstr) +{ + std::string str = (gstr ? gstr : ""); + g_free(gstr); + return str; +} + + + +std::string get_home_dir() +{ + std::string dir; + + if (g_get_home_dir()) + dir = g_get_home_dir(); + +#ifdef _WIN32 + if (dir == "") { + dir = win32_get_registry_value_string(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Personal"); + } + if (dir == "") { + dir = win32_get_registry_value_string(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "User"); + } +#endif + + return dir; + +} + + + + +// ------------------------------------------------------ + + +static std::string s_orig_theme; +static std::string s_orig_font; + +std::string& get_orig_theme() +{ + return s_orig_theme; +} + + +std::string& get_orig_font() +{ + return s_orig_font; +} + + +// ------------------------------------------------------ + + +std::string get_current_theme() +{ + + GtkSettings* settings = gtk_settings_get_default(); + gchar* theme; + g_object_get(settings, "gtk-theme-name", &theme, NULL); + + return gchar_to_string(theme); +} + + + + +std::string get_current_font() +{ + return gchar_to_string(pango_font_description_to_string(gtk_rc_get_style(g_main_window)->font_desc)); +} + + + +// ------------------------------------------------------ + + + +std::string get_selected_theme() +{ + GtkTreeView* treeview = GTK_TREE_VIEW(lookup_widget(g_main_window, "main_themelist")); + GtkTreeModel* model = gtk_tree_view_get_model(treeview); + GtkTreeSelection* selection = gtk_tree_view_get_selection(treeview); + + GtkTreeIter iter; + gtk_tree_selection_get_selected(selection, 0, &iter); + + gchar* theme_name; + gtk_tree_model_get(model, &iter, 0, &theme_name, -1); +// std::cout << theme_name << "\n"; + return gchar_to_string(theme_name); +} + + + +std::string get_selected_font() +{ +// GtkWidget* fontentry = lookup_widget(g_main_window, "main_fontentry"); +// return gtk_entry_get_text(GTK_ENTRY(fontentry)); + + bool default_font = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(g_main_window, "main_use_default_font_radio"))); + + if (default_font) + return ""; + + GtkWidget* fontbutton = lookup_widget(g_main_window, "main_font_selector_button"); + return gtk_font_button_get_font_name(GTK_FONT_BUTTON(fontbutton)); +} + + +// ------------------------------------------------------ + + + +static void themelist_selection_changed_cb(GtkTreeSelection* selection, gpointer data) +{ + if (gtk_tree_selection_get_selected (selection, 0, 0)) + apply_theme(get_selected_theme(), get_current_font()); +} + + + +// ------------------------------------------------------ + + + +static void populate_with_themes(GtkWidget* w) +{ + + std::string search_path = gchar_to_string(gtk_rc_get_theme_dir()); + + if (search_path.size() && search_path[search_path.size() -1] != G_DIR_SEPARATOR) + search_path += G_DIR_SEPARATOR_S; + + GDir* gdir = g_dir_open(search_path.c_str(), 0, NULL); + if (gdir == NULL) + return; + + + char* name; + GList* glist = 0; + + while ( (name = const_cast(g_dir_read_name(gdir))) != NULL ) { + std::string filename = name; + +// if (g_ascii_strup(fname.c_str(), -1) == "Default") +// continue; + + std::string fullname = search_path + filename; + std::string rc = fullname; rc += G_DIR_SEPARATOR_S; rc += "gtk-2.0"; rc += G_DIR_SEPARATOR_S; rc += "gtkrc"; + + bool is_dir = 0; + if (g_file_test(fullname.c_str(), G_FILE_TEST_IS_DIR)) + is_dir = 1; + + if (is_dir && g_file_test(rc.c_str(), G_FILE_TEST_IS_REGULAR)) { + glist = g_list_insert_sorted(glist, g_strdup(filename.c_str()), (GCompareFunc)strcmp); + } + } + + g_dir_close(gdir); + + + + + // ---------------- tree + + + GtkTreeView* treeview = GTK_TREE_VIEW(w); + GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING); + gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); + + GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes ( + "Theme", gtk_cell_renderer_text_new(), + "text", 0, + NULL); + gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY); + gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column); + + + GtkTreeIter iter; + + int i =0, curr=0; + while (char* theme = (char*)g_list_nth_data(glist, i)) { + gtk_list_store_append (store, &iter); + gtk_list_store_set (store, &iter, 0, theme, -1); + + if (strcmp(theme, get_current_theme().c_str()) == 0) { + curr = i; + } + + ++i; + } + + + GtkTreeSelection* selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); + + // set the default theme + + // THIS IS IMPORTANT!!! + gtk_widget_grab_focus(w); + + std::stringstream str; + str << curr; + GtkTreePath* selpath = gtk_tree_path_new_from_string (str.str().c_str()); + if (selpath) { + gtk_tree_selection_select_path(selection, selpath); + gtk_tree_view_scroll_to_cell(treeview, selpath, NULL, true, 0.5, 0.0); + gtk_tree_path_free(selpath); + } + + g_signal_connect (G_OBJECT (selection), "changed", + G_CALLBACK (themelist_selection_changed_cb), NULL); + + g_object_unref (G_OBJECT (store)); + + + // ---------------- font + +// GtkWidget* fontentry = lookup_widget(g_main_window, "main_fontentry"); +// gtk_entry_set_text(GTK_ENTRY(fontentry), get_current_font().c_str()); + + GtkWidget* fontbutton = lookup_widget(g_main_window, "main_font_selector_button"); + gtk_font_button_set_font_name(GTK_FONT_BUTTON(fontbutton), get_current_font().c_str()); + + +} + + + + +// ------------------------------------------------------ + +#ifdef _WIN32 +static void redirect_to_file (const gchar* log_domain, GLogLevelFlags log_level, + const gchar* message, gpointer user_data) +{ + std::fstream f; + f.open("g_stdout.txt", std::ios::app); + f << message << "\n"; + f.close(); +} +#endif + +// ------------------------------------------------------ + + + + +int main(int argc, char *argv[]) +{ + + // work around pango weirdness +#ifdef _WIN32 + // no longer needed as of pango 1.2.5, but won't do any harm +// putenv("PANGO_WIN32_NO_UNISCRIBE=1"); +#endif + + + + + std::string user = g_get_user_name(); + std::string tmp = g_get_tmp_dir(); + std::string tmp_file = tmp + G_DIR_SEPARATOR_S + "gtk_prefs_tmprc_" + user; + s_tmp_file = tmp_file; + gtk_rc_add_default_file(tmp_file.c_str()); + + + + gtk_init (&argc, &argv); + + // redirect gtk warnings to file when in win32 +#if defined _WIN32 && !defined DEBUG + g_log_set_handler ("GLib", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL + | G_LOG_FLAG_RECURSION), redirect_to_file, NULL); + g_log_set_handler ("GModule", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL + | G_LOG_FLAG_RECURSION), redirect_to_file, NULL); + g_log_set_handler ("GLib-GObject", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL + | G_LOG_FLAG_RECURSION), redirect_to_file, NULL); + g_log_set_handler ("GThread", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL + | G_LOG_FLAG_RECURSION), redirect_to_file, NULL); + g_log_set_handler ("Gtk", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL + | G_LOG_FLAG_RECURSION), redirect_to_file, NULL); + g_log_set_handler ("Gdk", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL + | G_LOG_FLAG_RECURSION), redirect_to_file, NULL); + g_log_set_handler ("GdkPixbuf", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL + | G_LOG_FLAG_RECURSION), redirect_to_file, NULL); +#endif + + + add_pixmap_directory("."); + + g_main_window = create_main_window(); + + + populate_with_themes(lookup_widget(g_main_window, "main_themelist")); + + + std::string about_text = std::string("Gtk2 Theme Selector v") + VERSION + "\n\ +\n\ +by Alex Shaduri \n\ +\n\ + The authors make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided \"AS IS\", and you, its user, assume the entire risk as to its quality and accuracy.\n\ +\n\ + This is free software, and you are welcome to redistribute it under terms of GNU General Public License v2."; + + + gtk_label_set_text(GTK_LABEL(lookup_widget(g_main_window, "about_label")), about_text.c_str()); + + + GtkTreeView* treeview = GTK_TREE_VIEW(lookup_widget(g_main_window, "preview_treeview")); + GtkTreeStore *store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_INT); + gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); + + + GtkTreeViewColumn* column1 = gtk_tree_view_column_new_with_attributes ("Text", gtk_cell_renderer_text_new(), "text", 0, NULL); + gtk_tree_view_column_set_sizing(column1, GTK_TREE_VIEW_COLUMN_GROW_ONLY); + gtk_tree_view_column_set_resizable(column1, true); + gtk_tree_view_column_set_reorderable (column1, true); + gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column1); + + GtkTreeViewColumn* column2 = gtk_tree_view_column_new_with_attributes ("Number", gtk_cell_renderer_text_new(), "text", 1, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column2); + + + GtkTreeIter iter1, iter2; + + gtk_tree_store_append (store, &iter1, NULL); + gtk_tree_store_set (store, &iter1, 0, "Parent 2", 1, 66, -1); + + gtk_tree_store_append (store, &iter1, NULL); + gtk_tree_store_set (store, &iter1, 0, "Parent 1", 1, 65, -1); + + gtk_tree_store_append (store, &iter2, &iter1); + gtk_tree_store_set (store, &iter2, 0, "Child 1", 1, 67, -1); + + gtk_tree_view_column_set_sort_column_id(column1, 0); + gtk_tree_view_column_set_sort_order (column1, GTK_SORT_ASCENDING); + gtk_tree_view_column_set_sort_indicator(column1, true); + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), 0, GTK_SORT_ASCENDING); + + g_object_unref (G_OBJECT (store)); + + + get_orig_theme() = get_current_theme(); + get_orig_font() = get_current_font(); + + + gtk_widget_show (g_main_window); + + + gtk_main(); + + return EXIT_SUCCESS; + +} + + + +// ------------------------------- + + + +void set_theme(const std::string& theme_name, const std::string& font) +{ + // set widgets accordingly + + // tree + GtkTreeView* treeview = GTK_TREE_VIEW(lookup_widget(g_main_window, "main_themelist")); + GtkTreeModel* model = gtk_tree_view_get_model(treeview); + GtkTreeSelection* selection = gtk_tree_view_get_selection(treeview); + + GtkTreeIter iter; + gtk_tree_model_get_iter_first(model, &iter); + + while(gtk_tree_model_iter_next(model, &iter)) { + + gchar* text; + gtk_tree_model_get (model, &iter, 0, &text, -1); + std::string theme = gchar_to_string(text); + + if (theme_name == theme) { + gtk_tree_selection_select_iter(selection, &iter); + break; + } + + } + + + // font +// GtkWidget* fontentry = lookup_widget(g_main_window, "main_fontentry"); +// gtk_entry_set_text(GTK_ENTRY(fontentry), font.c_str()); + + if (font != "") { + GtkWidget* fontbutton = lookup_widget(g_main_window, "main_font_selector_button"); + gtk_font_button_set_font_name(GTK_FONT_BUTTON(fontbutton), get_current_font().c_str()); + } + + + apply_theme(get_selected_theme(), get_selected_font()); + +} + + + + +void apply_theme(const std::string& theme_name, const std::string& font) +{ + + std::stringstream strstr; + strstr << "gtk-theme-name = \"" << theme_name << "\"\n"; + + if (font != "") + strstr << "style \"user-font\"\n{\nfont_name=\"" << font << "\"\n}\nwidget_class \"*\" style \"user-font\""; + +// std::cout << strstr.str() << "\n\n\n"; + std::fstream f; + f.open(s_tmp_file.c_str(), std::ios::out); + f << strstr.str(); + f.close(); + + + GtkSettings* settings = gtk_settings_get_default(); + + gtk_rc_reparse_all_for_settings (settings, true); +// gtk_rc_parse_string(strstr.str().c_str()); +// gtk_rc_parse("/root/.gtk-tmp"); +// gtk_rc_reset_styles(settings); + + unlink(s_tmp_file.c_str()); + + while (gtk_events_pending()) + gtk_main_iteration(); + + +} + + + + +#ifdef _WIN32 +#define mkdir(a, b) mkdir(a) +#endif + + +bool save_current_theme() +{ + + std::string conf_file = ""; + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(g_main_window, "main_use_system_config_checkbutton")))) { + + char* themes_dir_c = gtk_rc_get_theme_dir(); + char* conf_file_c = g_build_filename(themes_dir_c, "..", "..", "etc", "gtk-2.0", "gtkrc", NULL); + + conf_file = (conf_file_c ? conf_file_c : ""); + + // file doesn't exist, try to get it from gtk. + if (!g_file_test(conf_file.c_str(), G_FILE_TEST_EXISTS)) { + + gchar** rc_files = gtk_rc_get_default_files(); + if (rc_files[0] != 0) { + conf_file = rc_files[0]; + } + + } + + + g_free(themes_dir_c); + g_free(conf_file_c); + + + // mkdir a directory, only one level deep + char* etc = g_path_get_dirname(conf_file.c_str()); + if (!g_file_test(etc, G_FILE_TEST_IS_DIR)) { + mkdir(etc, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); + } + g_free(etc); + + + } else { + + conf_file = get_home_dir(); + + if (conf_file[conf_file.length()-1] != G_DIR_SEPARATOR) + conf_file += G_DIR_SEPARATOR_S; + + conf_file += ".gtkrc-2.0"; + + } + + + + // ask + + GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + GtkWidget* dialog = gtk_dialog_new_with_buttons ("Query", GTK_WINDOW(window), + GtkDialogFlags(GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL), + GTK_STOCK_NO, GTK_RESPONSE_REJECT, + GTK_STOCK_YES, GTK_RESPONSE_ACCEPT, + NULL); + gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); + GtkWidget* hbox = gtk_hbox_new(1, 1); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 10); + + gtk_container_add (GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); + gtk_container_add (GTK_CONTAINER(hbox), + gtk_label_new((std::string("\n\nThe file \"") + conf_file + "\" will be overwritten.\nAre you sure?\n\n").c_str())); + + gtk_widget_show_all (dialog); + + bool ret = 0; + gint result = gtk_dialog_run (GTK_DIALOG (dialog)); + switch (result) { + case GTK_RESPONSE_ACCEPT: + ret = 1; + break; + } + gtk_widget_destroy(dialog); + gtk_widget_destroy(window); + + if (!ret) // the user pressed "No". + return false; + + + std::string font = get_selected_font(); + + std::fstream f; + f.open(conf_file.c_str(), std::ios::out); + f << "# Auto-written by gtk2_prefs. Do not edit.\n\n"; + f << "gtk-theme-name = \"" << get_selected_theme() << "\"\n"; + + if (font != "") + f << "style \"user-font\"\n{\n\tfont_name=\"" << font << "\"\n}\nwidget_class \"*\" style \"user-font\""; + f.close(); + + + return true; + +} + + + + +void program_shutdown() +{ + gtk_main_quit(); +} + + + + + diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/main.h b/gtk2_prefs/trunk/gtk2_prefs/src/main.h new file mode 100644 index 00000000..56db3eaa --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/main.h @@ -0,0 +1,32 @@ +/*************************************************************************** + main.cpp - description + ------------------- + begin : Wed Jan 1 2003 + copyright : (C) 2003 - 2005 by Alexander Shaduri + email : ashaduri '@' gmail.com + ***************************************************************************/ + +#ifndef _MAIN_H_ +#define _MAIN_H_ + + +#include + + +std::string& get_orig_theme(); +std::string& get_orig_font(); + +std::string get_current_theme(); +std::string get_current_font(); + +std::string get_selected_theme(); +std::string get_selected_font(); + +void set_theme(const std::string& theme_name, const std::string& font); +void apply_theme(const std::string& theme_name, const std::string& font); +bool save_current_theme(); + +void program_shutdown(); + + +#endif diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/support.c b/gtk2_prefs/trunk/gtk2_prefs/src/support.c new file mode 100644 index 00000000..7dc3c78c --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/support.c @@ -0,0 +1,144 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include + +#include "support.h" + +GtkWidget* +lookup_widget (GtkWidget *widget, + const gchar *widget_name) +{ + GtkWidget *parent, *found_widget; + + for (;;) + { + if (GTK_IS_MENU (widget)) + parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); + else + parent = widget->parent; + if (!parent) + parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey"); + if (parent == NULL) + break; + widget = parent; + } + + found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), + widget_name); + if (!found_widget) + g_warning ("Widget not found: %s", widget_name); + return found_widget; +} + +static GList *pixmaps_directories = NULL; + +/* Use this function to set the directory containing installed pixmaps. */ +void +add_pixmap_directory (const gchar *directory) +{ + pixmaps_directories = g_list_prepend (pixmaps_directories, + g_strdup (directory)); +} + +/* This is an internally used function to find pixmap files. */ +static gchar* +find_pixmap_file (const gchar *filename) +{ + GList *elem; + + /* We step through each of the pixmaps directory to find it. */ + elem = pixmaps_directories; + while (elem) + { + gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data, + G_DIR_SEPARATOR_S, filename); + if (g_file_test (pathname, G_FILE_TEST_EXISTS)) + return pathname; + g_free (pathname); + elem = elem->next; + } + return NULL; +} + +/* This is an internally used function to create pixmaps. */ +GtkWidget* +create_pixmap (GtkWidget *widget, + const gchar *filename) +{ + gchar *pathname = NULL; + GtkWidget *pixmap; + + if (!filename || !filename[0]) + return gtk_image_new (); + + pathname = find_pixmap_file (filename); + + if (!pathname) + { + g_warning ("Couldn't find pixmap file: %s", filename); + return gtk_image_new (); + } + + pixmap = gtk_image_new_from_file (pathname); + g_free (pathname); + return pixmap; +} + +/* This is an internally used function to create pixmaps. */ +GdkPixbuf* +create_pixbuf (const gchar *filename) +{ + gchar *pathname = NULL; + GdkPixbuf *pixbuf; + GError *error = NULL; + + if (!filename || !filename[0]) + return NULL; + + pathname = find_pixmap_file (filename); + + if (!pathname) + { + g_warning ("Couldn't find pixmap file: %s", filename); + return NULL; + } + + pixbuf = gdk_pixbuf_new_from_file (pathname, &error); + if (!pixbuf) + { + fprintf (stderr, "Failed to load pixbuf file: %s: %s\n", + pathname, error->message); + g_error_free (error); + } + g_free (pathname); + return pixbuf; +} + +/* This is used to set ATK action descriptions. */ +void +glade_set_atk_action_description (AtkAction *action, + const gchar *action_name, + const gchar *description) +{ + gint n_actions, i; + + n_actions = atk_action_get_n_actions (action); + for (i = 0; i < n_actions; i++) + { + if (!strcmp (atk_action_get_name (action, i), action_name)) + atk_action_set_description (action, i, description); + } +} + diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/support.cpp b/gtk2_prefs/trunk/gtk2_prefs/src/support.cpp new file mode 100644 index 00000000..1ca697e6 --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/support.cpp @@ -0,0 +1,144 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include + +#include "support.h" + +GtkWidget* +lookup_widget (GtkWidget *widget, + const gchar *widget_name) +{ + GtkWidget *parent, *found_widget; + + for (;;) + { + if (GTK_IS_MENU (widget)) + parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); + else + parent = widget->parent; + if (!parent) + parent = (GtkWidget*)g_object_get_data (G_OBJECT (widget), "GladeParentKey"); + if (parent == NULL) + break; + widget = parent; + } + + found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), + widget_name); + if (!found_widget) + g_warning ("Widget not found: %s", widget_name); + return found_widget; +} + +static GList *pixmaps_directories = NULL; + +/* Use this function to set the directory containing installed pixmaps. */ +void +add_pixmap_directory (const gchar *directory) +{ + pixmaps_directories = g_list_prepend (pixmaps_directories, + g_strdup (directory)); +} + +/* This is an internally used function to find pixmap files. */ +static gchar* +find_pixmap_file (const gchar *filename) +{ + GList *elem; + + /* We step through each of the pixmaps directory to find it. */ + elem = pixmaps_directories; + while (elem) + { + gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data, + G_DIR_SEPARATOR_S, filename); + if (g_file_test (pathname, G_FILE_TEST_EXISTS)) + return pathname; + g_free (pathname); + elem = elem->next; + } + return NULL; +} + +/* This is an internally used function to create pixmaps. */ +GtkWidget* +create_pixmap (GtkWidget *widget, + const gchar *filename) +{ + gchar *pathname = NULL; + GtkWidget *pixmap; + + if (!filename || !filename[0]) + return gtk_image_new (); + + pathname = find_pixmap_file (filename); + + if (!pathname) + { + g_warning ("Couldn't find pixmap file: %s", filename); + return gtk_image_new (); + } + + pixmap = gtk_image_new_from_file (pathname); + g_free (pathname); + return pixmap; +} + +/* This is an internally used function to create pixmaps. */ +GdkPixbuf* +create_pixbuf (const gchar *filename) +{ + gchar *pathname = NULL; + GdkPixbuf *pixbuf; + GError *error = NULL; + + if (!filename || !filename[0]) + return NULL; + + pathname = find_pixmap_file (filename); + + if (!pathname) + { + g_warning ("Couldn't find pixmap file: %s", filename); + return NULL; + } + + pixbuf = gdk_pixbuf_new_from_file (pathname, &error); + if (!pixbuf) + { + fprintf (stderr, "Failed to load pixbuf file: %s: %s\n", + pathname, error->message); + g_error_free (error); + } + g_free (pathname); + return pixbuf; +} + +/* This is used to set ATK action descriptions. */ +void +glade_set_atk_action_description (AtkAction *action, + const gchar *action_name, + const gchar *description) +{ + gint n_actions, i; + + n_actions = atk_action_get_n_actions (action); + for (i = 0; i < n_actions; i++) + { + if (!strcmp (atk_action_get_name (action, i), action_name)) + atk_action_set_description (action, i, description); + } +} + diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/support.h b/gtk2_prefs/trunk/gtk2_prefs/src/support.h new file mode 100644 index 00000000..2dea079c --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/support.h @@ -0,0 +1,44 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +/* + * Public Functions. + */ + +/* + * This function returns a widget in a component created by Glade. + * Call it with the toplevel widget in the component (i.e. a window/dialog), + * or alternatively any widget in the component, and the name of the widget + * you want returned. + */ +GtkWidget* lookup_widget (GtkWidget *widget, + const gchar *widget_name); + + +/* Use this function to set the directory containing installed pixmaps. */ +void add_pixmap_directory (const gchar *directory); + + +/* + * Private Functions. + */ + +/* This is used to create the pixmaps used in the interface. */ +GtkWidget* create_pixmap (GtkWidget *widget, + const gchar *filename); + +/* This is used to create the pixbufs used in the interface. */ +GdkPixbuf* create_pixbuf (const gchar *filename); + +/* This is used to set ATK action descriptions. */ +void glade_set_atk_action_description (AtkAction *action, + const gchar *action_name, + const gchar *description); + diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/sys_win32.h b/gtk2_prefs/trunk/gtk2_prefs/src/sys_win32.h new file mode 100644 index 00000000..c0f5286c --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/sys_win32.h @@ -0,0 +1,28 @@ +/*************************************************************************** + sys_win32.h - description + ------------------- + begin : Wed Oct 22 2003 + copyright : (C) 2003 by Alexander Shaduri, Irakli A. Elizbarashvili + email : ashaduri 'at' gmail.com + ***************************************************************************/ +#ifndef SYS_WIN32_H +#define SYS_WIN32_H + + + + + +#ifdef _WIN32 + +# define WIN32_LEAN_AND_MEAN +# include + +#endif + + + + + + + +#endif diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/win32util.cpp b/gtk2_prefs/trunk/gtk2_prefs/src/win32util.cpp new file mode 100644 index 00000000..b99453c4 --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/win32util.cpp @@ -0,0 +1,80 @@ +/*************************************************************************** + win32util.cpp - description + ------------------- + begin : Tue Jan 14 2003 + copyright : (C) 2003 by Alexander Shaduri + email : ashaduri 'at' gmail.com + ***************************************************************************/ + +#ifdef _WIN32 + +#include +#include "sys_win32.h" +#include "win32util.h" + + + + + +std::string win32_get_registry_value_string(HKEY base, const std::string& keydir, const std::string& key) +{ + + HKEY reg_key = NULL; + DWORD type; + DWORD nbytes; + char* result = NULL; +//HKEY_CURRENT_USER + nbytes = 0; + if ( RegOpenKeyEx ( base, keydir.c_str(), 0, KEY_QUERY_VALUE, ®_key) == ERROR_SUCCESS + && RegQueryValueEx (reg_key, key.c_str(), 0, &type, NULL, &nbytes) == ERROR_SUCCESS ) { + result = (char*)malloc(nbytes + 1); + RegQueryValueEx (reg_key, key.c_str(), 0, &type, (BYTE*)result, &nbytes); + result[nbytes] = '\0'; + } + + if (reg_key != NULL) + RegCloseKey (reg_key); + + std::string ret = ""; + + if (result) { + ret = result; + } + + return ret; + +} + + + + +void win32_set_registry_value_string(HKEY base, const std::string& keydir, const std::string& key, const std::string& value) +{ + + HKEY reg_key = NULL; + DWORD nbytes; + + nbytes = value.length() + 1; + + if ( RegOpenKeyEx ( base, keydir.c_str(), 0, KEY_QUERY_VALUE, ®_key) == ERROR_SUCCESS) { + RegSetValueEx (reg_key, key.c_str(), 0, REG_SZ, (const BYTE*)(value.c_str()), nbytes); + } + + if (reg_key != NULL) + RegCloseKey (reg_key); + +} + + + + + + + +#endif + + + + + + diff --git a/gtk2_prefs/trunk/gtk2_prefs/src/win32util.h b/gtk2_prefs/trunk/gtk2_prefs/src/win32util.h new file mode 100644 index 00000000..bb580800 --- /dev/null +++ b/gtk2_prefs/trunk/gtk2_prefs/src/win32util.h @@ -0,0 +1,26 @@ +/*************************************************************************** + win32util.h - description + ------------------- + begin : Tue Jan 14 2003 + copyright : (C) 2003 by Alexander Shaduri + email : ashaduri 'at' gmail.com + ***************************************************************************/ +#ifndef WIN32UTIL_H +#define WIN32UTIL_H + +#ifdef _WIN32 + +#include +#include "sys_win32.h" + + + +std::string win32_get_registry_value_string(HKEY base, const std::string& keydir, const std::string& key); +void win32_set_registry_value_string(HKEY base, const std::string& keydir, const std::string& key, const std::string& value); + + + + +#endif //_WIN32 + +#endif // WIN32UTIL_H