gnome-control-center r8658 - in trunk: . capplets/appearance capplets/common
- From: jensg svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-control-center r8658 - in trunk: . capplets/appearance capplets/common
- Date: Sat, 19 Apr 2008 11:30:34 +0100 (BST)
Author: jensg
Date: Sat Apr 19 10:30:34 2008
New Revision: 8658
URL: http://svn.gnome.org/viewvc/gnome-control-center?rev=8658&view=rev
Log:
2008-04-19 Jens Granseuer <jensgr gmx net>
* configure.in: figure out where GTK+ expects its theme engines and
make that info available to interested capplets
2008-04-19 Jens Granseuer <jensgr gmx net>
* gtkrc-utils.c: (gtkrc_get_details): accept NULL for the
symbolic_colors parameter if the caller doesn't want that information
2008-04-19 Jens Granseuer <jensgr gmx net>
* Makefile.am:
* appearance-themes.c: (theme_validate),
(theme_message_area_update), (themes_init):
* appearance.h: show a warning message when the selected theme is
incomplete (e.g. missing icon theme or gtk theme engine)
Modified:
trunk/ChangeLog
trunk/capplets/appearance/ChangeLog
trunk/capplets/appearance/Makefile.am
trunk/capplets/appearance/appearance-themes.c
trunk/capplets/appearance/appearance.h
trunk/capplets/common/ChangeLog
trunk/capplets/common/gtkrc-utils.c
trunk/configure.in
Modified: trunk/capplets/appearance/Makefile.am
==============================================================================
--- trunk/capplets/appearance/Makefile.am (original)
+++ trunk/capplets/appearance/Makefile.am Sat Apr 19 10:30:34 2008
@@ -57,6 +57,7 @@
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
-DGNOMECC_GLADE_DIR="\"$(gladedir)\"" \
-DGNOMECC_PIXMAP_DIR="\"$(pixmapdir)\"" \
+ -DGTK_ENGINE_DIR="\"$(GTK_ENGINE_DIR)\"" \
-DWALLPAPER_DATADIR="\"$(wallpaperdir)\""
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES)
Modified: trunk/capplets/appearance/appearance-themes.c
==============================================================================
--- trunk/capplets/appearance/appearance-themes.c (original)
+++ trunk/capplets/appearance/appearance-themes.c Sat Apr 19 10:30:34 2008
@@ -351,6 +351,67 @@
return TRUE;
}
+static gchar *
+theme_validate (const GnomeThemeMetaInfo *info)
+{
+ GnomeThemeInfo *theme;
+ gchar *gtkrc;
+
+ theme = gnome_theme_info_find (info->gtk_theme_name);
+ if (!theme || !theme->has_gtk) {
+ return g_strdup_printf (
+ _("This theme will not look as intended because the required GTK+ theme '%s' is not installed."),
+ info->gtk_theme_name);
+ }
+
+ theme = gnome_theme_info_find (info->metacity_theme_name);
+ if (!theme || !theme->has_metacity) {
+ return g_strdup_printf (
+ _("This theme will not look as intended because the required window manager theme '%s' is not installed."),
+ info->metacity_theme_name);
+ }
+
+ if (!gnome_theme_icon_info_find (info->icon_theme_name)) {
+ return g_strdup_printf (
+ _("This theme will not look as intended because the required icon theme '%s' is not installed."),
+ info->gtk_theme_name);
+ }
+
+ /* check for gtk theme engines */
+ gtkrc = gtkrc_find_named (info->gtk_theme_name);
+ if (gtkrc) {
+ GSList *engines = NULL, *l;
+ gchar *msg = NULL;
+ gboolean found;
+
+ gtkrc_get_details (gtkrc, &engines, NULL);
+ g_free (gtkrc);
+
+ for (l = engines; l; l = l->next) {
+ gchar *lib = g_strconcat ("lib", l->data, ".so", NULL);
+ gchar *full = g_build_filename (GTK_ENGINE_DIR, lib, NULL);
+
+ g_free (lib);
+ found = g_file_test (full, G_FILE_TEST_EXISTS);
+ g_free (full);
+
+ if (!found) {
+ msg = g_strdup_printf (
+ _("This theme will not look as intended because the required GTK+ theme engine '%s' is not installed."),
+ (gchar *) l->data);
+ break;
+ }
+ }
+
+ g_slist_foreach (engines, (GFunc) g_free, NULL);
+ g_slist_free (engines);
+
+ return msg;
+ }
+
+ return NULL;
+}
+
static void
theme_set_custom_from_theme (const GnomeThemeMetaInfo *info, AppearanceData *data)
{
@@ -574,8 +635,10 @@
const GnomeThemeMetaInfo *theme;
gboolean show_apply_background = FALSE;
gboolean show_apply_font = FALSE;
- gboolean show_revert_font;
+ gboolean show_revert_font = FALSE;
+ gboolean show_error;
const gchar *message;
+ gchar *error_message;
gchar *font;
theme = theme_get_selected (GTK_ICON_VIEW (glade_xml_get_widget (data->xml, "theme_list")), data);
@@ -583,60 +646,64 @@
if (!theme)
return;
- if (theme->background_image != NULL) {
- gchar *background;
+ error_message = theme_validate (theme);
+ show_error = (error_message != NULL);
- background = gconf_client_get_string (data->client, BACKGROUND_KEY, NULL);
- show_apply_background =
- (!background || strcmp (theme->background_image, background) != 0);
- g_free (background);
- }
+ if (!show_error) {
+ if (theme->background_image != NULL) {
+ gchar *background;
+
+ background = gconf_client_get_string (data->client, BACKGROUND_KEY, NULL);
+ show_apply_background =
+ (!background || strcmp (theme->background_image, background) != 0);
+ g_free (background);
+ }
- if (theme->application_font) {
- font = gconf_client_get_string (data->client, APPLICATION_FONT_KEY, NULL);
- show_apply_font =
- (!font || strcmp (theme->application_font, font) != 0);
- g_free (font);
- }
+ if (theme->application_font) {
+ font = gconf_client_get_string (data->client, APPLICATION_FONT_KEY, NULL);
+ show_apply_font =
+ (!font || strcmp (theme->application_font, font) != 0);
+ g_free (font);
+ }
- if (!show_apply_font && theme->documents_font) {
- font = gconf_client_get_string (data->client, DOCUMENTS_FONT_KEY, NULL);
- show_apply_font =
- (!font || strcmp (theme->application_font, font) != 0);
- g_free (font);
- }
+ if (!show_apply_font && theme->documents_font) {
+ font = gconf_client_get_string (data->client, DOCUMENTS_FONT_KEY, NULL);
+ show_apply_font =
+ (!font || strcmp (theme->application_font, font) != 0);
+ g_free (font);
+ }
- if (!show_apply_font && theme->desktop_font) {
- font = gconf_client_get_string (data->client, DESKTOP_FONT_KEY, NULL);
- show_apply_font =
- (!font || strcmp (theme->application_font, font) != 0);
- g_free (font);
- }
+ if (!show_apply_font && theme->desktop_font) {
+ font = gconf_client_get_string (data->client, DESKTOP_FONT_KEY, NULL);
+ show_apply_font =
+ (!font || strcmp (theme->application_font, font) != 0);
+ g_free (font);
+ }
- if (!show_apply_font && theme->windowtitle_font) {
- font = gconf_client_get_string (data->client, WINDOWTITLE_FONT_KEY, NULL);
- show_apply_font =
- (!font || strcmp (theme->application_font, font) != 0);
- g_free (font);
- }
+ if (!show_apply_font && theme->windowtitle_font) {
+ font = gconf_client_get_string (data->client, WINDOWTITLE_FONT_KEY, NULL);
+ show_apply_font =
+ (!font || strcmp (theme->application_font, font) != 0);
+ g_free (font);
+ }
- if (!show_apply_font && theme->monospace_font) {
- font = gconf_client_get_string (data->client, MONOSPACE_FONT_KEY, NULL);
- show_apply_font =
- (!font || strcmp (theme->application_font, font) != 0);
- g_free (font);
- }
+ if (!show_apply_font && theme->monospace_font) {
+ font = gconf_client_get_string (data->client, MONOSPACE_FONT_KEY, NULL);
+ show_apply_font =
+ (!font || strcmp (theme->application_font, font) != 0);
+ g_free (font);
+ }
- show_revert_font = (data->revert_application_font != NULL ||
- data->revert_documents_font != NULL || data->revert_desktop_font != NULL ||
- data->revert_windowtitle_font != NULL || data->revert_monospace_font != NULL);
+ show_revert_font = (data->revert_application_font != NULL ||
+ data->revert_documents_font != NULL || data->revert_desktop_font != NULL ||
+ data->revert_windowtitle_font != NULL || data->revert_monospace_font != NULL);
+ }
if (data->theme_message_area == NULL) {
GtkWidget *hbox;
- GtkWidget *icon;
GtkWidget *parent;
- if (!show_apply_background && !show_revert_font && !show_apply_font)
+ if (!show_apply_background && !show_revert_font && !show_apply_font && !show_error)
return;
data->theme_message_area = gedit_message_area_new ();
@@ -665,10 +732,12 @@
hbox = gtk_hbox_new (FALSE, 9);
gtk_widget_show (hbox);
- icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
- gtk_widget_show (icon);
- gtk_misc_set_alignment (GTK_MISC (icon), 0.5, 0);
- gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
+ data->theme_info_icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
+ data->theme_error_icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (data->theme_info_icon), 0.5, 0);
+ gtk_misc_set_alignment (GTK_MISC (data->theme_error_icon), 0.5, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), data->theme_info_icon, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), data->theme_error_icon, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), data->theme_message_label, TRUE, TRUE, 0);
gedit_message_area_set_contents (GEDIT_MESSAGE_AREA (data->theme_message_area), hbox);
@@ -676,7 +745,9 @@
gtk_box_pack_start (GTK_BOX (parent), data->theme_message_area, FALSE, FALSE, 0);
}
- if (show_apply_background && show_apply_font && show_revert_font)
+ if (show_error)
+ message = error_message;
+ else if (show_apply_background && show_apply_font && show_revert_font)
message = _("The current theme suggests a background and a font. Also, the last applied font suggestion can be reverted.");
else if (show_apply_background && show_revert_font)
message = _("The current theme suggests a background. Also, the last applied font suggestion can be reverted.");
@@ -708,14 +779,23 @@
else
gtk_widget_hide (data->revert_font_button);
- if (show_apply_background || show_apply_font || show_revert_font) {
+ if (show_error || show_apply_background || show_apply_font || show_revert_font) {
gtk_widget_show (data->theme_message_area);
gtk_widget_queue_draw (data->theme_message_area);
+
+ if (show_error) {
+ gtk_widget_show (data->theme_error_icon);
+ gtk_widget_hide (data->theme_info_icon);
+ } else {
+ gtk_widget_show (data->theme_info_icon);
+ gtk_widget_hide (data->theme_error_icon);
+ }
} else {
gtk_widget_hide (data->theme_message_area);
}
gtk_label_set_text (GTK_LABEL (data->theme_message_label), message);
+ g_free (error_message);
}
static void
@@ -987,6 +1067,8 @@
data->revert_monospace_font = NULL;
data->theme_save_dialog = NULL;
data->theme_message_area = NULL;
+ data->theme_info_icon = NULL;
+ data->theme_error_icon = NULL;
data->theme_custom = gnome_theme_meta_info_new ();
data->theme_icon = gdk_pixbuf_new_from_file (GNOMECC_PIXMAP_DIR "/theme-thumbnailing.png", NULL);
data->theme_store = theme_store =
Modified: trunk/capplets/appearance/appearance.h
==============================================================================
--- trunk/capplets/appearance/appearance.h (original)
+++ trunk/capplets/appearance/appearance.h Sat Apr 19 10:30:34 2008
@@ -62,6 +62,8 @@
GtkWidget *apply_background_button;
GtkWidget *revert_font_button;
GtkWidget *apply_font_button;
+ GtkWidget *theme_info_icon;
+ GtkWidget *theme_error_icon;
gchar *revert_application_font;
gchar *revert_documents_font;
gchar *revert_desktop_font;
Modified: trunk/capplets/common/gtkrc-utils.c
==============================================================================
--- trunk/capplets/common/gtkrc-utils.c (original)
+++ trunk/capplets/common/gtkrc-utils.c Sat Apr 19 10:30:34 2008
@@ -117,6 +117,8 @@
GTokenType string_token;
if (token == '@')
{
+ if (symbolic_colors == NULL)
+ continue;
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_IDENTIFIER)
continue;
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Sat Apr 19 10:30:34 2008
@@ -111,6 +111,11 @@
PKG_CHECK_MODULES(LIBSOUNDS, gio-2.0 libgnome-2.0 libgnomeui-2.0)
PKG_CHECK_MODULES(GSD_DBUS, gnome-settings-daemon)
+gtk_lib_dir=`$PKG_CONFIG --variable libdir gtk+-2.0`
+gtk_binary_version=`$PKG_CONFIG --variable gtk_binary_version gtk+-2.0`
+GTK_ENGINE_DIR="$gtk_lib_dir/gtk-2.0/$gtk_binary_version/engines"
+AC_SUBST(GTK_ENGINE_DIR)
+
dnl
dnl Check for Xft version 2; we build in extra functionality to the font capplet
dnl when we have it.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]