Change the file format a bunch.
Tue Nov 5 15:48:33 2002 Jonathan Blandford <jrb@gnome.org> * gnome-theme-info.c: Change the file format a bunch. Tue Nov 5 15:48:20 2002 Jonathan Blandford <jrb@gnome.org> * gnome-theme-manager.c (read_themes): make more robust.
This commit is contained in:
parent
b79dae8b4e
commit
341038ca77
7 changed files with 129 additions and 46 deletions
|
@ -1,3 +1,7 @@
|
|||
Tue Nov 5 15:48:33 2002 Jonathan Blandford <jrb@gnome.org>
|
||||
|
||||
* gnome-theme-info.c: Change the file format a bunch.
|
||||
|
||||
2002-11-02 Jody Goldberg <jody@gnome.org>
|
||||
|
||||
* Release 2.1.2
|
||||
|
|
|
@ -12,6 +12,15 @@
|
|||
#include <libgnome/gnome-desktop-item.h>
|
||||
#include "gnome-theme-info.h"
|
||||
|
||||
#define GTK_THEME_KEY "X-GNOME-Metatheme/GtkTheme"
|
||||
#define METACITY_THEME_KEY "X-GNOME-Metatheme/MetacityTheme"
|
||||
#define SAWFISH_THEME_KEY "X-GNOME-Metatheme/SawfishTheme"
|
||||
#define ICON_THEME_KEY "X-GNOME-Metatheme/IconTheme"
|
||||
#define SOUND_THEME_KEY "X-GNOME-Metatheme/SoundTheme"
|
||||
#define APPLICATION_FONT_KEY "X-GNOME-Metatheme/ApplicationFont"
|
||||
#define BACKGROUND_IMAGE_KEY "X-GNOME-Metatheme/BackgroundImage"
|
||||
|
||||
|
||||
typedef struct _ThemeCallbackData
|
||||
{
|
||||
GFunc func;
|
||||
|
@ -29,10 +38,11 @@ const gchar *gtk2_suffix = "gtk-2.0";
|
|||
const gchar *key_suffix = "gtk-2.0-key";
|
||||
const gchar *metacity_suffix = "metacity-1";
|
||||
const gchar *icon_theme_file = "index.theme";
|
||||
const gchar *meta_theme_file = "theme.desktop";
|
||||
const gchar *meta_theme_file = "index.theme";
|
||||
|
||||
static GnomeThemeMetaInfo *
|
||||
read_meta_theme (const gchar *meta_theme_file)
|
||||
read_meta_theme (const gchar *theme_name,
|
||||
const gchar *meta_theme_file)
|
||||
{
|
||||
GnomeThemeMetaInfo *meta_theme_info;
|
||||
GnomeDesktopItem *meta_theme_ditem;
|
||||
|
@ -45,23 +55,23 @@ read_meta_theme (const gchar *meta_theme_file)
|
|||
meta_theme_info = gnome_theme_meta_info_new ();
|
||||
meta_theme_info->path = g_strdup (meta_theme_file);
|
||||
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, "Name");
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, GNOME_DESKTOP_ITEM_NAME);
|
||||
if (str == NULL)
|
||||
{
|
||||
gnome_theme_meta_info_free (meta_theme_info);
|
||||
return NULL;
|
||||
}
|
||||
meta_theme_info->name = g_strdup (str);
|
||||
meta_theme_info->readable_name = g_strdup (str);
|
||||
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, "Comment");
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, GNOME_DESKTOP_ITEM_COMMENT);
|
||||
if (str != NULL)
|
||||
meta_theme_info->comment = g_strdup (str);
|
||||
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, "Icon");
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, GNOME_DESKTOP_ITEM_ICON);
|
||||
if (str != NULL)
|
||||
meta_theme_info->icon_file = g_strdup (str);
|
||||
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, "X-GNOME-Metatheme/gtk-2.0");
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, GTK_THEME_KEY);
|
||||
if (str == NULL)
|
||||
{
|
||||
gnome_theme_meta_info_free (meta_theme_info);
|
||||
|
@ -69,7 +79,7 @@ read_meta_theme (const gchar *meta_theme_file)
|
|||
}
|
||||
meta_theme_info->gtk_theme_name = g_strdup (str);
|
||||
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, "X-GNOME-Metatheme/metacity");
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, METACITY_THEME_KEY);
|
||||
if (str == NULL)
|
||||
{
|
||||
gnome_theme_meta_info_free (meta_theme_info);
|
||||
|
@ -77,7 +87,7 @@ read_meta_theme (const gchar *meta_theme_file)
|
|||
}
|
||||
meta_theme_info->metacity_theme_name = g_strdup (str);
|
||||
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, "X-GNOME-Metatheme/icon");
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, ICON_THEME_KEY);
|
||||
if (str == NULL)
|
||||
{
|
||||
gnome_theme_meta_info_free (meta_theme_info);
|
||||
|
@ -85,13 +95,13 @@ read_meta_theme (const gchar *meta_theme_file)
|
|||
}
|
||||
meta_theme_info->icon_theme_name = g_strdup (str);
|
||||
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, "X-GNOME-Metatheme/font");
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, APPLICATION_FONT_KEY);
|
||||
if (str != NULL)
|
||||
meta_theme_info->font = g_strdup (str);
|
||||
meta_theme_info->application_font = g_strdup (str);
|
||||
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, "X-GNOME-Metatheme/background");
|
||||
str = gnome_desktop_item_get_string (meta_theme_ditem, BACKGROUND_IMAGE_KEY);
|
||||
if (str != NULL)
|
||||
meta_theme_info->background = g_strdup (str);
|
||||
meta_theme_info->background_image = g_strdup (str);
|
||||
|
||||
return meta_theme_info;
|
||||
}
|
||||
|
@ -133,7 +143,7 @@ update_theme_dir (const gchar *theme_dir)
|
|||
{
|
||||
GnomeThemeMetaInfo *meta_theme_info;
|
||||
|
||||
meta_theme_info = read_meta_theme (tmp);
|
||||
meta_theme_info = read_meta_theme (tmp, strrchr (theme_dir, '/'));
|
||||
if (meta_theme_info != NULL)
|
||||
g_hash_table_insert (meta_theme_hash, meta_theme_info->name, meta_theme_info);
|
||||
}
|
||||
|
@ -579,8 +589,8 @@ gnome_theme_meta_info_free (GnomeThemeMetaInfo *meta_theme_info)
|
|||
g_free (meta_theme_info->path);
|
||||
g_free (meta_theme_info->name);
|
||||
g_free (meta_theme_info->comment);
|
||||
g_free (meta_theme_info->font);
|
||||
g_free (meta_theme_info->background);
|
||||
g_free (meta_theme_info->application_font);
|
||||
g_free (meta_theme_info->background_image);
|
||||
g_free (meta_theme_info->gtk_theme_name);
|
||||
g_free (meta_theme_info->icon_theme_name);
|
||||
g_free (meta_theme_info->metacity_theme_name);
|
||||
|
|
|
@ -57,17 +57,19 @@ typedef struct _GnomeThemeMetaInfo GnomeThemeMetaInfo;
|
|||
struct _GnomeThemeMetaInfo
|
||||
{
|
||||
gchar *path;
|
||||
gchar *readable_name;
|
||||
gchar *name;
|
||||
gchar *font;
|
||||
gchar *comment;
|
||||
gchar *icon_file;
|
||||
gchar *background;
|
||||
|
||||
gchar *gtk_theme_name;
|
||||
gchar *icon_theme_name;
|
||||
gchar *metacity_theme_name;
|
||||
GnomeThemeInfo *gtk_theme;
|
||||
GnomeThemeInfo *icon_theme;
|
||||
GnomeThemeInfo *metacity_theme;
|
||||
gchar *icon_theme_name;
|
||||
gchar *sawfish_theme_name;
|
||||
gchar *sound_theme_name;
|
||||
|
||||
gchar *application_font;
|
||||
gchar *background_image;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
Tue Nov 5 15:48:20 2002 Jonathan Blandford <jrb@gnome.org>
|
||||
|
||||
* gnome-theme-manager.c (read_themes): make more robust.
|
||||
|
||||
2002-11-02 Jody Goldberg <jody@gnome.org>
|
||||
|
||||
* Release 2.1.2
|
||||
|
|
|
@ -167,7 +167,7 @@ gnome_theme_installer_run (GtkWidget *parent, gchar *filename)
|
|||
|
||||
g_signal_connect (G_OBJECT (widget), "response",
|
||||
G_CALLBACK (install_dialog_response), dialog);
|
||||
gtk_window_set_transient_for (GTK_WINDOW (widget), parent);
|
||||
gtk_window_set_transient_for (GTK_WINDOW (widget), GTK_WINDOW (parent));
|
||||
gtk_window_set_position (GTK_WINDOW (widget), GTK_WIN_POS_CENTER_ON_PARENT);
|
||||
if (filename)
|
||||
gnome_file_entry_set_filename (GNOME_FILE_ENTRY (WID ("install_theme_picker")), filename);
|
||||
|
|
|
@ -254,31 +254,31 @@ meta_theme_setup_info (GnomeThemeMetaInfo *meta_theme_info,
|
|||
gtk_widget_hide (WID ("meta_theme_description_label"));
|
||||
}
|
||||
|
||||
if (meta_theme_info->font != NULL)
|
||||
if (meta_theme_info->application_font != NULL)
|
||||
{
|
||||
gtk_widget_show (WID ("meta_theme_extras_vbox"));
|
||||
if (meta_theme_info->background != NULL)
|
||||
if (meta_theme_info->background_image != NULL)
|
||||
{
|
||||
gtk_label_set_text (GTK_LABEL (WID ("meta_theme_info_label")),
|
||||
_("This theme suggests the use of a font and a background:"));
|
||||
_("This theme suggests a matching font and a background:"));
|
||||
gtk_widget_show (WID ("meta_theme_background_button"));
|
||||
gtk_widget_show (WID ("meta_theme_font_button"));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_label_set_text (GTK_LABEL (WID ("meta_theme_info_label")),
|
||||
_("This theme suggests the use of a font:"));
|
||||
_("This theme suggests a matching font:"));
|
||||
gtk_widget_hide (WID ("meta_theme_background_button"));
|
||||
gtk_widget_show (WID ("meta_theme_font_button"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (meta_theme_info->background != NULL)
|
||||
if (meta_theme_info->background_image != NULL)
|
||||
{
|
||||
gtk_widget_show (WID ("meta_theme_extras_vbox"));
|
||||
gtk_label_set_text (GTK_LABEL (WID ("meta_theme_info_label")),
|
||||
_("This theme suggests the use of a background:"));
|
||||
_("This theme suggests a matching background:"));
|
||||
gtk_widget_show (WID ("meta_theme_background_button"));
|
||||
gtk_widget_hide (WID ("meta_theme_font_button"));
|
||||
}
|
||||
|
@ -419,6 +419,12 @@ read_themes (GladeXML *dialog)
|
|||
gchar *current_icon_theme;
|
||||
GnomeWindowManager *window_manager;
|
||||
GnomeWMSettings wm_settings;
|
||||
GtkWidget *notebook;
|
||||
|
||||
gboolean have_meta_theme;
|
||||
gboolean have_gtk_theme;
|
||||
gboolean have_window_theme;
|
||||
gboolean have_icon_theme;
|
||||
|
||||
client = gconf_client_get_default ();
|
||||
|
||||
|
@ -435,6 +441,8 @@ read_themes (GladeXML *dialog)
|
|||
if (current_gtk_theme == NULL)
|
||||
current_gtk_theme = g_strdup ("Default");
|
||||
|
||||
notebook = WID ("theme_notebook");
|
||||
|
||||
/* First, we update the GTK+ themes page */
|
||||
theme_list = gnome_theme_info_find_by_type (GNOME_THEME_GTK_2);
|
||||
string_list = NULL;
|
||||
|
@ -444,14 +452,34 @@ read_themes (GladeXML *dialog)
|
|||
string_list = g_list_prepend (string_list, info->name);
|
||||
}
|
||||
|
||||
load_theme_names (GTK_TREE_VIEW (WID ("control_theme_treeview")), string_list, current_gtk_theme, GTK_THEME_DEFAULT_NAME);
|
||||
g_list_free (string_list);
|
||||
if (string_list == NULL)
|
||||
{
|
||||
gtk_widget_hide (WID ("control_theme_vbox"));
|
||||
have_gtk_theme = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_show (WID ("control_theme_vbox"));
|
||||
have_gtk_theme = TRUE;
|
||||
load_theme_names (GTK_TREE_VIEW (WID ("control_theme_treeview")), string_list, current_gtk_theme, GTK_THEME_DEFAULT_NAME);
|
||||
g_list_free (string_list);
|
||||
}
|
||||
g_list_free (theme_list);
|
||||
|
||||
/* Next, we do the window managers */
|
||||
string_list = gnome_window_manager_get_theme_list (window_manager);
|
||||
load_theme_names (GTK_TREE_VIEW (WID ("window_theme_treeview")), string_list, current_window_theme, WINDOW_THEME_DEFAULT_NAME);
|
||||
g_list_free (string_list);
|
||||
if (string_list == NULL)
|
||||
{
|
||||
gtk_widget_hide (WID ("window_theme_vbox"));
|
||||
have_window_theme = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_show (WID ("window_theme_vbox"));
|
||||
have_window_theme = TRUE;
|
||||
load_theme_names (GTK_TREE_VIEW (WID ("window_theme_treeview")), string_list, current_window_theme, WINDOW_THEME_DEFAULT_NAME);
|
||||
g_list_free (string_list);
|
||||
}
|
||||
|
||||
/* Third, we do the icon theme */
|
||||
theme_list = gnome_theme_icon_info_find_all ();
|
||||
|
@ -463,8 +491,18 @@ read_themes (GladeXML *dialog)
|
|||
string_list = g_list_prepend (string_list, info->name);
|
||||
}
|
||||
|
||||
load_theme_names (GTK_TREE_VIEW (WID ("icon_theme_treeview")), string_list, current_icon_theme, ICON_THEME_DEFAULT_NAME);
|
||||
g_list_free (string_list);
|
||||
if (string_list == NULL)
|
||||
{
|
||||
gtk_widget_hide (WID ("icon_theme_vbox"));
|
||||
have_icon_theme = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_show (WID ("icon_theme_vbox"));
|
||||
have_icon_theme = TRUE;
|
||||
load_theme_names (GTK_TREE_VIEW (WID ("icon_theme_treeview")), string_list, current_icon_theme, ICON_THEME_DEFAULT_NAME);
|
||||
g_list_free (string_list);
|
||||
}
|
||||
g_list_free (theme_list);
|
||||
|
||||
/* Finally, we do the Meta themes */
|
||||
|
@ -483,20 +521,44 @@ read_themes (GladeXML *dialog)
|
|||
string_list = g_list_prepend (string_list, info->name);
|
||||
}
|
||||
|
||||
if (current_meta_theme == NULL)
|
||||
current_meta_theme = g_strdup (_("Current modified"));
|
||||
|
||||
load_theme_names (GTK_TREE_VIEW (WID ("meta_theme_treeview")), string_list, current_meta_theme, META_THEME_DEFAULT_NAME);
|
||||
g_list_free (string_list);
|
||||
if (string_list == NULL)
|
||||
{
|
||||
have_meta_theme = FALSE;
|
||||
gtk_widget_hide (WID ("meta_theme_hbox"));
|
||||
}
|
||||
else
|
||||
{
|
||||
have_meta_theme = TRUE;
|
||||
gtk_widget_show (WID ("meta_theme_hbox"));
|
||||
if (current_meta_theme == NULL)
|
||||
current_meta_theme = g_strdup (_("Current modified"));
|
||||
load_theme_names (GTK_TREE_VIEW (WID ("meta_theme_treeview")), string_list, current_meta_theme, META_THEME_DEFAULT_NAME);
|
||||
g_list_free (string_list);
|
||||
}
|
||||
g_list_free (theme_list);
|
||||
|
||||
|
||||
g_free (current_gtk_theme);
|
||||
g_free (current_icon_theme);
|
||||
g_free (current_meta_theme);
|
||||
|
||||
if (! have_meta_theme && ! have_icon_theme && !have_window_theme && ! have_gtk_theme)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (NULL,
|
||||
GTK_DIALOG_MODAL,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK,
|
||||
_("No themes could be found on your system. This probably means that your \"Theme Preferences\" dialog was improperly installed."));
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
exit (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
theme_key_changed (GConfClient *client,
|
||||
guint cnxn_id,
|
||||
|
@ -700,7 +762,7 @@ setup_tree_view (GtkTreeView *tree_view,
|
|||
gtk_cell_renderer_text_new (),
|
||||
"text", THEME_NAME_COLUMN,
|
||||
NULL);
|
||||
|
||||
|
||||
model = (GtkTreeModel *) gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
|
||||
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (model), 0, sort_func, NULL, NULL);
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), 0, GTK_SORT_ASCENDING);
|
||||
|
@ -710,6 +772,7 @@ setup_tree_view (GtkTreeView *tree_view,
|
|||
g_signal_connect (G_OBJECT (selection), "changed", changed_callback, dialog);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
setup_dialog (GladeXML *dialog)
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="notebook1">
|
||||
<widget class="GtkNotebook" id="theme_notebook">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
@ -72,7 +72,7 @@
|
|||
<property name="enable_popup">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox9">
|
||||
<widget class="GtkHBox" id="meta_theme_hbox">
|
||||
<property name="border_width">8</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
|
@ -282,7 +282,7 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<widget class="GtkVBox" id="control_theme_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">8</property>
|
||||
|
@ -462,7 +462,7 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox5">
|
||||
<widget class="GtkVBox" id="window_theme_vbox">
|
||||
<property name="border_width">8</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
|
@ -628,7 +628,7 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox9">
|
||||
<widget class="GtkVBox" id="icon_theme_vbox">
|
||||
<property name="border_width">8</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
|
|
Loading…
Add table
Reference in a new issue