From 2d9c0e2298ffddd7e5ceaca4591f838b09164b58 Mon Sep 17 00:00:00 2001 From: Andrew Sobala Date: Thu, 24 Jul 2003 19:35:08 +0000 Subject: [PATCH] added GUI to ask if a font should be applied 2003-07-24 Andrew Sobala * added GUI to ask if a font should be applied --- ChangeLog | 4 + configure.in | 2 +- po/ChangeLog | 4 + vfs-methods/themus/ChangeLog | 5 + vfs-methods/themus/Makefile.am | 6 +- vfs-methods/themus/apply-font.glade | 233 ++++++++++++++++++++++ vfs-methods/themus/themus-theme-applier.c | 38 +++- 7 files changed, 287 insertions(+), 5 deletions(-) create mode 100644 vfs-methods/themus/apply-font.glade diff --git a/ChangeLog b/ChangeLog index dd0225194..1e3bf590e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-07-24 Andrew Sobala + + * Added libglade to themus configure check + 2003-07-17 Richard Hult * typing-break/main.c (main): Remove session stuff since g-s-d diff --git a/configure.in b/configure.in index 74ca0237e..6e25ddf27 100644 --- a/configure.in +++ b/configure.in @@ -131,7 +131,7 @@ if test x$enable_vfs_methods = xyes; then PKG_CHECK_MODULES(THEME_METHOD, gnome-vfs-module-2.0 >= 2.2.0 gnome-vfs-2.0 >= 2.2.0) PKG_CHECK_MODULES(THEMUS_THUMBNAILER, gdk-2.0 >= 2.2.0 libgnomeui-2.0 >= 2.2.0 libmetacity-private gnome-vfs-2.0 >= 2.2.0) - PKG_CHECK_MODULES(THEMUS_COMPONENT, glib-2.0 >= 2.2.0 gtk+-2.0 >= 2.2.0 atk >= 1.2.0 libgnome-2.0 >= 2.2.0 libgnomeui-2.0 >= 2.2.0 gnome-vfs-2.0 >= 2.2.0 libbonobo-2.0 >= 2.2.0 libbonoboui-2.0 >= 2.2.0 libnautilus >= 2.2.0) + PKG_CHECK_MODULES(THEMUS_COMPONENT, glib-2.0 >= 2.2.0 gtk+-2.0 >= 2.2.0 atk >= 1.2.0 libgnome-2.0 >= 2.2.0 libgnomeui-2.0 >= 2.2.0 gnome-vfs-2.0 >= 2.2.0 libbonobo-2.0 >= 2.2.0 libbonoboui-2.0 >= 2.2.0 libnautilus >= 2.2.0 libglade-2.0) PKG_CHECK_MODULES(FONT_METHOD, [gnome-vfs-module-2.0 >= gnomevfs_minver fontconfig >= fontconfig_minver]) PKG_CHECK_MODULES(FONT_THUMBNAILER, [gnome-vfs-2.0 >= gnomevfs_minver gdk-pixbuf-2.0 >= gtk_minver]) PKG_CHECK_MODULES(FONT_CONTEXT_MENU, [gnome-vfs-2.0 >= gnomevfs_minver libbonobo-2.0 >= libbonobo_minver]) diff --git a/po/ChangeLog b/po/ChangeLog index 68eab4c67..f1f7b63e6 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,7 @@ +2003-07-24 Andrew Sobala + + * POTFILES.in: added vfs-methods/themus/apply-font.glade + 2003-07-23 Andrew Sobala * POTFILES.in: s/themus-component.c/themus-theme-applier.c/ diff --git a/vfs-methods/themus/ChangeLog b/vfs-methods/themus/ChangeLog index 769137276..21ceece38 100644 --- a/vfs-methods/themus/ChangeLog +++ b/vfs-methods/themus/ChangeLog @@ -1,3 +1,8 @@ +2003-07-24 Andrew Sobala + + * Makefile.am, apply-font.glade, themus-theme-applier.c: + added GUI to ask if a font should be applied + 2003-07-21 Andrew Sobala As per comments on Usability@gnome.org: diff --git a/vfs-methods/themus/Makefile.am b/vfs-methods/themus/Makefile.am index 90a58cdc1..9491c0a6b 100644 --- a/vfs-methods/themus/Makefile.am +++ b/vfs-methods/themus/Makefile.am @@ -2,7 +2,8 @@ INCLUDES = $(THEME_METHOD_CFLAGS) \ $(THEMUS_THUMBNAILER_CFLAGS) \ $(THEMUS_COMPONENT_CFLAGS) \ -I$(top_srcdir)/capplets/common \ - -DDIRECTORY_DIR=\"$(vfsdirectorydir)\" + -DDIRECTORY_DIR=\"$(vfsdirectorydir)\" \ + -DDATA_DIR=\"$(datadir)/themus\" AM_CFLAGS = -g @@ -38,6 +39,8 @@ libthemus_theme_properties_view_la_SOURCES = \ themus-properties-view.h \ themus-properties-main.c +pkgdata_DATA = apply-font.glade + @INTLTOOL_DIRECTORY_RULE@ vfsmoduleconfdir = $(sysconfdir)/gnome-vfs-2.0/modules @@ -75,6 +78,7 @@ install-data-local: @INTLTOOL_SCHEMAS_RULE@ EXTRA_DIST = \ + apply-font.glade \ theme-method.directory.in \ theme-method.conf \ themus.schemas.in \ diff --git a/vfs-methods/themus/apply-font.glade b/vfs-methods/themus/apply-font.glade new file mode 100644 index 000000000..1590c9c11 --- /dev/null +++ b/vfs-methods/themus/apply-font.glade @@ -0,0 +1,233 @@ + + + + + + + 6 + True + + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + False + False + + + + True + False + 12 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + GTK_RELIEF_NORMAL + -6 + + + + True + 0.5 + 0.5 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-cancel + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Do _not apply font + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + _Apply font + True + GTK_RELIEF_NORMAL + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 6 + True + False + 12 + + + + True + gtk-dialog-warning + 6 + 0.5 + 0 + 0 + 0 + + + 0 + True + True + + + + + + True + False + 12 + + + + True + <span weight="bold" size="larger">Apply new font?</span> + False + True + GTK_JUSTIFY_LEFT + True + False + 0 + 0 + 0 + 0 + + + 0 + False + False + + + + + + True + The theme you have selected suggests a new font. A preview of the font is shown below. + False + False + GTK_JUSTIFY_LEFT + True + False + 0 + 0 + 0 + 0 + + + 0 + True + True + + + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + + diff --git a/vfs-methods/themus/themus-theme-applier.c b/vfs-methods/themus/themus-theme-applier.c index d56f4d1c1..169a76c34 100644 --- a/vfs-methods/themus/themus-theme-applier.c +++ b/vfs-methods/themus/themus-theme-applier.c @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -36,9 +37,13 @@ int main (int argc, char* argv[]) GnomeThemeMetaInfo *theme; GConfClient *client; GnomeProgram *program; + GladeXML *font_xml; + GtkWidget *font_dialog; + GtkWidget *font_sample; + gboolean apply_font = FALSE; poptContext ctx; gchar **args; - + program = gnome_program_init ("ThemeApplier", "0.3.0", LIBGNOMEUI_MODULE, argc, argv, GNOME_PARAM_NONE); @@ -60,13 +65,40 @@ int main (int argc, char* argv[]) gnome_vfs_uri_unref (uri); g_assert (theme != NULL); - - gnome_meta_theme_set (theme); + if (theme->application_font) + { + glade_init (); + font_xml = glade_xml_new (DATA_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 ( + "application_font, + "\">", + /* translators: you may want to include non-western chars here */ + _("ABCDEFG"), + "", + NULL)); + + if (gtk_dialog_run (GTK_DIALOG(font_dialog)) == GTK_RESPONSE_OK) + apply_font = TRUE; + } + /* if installation is borked, recover and apply the font */ + else apply_font = TRUE; + } + + gnome_meta_theme_set (theme); + + if (apply_font) { client = gconf_client_get_default (); gconf_client_set_string (client, FONT_KEY, theme->application_font, NULL); } + return 0; } else return 1;