Remove preview option and button, this makes no sense with instant apply.

2002-03-09  Richard Hestilow  <hestilow@ximian.com>

	* gtk-theme-selector.glade, main.c: Remove preview option
	and button, this makes no sense with instant apply.
	(select_cb): Just call apply_cb.
This commit is contained in:
Richard Hestilow 2002-03-09 20:19:14 +00:00 committed by Rachel Hestilow
parent b0c3e85b9c
commit ee4d5b6c69
3 changed files with 193 additions and 154 deletions

View file

@ -1,3 +1,9 @@
2002-03-09 Richard Hestilow <hestilow@ximian.com>
* 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 <kmaraas@gnome.org> 2002-02-27 Kjartan Maraas <kmaraas@gnome.org>
* main.c: s/PACKAGE/GETTEXT_PACKAGE/g * main.c: s/PACKAGE/GETTEXT_PACKAGE/g

View file

@ -1,133 +1,178 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "../glade-2.0.dtd" > <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface> <glade-interface>
<requires lib="bonobo"/> <requires lib="bonobo"/>
<widget class="GtkDialog" id="window1"> <widget class="GtkDialog" id="window1">
<property name="title" translatable="yes">Gtk+ Theme</property> <property name="visible">True</property>
<property name="visible">yes</property> <property name="title" translatable="yes">Gtk+ Theme</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="has_separator">True</property>
<signal name="destroy" handler="gtk_main_quit"/>
<signal name="response" handler="response_cb"/>
<signal name="destroy" handler="gtk_main_quit" /> <child internal-child="vbox">
<signal name="response" handler="response_cb" /> <widget class="GtkVBox" id="vbox1">
<property name="border_width">2</property>
<child internal-child="vbox"> <property name="homogeneous">False</property>
<widget class="GtkVBox" id="vbox1"> <property name="spacing">4</property>
<property name="spacing">4</property>
<child>
<widget class="GtkFrame" id="frame1">
<property name="label" translatable="yes">Available Themes</property>
<property name="visible">yes</property>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="homogeneous">no</property>
<property name="spacing">4</property>
<property name="border_width">4</property>
<property name="visible">yes</property>
<child>
<widget class="GtkScrolledWindow" id="scrolled1">
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<property name="visible">yes</property>
<child>
<widget class="GtkTreeView" id="tree1">
<property name="headers_visible">no</property>
<property name="visible">yes</property>
<signal name="cursor_changed" handler="call_apply" /> <child internal-child="action_area">
</widget> <widget class="GtkHButtonBox" id="buttonbox1">
</child> <property name="border_width">5</property>
</widget> <property name="layout_style">GTK_BUTTONBOX_END</property>
<packing> <property name="spacing">10</property>
<property name="expand">yes</property>
<property name="fill">yes</property> <child>
</packing> <widget class="GtkButton" id="button1">
</child> <property name="visible">True</property>
<child> <property name="label">gtk-close</property>
<widget class="GtkVBox" id="vbox2"> <property name="use_stock">True</property>
<property name="homogeneous">no</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="spacing">4</property> <property name="response_id">2</property>
<property name="visible">yes</property> </widget>
<child> </child>
<widget class="GtkCheckButton" id="check1"> </widget>
<property name="label" translatable="yes">Auto Preview</property> <packing>
<property name="visible">yes</property> <property name="padding">0</property>
<signal name="toggled" handler="preview_toggled_cb" /> <property name="expand">False</property>
</widget> <property name="fill">True</property>
<packing> <property name="pack_type">GTK_PACK_END</property>
<property name="expand">no</property> </packing>
</packing> </child>
</child>
<child> <child>
<widget class="GtkButton" id="button3"> <widget class="GtkFrame" id="frame1">
<property name="label" translatable="yes">Preview</property> <property name="visible">True</property>
<property name="visible">yes</property> <property name="label_xalign">0</property>
<signal name="clicked" handler="preview_cb" /> <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
</widget>
<packing> <child>
<property name="expand">no</property> <widget class="GtkHBox" id="hbox1">
</packing> <property name="border_width">4</property>
</child> <property name="visible">True</property>
<child> <property name="homogeneous">False</property>
<widget class="GtkButton" id="button4"> <property name="spacing">4</property>
<property name="label" translatable="yes">Install new theme...</property>
<property name="visible">yes</property> <child>
<signal name="clicked" handler="install_cb" /> <widget class="GtkScrolledWindow" id="scrolled1">
</widget> <property name="visible">True</property>
<packing> <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="expand">no</property> <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
</packing> <property name="shadow_type">GTK_SHADOW_NONE</property>
</child> <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
</widget>
<packing> <child>
<property name="expand">no</property> <widget class="GtkTreeView" id="tree1">
</packing> <property name="visible">True</property>
</child> <property name="headers_visible">False</property>
</widget> <property name="rules_hint">False</property>
</child> <property name="reorderable">False</property>
</widget> <property name="enable_search">True</property>
</child> </widget>
<child> </child>
<widget class="GtkFrame" id="frame2"> </widget>
<property name="label" translatable="yes">Preview</property> <packing>
<property name="visible">yes</property> <property name="padding">0</property>
<child> <property name="expand">True</property>
<widget class="GtkHBox" id="hbox2"> <property name="fill">True</property>
<property name="border_width">4</property> </packing>
<property name="visible">yes</property> </child>
<child>
<widget class="GtkFrame" id="frame3"> <child>
<property name="visible">yes</property> <widget class="GtkVBox" id="vbox2">
<property name="shadow_type">in</property> <property name="visible">True</property>
<child> <property name="homogeneous">False</property>
<widget class="BonoboWidget" id="control1"> <property name="spacing">4</property>
<property name="moniker">OAFIID:GNOME_Theme_Preview</property>
<property name="visible">yes</property> <child>
</widget> <placeholder/>
</child> </child>
</widget>
</child> <child>
</widget> <placeholder/>
</child> </child>
</widget>
</child> <child>
</widget> <widget class="GtkButton" id="button4">
</child> <property name="visible">True</property>
<property name="label" translatable="yes">Install new theme...</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<signal name="clicked" handler="install_cb"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="border_width">4</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="BonoboWidget" id="control1">
<property name="visible">True</property>
<property name="moniker">OAFIID:GNOME_Theme_Preview</property>
<property name="theme"></property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="buttonbox1">
<child>
<widget class="GtkButton" id="button1">
<property name="label">gtk-close</property>
<property name="use_stock">yes</property>
<property name="use_underline">yes</property>
<property name="response_id">2</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
</widget>
</glade-interface> </glade-interface>

View file

@ -12,7 +12,7 @@
static GladeXML *xml; static GladeXML *xml;
static gchar** themes = NULL; static gchar** themes = NULL;
static GtkListStore *model; static GtkListStore *model;
static gboolean auto_preview; static gboolean ignore_select = FALSE;
enum enum
{ {
@ -61,7 +61,9 @@ themes_list_refresh (void)
{ {
GArray *arr; GArray *arr;
gchar *dir; gchar *dir;
gchar *def;
int i; int i;
GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (glade_xml_get_widget (xml, "tree1")));
if (themes) if (themes)
g_strfreev (themes); g_strfreev (themes);
@ -79,6 +81,8 @@ themes_list_refresh (void)
themes = (gchar**) arr->data; themes = (gchar**) arr->data;
g_array_free (arr, FALSE); 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); gtk_list_store_clear (model);
for (i = 0; themes[i] != NULL; i++) for (i = 0; themes[i] != NULL; i++)
{ {
@ -87,6 +91,12 @@ themes_list_refresh (void)
basename = g_path_get_basename (themes[i]); basename = g_path_get_basename (themes[i]);
gtk_list_store_append (model, &iter); gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, basename, -1); 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); g_free (basename);
} }
} }
@ -99,6 +109,7 @@ select_foreach_cb (GtkTreeModel *model, GtkTreePath *path,
*index = *inds; *index = *inds;
} }
#if 0
static gchar* get_selected_theme (void) static gchar* get_selected_theme (void)
{ {
int index = -1; int index = -1;
@ -113,7 +124,7 @@ static gchar* get_selected_theme (void)
theme = g_build_filename (themes[index], "gtk-2.0", "gtkrc", NULL); theme = g_build_filename (themes[index], "gtk-2.0", "gtkrc", NULL);
return theme; return theme;
} }
#endif
static gchar* get_selected_theme_name (void) static gchar* get_selected_theme_name (void)
{ {
@ -139,13 +150,6 @@ apply_cb (void)
} }
} }
void
call_apply (GtkWidget *widget, gpointer data)
{
apply_cb ();
}
void void
response_cb (GtkDialog *dialog, gint r, gpointer data) 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 static void
select_cb (GtkTreeSelection *sel, GtkButton *b) select_cb (GtkTreeSelection *sel, GtkButton *b)
{ {
#if 0
GtkWidget *control; GtkWidget *control;
gchar *theme; gchar *theme;
if (!(auto_preview || b))
return;
theme = get_selected_theme (); theme = get_selected_theme ();
if (!theme) if (!theme)
return; return;
@ -181,12 +177,9 @@ select_cb (GtkTreeSelection *sel, GtkButton *b)
"theme", TC_CORBA_string, "theme", TC_CORBA_string,
theme, NULL); theme, NULL);
g_free (theme); g_free (theme);
} #endif
if (!ignore_select)
void apply_cb ();
preview_cb (GtkButton *b, gpointer data)
{
select_cb (NULL, b);
} }
static void 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); xml = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gtk-theme-selector.glade", NULL, NULL);
setup_list (); 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); glade_xml_signal_autoconnect (xml);
gtk_main (); gtk_main ();
gconf_client_set_bool (gconf_client_get_default (), "/apps/gtk-theme-selector/auto", auto_preview, NULL);
return 0; return 0;
} }