Added E-GtkRc from Tuncer M. Ayaz <tma@wse.de>

Right now the E-GtkRc-Tester app is not built, as it depends on gtk, I'll
add a configure check for that at some point and patch it in fully.


SVN revision: 3529
This commit is contained in:
Tom Gilbert 2000-09-20 12:19:09 +00:00
parent 60f64aca27
commit 3181ede592
4 changed files with 279 additions and 5 deletions

74
epplets/E-GtkRc-Tester.c Normal file
View File

@ -0,0 +1,74 @@
/*
* Copyright (C) 2000, Tuncer M. Ayaz
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <gtk/gtk.h>
/* when clicked on the button exit correctly */
gint
On_Btn_Clicked ( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
gtk_main_quit();
return (TRUE);
}
int
main ( int argc, char **argv )
{
GdkEventClient rcevent; /* for sending the GDK_SIGNAL */
GtkWidget *wnd, *btn;
gtk_init (&argc, &argv);
/* create window with button */
wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(wnd),"E-GtkRc-Tester");
gtk_signal_connect ( GTK_OBJECT (wnd), "destroy",
GTK_SIGNAL_FUNC (gtk_exit), NULL);
gtk_signal_connect ( GTK_OBJECT (wnd), "delete_event",
GTK_SIGNAL_FUNC(gtk_exit), NULL);
gtk_container_set_border_width(GTK_CONTAINER(wnd), 0);
btn = gtk_button_new_with_label("This is how the selected theme looks like.");
gtk_signal_connect ( GTK_OBJECT(btn), "clicked",
GTK_SIGNAL_FUNC(On_Btn_Clicked), NULL);
gtk_container_add ( GTK_CONTAINER(wnd), btn );
/* make button DEFAULT-button */
GTK_WIDGET_SET_FLAGS (btn, GTK_CAN_DEFAULT);
gtk_widget_grab_default (btn);
gtk_widget_show (btn);
gtk_widget_show (wnd);
/* send GDK_SIGNAL to reload the Gtk-Theme */
rcevent.type = GDK_CLIENT_EVENT;
rcevent.window = btn->window;
rcevent.send_event = TRUE;
rcevent.message_type = gdk_atom_intern("_GTK_READ_RCFILES", FALSE);
rcevent.data_format = 8;
gdk_event_send_clientmessage_toall((GdkEvent *)&rcevent);
gtk_main();
return (0);
}

View File

@ -0,0 +1,29 @@
<page columns=1 padding=16 name=front background=bg.png linkcolor=#88dddd>
<font face=aircut3/32 color=#ffffff>
<p align=50%>
E-GtkRc
<font face=aircut3/18 color=#88eeff>
<p align=50%>
Epplet for changing your Gtk-Theme
<font face=aircut3/12 color=#ffffff>
<p align=50%>
By Tuncer M. Ayaz - 2000<br>
<p>
With this Epplet you can switch between your Gtk-Themes.
<br>
Switching updates the theme for all Gtk-Apps and starts a little Gtk-App that comes with E-GtkRc to show you the result.
<p>
I wrote this little Epplet because I don't use GNOME just E. So I needed a little tool that would do the same as the Theme-Selector of the GNOME-ControlCenter.
<p>
_Usage(usage)
<page columns=1 padding=16 name=usage background=bg.png linkcolor=#88dddd>
<p align=50%>
<font face=aircut3/16 color=#88eeff>HowTo use:
<p>
<font face=aircut3/12 color=#ffffff>
You must have your .gtkrc-files installed in ~/.gtk/.
<br>
For example to select BlueSteel from the themes-list you should have the file .gtkrc.BlueSteel in ~/.gtk/ which could have it's pixmap-directory in ~/.gtk/ too.<p>
The Epplet just makes symlinks to the gtkrc's so it is very important that you have the right "module_path" and "pixmap_path" definitions in your gtkrc's. module_path is for the different gtk-engines you may use like "pixmap" or "thinice". pixmap_path tells the gtk-engines where to find the pixmaps used in the gtk-themes.
<p>
When you install new themes you have to press the RELOAD-button between help and close.

164
epplets/E-GtkRc.c Normal file
View File

@ -0,0 +1,164 @@
/*
* Copyright (C) 2000, Tuncer M. Ayaz
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <epplet.h>
Epplet_gadget btn_help, btn_reload, btn_close, p;
static void On_Btn_Help ( void *data );
static void On_Btn_Close ( void *data );
static void On_List_Reload ( void *data );
static void On_List_Select ( void *data );
static void On_Focus_In ( void *data, Window w );
static void On_Focus_Out ( void *data, Window w );
static void
On_Btn_Help ( void *data )
{
Epplet_show_about ("E-GtkRc");
return;
data = NULL;
}
static void
On_Btn_Close (void *data)
{
Epplet_unremember();
Esync();
Epplet_cleanup();
data = NULL;
exit(0);
}
static void
On_List_Reload ( void *data )
{
int i, num_popup_entries;
char *s;
FILE *f;
s = (char *) calloc (1024, sizeof(char));
system ("cd ~/.gtk; ls .gtkrc.* | sed s/.gtkrc.// | cat > ~/gtkRCs.txt");
sprintf (s, "%s/gtkRCs.txt", getenv("HOME"));
if ( !(f = fopen(s, "r")) )
return;
/* scan ~/.gtk/ and reload the current themes into the list */
if ( p ) {
num_popup_entries = Epplet_popup_entry_num ( p );
for ( i = num_popup_entries; i > 0; i-- )
Epplet_remove_popup_entry ( p, i - 1 );
p = Epplet_create_popup();
Epplet_gadget_show( Epplet_create_popupbutton ("Themes", NULL, 2, 20, 44, 13, NULL, p) );
}
Epplet_add_popup_entry (p, "-Empty-", NULL, NULL, NULL);
while ( (fscanf(f, "%s", s)) != EOF )
Epplet_add_popup_entry (p, s, NULL, On_List_Select, strdup(s));
fclose(f);
free(s);
system("rm ~/gtkRCs.txt");
return;
data = NULL;
}
static void
On_List_Select ( void *data )
{
char *s;
s = (char *) calloc (1024, sizeof(char));
sprintf (s, "ln -sf ~/.gtk/.gtkrc.%s ~/.gtkrc", (char *) data);
system(s);
if ( getenv("EBIN") ) {
sprintf ( s, "%s/E-GtkRc-Tester", getenv("EBIN") );
system(s);
}
else
system ("/usr/local/enlightenment/bin/E-GtkRc-Tester");
free(s);
return;
data = NULL;
}
static void
On_Focus_In (void *data, Window w)
{
if ( w == Epplet_get_main_window() ) {
Epplet_gadget_show(btn_help);
Epplet_gadget_show(btn_close);
}
return;
data = NULL;
w = (Window) 0;
}
static void
On_Focus_Out (void *data, Window w)
{
if ( w == Epplet_get_main_window() ) {
Epplet_gadget_hide(btn_help);
Epplet_gadget_hide(btn_close);
}
return;
data = NULL;
w = (Window) 0;
}
int
main(int argc, char **argv)
{
Epplet_Init( "E-GtkRc", "0.3", "Gtk-Themes-Switcher", 3, 3, argc, argv, 0 );
btn_help = Epplet_create_button( NULL, NULL, 3, 2, 0, 0, "HELP", 0, NULL, On_Btn_Help, NULL );
btn_reload = Epplet_create_button( NULL, NULL, 18, 2, 0, 0, "REPEAT", 0, NULL, On_List_Reload, NULL );
btn_close = Epplet_create_button( NULL, NULL, 33, 2, 0, 0, "CLOSE", 0, NULL, On_Btn_Close, NULL );
Epplet_gadget_show( btn_help );
Epplet_gadget_show( btn_reload );
Epplet_gadget_show( btn_close );
p = Epplet_create_popup();
Epplet_gadget_show( Epplet_create_popupbutton ("Themes", NULL, 2, 20, 44, 13, NULL, p) );
Epplet_register_focus_in_handler (On_Focus_In, NULL);
Epplet_register_focus_out_handler (On_Focus_Out, NULL);
On_List_Reload (NULL); /* initially load themes-list */
Epplet_show();
Epplet_Loop();
return 0;
}

View File

@ -8,7 +8,7 @@ E-MemWatch.epplet E-Disk.epplet E-Areas.epplet E-Magic.epplet E-Toolbox.epplet \
E-NetFlame.epplet E-Sys.epplet E-ScreenShoot.epplet E-Slides.epplet \
E-Xss.epplet E-Mountbox.epplet E-Exec.epplet @ESD_PROGS@ @PLAYCD_PROGS@ \
E-ScreenSave.epplet E-NetGraph.epplet E-MoonClock.epplet E-UrlWatch.epplet \
E-LoadMeter.epplet
E-LoadMeter.epplet E-GtkRc.epplet
EXTRA_PROGRAMS = EppletTest.epplet EppletConfigTest.epplet E-Mixer.epplet \
Emix.epplet E-PlayCD.epplet E-OpenGL-Demo.epplet E-SD.epplet
@ -145,6 +145,11 @@ E_UrlWatch_epplet_DEPENDENCIES = $(top_builddir)/api/libepplet.la
E_UrlWatch_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir) $(X_LIBS)
E_UrlWatch_epplet_LDADD = $(top_builddir)/api/libepplet.la -L$(libdir) -L$(prefix)/lib $(LIBS) $(X_LIBS)
E_GtkRc_epplet_SOURCES = E-GtkRc.c
E_GtkRc_epplet_DEPENDENCIES = $(top_builddir)/api/libepplet.la
E_GtkRc_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir) $(X_LIBS)
E_GtkRc_epplet_LDADD = $(top_builddir)/api/libepplet.la -L$(libdir) -L$(prefix)/lib $(LIBS) $(X_LIBS)
E_Areas_epplet_SOURCES = E-Areas.c
E_Areas_epplet_DEPENDENCIES = $(top_builddir)/api/libepplet.la
E_Areas_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir)
@ -168,7 +173,9 @@ E-Power.ABOUT/MAIN E-SD.ABOUT/MAIN E-ScreenSave.ABOUT/MAIN \
E-ScreenShoot.ABOUT/E_ScreenShoot_buttons.png \
E-ScreenShoot.ABOUT/E_ScreenShoot_cloak.png E-ScreenShoot.ABOUT/MAIN \
Emix.ABOUT/MAIN E-UrlWatch.ABOUT/MAIN E-PlayCD.ABOUT/EPlayCD.jpg \
E-PlayCD.ABOUT/MAIN E-PlayCD.ABOUT/E-PlayCD_Controls.png
E-PlayCD.ABOUT/MAIN E-PlayCD.ABOUT/E-PlayCD_Controls.png \
E-GtkRc.ABOUT/MAIN bg.png
# ICONS = `(cd epplets && ls -1d icons/*.icon | grep -v CVS)`
ICONS = icons/E-Biff.icon icons/E-Clock.icon icons/E-Cpu.icon icons/E-Disk.icon \
@ -177,7 +184,7 @@ icons/E-Mountbox.icon icons/E-Net.icon icons/E-NetFlame.icon icons/E-Power.icon
icons/E-SD.icon icons/E-ScreenSave.icon icons/E-ScreenShoot.icon \
icons/E-Slides.icon icons/E-Sys.icon icons/E-Time.icon icons/E-Xss.icon \
icons/Emix.icon icons/E-UrlWatch.icon icons/E-Magic.icon icons/E-PlayCD.icon \
icons/E-OpenGL-Demo.icon
icons/E-OpenGL-Demo.icon icons/E-GtkRc.icon
# DATA_FILES = `(cd epplets && ls -1d *-data/* 2>/dev/null | grep -v CVS)`
@ -234,8 +241,8 @@ E-Toolbox-data/sample.cfg E-Toolbox-data/popup-sample.cfg E-Toolbox-data/default
EXTRA_DIST = ${ICONS} ${ABOUT_DOCS} ${DATA_FILES}
NEED_FONT = E-Clock E-Mixer E-MoonClock E-Mountbox E-NetFlame E-Power E-SD E-ScreenSave E-ScreenShoot Emix E-UrlWatch E-PlayCD E-OpenGL-Demo
NEED_BG = E-Clock E-Mixer E-MoonClock E-Mountbox E-NetFlame E-Power E-SD E-ScreenSave E-ScreenShoot Emix E-UrlWatch E-PlayCD E-OpenGL-Demo
NEED_FONT = E-Clock E-Mixer E-MoonClock E-Mountbox E-NetFlame E-Power E-SD E-ScreenSave E-ScreenShoot Emix E-UrlWatch E-PlayCD E-OpenGL-Demo E-GtkRc
NEED_BG = E-Clock E-Mixer E-MoonClock E-Mountbox E-NetFlame E-Power E-SD E-ScreenSave E-ScreenShoot Emix E-UrlWatch E-PlayCD E-OpenGL-Demo E-GtkRc
BG_SRC = E-Cpu.ABOUT/bg.png
FONT_SRC = E-Cpu.ABOUT/aircut3.ttf