2003-05-13 18:37:05 +00:00
|
|
|
/* -*- mode: C; c-basic-offset: 4 -*-
|
|
|
|
* themus - utilities for GNOME themes
|
|
|
|
* Copyright (C) 2002 Jonathan Blandford <aes@gnome.org>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
port from gnome-vfs to gio (part of bug #524401)
2008-05-01 Jens Granseuer <jensgr@gmx.net>
* gnome-theme-apply.c:
* gnome-theme-info.c: (get_file_type), (add_theme_to_hash_by_name),
(get_theme_from_hash_by_name), (gnome_theme_read_meta_theme),
(read_icon_theme), (gdk_pixbuf_from_xcursor_image),
(read_cursor_theme), (handle_change_signal), (update_theme_index),
(update_gtk2_index), (update_keybinding_index),
(update_metacity_index), (update_common_theme_dir_index),
(update_meta_theme_index), (update_icon_theme_index),
(update_cursor_theme_index), (gtk2_dir_changed),
(keybinding_dir_changed), (metacity_dir_changed),
(common_theme_dir_changed), (common_icon_theme_dir_changed),
(add_common_theme_dir_monitor),
(add_common_icon_theme_dir_monitor),
(remove_common_theme_dir_monitor),
(remove_common_icon_theme_dir_monitor), (top_theme_dir_changed),
(top_icon_theme_dir_changed), (real_add_top_theme_dir_monitor),
(add_top_theme_dir_monitor), (add_top_icon_theme_dir_monitor),
(gnome_theme_init):
* gnome-theme-info.h:
* gnome-theme-test.c: (main): port from gnome-vfs to gio (part of
bug #524401)
2008-05-01 Jens Granseuer <jensgr@gmx.net>
* appearance-themes.c: (themes_init): update for changes in the
theme-info API
2008-05-01 Jens Granseuer <jensgr@gmx.net>
* theme-method.c: (vfs_module_init):
* themus-properties-view.c: (themus_properties_view_init),
(themus_properties_view_set_location):
* themus-theme-applier.c: (main): update users of the theme-info
API
svn path=/trunk/; revision=8681
2008-05-01 09:08:07 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2003-06-03 16:42:01 +00:00
|
|
|
#include <string.h>
|
2003-05-13 18:37:05 +00:00
|
|
|
#include <gconf/gconf-client.h>
|
|
|
|
#include <gnome-wm-manager.h>
|
|
|
|
#include "gnome-theme-apply.h"
|
2007-07-26 19:48:14 +00:00
|
|
|
#include "gtkrc-utils.h"
|
2003-05-13 18:37:05 +00:00
|
|
|
|
|
|
|
#define GTK_THEME_KEY "/desktop/gnome/interface/gtk_theme"
|
- Remove seperate color scheme saving UI - Add support for
2007-01-19 Thomas Wood <thos@gnome.org>
* gnome-theme-details.c: (update_color_scheme_tab), (color_select),
(toggle_color_scheme_key):
* gnome-theme-manager.c: (free_all), (load_meta_themes),
(meta_theme_setup_info), (meta_theme_selection_changed),
(update_themes_from_disk), (add_custom_row_to_meta_theme),
(themes_equal), (update_settings_from_gconf_idle),
(update_settings_from_gconf), (gtk_theme_key_changed),
(setup_dialog):
* gnome-theme-save.c: (write_theme_to_disk):
* theme-properties.glade:
- Remove seperate color scheme saving UI
- Add support for gtk-color-scheme key in metatheme info
2007-01-19 Thomas Wood <thos@gnome.org>
* gnome-theme-apply.c: (gnome_meta_theme_set):
* gnome-theme-info.c: (gnome_theme_read_meta_theme),
(gnome_theme_meta_info_new), (gnome_theme_meta_info_free),
(gnome_theme_meta_info_print), (gnome_theme_meta_info_compare):
* gnome-theme-info.h:
Add support for saving and applying the gtk-color-scheme key
svn path=/trunk/; revision=7152
2007-01-19 01:33:26 +00:00
|
|
|
#define COLOR_SCHEME_KEY "/desktop/gnome/interface/gtk_color_scheme"
|
2003-05-13 18:37:05 +00:00
|
|
|
#define ICON_THEME_KEY "/desktop/gnome/interface/icon_theme"
|
2007-07-25 17:30:21 +00:00
|
|
|
#define FONT_KEY "/desktop/gnome/interface/font_name"
|
2007-07-26 16:15:35 +00:00
|
|
|
#define CURSOR_FONT_KEY "/desktop/gnome/peripherals/mouse/cursor_font"
|
2007-07-25 17:30:21 +00:00
|
|
|
#define CURSOR_THEME_KEY "/desktop/gnome/peripherals/mouse/cursor_theme"
|
|
|
|
#define CURSOR_SIZE_KEY "/desktop/gnome/peripherals/mouse/cursor_size"
|
2008-07-15 18:23:31 +00:00
|
|
|
#define NOTIFICATION_THEME_KEY "/apps/notification-daemon/theme"
|
2003-05-13 18:37:05 +00:00
|
|
|
|
2007-02-28 09:18:24 +00:00
|
|
|
#define compare(x,y) (!x && y) || (x && !y) || (x && y && strcmp (x, y))
|
|
|
|
|
2003-05-13 18:37:05 +00:00
|
|
|
void
|
|
|
|
gnome_meta_theme_set (GnomeThemeMetaInfo *meta_theme_info)
|
|
|
|
{
|
|
|
|
GConfClient *client;
|
|
|
|
gchar *old_key;
|
2007-10-25 16:01:44 +00:00
|
|
|
gint old_key_int;
|
2003-05-13 18:37:05 +00:00
|
|
|
GnomeWindowManager *window_manager;
|
|
|
|
GnomeWMSettings wm_settings;
|
|
|
|
|
|
|
|
gnome_wm_manager_init ();
|
|
|
|
|
|
|
|
window_manager = gnome_wm_manager_get_current (gdk_display_get_default_screen (gdk_display_get_default ()));
|
|
|
|
|
|
|
|
client = gconf_client_get_default ();
|
|
|
|
|
|
|
|
/* Set the gtk+ key */
|
|
|
|
old_key = gconf_client_get_string (client, GTK_THEME_KEY, NULL);
|
2007-06-10 17:22:16 +00:00
|
|
|
if (compare (old_key, meta_theme_info->gtk_theme_name))
|
2003-05-13 18:37:05 +00:00
|
|
|
{
|
|
|
|
gconf_client_set_string (client, GTK_THEME_KEY, meta_theme_info->gtk_theme_name, NULL);
|
|
|
|
}
|
|
|
|
g_free (old_key);
|
|
|
|
|
2007-06-10 17:22:16 +00:00
|
|
|
/* Set the color scheme key */
|
- Remove seperate color scheme saving UI - Add support for
2007-01-19 Thomas Wood <thos@gnome.org>
* gnome-theme-details.c: (update_color_scheme_tab), (color_select),
(toggle_color_scheme_key):
* gnome-theme-manager.c: (free_all), (load_meta_themes),
(meta_theme_setup_info), (meta_theme_selection_changed),
(update_themes_from_disk), (add_custom_row_to_meta_theme),
(themes_equal), (update_settings_from_gconf_idle),
(update_settings_from_gconf), (gtk_theme_key_changed),
(setup_dialog):
* gnome-theme-save.c: (write_theme_to_disk):
* theme-properties.glade:
- Remove seperate color scheme saving UI
- Add support for gtk-color-scheme key in metatheme info
2007-01-19 Thomas Wood <thos@gnome.org>
* gnome-theme-apply.c: (gnome_meta_theme_set):
* gnome-theme-info.c: (gnome_theme_read_meta_theme),
(gnome_theme_meta_info_new), (gnome_theme_meta_info_free),
(gnome_theme_meta_info_print), (gnome_theme_meta_info_compare):
* gnome-theme-info.h:
Add support for saving and applying the gtk-color-scheme key
svn path=/trunk/; revision=7152
2007-01-19 01:33:26 +00:00
|
|
|
old_key = gconf_client_get_string (client, COLOR_SCHEME_KEY, NULL);
|
2007-02-28 09:18:24 +00:00
|
|
|
if (compare (old_key, meta_theme_info->gtk_color_scheme))
|
- Remove seperate color scheme saving UI - Add support for
2007-01-19 Thomas Wood <thos@gnome.org>
* gnome-theme-details.c: (update_color_scheme_tab), (color_select),
(toggle_color_scheme_key):
* gnome-theme-manager.c: (free_all), (load_meta_themes),
(meta_theme_setup_info), (meta_theme_selection_changed),
(update_themes_from_disk), (add_custom_row_to_meta_theme),
(themes_equal), (update_settings_from_gconf_idle),
(update_settings_from_gconf), (gtk_theme_key_changed),
(setup_dialog):
* gnome-theme-save.c: (write_theme_to_disk):
* theme-properties.glade:
- Remove seperate color scheme saving UI
- Add support for gtk-color-scheme key in metatheme info
2007-01-19 Thomas Wood <thos@gnome.org>
* gnome-theme-apply.c: (gnome_meta_theme_set):
* gnome-theme-info.c: (gnome_theme_read_meta_theme),
(gnome_theme_meta_info_new), (gnome_theme_meta_info_free),
(gnome_theme_meta_info_print), (gnome_theme_meta_info_compare):
* gnome-theme-info.h:
Add support for saving and applying the gtk-color-scheme key
svn path=/trunk/; revision=7152
2007-01-19 01:33:26 +00:00
|
|
|
{
|
2007-07-26 19:48:14 +00:00
|
|
|
/* only save the color scheme if it differs from the default
|
|
|
|
scheme for the selected gtk theme */
|
|
|
|
gchar *newval, *gtkcols;
|
|
|
|
|
|
|
|
newval = meta_theme_info->gtk_color_scheme;
|
|
|
|
gtkcols = gtkrc_get_color_scheme_for_theme (meta_theme_info->gtk_theme_name);
|
|
|
|
|
|
|
|
if (newval == NULL || !strcmp (newval, "") ||
|
|
|
|
gnome_theme_color_scheme_equal (newval, gtkcols))
|
|
|
|
{
|
|
|
|
gconf_client_unset (client, COLOR_SCHEME_KEY, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gconf_client_set_string (client, COLOR_SCHEME_KEY, newval, NULL);
|
|
|
|
}
|
2007-07-29 13:05:29 +00:00
|
|
|
g_free (gtkcols);
|
- Remove seperate color scheme saving UI - Add support for
2007-01-19 Thomas Wood <thos@gnome.org>
* gnome-theme-details.c: (update_color_scheme_tab), (color_select),
(toggle_color_scheme_key):
* gnome-theme-manager.c: (free_all), (load_meta_themes),
(meta_theme_setup_info), (meta_theme_selection_changed),
(update_themes_from_disk), (add_custom_row_to_meta_theme),
(themes_equal), (update_settings_from_gconf_idle),
(update_settings_from_gconf), (gtk_theme_key_changed),
(setup_dialog):
* gnome-theme-save.c: (write_theme_to_disk):
* theme-properties.glade:
- Remove seperate color scheme saving UI
- Add support for gtk-color-scheme key in metatheme info
2007-01-19 Thomas Wood <thos@gnome.org>
* gnome-theme-apply.c: (gnome_meta_theme_set):
* gnome-theme-info.c: (gnome_theme_read_meta_theme),
(gnome_theme_meta_info_new), (gnome_theme_meta_info_free),
(gnome_theme_meta_info_print), (gnome_theme_meta_info_compare):
* gnome-theme-info.h:
Add support for saving and applying the gtk-color-scheme key
svn path=/trunk/; revision=7152
2007-01-19 01:33:26 +00:00
|
|
|
}
|
|
|
|
g_free (old_key);
|
|
|
|
|
2003-05-13 18:37:05 +00:00
|
|
|
/* Set the wm key */
|
|
|
|
wm_settings.flags = GNOME_WM_SETTING_THEME;
|
|
|
|
wm_settings.theme = meta_theme_info->metacity_theme_name;
|
|
|
|
if (window_manager)
|
|
|
|
gnome_window_manager_change_settings (window_manager, &wm_settings);
|
|
|
|
|
|
|
|
/* set the icon theme */
|
|
|
|
old_key = gconf_client_get_string (client, ICON_THEME_KEY, NULL);
|
2007-06-10 17:22:16 +00:00
|
|
|
if (compare (old_key, meta_theme_info->icon_theme_name))
|
2003-05-13 18:37:05 +00:00
|
|
|
{
|
|
|
|
gconf_client_set_string (client, ICON_THEME_KEY, meta_theme_info->icon_theme_name, NULL);
|
|
|
|
}
|
|
|
|
g_free (old_key);
|
2007-07-25 17:30:21 +00:00
|
|
|
|
2008-07-15 18:23:31 +00:00
|
|
|
/* set the notification theme */
|
|
|
|
old_key = gconf_client_get_string (client, NOTIFICATION_THEME_KEY, NULL);
|
2008-08-03 08:23:24 +00:00
|
|
|
if (compare (old_key, meta_theme_info->notification_theme_name))
|
2008-07-15 18:23:31 +00:00
|
|
|
{
|
2008-08-03 08:23:24 +00:00
|
|
|
gconf_client_set_string (client, NOTIFICATION_THEME_KEY, meta_theme_info->notification_theme_name, NULL);
|
2008-07-15 18:23:31 +00:00
|
|
|
}
|
|
|
|
g_free (old_key);
|
|
|
|
|
2007-07-25 17:30:21 +00:00
|
|
|
/* Set the cursor theme key */
|
2007-07-26 16:15:35 +00:00
|
|
|
#ifdef HAVE_XCURSOR
|
2007-07-25 17:30:21 +00:00
|
|
|
old_key = gconf_client_get_string (client, CURSOR_THEME_KEY, NULL);
|
|
|
|
if (compare (old_key, meta_theme_info->cursor_theme_name))
|
|
|
|
{
|
|
|
|
gconf_client_set_string (client, CURSOR_THEME_KEY, meta_theme_info->cursor_theme_name, NULL);
|
2007-10-25 16:01:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
old_key_int = gconf_client_get_int (client, CURSOR_SIZE_KEY, NULL);
|
2008-03-11 19:00:37 +00:00
|
|
|
if (old_key_int != meta_theme_info->cursor_size)
|
2007-10-25 16:01:44 +00:00
|
|
|
{
|
2008-03-11 19:00:37 +00:00
|
|
|
gconf_client_set_int (client, CURSOR_SIZE_KEY, meta_theme_info->cursor_size, NULL);
|
2007-07-25 17:30:21 +00:00
|
|
|
}
|
2007-07-26 16:15:35 +00:00
|
|
|
#else
|
|
|
|
old_key = gconf_client_get_string (client, CURSOR_FONT_KEY, NULL);
|
|
|
|
if (compare (old_key, meta_theme_info->cursor_theme_name))
|
|
|
|
{
|
|
|
|
gconf_client_set_string (client, CURSOR_FONT_KEY, meta_theme_info->cursor_theme_name, NULL);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-07-25 17:30:21 +00:00
|
|
|
g_free (old_key);
|
2005-05-22 15:46:45 +00:00
|
|
|
g_object_unref (client);
|
2003-05-13 18:37:05 +00:00
|
|
|
}
|