gtk-chtheme-0.3.1/0040755000175000001440000000000010011737231012231 5ustar apusersgtk-chtheme-0.3.1/stock_menu_about.xpm0100644000175000001440000000150510011567034016320 0ustar apusers/* XPM */ static char *stock_menu_about[] = { /* columns rows colors chars-per-pixel */ "16 16 27 1", " c black", ". c #050501", "X c #101104", "o c #151606", "O c #161705", "+ c #181806", "@ c #1C1D07", "# c #1E1F08", "$ c #1F1F08", "% c #212208", "& c #4A4C13", "* c #4C4E13", "= c #64671A", "- c #ABB02D", "; c #B4BA2F", ": c #CBD235", "> c #CDD435", ", c #CED636", "< c #E5EC3C", "1 c #E8F03D", "2 c #E9F03D", "3 c #EAF13D", "4 c #ECF33E", "5 c #EEF63E", "6 c #EFF73F", "7 c #F0F83F", "8 c None", /* pixels */ "8888888888888888", "8888888888888888", "8888888888888888", "8888888888888888", "8888888* o888888", "888888 5 888888", "888X= 37: &888", "8888 7777773 888", "8888$ 7777< .888", "88888 3577- 8888", "88888 75 5, 8888", "88888 ; + , 8888", "88888$ 888 o8888", "8888888888888888", "8888888888888888", "8888888888888888" }; gtk-chtheme-0.3.1/Makefile0100644000175000001440000000401310011737231013664 0ustar apusersinclude Metadata CFLAGS := $(if $(RPM_OPT_FLAGS), $(RPM_OPT_FLAGS), $(CFLAGS)) LDFLAGS = $(shell pkg-config --libs gtk+-2.0) CFLAGS += -Wall CFLAGS += $(shell pkg-config --cflags gtk+-2.0) -DGTK_DISABLE_BROKEN -DGTK_DISABLE_DEPRECATED CFLAGS += -DPROJNAME='"$(PROJNAME)"' -DVERSION='"$(VERSION)"' CPPFLAGS = CXXFLAGS = SRC = util stock theme_sel font_sel preview_pane about_dialog mainwin main EXTRAS = $(addprefix $(EXENAME), .spec .spec.in .pod .pod.in .1) \ stock_menu_about.xpm Makefile Metadata replace COPYING ChangeLog all: $(EXENAME) $(EXENAME).1 $(EXENAME): $(addsuffix .o, $(SRC)) $(CC) $(LDFLAGS) $^ -o $@ $(EXENAME).1: $(EXENAME).pod pod2man $< | sed 's/^\.TH .*/.TH $(EXENAME) 1/' > $@ $(EXENAME).pod: $(EXENAME).pod.in Metadata ./replace Metadata $< > $@ || rm $@ $(EXENAME).spec: $(EXENAME).spec.in Metadata ./replace Metadata $< > $@ || rm $@ depend: $(addsuffix .c, $(SRC)) $(addsuffix .h, $(SRC)) makedepend -Y $^ 2> /dev/null clean: -rm -f $(EXENAME) $(addsuffix .o, $(SRC)) distclean: clean depend -rm -f $(EXENAME).spec $(EXENAME).1 Makefile.bak install: all strip $(EXENAME) install -d $(DESTDIR)/$(BINDIR) install -c $(EXENAME) $(DESTDIR)/$(BINDIR) install -d $(DESTDIR)/$(MANDIR)/man1 install -c $(EXENAME).1 $(DESTDIR)/$(MANDIR)/man1 DISTFILES = $(addsuffix .c, $(SRC)) $(addsuffix .h, $(SRC)) $(EXTRAS) DISTNAME = $(EXENAME)-$(VERSION) dist: $(DISTFILES) rm -rf /tmp/$(DISTNAME) mkdir /tmp/$(DISTNAME) cp -a $(DISTFILES) /tmp/$(DISTNAME)/ tar cvjf $(DISTNAME).tar.bz2 -C /tmp $(DISTNAME)/ rm -rf /tmp/$(DISTNAME) rpm: dist $(EXENAME).spec rpmbuild -ta $(DISTNAME).tar.bz2 .PHONY: clean all install dist rpm depend # DO NOT DELETE util.o: util.h stock.o: stock.h stock_menu_about.xpm theme_sel.o: theme_sel.h main.h font_sel.o: font_sel.h main.h preview_pane.o: preview_pane.h util.h stock.h about_dialog.o: about_dialog.h util.h stock.h mainwin.o: main.h stock.h theme_sel.h font_sel.h preview_pane.h mainwin.o: about_dialog.h main.o: main.h stock.h mainwin.h gtk-chtheme-0.3.1/font_sel.c0100644000175000001440000000514710011060161014201 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include "font_sel.h" #include "main.h" GtkWidget *font_entry; static void font_dlg_ok_clicked(GtkWidget *widget, gboolean *flag) { *flag = TRUE; } static void font_browse_clicked(GtkWidget *widget, gpointer u) { GtkFontSelectionDialog *font_dlg = GTK_FONT_SELECTION_DIALOG(gtk_font_selection_dialog_new("Select Font")); gtk_font_selection_dialog_set_preview_text(font_dlg, PROJNAME); const gchar *curfont = gtk_entry_get_text(GTK_ENTRY(font_entry)); if (g_utf8_strlen(curfont, -1)) gtk_font_selection_dialog_set_font_name(font_dlg, curfont); gboolean is_confirmed = FALSE; g_signal_connect(G_OBJECT(font_dlg->ok_button), "clicked", G_CALLBACK(font_dlg_ok_clicked), &is_confirmed); gtk_dialog_run(GTK_DIALOG(font_dlg)); if(is_confirmed) set_font(gtk_font_selection_dialog_get_font_name(font_dlg), TRUE); gtk_widget_destroy(GTK_WIDGET(font_dlg)); } static void font_clear_clicked(GtkWidget *widget, gpointer u) { set_font(NULL, TRUE); } static void font_entry_set_from_style(GtkWidget *w, GtkStyle *prev, gpointer u) { gchar *font = get_font(); gtk_entry_set_text(GTK_ENTRY(font_entry), font ? font : ""); } GtkWidget *create_font_sel(void) { GtkWidget *box = gtk_hbox_new(FALSE, 0); GtkWidget *button; button = gtk_button_new_from_stock(GTK_STOCK_SELECT_FONT); await_activation(button); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(font_browse_clicked), NULL); gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); font_entry = gtk_entry_new(); gtk_editable_set_editable(GTK_EDITABLE(font_entry), FALSE); gtk_box_pack_start(GTK_BOX(box), font_entry, TRUE, TRUE, 3); g_signal_connect(G_OBJECT(font_entry), "style-set", G_CALLBACK(font_entry_set_from_style), NULL); button = gtk_button_new_from_stock(GTK_STOCK_CLEAR); await_activation(button); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(font_clear_clicked), NULL); gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); return box; } gtk-chtheme-0.3.1/font_sel.h0100644000175000001440000000136010011057047014210 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ___FONT_SEL_H #define ___FONT_SEL_H 1 GtkWidget* create_font_sel(void); #endif gtk-chtheme-0.3.1/replace0100755000175000001440000000214710011606621013571 0ustar apusers#!/usr/bin/perl # 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. use strict; use warnings; sub readconf { local @ARGV = @_; my @def; while(<>) { while(s/\\$//) { my $continuation = <>; last if not defined $continuation; $_ .= $continuation; } chomp; push @def, /\A \s* (\w+) \s* = \s* (.*)/sx; } return @def; } my %conf = readconf(shift); my $match_key = do { local $_ = join '|', keys %conf; qr/!!($_)/; }; while(<>) { 1 while s/$match_key/$conf{$1}/e; print; } gtk-chtheme-0.3.1/preview_pane.c0100644000175000001440000001247710011437001015061 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include "preview_pane.h" #include "util.h" #include "stock.h" #define MENU_PREVIEW_ITEMS 2 GtkWidget* create_preview_pane(void) { GtkBox* box = GTK_BOX(unfocussable(gtk_vbox_new(FALSE, 5))); { gint i; GtkWidget *menubar = unfocussable(gtk_menu_bar_new()); GtkWidget *menu = unfocussable(gtk_menu_new()); gtk_menu_shell_append(GTK_MENU_SHELL(menu), unfocussable(gtk_tearoff_menu_item_new())); GtkWidget *item = unfocussable(gtk_menu_item_new_with_label("Menu")); gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); for (i = 0; i < MENU_PREVIEW_ITEMS; i++) { gtk_menu_shell_append(GTK_MENU_SHELL(menu), unfocussable(gtk_menu_item_new_with_label("Simple item"))); } gtk_menu_shell_append(GTK_MENU_SHELL(menu), unfocussable(gtk_separator_menu_item_new())); for (i = 0; i < MENU_PREVIEW_ITEMS; i++) { gtk_menu_shell_append(GTK_MENU_SHELL(menu), unfocussable(gtk_image_menu_item_new_from_stock(GTK_STOCK_IMAGE, NULL))); } gtk_menu_shell_append(GTK_MENU_SHELL(menu), unfocussable(gtk_separator_menu_item_new())); GSList* group = NULL; for (i = 0; i < MENU_PREVIEW_ITEMS; i++) { item = unfocussable(gtk_radio_menu_item_new_with_label(group, "Radio")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM (item)); if(i == 0) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); } gtk_menu_shell_append(GTK_MENU_SHELL(menu), unfocussable(gtk_separator_menu_item_new())); for (i = 0; i < MENU_PREVIEW_ITEMS; i++) { item = unfocussable(gtk_check_menu_item_new_with_label("Check")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); if(i == 0) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); } gtk_box_pack_start(box, menubar, FALSE, FALSE, 0); } { GtkToolbar* toolbar = GTK_TOOLBAR(unfocussable(gtk_toolbar_new())); GtkWidget* button; button = unfocussable(gtk_check_button_new_with_label("Check 1")); gtk_toolbar_append_widget(toolbar, button, "Tooltip", ""); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); button = unfocussable(gtk_check_button_new_with_label("Check 2")); gtk_toolbar_append_widget(toolbar, button, "Tooltip", ""); gtk_toolbar_append_space(toolbar); GtkRadioButton* radio; radio = GTK_RADIO_BUTTON(unfocussable(gtk_radio_button_new_with_label(NULL, "Radio 1"))); gtk_toolbar_append_widget(toolbar, GTK_WIDGET(radio), "Tooltip", ""); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), TRUE); radio = GTK_RADIO_BUTTON(unfocussable(gtk_radio_button_new_with_label_from_widget(radio, "Radio 2"))); gtk_toolbar_append_widget(toolbar, GTK_WIDGET(radio), "Tooltip", ""); radio = GTK_RADIO_BUTTON(unfocussable(gtk_radio_button_new_with_label_from_widget(radio, "Radio 3"))); gtk_toolbar_append_widget(toolbar, GTK_WIDGET(radio), "Tooltip", ""); gtk_box_pack_start(box, GTK_WIDGET(toolbar), FALSE, FALSE, 0); } { GtkBox* hbox = GTK_BOX(unfocussable(gtk_hbox_new(FALSE, 0))); GtkWidget* button; gtk_box_pack_start(hbox, unfocussable(gtk_button_new_from_stock(GTK_STOCK_BUTTON)), TRUE, TRUE, 0); gtk_box_pack_start(hbox, unfocussable(gtk_label_new("")), FALSE, FALSE, 10); gtk_box_pack_start(hbox, button = unfocussable(gtk_toggle_button_new_from_stock(GTK_STOCK_TOGGLE1)), TRUE, TRUE, 0); gtk_box_pack_start(hbox, unfocussable(gtk_toggle_button_new_from_stock(GTK_STOCK_TOGGLE2)), TRUE, TRUE, 0); gtk_box_pack_start(hbox, unfocussable(gtk_toggle_button_new_from_stock(GTK_STOCK_TOGGLE3)), TRUE, TRUE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_box_pack_start(hbox, unfocussable(gtk_label_new("")), FALSE, FALSE, 10); { GtkWidget* button = unfocussable(gtk_button_new_from_stock(GTK_STOCK_DISABLED)); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_set_sensitive(button, FALSE); } gtk_box_pack_start(box, GTK_WIDGET(hbox), FALSE, FALSE, 0); } { GtkBox* hbox = GTK_BOX(unfocussable(gtk_hbox_new(FALSE, 5))); GtkAdjustment* adj = GTK_ADJUSTMENT(gtk_adjustment_new(50.0, 0.0, 100.0, 1.0, 5.0, 0.0)); GtkScale* scale = GTK_SCALE(unfocussable(gtk_hscale_new(adj))); gtk_scale_set_draw_value(scale, FALSE); gtk_box_pack_start(hbox, GTK_WIDGET(scale), TRUE, TRUE, 0); gtk_box_pack_start(hbox, unfocussable(gtk_hscrollbar_new(adj)), TRUE, TRUE, 0); gtk_box_pack_start(hbox, unfocussable(gtk_spin_button_new(adj, 1.0, 0)), FALSE, FALSE, 0); gtk_box_pack_start(box, GTK_WIDGET(hbox), FALSE, FALSE, 0); } GtkWidget* frame = unfocussable(gtk_frame_new("Preview")); gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(box)); return frame; } gtk-chtheme-0.3.1/preview_pane.h0100644000175000001440000000137410011027352015064 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ___PREVIEW_PANE_H #define ___PREVIEW_PANE_H 1 GtkWidget* create_preview_pane(void); #endif gtk-chtheme-0.3.1/gtk-chtheme.pod.in0100644000175000001440000000170610011606532015542 0ustar apusers=head1 NAME !!EXENAME - !!SUMMARY =head1 SYNOPSIS !!EXENAME =head1 DESCRIPTION !!DESCRIPTION =head1 BUGS The F<.gtkrc-2.0> parser is somewhat shaky, but this shouldn't affect anyone. =head1 AUTHORS !!AUTHOR =head1 COPYRIGHT Copyright (C) 2004 Aristotle Pagaltzis 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 B; without even the implied warranty of B or B. 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 =cut gtk-chtheme-0.3.1/gtk-chtheme.spec.in0100644000175000001440000000140410011736464015715 0ustar apusers%if %( test ! -f /etc/SuSE-release ; echo $? ) %define _prefix %( awk '/VERSION/ { print ( $3 < "9.0" ) ? "/opt/gnome2" : "/opt/gnome" }' /etc/SuSE-release ) %define _group System/GUI/GNOME %else %define _prefix /usr %define _group User Interface/Desktops %endif Name: !!EXENAME Summary: !!SUMMARY Packager: !!AUTHOR URL: !!HOMEPAGE Group: %{_group} License: GPL Version: !!VERSION Release: 1 Source0: %{name}-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build AutoReq: 0 %description !!DESCRIPTION %prep %setup -q %build make %install make install PREFIX="%{_prefix}" DESTDIR="%{buildroot}" MANDIR="%{_mandir}" %clean rm -rf %{buildroot} %files %defattr(-, root, root) %doc COPYING ChangeLog %{_bindir}/%{name} %{_mandir}/man1/%{name}.* gtk-chtheme-0.3.1/stock.c0100644000175000001440000000410010011567044013513 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include "stock.h" #include "stock_menu_about.xpm" #define NUM_NEW_STOCK_ITEMS 7 #define NUM_REMAPPED_STOCK_ITEMS 6 GtkStockItem stock_items[NUM_NEW_STOCK_ITEMS] = { { GTK_STOCK_BUTTON, "Button", 0, 0, "gtk20" }, { GTK_STOCK_TOGGLE1, "Toggle", 0, 0, "gtk20" }, { GTK_STOCK_TOGGLE2, "Toggle", 0, 0, "gtk20" }, { GTK_STOCK_TOGGLE3, "Toggle", 0, 0, "gtk20" }, { GTK_STOCK_DISABLED, "Disabled", 0, 0, "gtk20" }, { GTK_STOCK_IMAGE, "With image", 0, 0, "gtk20" }, { GTK_STOCK_ABOUT, "About", 0, 0, "gtk20" }, }; struct { gchar *old_id, *new_id; } stock_map[NUM_NEW_STOCK_ITEMS] = { { GTK_STOCK_BUTTON, GTK_STOCK_EXECUTE }, { GTK_STOCK_TOGGLE1, GTK_STOCK_BOLD }, { GTK_STOCK_TOGGLE2, GTK_STOCK_ITALIC }, { GTK_STOCK_TOGGLE3, GTK_STOCK_UNDERLINE }, { GTK_STOCK_DISABLED, GTK_STOCK_CLOSE }, { GTK_STOCK_IMAGE, GTK_STOCK_CONVERT }, }; void init_new_stock_items(void) { GtkIconFactory *icon_factory = gtk_icon_factory_new(); int i; for (i = 0; i < NUM_REMAPPED_STOCK_ITEMS; ++i) { gtk_icon_factory_add(icon_factory, stock_map[i].old_id, gtk_icon_factory_lookup_default(stock_map[i].new_id)); } gtk_icon_factory_add(icon_factory, GTK_STOCK_ABOUT, gtk_icon_set_new_from_pixbuf(gdk_pixbuf_new_from_xpm_data ((const char**)stock_menu_about))); gtk_stock_add_static(stock_items, NUM_NEW_STOCK_ITEMS); gtk_icon_factory_add_default(icon_factory); } gtk-chtheme-0.3.1/stock.h0100644000175000001440000000200510011014400013501 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ___STOCK_H #define ___STOCK_H 1 #define GTK_STOCK_BUTTON "gtk-button" #define GTK_STOCK_TOGGLE1 "gtk-toggle1" #define GTK_STOCK_TOGGLE2 "gtk-toggle2" #define GTK_STOCK_TOGGLE3 "gtk-toggle3" #define GTK_STOCK_DISABLED "gtk-disabled" #define GTK_STOCK_IMAGE "gtk-image" #define GTK_STOCK_ABOUT "gtk-about" void init_new_stock_items(void); #endif gtk-chtheme-0.3.1/main.c0100644000175000001440000001303110011606630013312 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include // unlink() #include // getenv() #include // fopen() fdopen() fprintf() #include #include #include "main.h" #include "stock.h" #include "mainwin.h" GHashTable *hash = NULL; GSList *awaiting_activation = NULL; gchar *tmp_rc = NULL, *gtkrc = NULL, *font = NULL, *themename = NULL; // dirname gets freed! void read_theme_list(gchar * dirname) { GDir *dir = g_dir_open(dirname, 0, NULL); const gchar *entry; gchar *rc_file; if (dir) { while ((entry = g_dir_read_name(dir))) { if (g_file_test(entry, G_FILE_TEST_IS_DIR)) continue; rc_file = g_strdup_printf("%s/%s/gtk-2.0/gtkrc", dirname, entry); if (!g_file_test(rc_file, G_FILE_TEST_IS_REGULAR)) { g_free(rc_file); continue; } g_hash_table_insert(hash, g_strdup(entry), rc_file); } } g_free(dirname); } void populate_themelist(GHFunc func, gpointer user_data) { g_hash_table_foreach(hash, func, user_data); } void cleanup_temporary(void) { if (tmp_rc) { unlink(tmp_rc); g_free(tmp_rc); tmp_rc = NULL; } } void apply_new_look(gboolean is_preview) { if(!themename) return; cleanup_temporary(); FILE *gtkrc_fh = is_preview ? fdopen(g_file_open_tmp("gtkrc.preview-XXXXXXXX", &tmp_rc, NULL), "w+") : fopen(gtkrc, "w"); gchar *include_file = g_hash_table_lookup(hash, themename); fprintf(gtkrc_fh, "# -- THEME AUTO-WRITTEN DO NOT EDIT\n" "include \"%s\"\n\n", include_file); if (font) { fprintf(gtkrc_fh, "style \"user-font\" {\n" "\tfont_name = \"%s\"\n" "}\n\n", font); fprintf(gtkrc_fh, "widget_class \"*\" style \"user-font\"\n\n"); fprintf(gtkrc_fh, "gtk-font-name=\"%s\"\n\n", font); } fprintf(gtkrc_fh, "include \"%s/.gtkrc.mine\"\n\n", getenv("HOME")); fprintf(gtkrc_fh, "# -- THEME AUTO-WRITTEN DO NOT EDIT\n"); fclose(gtkrc_fh); gchar *default_files[] = { is_preview ? tmp_rc : gtkrc, NULL }; gtk_rc_set_default_files(default_files); if (is_preview) { gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE); } else { GdkEventClient event = { GDK_CLIENT_EVENT, NULL, TRUE, gdk_atom_intern("_GTK_READ_RCFILES", FALSE), 8 }; gdk_event_send_clientmessage_toall((GdkEvent *) & event); } } void await_activation(GtkWidget* w) { if(themename) return; gtk_widget_set_sensitive(w, FALSE); awaiting_activation = g_slist_append(awaiting_activation, w); } void set_font(gchar * newfont, gboolean is_preview) { if (font) g_free(font); font = newfont; apply_new_look(is_preview); } gchar* get_font(void) { return font; } void set_theme(gchar * newthemename, gboolean is_preview) { themename = newthemename; apply_new_look(is_preview); if (awaiting_activation) { g_slist_foreach(awaiting_activation, (GFunc) gtk_widget_set_sensitive, GINT_TO_POINTER(TRUE)); g_slist_free(awaiting_activation); awaiting_activation = NULL; } } gchar* get_theme(void) { return themename; } void rc_skip_section(GScanner *s, GTokenType close) { while(!g_scanner_eof(s)) { g_scanner_get_next_token(s); switch(s->token) { case G_TOKEN_LEFT_PAREN: rc_skip_section(s, G_TOKEN_RIGHT_PAREN); break; case G_TOKEN_LEFT_CURLY: rc_skip_section(s, G_TOKEN_RIGHT_CURLY); break; case G_TOKEN_LEFT_BRACE: rc_skip_section(s, G_TOKEN_RIGHT_BRACE); break; default: if(s->token == close) return; } } } void set_theme_if_match(gpointer key, gpointer value, gpointer path) { if(strcmp(path, value) == 0) set_theme(key, TRUE); } void parse_gtkrc(void) { GScanner *s = gtk_rc_scanner_new(); g_scanner_input_file(s, open(gtkrc, O_RDONLY)); g_strconcat(getenv("HOME"), "/.themes", NULL); g_strconcat(gtk_rc_get_theme_dir(), "%s/gtk-2.0/gtkrc", NULL); while(!g_scanner_eof(s)) { g_scanner_get_next_token(s); switch(s->token) { case G_TOKEN_LEFT_PAREN: rc_skip_section(s, G_TOKEN_RIGHT_PAREN); break; case G_TOKEN_LEFT_CURLY: rc_skip_section(s, G_TOKEN_RIGHT_CURLY); break; case G_TOKEN_LEFT_BRACE: rc_skip_section(s, G_TOKEN_RIGHT_BRACE); break; case G_TOKEN_IDENTIFIER: if(strcmp(s->value.v_string, "include") == 0) { if(g_scanner_get_next_token(s) == G_TOKEN_STRING) g_hash_table_foreach(hash, set_theme_if_match, s->value.v_string); } else if(strcmp(s->value.v_string, "gtk-font-name") == 0) { if(g_scanner_get_next_token(s) == G_TOKEN_EQUAL_SIGN && g_scanner_get_next_token(s) == G_TOKEN_STRING) set_font(strdup(s->value.v_string), TRUE); } break; default: break; } } g_scanner_destroy(s); } int main(int argc, char *argv[]) { hash = g_hash_table_new(g_str_hash, g_str_equal); gtkrc = g_strdup_printf("%s/.gtkrc-2.0", getenv("HOME")); gtk_init(&argc, &argv); init_new_stock_items(); read_theme_list(g_strconcat(getenv("HOME"), "/.themes", NULL)); read_theme_list(gtk_rc_get_theme_dir()); parse_gtkrc(); gtk_widget_show_all(create_mainwin()); gtk_main(); cleanup_temporary(); return 0; } gtk-chtheme-0.3.1/main.h0100644000175000001440000000202710011057670013326 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ___MAIN_H #define ___MAIN_H 1 void read_theme_list(gchar * dirname); void populate_themelist(GHFunc func, gpointer user_data); void await_activation (GtkWidget* w); void set_font(gchar * newfont, gboolean is_preview); gchar* get_font(void); void set_theme(gchar * newthemename, gboolean is_preview); gchar* get_theme(void); void apply_new_look(gboolean is_preview); #endif gtk-chtheme-0.3.1/gtk-chtheme.10100644000175000001440000001205310011737231014511 0ustar apusers.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "GTK-CHTHEME 1" .TH gtk-chtheme 1 .SH "NAME" gtk\-chtheme \- Gtk+ 2.0 theme preview and selection made slick. .SH "SYNOPSIS" .IX Header "SYNOPSIS" gtk-chtheme .SH "DESCRIPTION" .IX Header "DESCRIPTION" As the name suggests, this little program lets you change your Gtk+ 2.0 theme. The aim is to make theme preview and selection as slick as possible. Themes installed on the system are presented for selection and previewed on the fly. A large variety of widgets provides a comprehensive demonstration. .SH "BUGS" .IX Header "BUGS" The \fI.gtkrc\-2.0\fR parser is somewhat shaky, but this shouldn't affect anyone. .SH "AUTHORS" .IX Header "AUTHORS" Aristotle Pagaltzis .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2004 Aristotle Pagaltzis .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but \&\fBwithout any warranty\fR; without even the implied warranty of \&\fBmerchantability\fR or \fBfitness for a particular purpose\fR. See the \s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, \s-1MA\s0 02111\-1307 \s-1USA\s0 gtk-chtheme-0.3.1/theme_sel.c0100644000175000001440000000633610011567154014354 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include "theme_sel.h" #include "main.h" GtkWidget *theme_list = NULL; static gboolean theme_list_focus(GtkWidget *w) { gtk_widget_grab_focus(w); return FALSE; } static gboolean theme_list_itemselected(GtkTreeSelection * sel, GtkTreeModel * model, GtkTreePath * path, gboolean is_selected, gpointer u) { GtkTreeIter iter; gchar *newtheme; if (!is_selected && gtk_tree_model_get_iter(model, &iter, path)) { gtk_tree_model_get(model, &iter, 0, &newtheme, -1); set_theme(newtheme, TRUE); } return TRUE; } static void insert_key_in_liststore(gchar * key, gchar * value, GtkListStore * store) { GtkTreeIter iter; gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, key, -1); } GtkWidget *create_theme_sel(void) { GtkListStore *store = gtk_list_store_new(1, G_TYPE_STRING); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), 0, GTK_SORT_ASCENDING); populate_themelist((GHFunc) insert_key_in_liststore, store); theme_list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(theme_list), TRUE); gtk_tree_view_set_search_column(GTK_TREE_VIEW(theme_list), 0); GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(theme_list)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE); gtk_tree_selection_set_select_function(selection, (GtkTreeSelectionFunc) theme_list_itemselected, NULL, NULL); if (get_theme()) { GtkTreeIter iter; gchar *newtheme; gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter); do { gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &newtheme, -1); if (strcmp(newtheme, get_theme()) != 0) continue; GtkTreePath *p = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); gtk_tree_view_set_cursor(GTK_TREE_VIEW(theme_list), p, NULL, FALSE); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(theme_list), p, NULL, TRUE, 0.5, 0); break; } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)); } g_object_unref(G_OBJECT(store)); GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes("Theme", gtk_cell_renderer_text_new(), "text", 0, NULL); gtk_tree_view_column_set_sort_column_id(column, 0); gtk_tree_view_append_column(GTK_TREE_VIEW(theme_list), column); GtkWidget *sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(sw), theme_list); gtk_timeout_add(0, (GtkFunction)theme_list_focus, theme_list); return sw; } gtk-chtheme-0.3.1/theme_sel.h0100644000175000001440000000136310011030414014334 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ___THEME_SEL_H #define ___THEME_SEL_H 1 GtkWidget* create_theme_sel(void); #endif gtk-chtheme-0.3.1/util.c0100644000175000001440000000260710011436311013347 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include "util.h" GtkWidget* unfocussable(GtkWidget *w) { GTK_WIDGET_UNSET_FLAGS(w, GTK_CAN_FOCUS); return w; } GtkWidget* gtk_toggle_button_new_from_stock(const gchar *stock_id) { GtkWidget* button = gtk_toggle_button_new_with_label(stock_id); gtk_button_set_use_stock(GTK_BUTTON(button), TRUE); return button; } GtkLabel* gtk_label_new_from_pango_markup(const char *markup_text, GtkJustification jtype) { PangoAttrList *attrs; gchar* parsed_text; pango_parse_markup(markup_text, -1, 0, &attrs, &parsed_text, NULL, NULL); GtkLabel* label = GTK_LABEL(gtk_label_new(parsed_text)); gtk_label_set_attributes(label, attrs); gtk_label_set_line_wrap(label, TRUE); gtk_label_set_justify(label, jtype); return label; } gtk-chtheme-0.3.1/util.h0100644000175000001440000000161510011436323013355 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ___UTIL_H #define ___UTIL_H 1 GtkWidget* unfocussable(GtkWidget *w); GtkWidget* gtk_toggle_button_new_from_stock(const gchar *stock_id); GtkLabel* gtk_label_new_from_pango_markup(const char *markup_text, GtkJustification jtype); #endif gtk-chtheme-0.3.1/gtk-chtheme.pod0100644000175000001440000000243210011734702015133 0ustar apusers=head1 NAME gtk-chtheme - Gtk+ 2.0 theme preview and selection made slick. =head1 SYNOPSIS gtk-chtheme =head1 DESCRIPTION As the name suggests, this little program lets you change your Gtk+ 2.0 theme. The aim is to make theme preview and selection as slick as possible. Themes installed on the system are presented for selection and previewed on the fly. A large variety of widgets provides a comprehensive demonstration. =head1 BUGS The F<.gtkrc-2.0> parser is somewhat shaky, but this shouldn't affect anyone. =head1 AUTHORS Aristotle Pagaltzis =head1 COPYRIGHT Copyright (C) 2004 Aristotle Pagaltzis 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 B; without even the implied warranty of B or B. 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 =cut gtk-chtheme-0.3.1/Metadata0100644000175000001440000000113210011734633013671 0ustar apusersPROJNAME = Gtk+ 2.0 Change Theme AUTHOR = Aristotle Pagaltzis EXENAME = gtk-chtheme VERSION = 0.3.1 HOMEPAGE = http://plasmasturm.org/programs/gtk-chtheme/ SUMMARY = Gtk+ 2.0 theme preview and selection made slick. DESCRIPTION = \ As the name suggests, this little program lets you change your Gtk+ 2.0 theme.\ The aim is to make theme preview and selection as slick as possible. Themes\ installed on the system are presented for selection and previewed on the fly.\ A large variety of widgets provides a comprehensive demonstration. PREFIX = /usr BINDIR = $(PREFIX)/bin MANDIR = $(PREFIX)/share/man gtk-chtheme-0.3.1/ChangeLog0100644000175000001440000000272110011737227014007 0ustar apusers# Version 0.3.1 * Fixes for a number of a packaging glitches. # Version 0.3 * Added writing "gtk-font-name" setting. * Added [Apply] button. * Added RPM .spec file. * Added this ChangeLog. * Another major code reorganization, some cleanup ensued. * Removed clearing of font upon theme selection change. * Removed notebook, moved preview panel onto main view, removed textarea from preview panel. * Renamed all references to "demo" to "preview". * Added blocking of main window when font dialog is shown. * Added disabling of font clear button; fixes segfault when clicked before any theme selected. * Added parsing of existing gtkrc to preset widgets * Made all widgets in preview pane unfocussable with keyboard. * Thanks to help from Andre Costa and Pascal Bleser, RPM packages are now available. # Version 0.2 * Massive code cleanup and reorganization. * Lots of minor improvements for the demo tab. # Version 0.1 * Based on Gtk Theme Switch. * Tarball installation features removed. * Theme directories that do not contain a Gtk+ theme are not offered for selection. * Theme names are presented in a scrollable list rather than a combobox. * The dialog window updates itself as a preview rather than opening a separate window. * Integrate the preview into the main window, putting the selection and preview controls in tabs. * Preview button removed, preview happens immediately when a selection is made. * Buttons renamed to Ok & Cancel. * Use stock icons as much as possible. gtk-chtheme-0.3.1/COPYING0100444000175000001440000004311010010551121013245 0ustar apusers 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. gtk-chtheme-0.3.1/mainwin.c0100644000175000001440000000571010011434627014042 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include "main.h" #include "stock.h" #include "theme_sel.h" #include "font_sel.h" #include "preview_pane.h" #include "about_dialog.h" static void about_clicked(GtkWidget *widget, gpointer u) { show_about_dialog(); } static void apply_clicked(GtkWidget *widget, gpointer u) { apply_new_look(FALSE); } static void ok_clicked(GtkWidget *widget, gpointer u) { apply_new_look(FALSE); gtk_main_quit(); } GtkWidget* create_mainwin(void) { GtkWidget *mainwin = gtk_dialog_new(); gtk_widget_realize(mainwin); gtk_window_set_title(GTK_WINDOW(mainwin), PROJNAME); gtk_window_set_resizable(GTK_WINDOW(mainwin), TRUE); gtk_window_set_default_size(GTK_WINDOW(mainwin), 360, 450); g_signal_connect(G_OBJECT(mainwin), "destroy", G_CALLBACK(gtk_main_quit), NULL); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->vbox), create_preview_pane(), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->vbox), gtk_hseparator_new(), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->vbox), create_theme_sel(), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->vbox), gtk_hseparator_new(), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->vbox), create_font_sel(), FALSE, FALSE, 0); GtkWidget* about_button = gtk_button_new_from_stock(GTK_STOCK_ABOUT); g_signal_connect(G_OBJECT(about_button), "clicked", G_CALLBACK(about_clicked), NULL); gtk_box_pack_end(GTK_BOX(GTK_DIALOG(mainwin)->action_area), about_button, TRUE, TRUE, 0); GtkWidget* apply_button = gtk_button_new_from_stock(GTK_STOCK_APPLY); g_signal_connect(G_OBJECT(apply_button), "clicked", G_CALLBACK(apply_clicked), NULL); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->action_area), apply_button, TRUE, TRUE, 0); await_activation(apply_button); GtkWidget* ok_button = gtk_button_new_from_stock(GTK_STOCK_OK); g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(ok_clicked), NULL); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->action_area), ok_button, TRUE, TRUE, 0); await_activation(ok_button); GtkWidget *cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(gtk_main_quit), NULL); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->action_area), cancel_button, TRUE, TRUE, 0); return mainwin; } gtk-chtheme-0.3.1/mainwin.h0100644000175000001440000000135510010772177014054 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ___MAINWIN_H #define ___MAINWIN_H 1 GtkWidget* create_mainwin(void); #endif gtk-chtheme-0.3.1/about_dialog.c0100644000175000001440000000520410011027426015022 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include "about_dialog.h" #include "util.h" #include "stock.h" #define LPROJNAME "" PROJNAME "" #define ABOUT \ "" LPROJNAME " " VERSION "\n" \ "by Aristotle Pagaltzis <pagaltzis@gmx.de>\n\n" \ "http://plasmasturm.org/" #define LICENSE \ "" \ LPROJNAME " 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, or (at your option) any later version.\n\n" \ LPROJNAME " 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.\n\n" \ "You should have received a copy of the GNU General Public License along with " LPROJNAME "; see the file COPYING." \ "If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA." \ "" void show_about_dialog(void) { GtkWidget* about_dlg = gtk_dialog_new(); gtk_window_set_title(GTK_WINDOW(about_dlg), "About"); gtk_window_set_resizable(GTK_WINDOW(about_dlg), FALSE); gtk_dialog_set_has_separator(GTK_DIALOG(about_dlg), FALSE); gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(about_dlg)->vbox), 20); GtkWidget* about = GTK_WIDGET(gtk_label_new_from_pango_markup((ABOUT), GTK_JUSTIFY_CENTER)); GtkWidget* box = gtk_hbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(box), 20); gtk_box_pack_start(GTK_BOX(box), about, FALSE, FALSE, 10); gtk_widget_show_all(box); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(about_dlg)->vbox), box, FALSE, FALSE, 10); GtkWidget* ok_button = gtk_dialog_add_button(GTK_DIALOG(about_dlg), GTK_STOCK_OK, 0); gtk_button_set_use_stock(GTK_BUTTON(ok_button), TRUE); gtk_dialog_run(GTK_DIALOG(about_dlg)); gtk_widget_destroy(about_dlg); } gtk-chtheme-0.3.1/about_dialog.h0100644000175000001440000000136410011027323015026 0ustar apusers/* 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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ___ABOUT_DIALOG_H #define ___ABOUT_DIALOG_H 1 void show_about_dialog(void); #endif gtk-chtheme-0.3.1/gtk-chtheme.spec0100644000175000001440000000216410011737231015305 0ustar apusers%if %( test ! -f /etc/SuSE-release ; echo $? ) %define _prefix %( awk '/VERSION/ { print ( $3 < "9.0" ) ? "/opt/gnome2" : "/opt/gnome" }' /etc/SuSE-release ) %define _group System/GUI/GNOME %else %define _prefix /usr %define _group User Interface/Desktops %endif Name: gtk-chtheme Summary: Gtk+ 2.0 theme preview and selection made slick. Packager: Aristotle Pagaltzis URL: http://plasmasturm.org/programs/gtk-chtheme/ Group: %{_group} License: GPL Version: 0.3.1 Release: 1 Source0: %{name}-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build AutoReq: 0 %description As the name suggests, this little program lets you change your Gtk+ 2.0 theme. The aim is to make theme preview and selection as slick as possible. Themes installed on the system are presented for selection and previewed on the fly. A large variety of widgets provides a comprehensive demonstration. %prep %setup -q %build make %install make install PREFIX="%{_prefix}" DESTDIR="%{buildroot}" MANDIR="%{_mandir}" %clean rm -rf %{buildroot} %files %defattr(-, root, root) %doc COPYING ChangeLog %{_bindir}/%{name} %{_mandir}/man1/%{name}.*