prefs: Remove titlebar font and use-system-font preferences

Specify them in CSS instead.
This commit is contained in:
Jasper St. Pierre 2012-05-03 23:21:37 -04:00
parent 2666303045
commit ecac8c9d09
3 changed files with 0 additions and 152 deletions

View File

@ -42,7 +42,6 @@
* not given a name here, because the purpose of the unified handlers
* is that keys should be referred to exactly once.
*/
#define KEY_TITLEBAR_FONT "titlebar-font"
#define KEY_NUM_WORKSPACES "num-workspaces"
#define KEY_WORKSPACE_NAMES "workspace-names"
@ -69,8 +68,6 @@ static guint changed_idle;
static GList *listeners = NULL;
static GHashTable *settings_schemas;
static gboolean use_system_font = FALSE;
static PangoFontDescription *titlebar_font = NULL;
static MetaVirtualModifier mouse_button_mods = Mod1Mask;
static GDesktopFocusMode focus_mode = G_DESKTOP_FOCUS_MODE_CLICK;
static GDesktopFocusNewWindows focus_new_windows = G_DESKTOP_FOCUS_NEW_WINDOWS_SMART;
@ -127,7 +124,6 @@ static void queue_changed (MetaPreference pref);
static void maybe_give_disable_workarounds_warning (void);
static gboolean titlebar_handler (GVariant*, gpointer*, gpointer);
static gboolean theme_name_handler (GVariant*, gpointer*, gpointer);
static gboolean mouse_button_mods_handler (GVariant*, gpointer*, gpointer);
static gboolean button_layout_handler (GVariant*, gpointer*, gpointer);
@ -266,13 +262,6 @@ static MetaBoolPreference preferences_bool[] =
},
&raise_on_click,
},
{
{ "titlebar-uses-system-font",
SCHEMA_GENERAL,
META_PREF_TITLEBAR_FONT, /* note! shares a pref */
},
&use_system_font,
},
{
{ "dynamic-workspaces",
SCHEMA_MUTTER,
@ -378,14 +367,6 @@ static MetaStringPreference preferences_string[] =
theme_name_handler,
NULL,
},
{
{ KEY_TITLEBAR_FONT,
SCHEMA_GENERAL,
META_PREF_TITLEBAR_FONT,
},
titlebar_handler,
NULL,
},
{
{ "button-layout",
SCHEMA_GENERAL,
@ -1122,45 +1103,6 @@ meta_prefs_get_cursor_size (void)
/* Handlers for string preferences. */
/****************************************************************************/
static gboolean
titlebar_handler (GVariant *value,
gpointer *result,
gpointer data)
{
PangoFontDescription *desc;
const gchar *string_value;
*result = NULL; /* ignored */
string_value = g_variant_get_string (value, NULL);
desc = pango_font_description_from_string (string_value);
if (desc == NULL)
{
meta_warning (_("Could not parse font description "
"\"%s\" from GSettings key %s\n"),
string_value ? string_value : "(null)",
KEY_TITLEBAR_FONT);
return FALSE;
}
/* Is the new description the same as the old? */
if (titlebar_font &&
pango_font_description_equal (desc, titlebar_font))
{
pango_font_description_free (desc);
}
else
{
if (titlebar_font)
pango_font_description_free (titlebar_font);
titlebar_font = desc;
queue_changed (META_PREF_TITLEBAR_FONT);
}
return TRUE;
}
static gboolean
theme_name_handler (GVariant *value,
gpointer *result,
@ -1478,15 +1420,6 @@ button_layout_handler (GVariant *value,
return TRUE;
}
const PangoFontDescription*
meta_prefs_get_titlebar_font (void)
{
if (use_system_font)
return NULL;
else
return titlebar_font;
}
int
meta_prefs_get_num_workspaces (void)
{
@ -1538,9 +1471,6 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_THEME:
return "THEME";
case META_PREF_TITLEBAR_FONT:
return "TITLEBAR_FONT";
case META_PREF_NUM_WORKSPACES:
return "NUM_WORKSPACES";

View File

@ -46,7 +46,6 @@ typedef enum
META_PREF_AUTO_RAISE,
META_PREF_AUTO_RAISE_DELAY,
META_PREF_THEME,
META_PREF_TITLEBAR_FONT,
META_PREF_NUM_WORKSPACES,
META_PREF_DYNAMIC_WORKSPACES,
META_PREF_APPLICATION_BASED,

View File

@ -86,7 +86,6 @@ static void meta_frames_ensure_layout (MetaFrames *frames,
static MetaUIFrame* meta_frames_lookup_window (MetaFrames *frames,
Window xwindow);
static void meta_frames_font_changed (MetaFrames *frames);
static void meta_frames_button_layout_changed (MetaFrames *frames);
@ -173,9 +172,6 @@ prefs_changed_callback (MetaPreference pref,
{
switch (pref)
{
case META_PREF_TITLEBAR_FONT:
meta_frames_font_changed (META_FRAMES (data));
break;
case META_PREF_BUTTON_LAYOUT:
meta_frames_button_layout_changed (META_FRAMES (data));
break;
@ -250,45 +246,6 @@ meta_frames_finalize (GObject *object)
G_OBJECT_CLASS (meta_frames_parent_class)->finalize (object);
}
static void
queue_recalc_func (gpointer key, gpointer value, gpointer data)
{
MetaUIFrame *frame;
MetaFrames *frames;
frames = META_FRAMES (data);
frame = value;
invalidate_whole_window (frames, frame);
meta_core_queue_frame_resize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
frame->xwindow);
if (frame->layout)
{
/* save title to recreate layout */
g_free (frame->title);
frame->title = g_strdup (pango_layout_get_text (frame->layout));
g_object_unref (G_OBJECT (frame->layout));
frame->layout = NULL;
}
}
static void
meta_frames_font_changed (MetaFrames *frames)
{
if (g_hash_table_size (frames->text_heights) > 0)
{
g_hash_table_destroy (frames->text_heights);
frames->text_heights = g_hash_table_new (NULL, NULL);
}
/* Queue a draw/resize on all frames */
g_hash_table_foreach (frames->frames,
queue_recalc_func, frames);
}
static void
queue_draw_func (gpointer key, gpointer value, gpointer data)
{
@ -327,8 +284,6 @@ meta_frames_style_updated (GtkWidget *widget)
frames = META_FRAMES (widget);
meta_frames_font_changed (frames);
g_hash_table_foreach (frames->frames,
reattach_style_func, frames);
@ -354,46 +309,10 @@ meta_frames_ensure_layout (MetaFrames *frames,
if (frame->layout == NULL)
{
gpointer key, value;
PangoFontDescription *font_desc;
double scale;
int size;
scale = meta_theme_get_title_scale (frame->tv->theme,
type,
flags);
frame->layout = gtk_widget_create_pango_layout (widget, frame->title);
pango_layout_set_ellipsize (frame->layout, PANGO_ELLIPSIZE_END);
pango_layout_set_auto_dir (frame->layout, FALSE);
font_desc = meta_gtk_widget_get_font_desc (widget, scale,
meta_prefs_get_titlebar_font ());
size = pango_font_description_get_size (font_desc);
if (g_hash_table_lookup_extended (frames->text_heights,
GINT_TO_POINTER (size),
&key, &value))
{
frame->text_height = GPOINTER_TO_INT (value);
}
else
{
frame->text_height =
meta_pango_font_desc_get_text_height (font_desc,
gtk_widget_get_pango_context (widget));
g_hash_table_replace (frames->text_heights,
GINT_TO_POINTER (size),
GINT_TO_POINTER (frame->text_height));
}
pango_layout_set_font_description (frame->layout,
font_desc);
pango_font_description_free (font_desc);
/* Save some RAM */
g_free (frame->title);