summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@gtk.org>1998-05-01 16:15:39 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-05-01 16:15:39 +0000
commitde210bbdec0d4ad614785638a2da00e091a61118 (patch)
tree596e18b58d557d7749e8fae8fa6c4562312c208e /tests
parent61554862e6620b7355df62f6842133c35010ad0d (diff)
downloadgtk+-de210bbdec0d4ad614785638a2da00e091a61118.tar.gz
New function to reset the RC styles for a heirarchy
Fri May 1 12:06:43 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkwindow.[ch] (gtk_widget_reset_rc_styles): New function to reset the RC styles for a heirarchy Clear the window background if necessary in gtk_window_style_set. * gtk/gtkrc.[ch]: New function gtk_rc_reparse_all() which rereads all previously read RC files. * gdk/gdkwindow.c gdk/gdk.h: New function gdk_window_get_toplevels(). (Should it just be called gdk_get_toplevels?) * gtk/testgtk.c: New test to reload RC files.
Diffstat (limited to 'tests')
-rw-r--r--tests/testgtk.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 7dc08bf40e..d158d8e7a4 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -6446,6 +6446,71 @@ create_idle_test ()
gtk_widget_destroy (window);
}
+void
+reload_rc_file (void)
+{
+ GList *toplevels;
+
+ gtk_rc_reparse_all ();
+
+ toplevels = gdk_window_get_toplevels();
+ while (toplevels)
+ {
+ GtkWidget *widget;
+ gdk_window_get_user_data (toplevels->data, (gpointer *)&widget);
+
+ if (widget)
+ gtk_widget_reset_rc_styles (widget);
+
+ toplevels = toplevels->next;
+ }
+
+ g_list_free (toplevels);
+}
+
+void
+create_rc_file ()
+{
+ static GtkWidget *window = NULL;
+ GtkWidget *button;
+
+ if (!window)
+ {
+ window = gtk_dialog_new ();
+
+ gtk_signal_connect (GTK_OBJECT (window), "destroy",
+ GTK_SIGNAL_FUNC(destroy_idle_test),
+ &window);
+
+ gtk_window_set_title (GTK_WINDOW (window), "Reload Rc file");
+ gtk_container_border_width (GTK_CONTAINER (window), 0);
+
+ button = gtk_button_new_with_label ("Reload");
+ gtk_signal_connect (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC(reload_rc_file), NULL);
+ GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
+ button, TRUE, TRUE, 0);
+ gtk_widget_grab_default (button);
+ gtk_widget_show (button);
+
+ button = gtk_button_new_with_label ("Close");
+ gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC(gtk_widget_destroy),
+ GTK_OBJECT (window));
+ GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
+ button, TRUE, TRUE, 0);
+ gtk_widget_show (button);
+
+ }
+
+ if (!GTK_WIDGET_VISIBLE (window))
+ gtk_widget_show (window);
+ else
+ gtk_widget_destroy (window);
+}
+
/*
* Test of recursive mainloop
*/
@@ -6550,6 +6615,7 @@ create_main_window ()
{ "progress bar", create_progress_bar },
{ "radio buttons", create_radio_buttons },
{ "range controls", create_range_controls },
+ { "rc file", create_rc_file },
{ "reparent", create_reparent },
{ "rulers", create_rulers },
{ "scrolled windows", create_scrolled_windows },