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>
* main.c: s/PACKAGE/GETTEXT_PACKAGE/g

View file

@ -1,133 +1,178 @@
<?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>
<requires lib="bonobo"/>
<requires lib="bonobo"/>
<widget class="GtkDialog" id="window1">
<property name="title" translatable="yes">Gtk+ Theme</property>
<property name="visible">yes</property>
<widget class="GtkDialog" id="window1">
<property name="visible">True</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" />
<signal name="response" handler="response_cb" />
<child internal-child="vbox">
<widget class="GtkVBox" id="vbox1">
<property name="border_width">2</property>
<property name="homogeneous">False</property>
<property name="spacing">4</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="vbox1">
<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 internal-child="action_area">
<widget class="GtkHButtonBox" id="buttonbox1">
<property name="border_width">5</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="spacing">10</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>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">2</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<signal name="cursor_changed" handler="call_apply" />
</widget>
</child>
</widget>
<packing>
<property name="expand">yes</property>
<property name="fill">yes</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="homogeneous">no</property>
<property name="spacing">4</property>
<property name="visible">yes</property>
<child>
<widget class="GtkCheckButton" id="check1">
<property name="label" translatable="yes">Auto Preview</property>
<property name="visible">yes</property>
<signal name="toggled" handler="preview_toggled_cb" />
</widget>
<packing>
<property name="expand">no</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button3">
<property name="label" translatable="yes">Preview</property>
<property name="visible">yes</property>
<signal name="clicked" handler="preview_cb" />
</widget>
<packing>
<property name="expand">no</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button4">
<property name="label" translatable="yes">Install new theme...</property>
<property name="visible">yes</property>
<signal name="clicked" handler="install_cb" />
</widget>
<packing>
<property name="expand">no</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">no</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkFrame" id="frame2">
<property name="label" translatable="yes">Preview</property>
<property name="visible">yes</property>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="border_width">4</property>
<property name="visible">yes</property>
<child>
<widget class="GtkFrame" id="frame3">
<property name="visible">yes</property>
<property name="shadow_type">in</property>
<child>
<widget class="BonoboWidget" id="control1">
<property name="moniker">OAFIID:GNOME_Theme_Preview</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkFrame" id="frame1">
<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="hbox1">
<property name="border_width">4</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">4</property>
<child>
<widget class="GtkScrolledWindow" id="scrolled1">
<property name="visible">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="tree1">
<property name="visible">True</property>
<property name="headers_visible">False</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">4</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkButton" id="button4">
<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>

View file

@ -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;
}