port of the font capplet to gtk_font_button and some cleanup,

patch from paolo borelli <pborelli@katamail.com> (Closes: #160016).
This commit is contained in:
Sebastien Bacher 2005-05-22 15:11:44 +00:00
parent 31ba399378
commit b63d084a0f
6 changed files with 309 additions and 454 deletions

View file

@ -1,3 +1,11 @@
2005-05-22 Sebastien Bacher <seb128@debian.org>
* gconf-property-editor.c: (peditor_font_value_changed),
(peditor_font_widget_changed), (gconf_peditor_new_font):
* gconf-property-editor.h:
port of the font capplet to gtk_font_button and some cleanup,
patch from paolo borelli <pborelli@katamail.com> (Closes: #160016).
2005-05-22 Sebastien Bacher <seb128@debian.org> 2005-05-22 Sebastien Bacher <seb128@debian.org>
* theme-thumbnail.c: (create_image): fix the theme preview crasher with * theme-thumbnail.c: (create_image): fix the theme preview crasher with

View file

@ -1256,72 +1256,6 @@ gconf_value_float_to_int (GConfPropertyEditor *ignored, const GConfValue *value)
return new_value; return new_value;
} }
static gint
peditor_font_get_size (const gchar *font_str)
{
PangoFontDescription *desc;
int size;
g_return_val_if_fail (font_str != NULL, -1);
desc = pango_font_description_from_string (font_str);
size = pango_font_description_get_size (desc);
pango_font_description_free (desc);
return size / PANGO_SCALE;
}
static gchar*
peditor_font_get_name (const gchar *font_str)
{
PangoFontDescription *desc;
gchar *name;
g_return_val_if_fail (font_str != NULL, NULL);
desc = pango_font_description_from_string (font_str);
pango_font_description_unset_fields (desc, PANGO_FONT_MASK_SIZE);
name = pango_font_description_to_string (desc);
pango_font_description_free (desc);
return name;
}
static void
peditor_font_merge_setting (GnomeFontPicker *font_picker, GConfValue *value, GConfPEditorFontType font_type)
{
PangoFontDescription *desc;
gchar *font_str;
g_return_if_fail (GNOME_IS_FONT_PICKER (font_picker));
g_return_if_fail (value != NULL);
desc = pango_font_description_from_string (gnome_font_picker_get_font_name (font_picker));
if (font_type == PEDITOR_FONT_SIZE)
{
pango_font_description_set_size (desc, gconf_value_get_int (value) * PANGO_SCALE);
}
else
{
PangoFontDescription *new_desc;
new_desc = pango_font_description_from_string (gconf_value_get_string (value));
if (font_type == PEDITOR_FONT_NAME)
pango_font_description_set_size (new_desc, pango_font_description_get_size (desc));
pango_font_description_free (desc);
desc = new_desc;
}
font_str = pango_font_description_to_string (desc);
g_object_set (G_OBJECT (font_picker),
"font_name", font_str,
"label-font-size", pango_font_description_get_size (desc) / PANGO_SCALE,
NULL);
g_free (font_str);
pango_font_description_free (desc);
}
static void static void
peditor_font_value_changed (GConfClient *client, peditor_font_value_changed (GConfClient *client,
guint cnxn_id, guint cnxn_id,
@ -1329,57 +1263,36 @@ peditor_font_value_changed (GConfClient *client,
GConfPropertyEditor *peditor) GConfPropertyEditor *peditor)
{ {
GConfValue *value, *value_wid; GConfValue *value, *value_wid;
GConfPEditorFontType font_type;
if (peditor->p->changeset != NULL) if (peditor->p->changeset != NULL)
gconf_change_set_remove (peditor->p->changeset, peditor->p->key); gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
font_type = GPOINTER_TO_UINT (peditor->p->data);
value = gconf_entry_get_value (entry); value = gconf_entry_get_value (entry);
if (value != NULL) { if (value != NULL) {
const gchar *font;
value_wid = peditor->p->conv_to_widget_cb (peditor, value); value_wid = peditor->p->conv_to_widget_cb (peditor, value);
peditor_font_merge_setting (GNOME_FONT_PICKER (peditor->p->ui_control), value_wid, font_type); font = gconf_value_get_string (value_wid);
gtk_font_button_set_font_name (GTK_FONT_BUTTON (peditor->p->ui_control),
font);
gconf_value_free (value_wid); gconf_value_free (value_wid);
} }
} }
static void static void
peditor_font_widget_changed (GConfPropertyEditor *peditor, peditor_font_widget_changed (GConfPropertyEditor *peditor,
gchar *font_str, GtkFontButton *font_button)
GnomeFontPicker *font_picker)
{ {
const gchar *font_name;
GConfValue *value, *value_wid = NULL; GConfValue *value, *value_wid = NULL;
GConfPEditorFontType font_type;
gchar *font_name;
int font_size;
if (!peditor->p->inited) return; if (!peditor->p->inited)
return;
font_type = GPOINTER_TO_UINT (peditor->p->data); font_name = gtk_font_button_get_font_name (font_button);
font_size = peditor_font_get_size (font_str);
g_object_set (G_OBJECT (peditor->p->ui_control),
"label-font-size", font_size,
NULL);
switch (font_type)
{
case PEDITOR_FONT_NAME:
value_wid = gconf_value_new (GCONF_VALUE_STRING); value_wid = gconf_value_new (GCONF_VALUE_STRING);
font_name = peditor_font_get_name (font_str);
gconf_value_set_string (value_wid, font_name); gconf_value_set_string (value_wid, font_name);
g_free (font_name);
break;
case PEDITOR_FONT_SIZE:
value_wid = gconf_value_new (GCONF_VALUE_INT);
gconf_value_set_int (value_wid, font_size);
break;
case PEDITOR_FONT_COMBINED:
value_wid = gconf_value_new (GCONF_VALUE_STRING);
gconf_value_set_string (value_wid, font_str);
break;
}
value = peditor->p->conv_from_widget_cb (peditor, value_wid); value = peditor->p->conv_from_widget_cb (peditor, value_wid);
@ -1393,8 +1306,7 @@ peditor_font_widget_changed (GConfPropertyEditor *peditor,
GObject * GObject *
gconf_peditor_new_font (GConfChangeSet *changeset, gconf_peditor_new_font (GConfChangeSet *changeset,
gchar *key, gchar *key,
GtkWidget *font_picker, GtkWidget *font_button,
GConfPEditorFontType font_type,
gchar *first_property_name, gchar *first_property_name,
...) ...)
{ {
@ -1402,24 +1314,21 @@ gconf_peditor_new_font (GConfChangeSet *changeset,
va_list var_args; va_list var_args;
g_return_val_if_fail (key != NULL, NULL); g_return_val_if_fail (key != NULL, NULL);
g_return_val_if_fail (font_picker != NULL, NULL); g_return_val_if_fail (GTK_IS_FONT_BUTTON (font_button), NULL);
g_return_val_if_fail (GNOME_IS_FONT_PICKER (font_picker), NULL);
va_start (var_args, first_property_name); va_start (var_args, first_property_name);
peditor = gconf_peditor_new peditor = gconf_peditor_new (key,
(key,
(GConfClientNotifyFunc) peditor_font_value_changed, (GConfClientNotifyFunc) peditor_font_value_changed,
changeset, changeset,
G_OBJECT (font_picker), G_OBJECT (font_button),
first_property_name, first_property_name,
var_args, var_args,
"data", GUINT_TO_POINTER (font_type),
NULL); NULL);
va_end (var_args); va_end (var_args);
g_signal_connect_swapped (G_OBJECT (font_picker), "font_set", g_signal_connect_swapped (font_button, "font_set",
(GCallback) peditor_font_widget_changed, peditor); (GCallback) peditor_font_widget_changed, peditor);
return peditor; return peditor;

View file

@ -41,13 +41,6 @@ typedef struct _GConfPropertyEditorPrivate GConfPropertyEditorPrivate;
typedef GConfValue *(*GConfPEditorValueConvFn) (GConfPropertyEditor *peditor, const GConfValue *); typedef GConfValue *(*GConfPEditorValueConvFn) (GConfPropertyEditor *peditor, const GConfValue *);
typedef int (*GConfPEditorGetValueFn) (GConfPropertyEditor *peditor, gpointer data); typedef int (*GConfPEditorGetValueFn) (GConfPropertyEditor *peditor, gpointer data);
typedef enum
{
PEDITOR_FONT_NAME,
PEDITOR_FONT_SIZE,
PEDITOR_FONT_COMBINED
} GConfPEditorFontType;
struct _GConfPropertyEditor struct _GConfPropertyEditor
{ {
GObject parent; GObject parent;
@ -142,8 +135,7 @@ GObject *gconf_peditor_new_numeric_range (GConfChangeSet *changeset,
GObject *gconf_peditor_new_font (GConfChangeSet *changeset, GObject *gconf_peditor_new_font (GConfChangeSet *changeset,
gchar *key, gchar *key,
GtkWidget *font_picker, GtkWidget *font_button,
GConfPEditorFontType font_type,
gchar *first_property_name, gchar *first_property_name,
...); ...);

View file

@ -1,3 +1,11 @@
2005-05-22 Sebastien Bacher <seb128@debian.org>
* font-properties.glade:
* main.c: (application_font_to_gconf), (application_font_changed),
(setup_dialog), (cb_show_details), (main):
port of the font capplet to gtk_font_button and some cleanup,
patch from paolo borelli <pborelli@katamail.com> (Closes: #160016).
2005-01-02 Sebastien Bacher <seb128@debian.org> 2005-01-02 Sebastien Bacher <seb128@debian.org>
* font-properties.glade: * font-properties.glade:

View file

@ -12,6 +12,11 @@
<property name="modal">False</property> <property name="modal">False</property>
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="destroy_with_parent">False</property> <property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property> <property name="has_separator">False</property>
<child internal-child="vbox"> <child internal-child="vbox">
@ -33,6 +38,7 @@
<property name="label">gtk-help</property> <property name="label">gtk-help</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property> <property name="response_id">-11</property>
</widget> </widget>
</child> </child>
@ -45,6 +51,7 @@
<property name="label">gtk-close</property> <property name="label">gtk-close</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-7</property> <property name="response_id">-7</property>
</widget> </widget>
</child> </child>
@ -98,25 +105,6 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GnomeFontPicker" id="application_font">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Set the font for applications</property>
<property name="can_focus">True</property>
<property name="mode">GNOME_FONT_PICKER_MODE_FONT_INFO</property>
<property name="show_size">True</property>
<property name="use_font_in_label">True</property>
<property name="label_font_size">14</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options">fill</property>
</packing>
</child>
<child> <child>
<widget class="GtkLabel" id="label6"> <widget class="GtkLabel" id="label6">
<property name="visible">True</property> <property name="visible">True</property>
@ -142,26 +130,6 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GnomeFontPicker" id="desktop_font">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Set the font for the icons on the desktop</property>
<property name="can_focus">True</property>
<property name="mode">GNOME_FONT_PICKER_MODE_FONT_INFO</property>
<property name="show_size">True</property>
<property name="use_font_in_label">True</property>
<property name="label_font_size">14</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<widget class="GtkLabel" id="label12"> <widget class="GtkLabel" id="label12">
<property name="visible">True</property> <property name="visible">True</property>
@ -187,25 +155,6 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GnomeFontPicker" id="window_title_font">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="mode">GNOME_FONT_PICKER_MODE_FONT_INFO</property>
<property name="show_size">True</property>
<property name="use_font_in_label">True</property>
<property name="label_font_size">14</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<widget class="GtkLabel" id="label13"> <widget class="GtkLabel" id="label13">
<property name="visible">True</property> <property name="visible">True</property>
@ -232,21 +181,77 @@
</child> </child>
<child> <child>
<widget class="GnomeFontPicker" id="monospace_font"> <widget class="GtkFontButton" id="application_font">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">Set the monospace font for terminals and similar applications</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="mode">GNOME_FONT_PICKER_MODE_FONT_INFO</property> <property name="show_style">True</property>
<property name="show_size">True</property> <property name="show_size">True</property>
<property name="use_font_in_label">True</property> <property name="use_font">True</property>
<property name="label_font_size">14</property> <property name="use_size">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkFontButton" id="desktop_font">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_style">True</property>
<property name="show_size">True</property>
<property name="use_font">True</property>
<property name="use_size">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkFontButton" id="window_title_font">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_style">True</property>
<property name="show_size">True</property>
<property name="use_font">True</property>
<property name="use_size">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkFontButton" id="monospace_font">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_style">True</property>
<property name="show_size">True</property>
<property name="use_font">True</property>
<property name="use_size">False</property>
<property name="focus_on_click">True</property>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">3</property> <property name="top_attach">3</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
@ -334,6 +339,7 @@
<property name="label" translatable="yes">_Monochrome</property> <property name="label" translatable="yes">_Monochrome</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -352,6 +358,10 @@
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xscale">1</property> <property name="xscale">1</property>
<property name="yscale">1</property> <property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkDrawingArea" id="monochrome_sample"> <widget class="GtkDrawingArea" id="monochrome_sample">
@ -381,6 +391,10 @@
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xscale">0</property> <property name="xscale">0</property>
<property name="yscale">1</property> <property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkButton" id="details_button"> <widget class="GtkButton" id="details_button">
@ -389,6 +403,7 @@
<property name="label" translatable="yes">D_etails...</property> <property name="label" translatable="yes">D_etails...</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget> </widget>
</child> </child>
</widget> </widget>
@ -415,6 +430,7 @@
<property name="label" translatable="yes">Best _shapes</property> <property name="label" translatable="yes">Best _shapes</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -434,6 +450,10 @@
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xscale">1</property> <property name="xscale">1</property>
<property name="yscale">1</property> <property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkDrawingArea" id="best_shapes_sample"> <widget class="GtkDrawingArea" id="best_shapes_sample">
@ -469,6 +489,7 @@
<property name="label" translatable="yes">Best co_ntrast</property> <property name="label" translatable="yes">Best co_ntrast</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -488,6 +509,10 @@
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xscale">1</property> <property name="xscale">1</property>
<property name="yscale">1</property> <property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkDrawingArea" id="best_contrast_sample"> <widget class="GtkDrawingArea" id="best_contrast_sample">
@ -523,6 +548,7 @@
<property name="label" translatable="yes">Sub_pixel smoothing (LCDs)</property> <property name="label" translatable="yes">Sub_pixel smoothing (LCDs)</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -542,6 +568,10 @@
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xscale">1</property> <property name="xscale">1</property>
<property name="yscale">1</property> <property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkDrawingArea" id="subpixel_sample"> <widget class="GtkDrawingArea" id="subpixel_sample">
@ -603,6 +633,11 @@
<property name="modal">False</property> <property name="modal">False</property>
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="destroy_with_parent">False</property> <property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property> <property name="has_separator">False</property>
<child internal-child="vbox"> <child internal-child="vbox">
@ -624,6 +659,7 @@
<property name="label">gtk-help</property> <property name="label">gtk-help</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property> <property name="response_id">-11</property>
</widget> </widget>
</child> </child>
@ -636,6 +672,7 @@
<property name="label" translatable="yes">Go _to font folder</property> <property name="label" translatable="yes">Go _to font folder</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">1</property> <property name="response_id">1</property>
</widget> </widget>
</child> </child>
@ -648,6 +685,7 @@
<property name="label">gtk-close</property> <property name="label">gtk-close</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-7</property> <property name="response_id">-7</property>
</widget> </widget>
</child> </child>
@ -674,6 +712,10 @@
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xscale">0</property> <property name="xscale">0</property>
<property name="yscale">1</property> <property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkHBox" id="hbox1"> <widget class="GtkHBox" id="hbox1">
@ -801,6 +843,7 @@
<property name="label" translatable="yes">_None</property> <property name="label" translatable="yes">_None</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -820,6 +863,10 @@
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xscale">1</property> <property name="xscale">1</property>
<property name="yscale">1</property> <property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkDrawingArea" id="antialias_none_sample"> <widget class="GtkDrawingArea" id="antialias_none_sample">
@ -856,6 +903,7 @@
<property name="label" translatable="yes">Gra_yscale</property> <property name="label" translatable="yes">Gra_yscale</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -876,6 +924,10 @@
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xscale">1</property> <property name="xscale">1</property>
<property name="yscale">1</property> <property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkDrawingArea" id="antialias_grayscale_sample"> <widget class="GtkDrawingArea" id="antialias_grayscale_sample">
@ -912,6 +964,7 @@
<property name="label" translatable="yes">Sub_pixel (LCDs)</property> <property name="label" translatable="yes">Sub_pixel (LCDs)</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -932,6 +985,10 @@
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xscale">1</property> <property name="xscale">1</property>
<property name="yscale">1</property> <property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkDrawingArea" id="antialias_subpixel_sample"> <widget class="GtkDrawingArea" id="antialias_subpixel_sample">
@ -1018,6 +1075,7 @@
<property name="label" translatable="yes">N_one</property> <property name="label" translatable="yes">N_one</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -1037,6 +1095,10 @@
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xscale">1</property> <property name="xscale">1</property>
<property name="yscale">1</property> <property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkDrawingArea" id="hint_none_sample"> <widget class="GtkDrawingArea" id="hint_none_sample">
@ -1072,6 +1134,7 @@
<property name="label" translatable="yes">_Slight</property> <property name="label" translatable="yes">_Slight</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -1092,6 +1155,10 @@
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xscale">1</property> <property name="xscale">1</property>
<property name="yscale">1</property> <property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkDrawingArea" id="hint_slight_sample"> <widget class="GtkDrawingArea" id="hint_slight_sample">
@ -1128,6 +1195,7 @@
<property name="label" translatable="yes">_Medium</property> <property name="label" translatable="yes">_Medium</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -1148,6 +1216,10 @@
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xscale">1</property> <property name="xscale">1</property>
<property name="yscale">1</property> <property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkDrawingArea" id="hint_medium_sample"> <widget class="GtkDrawingArea" id="hint_medium_sample">
@ -1184,6 +1256,7 @@
<property name="label" translatable="yes">_Full</property> <property name="label" translatable="yes">_Full</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -1204,6 +1277,10 @@
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xscale">1</property> <property name="xscale">1</property>
<property name="yscale">1</property> <property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkDrawingArea" id="hint_full_sample"> <widget class="GtkDrawingArea" id="hint_full_sample">
@ -1291,6 +1368,7 @@
<property name="label" translatable="yes">_RGB</property> <property name="label" translatable="yes">_RGB</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -1338,6 +1416,7 @@
<property name="label" translatable="yes">_BGR</property> <property name="label" translatable="yes">_BGR</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -1387,6 +1466,7 @@
<property name="label" translatable="yes">_VRGB</property> <property name="label" translatable="yes">_VRGB</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -1436,6 +1516,7 @@
<property name="label" translatable="yes">VB_GR</property> <property name="label" translatable="yes">VB_GR</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -1497,166 +1578,4 @@
</child> </child>
</widget> </widget>
<widget class="GtkDialog" id="font_size_warning_dialog">
<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">True</property>
<property name="destroy_with_parent">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button4">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button5">
<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">1</property>
<child>
<widget class="GtkAlignment" id="alignment14">
<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="hbox7">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-ok</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="label15">
<property name="visible">True</property>
<property name="label" translatable="yes">_Use 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>
</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="hbox8">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
<widget class="GtkImage" id="image2">
<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">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="font_size_warning_label">
<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">True</property>
<property name="selectable">False</property>
<property name="xalign">0</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">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> </glade-interface>

View file

@ -46,16 +46,6 @@ static gchar *old_font = NULL;
#define MAX_FONT_POINT_WITHOUT_WARNING 32 #define MAX_FONT_POINT_WITHOUT_WARNING 32
#define MAX_FONT_SIZE_WITHOUT_WARNING MAX_FONT_POINT_WITHOUT_WARNING*1024 #define MAX_FONT_SIZE_WITHOUT_WARNING MAX_FONT_POINT_WITHOUT_WARNING*1024
#define PICKER_DIALOG_DATA_STRING "picker-dialog-data-string"
static GladeXML *
create_dialog (void)
{
GladeXML *dialog;
dialog = glade_xml_new (GLADEDIR "/font-properties.glade", "font_dialog", NULL);
return dialog;
}
static void static void
cb_dialog_response (GtkDialog *dialog, gint response_id) cb_dialog_response (GtkDialog *dialog, gint response_id)
@ -447,8 +437,6 @@ metacity_changed (GConfClient *client,
metacity_titlebar_load_sensitivity (client, user_data); metacity_titlebar_load_sensitivity (client, user_data);
} }
/* returns 0 if the font is safe, otherwise returns the size in points. */ /* returns 0 if the font is safe, otherwise returns the size in points. */
static gint static gint
new_font_dangerous (const char *new_font) new_font_dangerous (const char *new_font)
@ -477,14 +465,11 @@ application_font_to_gconf (GConfPropertyEditor *peditor,
{ {
GConfValue *new_value; GConfValue *new_value;
const char *new_font; const char *new_font;
GtkWidget *font_picker; GtkWidget *font_button;
GladeXML *dialog;
gint danger_level; gint danger_level;
font_picker = (GtkWidget *) gconf_property_editor_get_ui_control (peditor); font_button = GTK_WIDGET (gconf_property_editor_get_ui_control (peditor));
g_assert (font_picker); g_return_val_if_fail (font_button != NULL, NULL);
dialog = glade_xml_new (GLADEDIR "/font-properties.glade", "font_size_warning_dialog", NULL);
new_value = gconf_value_new (GCONF_VALUE_STRING); new_value = gconf_value_new (GCONF_VALUE_STRING);
new_font = gconf_value_get_string (value); new_font = gconf_value_get_string (value);
@ -496,34 +481,58 @@ application_font_to_gconf (GConfPropertyEditor *peditor,
danger_level = new_font_dangerous (new_font); danger_level = new_font_dangerous (new_font);
if (danger_level) { if (danger_level) {
GtkWidget *font_size_warning_dialog; GtkWidget *warning_dialog;
gchar *warning_label; gchar *warning_label;
gchar *warning_label2; gchar *warning_label2;
font_size_warning_dialog = WID ("font_size_warning_dialog"); warning_label = g_strdup (_("Font may be too large"));
if (danger_level > MAX_FONT_POINT_WITHOUT_WARNING) { if (danger_level > MAX_FONT_POINT_WITHOUT_WARNING) {
warning_label = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", warning_label2 = g_strdup_printf (ngettext (
_("Font may be too large"), "The font selected is %d point large, "
ngettext ("The font selected is %d point large, and may make it difficult to effectively use the computer. It is recommended that you select a size smaller than %d.", "and may make it difficult to effectively "
"The font selected is %d points large, and may make it difficult to effectively use the computer. It is recommended that you select a size smaller than %d.", "use the computer. It is recommended that "
danger_level)); "you select a size smaller than %d.",
warning_label2 = g_strdup_printf (warning_label, danger_level, MAX_FONT_POINT_WITHOUT_WARNING); "The font selected is %d points large, "
"and may make it difficult to effectively "
"use the computer. It is recommended that "
"you select a size smaller than %d.",
danger_level),
danger_level,
MAX_FONT_POINT_WITHOUT_WARNING);
} else { } else {
warning_label = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", warning_label2 = g_strdup_printf (ngettext (
_("Font may be too large"), "The font selected is %d point large, "
ngettext ("The font selected is %d point large, and may make it difficult to effectively use the computer. It is recommended that you select a smaller sized font.", "and may make it difficult to effectively "
"The font selected is %d points large, and may make it difficult to effectively use the computer. It is recommended that you select a smaller sized font.", "use the computer. It is recommended that "
danger_level)); "you select a smaller sized font.",
warning_label2 = g_strdup_printf (warning_label, danger_level); "The font selected is %d points large, "
"and may make it difficult to effectively "
"use the computer. It is recommended that "
"you select a smaller sized font.",
danger_level),
danger_level);
} }
gtk_label_set_markup (GTK_LABEL (WID ("font_size_warning_label")), warning_label2);
if (gtk_dialog_run (GTK_DIALOG (font_size_warning_dialog)) == 1) { warning_dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK_CANCEL,
warning_label);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (warning_dialog),
warning_label2);
g_free (warning_label);
g_free (warning_label2);
if (gtk_dialog_run (GTK_DIALOG (warning_dialog)) == GTK_RESPONSE_OK) {
gconf_value_set_string (new_value, new_font); gconf_value_set_string (new_value, new_font);
} else { } else {
gconf_value_set_string (new_value, old_font); gconf_value_set_string (new_value, old_font);
gnome_font_picker_set_font_name (GNOME_FONT_PICKER (font_picker), old_font); gtk_font_button_set_font_name (GTK_FONT_BUTTON (font_button), old_font);
} }
gtk_widget_destroy (font_size_warning_dialog);
gtk_widget_destroy (warning_dialog);
} else { } else {
gconf_value_set_string (new_value, new_font); gconf_value_set_string (new_value, new_font);
} }
@ -532,22 +541,29 @@ application_font_to_gconf (GConfPropertyEditor *peditor,
} }
static void static void
application_font_changed (GtkWidget *font_picker) application_font_changed (GtkWidget *font_button)
{ {
const gchar *font; const gchar *font;
font = gnome_font_picker_get_font_name (GNOME_FONT_PICKER (font_picker)); font = gtk_font_button_get_font_name (GTK_FONT_BUTTON (font_button));
g_free (old_font); g_free (old_font);
old_font = g_strdup (font); old_font = g_strdup (font);
} }
static void static void
setup_dialog (GladeXML *dialog) setup_dialog (void)
{ {
GladeXML *dialog;
GConfClient *client; GConfClient *client;
GtkWidget *widget; GtkWidget *widget;
GObject *peditor; GObject *peditor;
dialog = glade_xml_new (GLADEDIR "/font-properties.glade", "font_dialog", NULL);
if (!dialog) {
g_warning ("could not load font-properties.glade");
return;
}
client = gconf_client_get_default (); client = gconf_client_get_default ();
gconf_client_add_dir (client, "/desktop/gnome/interface", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); gconf_client_add_dir (client, "/desktop/gnome/interface", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
@ -557,25 +573,25 @@ setup_dialog (GladeXML *dialog)
gconf_client_add_dir (client, FONT_RENDER_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); gconf_client_add_dir (client, FONT_RENDER_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
#endif /* HAVE_XFT2 */ #endif /* HAVE_XFT2 */
g_object_set_data (G_OBJECT (WID ("application_font")), PICKER_DIALOG_DATA_STRING, dialog);
peditor = gconf_peditor_new_font (NULL, GTK_FONT_KEY, peditor = gconf_peditor_new_font (NULL, GTK_FONT_KEY,
WID ("application_font"), WID ("application_font"),
PEDITOR_FONT_COMBINED,
"conv-from-widget-cb", application_font_to_gconf, "conv-from-widget-cb", application_font_to_gconf,
NULL); NULL);
g_signal_connect_swapped (G_OBJECT (peditor), "value-changed", (GCallback) application_font_changed, WID ("application_font")); g_signal_connect_swapped (peditor, "value-changed",
G_CALLBACK (application_font_changed), WID ("application_font"));
application_font_changed (WID ("application_font")); application_font_changed (WID ("application_font"));
peditor = gconf_peditor_new_font (NULL, DESKTOP_FONT_KEY, peditor = gconf_peditor_new_font (NULL, DESKTOP_FONT_KEY,
WID ("desktop_font"), WID ("desktop_font"),
PEDITOR_FONT_COMBINED, NULL); NULL);
peditor = gconf_peditor_new_font (NULL, WINDOW_TITLE_FONT_KEY, peditor = gconf_peditor_new_font (NULL, WINDOW_TITLE_FONT_KEY,
WID ("window_title_font"), WID ("window_title_font"),
PEDITOR_FONT_COMBINED, NULL); NULL);
peditor = gconf_peditor_new_font (NULL, MONOSPACE_FONT_KEY, peditor = gconf_peditor_new_font (NULL, MONOSPACE_FONT_KEY,
WID ("monospace_font"), WID ("monospace_font"),
PEDITOR_FONT_COMBINED, NULL); NULL);
gconf_client_notify_add (client, METACITY_DIR, gconf_client_notify_add (client, METACITY_DIR,
metacity_changed, metacity_changed,
@ -598,19 +614,18 @@ setup_dialog (GladeXML *dialog)
font_render_changed, font_render_changed,
NULL, NULL, NULL); NULL, NULL, NULL);
g_signal_connect (WID ("details_button"), g_signal_connect (WID ("details_button"), "clicked",
"clicked",
G_CALLBACK (cb_show_details), widget); G_CALLBACK (cb_show_details), widget);
#else /* !HAVE_XFT2 */ #else /* !HAVE_XFT2 */
gtk_widget_hide (WID ("font_render_frame")); gtk_widget_hide (WID ("font_render_frame"));
#endif /* HAVE_XFT2 */ #endif /* HAVE_XFT2 */
g_signal_connect (G_OBJECT (widget), g_signal_connect (widget, "response",
"response",
G_CALLBACK (cb_dialog_response), NULL); G_CALLBACK (cb_dialog_response), NULL);
gtk_widget_show (widget); gtk_widget_show (widget);
g_object_unref (dialog);
g_object_unref (client); g_object_unref (client);
} }
@ -808,12 +823,18 @@ cb_show_details (GtkWidget *button,
if (!details_dialog) { if (!details_dialog) {
GConfClient *client = gconf_client_get_default (); GConfClient *client = gconf_client_get_default ();
GladeXML *dialog = glade_xml_new (GLADEDIR "/font-properties.glade", "render_details", NULL); GladeXML *dialog;
GtkWidget *dpi_spinner; GtkWidget *dpi_spinner;
GnomeVFSURI *uri; GnomeVFSURI *uri;
int dpi; int dpi;
GtkAdjustment *adjustment; GtkAdjustment *adjustment;
dialog = glade_xml_new (GLADEDIR "/font-properties.glade", "render_details", NULL);
if (!dialog) {
g_warning ("could not load font-properties.glade");
return;
}
details_dialog = WID ("render_details"); details_dialog = WID ("render_details");
uri = gnome_vfs_uri_new ("fonts:///"); uri = gnome_vfs_uri_new ("fonts:///");
if (uri == NULL) { if (uri == NULL) {
@ -888,6 +909,7 @@ cb_show_details (GtkWidget *button,
"delete_event", "delete_event",
G_CALLBACK (gtk_true), NULL); G_CALLBACK (gtk_true), NULL);
g_object_unref (dialog);
g_object_unref (client); g_object_unref (client);
} }
@ -898,8 +920,6 @@ cb_show_details (GtkWidget *button,
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
GladeXML *dialog;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE); textdomain (GETTEXT_PACKAGE);
@ -911,8 +931,7 @@ main (int argc, char *argv[])
activate_settings_daemon (); activate_settings_daemon ();
dialog = create_dialog (); setup_dialog ();
setup_dialog (dialog);
gtk_main (); gtk_main ();