2005-05-22 Sebastien Bacher <seb128@debian.org> * ChangeLog capplets/about-me/e-image-chooser.c capplets/accessibility/at-properties/at-startup-session.h capplets/accessibility/keyboard/accessibility-keyboard.c capplets/background/gnome-wp-info.c capplets/common/gconf-property-editor.c capplets/common/gnome-theme-apply.c capplets/default-applications/gnome-default-applications-properties.c capplets/keybindings/gnome-keybinding-properties.c capplets/keyboard/gnome-keyboard-properties.c capplets/mouse/gnome-mouse-properties.c capplets/network/gnome-network-preferences.c capplets/sound/sound-properties-capplet.c capplets/theme-switcher/gnome-theme-details.c capplets/theme-switcher/gnome-theme-manager.c capplets/ui-properties/gnome-ui-properties.c capplets/windows/gnome-window-properties.c gnome-settings-daemon/factory.c gnome-settings-daemon/gnome-settings-accessibility-keyboard.c gnome-settings-daemon/gnome-settings-background.c gnome-settings-daemon/gnome-settings-daemon.c gnome-settings-daemon/gnome-settings-daemon.h gnome-settings-daemon/gnome-settings-font.c gnome-settings-daemon/gnome-settings-keybindings.c gnome-settings-daemon/gnome-settings-keybindings.h gnome-settings-daemon/gnome-settings-keyboard-xkb.c gnome-settings-daemon/gnome-settings-keyboard.c gnome-settings-daemon/gnome-settings-locate-pointer.h gnome-settings-daemon/gnome-settings-mouse.c gnome-settings-daemon/gnome-settings-multimedia-keys.c gnome-settings-daemon/gnome-settings-screensaver.c gnome-settings-daemon/gnome-settings-sound.c gnome-settings-daemon/gnome-settings-xmodmap.c gnome-settings-daemon/gnome-settings-xrdb.c gnome-settings-daemon/gnome-settings-xsettings.c libbackground/applier.c libbackground/applier.h libbackground/preferences.c libsounds/sound-properties.c libsounds/sound-view.h libwindow-settings/gnome-wm-manager.c libwindow-settings/metacity-window-manager.c typing-break/drw-break-window.c typing-break/drw-utils.h typing-break/drwright.c vfs-methods/fontilus/font-view.c vfs-methods/themus/themus-theme-applier.c: Cleanup of gconf and a few other things, patch from Kjartan Maraas <kmaraas@gnome.org> (Closes: #301945).
99 lines
2.8 KiB
C
99 lines
2.8 KiB
C
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
|
|
|
/*
|
|
* This program 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 of the
|
|
* License, or (at your option) any later version.
|
|
*
|
|
* This program 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 av.
|
|
*
|
|
* You should have received a copy of the GNU General Public
|
|
* License along with this program; if not, write to the
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
* Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <glib/gi18n.h>
|
|
#include <gtk/gtk.h>
|
|
#include <glade/glade.h>
|
|
#include <libgnome/libgnome.h>
|
|
#include <libgnomevfs/gnome-vfs.h>
|
|
#include <gconf/gconf-client.h>
|
|
|
|
#include <gnome-theme-info.h>
|
|
#include <gnome-theme-apply.h>
|
|
|
|
#define FONT_KEY "/desktop/gnome/interface/font_name"
|
|
|
|
int main (int argc, char **argv)
|
|
{
|
|
GnomeVFSURI *uri;
|
|
GnomeThemeMetaInfo *theme;
|
|
GnomeProgram *program;
|
|
GladeXML *font_xml;
|
|
GtkWidget *font_dialog;
|
|
GtkWidget *font_sample;
|
|
gboolean apply_font = FALSE;
|
|
poptContext ctx;
|
|
gchar **args;
|
|
|
|
gtk_init (&argc, &argv);
|
|
program = gnome_program_init ("ThemeApplier", "0.3.0", LIBGNOME_MODULE,
|
|
argc, argv, GNOME_PARAM_NONE);
|
|
|
|
g_object_get (program, GNOME_PARAM_POPT_CONTEXT, &ctx, NULL);
|
|
args = (char**) poptGetArgs(ctx);
|
|
|
|
if (!args) return 1;
|
|
|
|
gnome_vfs_init ();
|
|
gnome_theme_init (NULL);
|
|
|
|
uri = gnome_vfs_uri_new (args[0]);
|
|
g_assert (uri != NULL);
|
|
|
|
theme = gnome_theme_read_meta_theme (uri);
|
|
gnome_vfs_uri_unref (uri);
|
|
|
|
g_assert (theme != NULL);
|
|
|
|
if (theme->application_font) {
|
|
glade_init ();
|
|
font_xml = glade_xml_new (GNOMECC_GLADE_DIR "/apply-font.glade",
|
|
NULL, NULL);
|
|
if (font_xml) {
|
|
font_dialog = glade_xml_get_widget (font_xml, "ApplyFontAlert");
|
|
font_sample = glade_xml_get_widget (font_xml, "font_sample");
|
|
gtk_label_set_markup (GTK_LABEL (font_sample),
|
|
g_strconcat ("<span font_desc=\"",
|
|
theme->application_font,
|
|
"\">",
|
|
/* translators: you may want to include non-western chars here */
|
|
_("ABCDEFG"),
|
|
"</span>",
|
|
NULL));
|
|
|
|
if (gtk_dialog_run (GTK_DIALOG(font_dialog)) == GTK_RESPONSE_OK)
|
|
apply_font = TRUE;
|
|
} else {
|
|
/* if installation is borked, recover and apply the font */
|
|
apply_font = TRUE;
|
|
}
|
|
}
|
|
|
|
gnome_meta_theme_set (theme);
|
|
|
|
if (apply_font) {
|
|
GConfClient *client = gconf_client_get_default ();
|
|
gconf_client_set_string (client, FONT_KEY, theme->application_font, NULL);
|
|
g_object_unref (client);
|
|
}
|
|
|
|
return 0;
|
|
}
|