summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrhlabs <rhlabs>1998-04-28 14:28:50 +0000
committerrhlabs <rhlabs>1998-04-28 14:28:50 +0000
commit64305ff2c9b147a929638e1005ae17b5b007fb07 (patch)
tree2617a63155a7f3f5a176a8a19ece6654354e9747
parentd0661e26d9b22ca2369af9568d576e3b878d96ff (diff)
downloadgtk+-64305ff2c9b147a929638e1005ae17b5b007fb07.tar.gz
minor fixes
minor fixes
-rw-r--r--gtk/gtkbutton.c18
-rw-r--r--gtk/gtkthemes.c51
2 files changed, 42 insertions, 27 deletions
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index a892ff53f1..189b38831e 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -244,10 +244,13 @@ gtk_button_new ()
GtkButton *button;
button=GTK_BUTTON(gtk_type_new(gtk_button_get_type()));
- button->init=th_dat.functions.button.init;
- button->border=th_dat.functions.button.border;
- button->draw=th_dat.functions.button.draw;
- button->exit=th_dat.functions.button.exit;
+ if (button)
+ {
+ button->init=th_dat.functions.button.init;
+ button->border=th_dat.functions.button.border;
+ button->draw=th_dat.functions.button.draw;
+ button->exit=th_dat.functions.button.exit;
+ }
return GTK_WIDGET(button);
}
@@ -487,9 +490,9 @@ gtk_button_draw (GtkWidget *widget,
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_BUTTON (widget));
-
-
+
button = GTK_BUTTON (widget);
+
if (GTK_WIDGET_DRAWABLE (widget))
{
if (!area)
@@ -509,6 +512,7 @@ gtk_button_draw (GtkWidget *widget,
GtkShadowType shadow_type;
gint width, height;
gint x, y;
+
restrict_area.x = GTK_WIDGET (widget)->style->klass->xthickness;
restrict_area.y = GTK_WIDGET (widget)->style->klass->ythickness;
restrict_area.width = (GTK_WIDGET (widget)->allocation.width - restrict_area.x * 2 -
@@ -935,7 +939,7 @@ gtk_button_unrealize (GtkWidget *widget)
gtk_container_foreach (GTK_CONTAINER (widget),
(GtkCallback)gtk_widget_unrealize,
NULL);
- if (button->exit)
+ if (button->exit)
button->exit(GTK_WIDGET(widget));
widget->window = NULL;
diff --git a/gtk/gtkthemes.c b/gtk/gtkthemes.c
index 17ebd3156d..f82aef53ec 100644
--- a/gtk/gtkthemes.c
+++ b/gtk/gtkthemes.c
@@ -45,43 +45,54 @@ gtk_themes_init (int *argc,
{
int i;
char *s,ss[1024];
-/* Reset info */
+ char *thenv;
+
+ /* Reset info */
th_dat.theme_lib=NULL;
th_dat.theme_name=NULL;
th_dat.data=NULL;
printf("init theme\n");
-/* get the library name for the theme */
- if ((argc)&&(argv))
+ /* get the library name for the theme */
+
+ thenv=getenv("THEME");
+ if (thenv)
+ {
+ snprintf(ss,1024,"%s/themes/lib%s.so",getenv("HOME"),thenv);
+ th_dat.theme_name=strdup(ss);
+ }
+ else
{
- for(i=1;i<*argc;i++)
+ if ((argc)&&(argv))
{
- if ((*argv)[i]==NULL)
+ for(i=1;i<*argc;i++)
{
- i+=1;continue;
- }
+ if ((*argv)[i]==NULL)
+ {
+ i+=1;continue;
+ }
/* If the program is run wiht a --theme THEME_NAME parameter it loads that */
/* theme currently hard-coded as ".lib/libTHEME_NAME.so" jsut so it will */
/* work for me for the moment */
- if (strcmp("--theme",(*argv)[i])==0)
- {
- (*argv)[i]=NULL;
- if (((i+1)<*argc)&&((*argv)[i+1]))
+ if (strcmp("--theme",(*argv)[i])==0)
{
- s=(*argv)[i+1];
- if (s)
+ (*argv)[i]=NULL;
+ if (((i+1)<*argc)&&((*argv)[i+1]))
{
- snprintf(ss,1024,"%s/themes/lib%s.so",getenv("HOME"),s);
- th_dat.theme_name=strdup(ss);
+ s=(*argv)[i+1];
+ if (s)
+ {
+ snprintf(ss,1024,"%s/themes/lib%s.so",getenv("HOME"),s);
+ th_dat.theme_name=strdup(ss);
+ }
+ (*argv)[i+1]=NULL;
+ i+=1;
}
- (*argv)[i+1]=NULL;
- i+=1;
}
}
-
}
}
-/* load the lib */
+ /* load the lib */
th_dat.theme_lib=NULL;
if (th_dat.theme_name)
{
@@ -100,7 +111,7 @@ gtk_themes_init (int *argc,
th_dat.functions.button.exit=NULL;
return;
}
-/* extract symbols from the lib */
+ /* extract symbols from the lib */
th_dat.init=dlsym(th_dat.theme_lib,"theme_init");
th_dat.exit=dlsym(th_dat.theme_lib,"theme_exit");
th_dat.functions.button.border=dlsym(th_dat.theme_lib,"button_border");