added GUI to ask if a font should be applied

2003-07-24  Andrew Sobala  <aes@gnome.org>

	* added GUI to ask if a font should be applied
This commit is contained in:
Andrew Sobala 2003-07-24 19:35:08 +00:00 committed by Andrew Sobala
parent e840580a1e
commit 2d9c0e2298
7 changed files with 287 additions and 5 deletions

View file

@ -1,3 +1,7 @@
2003-07-24 Andrew Sobala <aes@gnome.org>
* Added libglade to themus configure check
2003-07-17 Richard Hult <richard@imendio.com> 2003-07-17 Richard Hult <richard@imendio.com>
* typing-break/main.c (main): Remove session stuff since g-s-d * typing-break/main.c (main): Remove session stuff since g-s-d

View file

@ -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(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_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_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_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]) PKG_CHECK_MODULES(FONT_CONTEXT_MENU, [gnome-vfs-2.0 >= gnomevfs_minver libbonobo-2.0 >= libbonobo_minver])

View file

@ -1,3 +1,7 @@
2003-07-24 Andrew Sobala <aes@gnome.org>
* POTFILES.in: added vfs-methods/themus/apply-font.glade
2003-07-23 Andrew Sobala <aes@gnome.org> 2003-07-23 Andrew Sobala <aes@gnome.org>
* POTFILES.in: s/themus-component.c/themus-theme-applier.c/ * POTFILES.in: s/themus-component.c/themus-theme-applier.c/

View file

@ -1,3 +1,8 @@
2003-07-24 Andrew Sobala <aes@gnome.org>
* Makefile.am, apply-font.glade, themus-theme-applier.c:
added GUI to ask if a font should be applied
2003-07-21 Andrew Sobala <aes@gnome.org> 2003-07-21 Andrew Sobala <aes@gnome.org>
As per comments on Usability@gnome.org: As per comments on Usability@gnome.org:

View file

@ -2,7 +2,8 @@ INCLUDES = $(THEME_METHOD_CFLAGS) \
$(THEMUS_THUMBNAILER_CFLAGS) \ $(THEMUS_THUMBNAILER_CFLAGS) \
$(THEMUS_COMPONENT_CFLAGS) \ $(THEMUS_COMPONENT_CFLAGS) \
-I$(top_srcdir)/capplets/common \ -I$(top_srcdir)/capplets/common \
-DDIRECTORY_DIR=\"$(vfsdirectorydir)\" -DDIRECTORY_DIR=\"$(vfsdirectorydir)\" \
-DDATA_DIR=\"$(datadir)/themus\"
AM_CFLAGS = -g AM_CFLAGS = -g
@ -38,6 +39,8 @@ libthemus_theme_properties_view_la_SOURCES = \
themus-properties-view.h \ themus-properties-view.h \
themus-properties-main.c themus-properties-main.c
pkgdata_DATA = apply-font.glade
@INTLTOOL_DIRECTORY_RULE@ @INTLTOOL_DIRECTORY_RULE@
vfsmoduleconfdir = $(sysconfdir)/gnome-vfs-2.0/modules vfsmoduleconfdir = $(sysconfdir)/gnome-vfs-2.0/modules
@ -75,6 +78,7 @@ install-data-local:
@INTLTOOL_SCHEMAS_RULE@ @INTLTOOL_SCHEMAS_RULE@
EXTRA_DIST = \ EXTRA_DIST = \
apply-font.glade \
theme-method.directory.in \ theme-method.directory.in \
theme-method.conf \ theme-method.conf \
themus.schemas.in \ themus.schemas.in \

View file

@ -0,0 +1,233 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkDialog" id="ApplyFontAlert">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="title" translatable="yes"> </property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-6</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="stock">gtk-cancel</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">Do _not apply font</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkButton" id="button2">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Apply font</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-5</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-dialog-warning</property>
<property name="icon_size">6</property>
<property name="xalign">0.5</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;span weight=&quot;bold&quot; size=&quot;larger&quot;&gt;Apply new font?&lt;/span&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">The theme you have selected suggests a new font. A preview of the font is shown below.</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkLabel" id="font_sample">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View file

@ -24,6 +24,7 @@
#include <gnome-theme-info.h> #include <gnome-theme-info.h>
#include <gnome-theme-apply.h> #include <gnome-theme-apply.h>
#include <gconf/gconf-client.h> #include <gconf/gconf-client.h>
#include <glade/glade.h>
#include <stdlib.h> #include <stdlib.h>
@ -36,9 +37,13 @@ int main (int argc, char* argv[])
GnomeThemeMetaInfo *theme; GnomeThemeMetaInfo *theme;
GConfClient *client; GConfClient *client;
GnomeProgram *program; GnomeProgram *program;
GladeXML *font_xml;
GtkWidget *font_dialog;
GtkWidget *font_sample;
gboolean apply_font = FALSE;
poptContext ctx; poptContext ctx;
gchar **args; gchar **args;
program = gnome_program_init ("ThemeApplier", "0.3.0", LIBGNOMEUI_MODULE, argc, program = gnome_program_init ("ThemeApplier", "0.3.0", LIBGNOMEUI_MODULE, argc,
argv, GNOME_PARAM_NONE); argv, GNOME_PARAM_NONE);
@ -60,13 +65,40 @@ int main (int argc, char* argv[])
gnome_vfs_uri_unref (uri); gnome_vfs_uri_unref (uri);
g_assert (theme != NULL); g_assert (theme != NULL);
gnome_meta_theme_set (theme);
if (theme->application_font) 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 (
"<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;
}
/* 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 (); client = gconf_client_get_default ();
gconf_client_set_string (client, FONT_KEY, theme->application_font, NULL); gconf_client_set_string (client, FONT_KEY, theme->application_font, NULL);
} }
return 0; return 0;
} }
else return 1; else return 1;