Move the font code into a seperate capplet.
2002-04-26 Seth Nickell <snickell@stanford.edu> * Makefile.am: * gnome-font-and-theme-properties.c: * gnome-font-and-theme-properties.glade: * gtk-theme-selector.glade: * main.c: * theme-properties.glade: * theme-switcher.c: (create_dialog), (theme_selection_changed), (read_themes), (theme_key_changed), (theme_changed_func), (sort_func), (setup_dialog), (main): Move the font code into a seperate capplet.
This commit is contained in:
parent
8c999e79e0
commit
2bfe30abbe
7 changed files with 156 additions and 777 deletions
|
@ -1,3 +1,17 @@
|
|||
2002-04-26 Seth Nickell <snickell@stanford.edu>
|
||||
|
||||
* Makefile.am:
|
||||
* gnome-font-and-theme-properties.c:
|
||||
* gnome-font-and-theme-properties.glade:
|
||||
* gtk-theme-selector.glade:
|
||||
* main.c:
|
||||
* theme-properties.glade:
|
||||
* theme-switcher.c: (create_dialog), (theme_selection_changed),
|
||||
(read_themes), (theme_key_changed), (theme_changed_func),
|
||||
(sort_func), (setup_dialog), (main):
|
||||
|
||||
Move the font code into a seperate capplet.
|
||||
|
||||
Thu Apr 18 19:35:42 2002 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gnome-font-and-theme-properties.c (setup_dialog): handle new
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
bin_PROGRAMS = gnome-font-and-theme-properties
|
||||
bin_PROGRAMS = gnome-theme-properties
|
||||
|
||||
gnome_font_and_theme_properties_LDADD = $(GNOMECC_CAPPLETS_LIBS)
|
||||
gnome_font_and_theme_properties_SOURCES = \
|
||||
gnome-font-and-theme-properties.c
|
||||
gnome_font_and_theme_properties_LDFLAGS = -export-dynamic
|
||||
gnome_theme_properties_LDADD = $(GNOMECC_CAPPLETS_LIBS)
|
||||
gnome_theme_properties_SOURCES = \
|
||||
theme-switcher.c
|
||||
gnome_theme_properties_LDFLAGS = -export-dynamic
|
||||
|
||||
@INTLTOOL_DESKTOP_RULE@
|
||||
|
||||
|
@ -12,7 +12,7 @@ Desktop_in_files = gtk-theme-selector.desktop.in
|
|||
desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
|
||||
|
||||
gladedir = $(GNOMECC_GLADE_DIR)
|
||||
glade_DATA = gnome-font-and-theme-properties.glade
|
||||
glade_DATA = theme-properties.glade
|
||||
|
||||
INCLUDES = \
|
||||
$(GNOMECC_CAPPLETS_CFLAGS) \
|
||||
|
|
|
@ -1,320 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
<requires lib="gnome"/>
|
||||
|
||||
<widget class="GtkDialog" id="font_and_theme_dialog">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Font and Theme Properties</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">False</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="border_width">2</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<property name="spacing">10</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="helpbutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-help</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="response_id">-11</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="closebutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">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">-7</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>
|
||||
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="notebook1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="show_tabs">True</property>
|
||||
<property name="show_border">True</property>
|
||||
<property name="tab_pos">GTK_POS_TOP</property>
|
||||
<property name="scrollable">False</property>
|
||||
<property name="tab_hborder">2</property>
|
||||
<property name="tab_vborder">2</property>
|
||||
<property name="enable_popup">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="border_width">8</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">8</property>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFrame" id="theme_frame">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Available themes</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>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="theme_swindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="theme_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="rules_hint">True</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>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
<property name="tab_fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Themes</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTable" id="table1">
|
||||
<property name="border_width">4</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">3</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">4</property>
|
||||
<property name="column_spacing">4</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Application</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Desktop</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GnomeFontPicker" id="application_font">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="mode">GNOME_FONT_PICKER_MODE_FONT_INFO</property>
|
||||
<property name="show_size">True</property>
|
||||
<property name="use_font_in_label">True</property>
|
||||
<property name="label_font_size">14</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GnomeFontPicker" id="desktop_font">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="mode">GNOME_FONT_PICKER_MODE_FONT_INFO</property>
|
||||
<property name="show_size">True</property>
|
||||
<property name="use_font_in_label">True</property>
|
||||
<property name="label_font_size">14</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
<property name="tab_fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Fonts</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -1,178 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
<requires lib="bonobo"/>
|
||||
|
||||
<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"/>
|
||||
|
||||
<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="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="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>
|
||||
|
||||
<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>
|
||||
|
||||
</glade-interface>
|
|
@ -1,255 +0,0 @@
|
|||
#include <config.h>
|
||||
|
||||
#include <gnome.h>
|
||||
#include <bonobo.h>
|
||||
#include <glade/glade.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
static GladeXML *xml;
|
||||
static gchar** themes = NULL;
|
||||
static GtkListStore *model;
|
||||
static gboolean ignore_select = FALSE;
|
||||
|
||||
enum
|
||||
{
|
||||
RESPONSE_APPLY = 1,
|
||||
RESPONSE_CLOSE
|
||||
};
|
||||
|
||||
static void
|
||||
themes_list_add_dir (GArray *arr, const char *dirname)
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *de;
|
||||
const gchar *suffix = "gtk-2.0";
|
||||
|
||||
g_return_if_fail (arr != NULL);
|
||||
g_return_if_fail (dirname != NULL);
|
||||
|
||||
dir = opendir (dirname);
|
||||
if (!dir)
|
||||
return;
|
||||
|
||||
while ((de = readdir (dir)))
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
if (de->d_name[0] == '.')
|
||||
continue;
|
||||
|
||||
tmp = g_build_filename (dirname, de->d_name, suffix, NULL);
|
||||
if (!g_file_test (tmp, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
g_free (tmp);
|
||||
continue;
|
||||
}
|
||||
g_free (tmp);
|
||||
|
||||
tmp = g_build_filename (dirname, de->d_name, NULL);
|
||||
g_array_append_val (arr, tmp);
|
||||
}
|
||||
|
||||
closedir (dir);
|
||||
}
|
||||
|
||||
static void
|
||||
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);
|
||||
|
||||
arr = g_array_new (TRUE, TRUE, sizeof (gchar*));
|
||||
|
||||
dir = g_build_filename (g_get_home_dir (), ".themes", NULL);
|
||||
themes_list_add_dir (arr, dir);
|
||||
g_free (dir);
|
||||
|
||||
dir = gtk_rc_get_theme_dir ();
|
||||
themes_list_add_dir (arr, dir);
|
||||
g_free (dir);
|
||||
|
||||
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++)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gchar *basename;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
select_foreach_cb (GtkTreeModel *model, GtkTreePath *path,
|
||||
GtkTreeIter *iter, int *index)
|
||||
{
|
||||
int *inds = gtk_tree_path_get_indices (path);
|
||||
*index = *inds;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static gchar* get_selected_theme (void)
|
||||
{
|
||||
int index = -1;
|
||||
gchar *theme;
|
||||
GtkTreeView *view = GTK_TREE_VIEW (glade_xml_get_widget (xml, "tree1"));
|
||||
|
||||
gtk_tree_selection_selected_foreach (gtk_tree_view_get_selection (view), (GtkTreeSelectionForeachFunc) select_foreach_cb, &index);
|
||||
|
||||
if (index == -1)
|
||||
return NULL;
|
||||
|
||||
theme = g_build_filename (themes[index], "gtk-2.0", "gtkrc", NULL);
|
||||
return theme;
|
||||
}
|
||||
#endif
|
||||
|
||||
static gchar* get_selected_theme_name (void)
|
||||
{
|
||||
int index = -1;
|
||||
GtkTreeView *view = GTK_TREE_VIEW (glade_xml_get_widget (xml, "tree1"));
|
||||
|
||||
gtk_tree_selection_selected_foreach (gtk_tree_view_get_selection (view), (GtkTreeSelectionForeachFunc) select_foreach_cb, &index);
|
||||
|
||||
if (index == -1)
|
||||
return NULL;
|
||||
|
||||
return g_path_get_basename (themes[index]);
|
||||
}
|
||||
|
||||
static void
|
||||
apply_cb (void)
|
||||
{
|
||||
gchar *name = get_selected_theme_name ();
|
||||
if (name)
|
||||
{
|
||||
gconf_client_set_string (gconf_client_get_default (), "/desktop/gnome/interface/gtk_theme", name, NULL);
|
||||
g_free (name);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
response_cb (GtkDialog *dialog, gint r, gpointer data)
|
||||
{
|
||||
switch (r)
|
||||
{
|
||||
case RESPONSE_CLOSE:
|
||||
gtk_main_quit ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
select_cb (GtkTreeSelection *sel, GtkButton *b)
|
||||
{
|
||||
#if 0
|
||||
GtkWidget *control;
|
||||
gchar *theme;
|
||||
|
||||
theme = get_selected_theme ();
|
||||
if (!theme)
|
||||
return;
|
||||
|
||||
control = glade_xml_get_widget (xml, "control1");
|
||||
bonobo_widget_set_property (BONOBO_WIDGET (control),
|
||||
"theme", TC_CORBA_string,
|
||||
theme, NULL);
|
||||
g_free (theme);
|
||||
#endif
|
||||
if (!ignore_select)
|
||||
apply_cb ();
|
||||
}
|
||||
|
||||
static void
|
||||
fsel_ok_cb (GtkButton *b, GtkFileSelection *sel)
|
||||
{
|
||||
const gchar *filename = gtk_file_selection_get_filename (sel);
|
||||
gchar *command;
|
||||
gchar *todir;
|
||||
|
||||
if (!filename)
|
||||
return;
|
||||
|
||||
todir = g_build_filename (g_get_home_dir (), ".themes", NULL);
|
||||
if (!g_file_test (todir, G_FILE_TEST_IS_DIR))
|
||||
mkdir (todir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
|
||||
|
||||
command = g_strdup_printf ("gzip -d -c < \"%s\" | tar xf - -C \"%s\"", filename, todir);
|
||||
system (command);
|
||||
g_free (command);
|
||||
g_free (todir);
|
||||
gtk_widget_destroy (GTK_WIDGET (sel));
|
||||
|
||||
themes_list_refresh ();
|
||||
}
|
||||
|
||||
void
|
||||
install_cb (GtkButton *b, gpointer data)
|
||||
{
|
||||
GtkFileSelection *sel = GTK_FILE_SELECTION (gtk_file_selection_new (_("Select a theme to install")));
|
||||
g_signal_connect (G_OBJECT (sel->ok_button), "clicked", (GCallback) fsel_ok_cb, sel);
|
||||
g_signal_connect_swapped (G_OBJECT (sel->cancel_button), "clicked", (GCallback) gtk_widget_destroy, sel);
|
||||
gtk_widget_show_all (GTK_WIDGET (sel));
|
||||
}
|
||||
|
||||
static void
|
||||
setup_list (void)
|
||||
{
|
||||
GtkTreeView *view;
|
||||
GtkCellRenderer *cell;
|
||||
GtkTreeSelection *sel;
|
||||
|
||||
model = gtk_list_store_new (1, G_TYPE_STRING);
|
||||
|
||||
view = GTK_TREE_VIEW (glade_xml_get_widget (xml, "tree1"));
|
||||
g_object_set (G_OBJECT (view), "model", model, NULL);
|
||||
cell = gtk_cell_renderer_text_new ();
|
||||
gtk_tree_view_insert_column_with_attributes (view, -1, "", cell, "text", 0, NULL);
|
||||
|
||||
themes_list_refresh ();
|
||||
|
||||
sel = gtk_tree_view_get_selection (view);
|
||||
g_signal_connect (G_OBJECT (sel), "changed", (GCallback) select_cb, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
gnome_program_init ("gtk-theme-selector", VERSION,
|
||||
LIBGNOMEUI_MODULE, argc, argv, NULL);
|
||||
|
||||
xml = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gtk-theme-selector.glade", NULL, NULL);
|
||||
setup_list ();
|
||||
|
||||
glade_xml_signal_autoconnect (xml);
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
134
capplets/theme-switcher/theme-properties.glade
Normal file
134
capplets/theme-switcher/theme-properties.glade
Normal file
|
@ -0,0 +1,134 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
|
||||
<widget class="GtkDialog" id="theme_dialog">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Theme Properties</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">False</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="border_width">2</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<property name="spacing">10</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="helpbutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-help</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="response_id">-11</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="closebutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">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">-7</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>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFrame" id="theme_frame">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</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="theme_swindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="theme_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="rules_hint">True</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>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Available themes</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -15,9 +15,6 @@
|
|||
#include "gconf-property-editor.h"
|
||||
|
||||
#define GTK_THEME_KEY "/desktop/gnome/interface/gtk_theme"
|
||||
#define GTK_FONT_KEY "/desktop/gnome/interface/font_name"
|
||||
#define DESKTOP_FONT_NAME_KEY "/apps/nautilus/preferences/default_font"
|
||||
#define DESKTOP_FONT_SIZE_KEY "/apps/nautilus/preferences/default_font_size"
|
||||
|
||||
#define MAX_ELEMENTS_BEFORE_SCROLLING 8
|
||||
|
||||
|
@ -35,7 +32,7 @@ create_dialog (void)
|
|||
{
|
||||
GladeXML *dialog;
|
||||
|
||||
dialog = glade_xml_new (GLADEDIR "/gnome-font-and-theme-properties.glade", "font_and_theme_dialog", NULL);
|
||||
dialog = glade_xml_new (GLADEDIR "/theme-properties.glade", "theme_dialog", NULL);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
@ -208,7 +205,6 @@ setup_dialog (GladeXML *dialog)
|
|||
GtkWidget *widget;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeSelection *selection;
|
||||
GObject *peditor;
|
||||
|
||||
client = gconf_client_get_default ();
|
||||
|
||||
|
@ -234,19 +230,7 @@ setup_dialog (GladeXML *dialog)
|
|||
read_themes (dialog);
|
||||
theme_common_register_theme_change (theme_changed_func, dialog);
|
||||
|
||||
peditor = gconf_peditor_new_font (NULL, GTK_FONT_KEY,
|
||||
WID ("application_font"),
|
||||
PEDITOR_FONT_COMBINED, NULL);
|
||||
|
||||
peditor = gconf_peditor_new_font (NULL, DESKTOP_FONT_NAME_KEY,
|
||||
WID ("desktop_font"),
|
||||
PEDITOR_FONT_NAME, NULL);
|
||||
|
||||
peditor = gconf_peditor_new_font (NULL, DESKTOP_FONT_SIZE_KEY,
|
||||
WID ("desktop_font"),
|
||||
PEDITOR_FONT_SIZE, NULL);
|
||||
|
||||
widget = WID ("font_and_theme_dialog");
|
||||
widget = WID ("theme_dialog");
|
||||
gtk_widget_show (widget);
|
||||
|
||||
g_signal_connect (G_OBJECT (widget), "response", gtk_main_quit, NULL);
|
Loading…
Add table
Add a link
Reference in a new issue