From ee4d5b6c69dc7a86482cc1b5ab1aaa7c9dd77a92 Mon Sep 17 00:00:00 2001 From: Richard Hestilow Date: Sat, 9 Mar 2002 20:19:14 +0000 Subject: [PATCH] Remove preview option and button, this makes no sense with instant apply. 2002-03-09 Richard Hestilow * gtk-theme-selector.glade, main.c: Remove preview option and button, this makes no sense with instant apply. (select_cb): Just call apply_cb. --- capplets/theme-switcher/ChangeLog | 6 + .../theme-switcher/gtk-theme-selector.glade | 295 ++++++++++-------- capplets/theme-switcher/main.c | 46 +-- 3 files changed, 193 insertions(+), 154 deletions(-) diff --git a/capplets/theme-switcher/ChangeLog b/capplets/theme-switcher/ChangeLog index ef78e65eb..734b95788 100644 --- a/capplets/theme-switcher/ChangeLog +++ b/capplets/theme-switcher/ChangeLog @@ -1,3 +1,9 @@ +2002-03-09 Richard Hestilow + + * gtk-theme-selector.glade, main.c: Remove preview option + and button, this makes no sense with instant apply. + (select_cb): Just call apply_cb. + 2002-02-27 Kjartan Maraas * main.c: s/PACKAGE/GETTEXT_PACKAGE/g diff --git a/capplets/theme-switcher/gtk-theme-selector.glade b/capplets/theme-switcher/gtk-theme-selector.glade index 1ba653756..3acbca764 100644 --- a/capplets/theme-switcher/gtk-theme-selector.glade +++ b/capplets/theme-switcher/gtk-theme-selector.glade @@ -1,133 +1,178 @@ - + - + - - Gtk+ Theme - yes + + True + Gtk+ Theme + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + + - - - - - - 4 - - - Available Themes - yes - - - - no - 4 - 4 - yes - - - automatic - automatic - in - yes - - - no - yes + + + 2 + False + 4 - - - - - - yes - yes - - - - - no - 4 - yes - - - Auto Preview - yes - - - - no - - - - - Preview - yes - - - - no - - - - - Install new theme... - yes - - - - no - - - - - no - - - - - - - - - Preview - yes - - - 4 - yes - - - yes - in - - - OAFIID:GNOME_Theme_Preview - yes - - - - - - - - - - + + + 5 + GTK_BUTTONBOX_END + 10 + + + + True + gtk-close + True + GTK_RELIEF_NORMAL + 2 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + 0 + GTK_SHADOW_ETCHED_IN + + + + 4 + True + False + 4 + + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + False + False + False + True + + + + + 0 + True + True + + + + + + True + False + 4 + + + + + + + + + + + + True + Install new theme... + True + GTK_RELIEF_NORMAL + + + + 0 + False + True + + + + + 0 + False + True + + + + + + + 0 + True + True + + + + + + True + 0 + GTK_SHADOW_ETCHED_IN + + + + 4 + True + False + 0 + + + + True + 0 + GTK_SHADOW_ETCHED_IN + + + + True + OAFIID:GNOME_Theme_Preview + + + + + + 0 + True + True + + + + + + + 0 + True + True + + + + + - - - - - gtk-close - yes - yes - 2 - yes - - - - - diff --git a/capplets/theme-switcher/main.c b/capplets/theme-switcher/main.c index 7dc3f9dcd..d8b46c67a 100644 --- a/capplets/theme-switcher/main.c +++ b/capplets/theme-switcher/main.c @@ -12,7 +12,7 @@ static GladeXML *xml; static gchar** themes = NULL; static GtkListStore *model; -static gboolean auto_preview; +static gboolean ignore_select = FALSE; enum { @@ -61,7 +61,9 @@ themes_list_refresh (void) { GArray *arr; gchar *dir; + gchar *def; int i; + GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (glade_xml_get_widget (xml, "tree1"))); if (themes) g_strfreev (themes); @@ -79,6 +81,8 @@ themes_list_refresh (void) themes = (gchar**) arr->data; g_array_free (arr, FALSE); + def = gconf_client_get_string (gconf_client_get_default (), "/desktop/gnome/interface/gtk_theme", NULL); + gtk_list_store_clear (model); for (i = 0; themes[i] != NULL; i++) { @@ -87,6 +91,12 @@ themes_list_refresh (void) basename = g_path_get_basename (themes[i]); gtk_list_store_append (model, &iter); gtk_list_store_set (model, &iter, 0, basename, -1); + if (def && !strcmp (def, basename)) + { + ignore_select = TRUE; + gtk_tree_selection_select_iter (sel, &iter); + ignore_select = FALSE; + } g_free (basename); } } @@ -99,6 +109,7 @@ select_foreach_cb (GtkTreeModel *model, GtkTreePath *path, *index = *inds; } +#if 0 static gchar* get_selected_theme (void) { int index = -1; @@ -113,7 +124,7 @@ static gchar* get_selected_theme (void) theme = g_build_filename (themes[index], "gtk-2.0", "gtkrc", NULL); return theme; } - +#endif static gchar* get_selected_theme_name (void) { @@ -139,13 +150,6 @@ apply_cb (void) } } -void -call_apply (GtkWidget *widget, gpointer data) -{ - apply_cb (); -} - - void response_cb (GtkDialog *dialog, gint r, gpointer data) { @@ -157,21 +161,13 @@ response_cb (GtkDialog *dialog, gint r, gpointer data) } } -void -preview_toggled_cb (GtkToggleButton *b, gpointer data) -{ - auto_preview = gtk_toggle_button_get_active (b); -} - static void select_cb (GtkTreeSelection *sel, GtkButton *b) { +#if 0 GtkWidget *control; gchar *theme; - if (!(auto_preview || b)) - return; - theme = get_selected_theme (); if (!theme) return; @@ -181,12 +177,9 @@ select_cb (GtkTreeSelection *sel, GtkButton *b) "theme", TC_CORBA_string, theme, NULL); g_free (theme); -} - -void -preview_cb (GtkButton *b, gpointer data) -{ - select_cb (NULL, b); +#endif + if (!ignore_select) + apply_cb (); } static void @@ -254,14 +247,9 @@ main (int argc, char **argv) xml = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gtk-theme-selector.glade", NULL, NULL); setup_list (); - auto_preview = gconf_client_get_bool (gconf_client_get_default (), "/apps/gtk-theme-selector/auto", NULL); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (glade_xml_get_widget (xml, "check1")), auto_preview); - glade_xml_signal_autoconnect (xml); gtk_main (); - gconf_client_set_bool (gconf_client_get_default (), "/apps/gtk-theme-selector/auto", auto_preview, NULL); - return 0; }