[anjuta] sourceview: Fix bgo#701443 - When trying to change font of GtkSourceView Anjuta crashes
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] sourceview: Fix bgo#701443 - When trying to change font of GtkSourceView Anjuta crashes
- Date: Mon, 3 Jun 2013 17:32:00 +0000 (UTC)
commit 67cc4681ffcce8e5f2fc01d89c4927352a52d482
Author: Johannes Schmid <jhs gnome org>
Date: Mon Jun 3 19:31:17 2013 +0200
sourceview: Fix bgo#701443 - When trying to change font of GtkSourceView Anjuta crashes
plugins/sourceview/plugin.c | 2 +-
plugins/sourceview/sourceview-prefs.c | 50 +++++++-------------------------
2 files changed, 12 insertions(+), 40 deletions(-)
---
diff --git a/plugins/sourceview/plugin.c b/plugins/sourceview/plugin.c
index f1c90e1..efb71b6 100644
--- a/plugins/sourceview/plugin.c
+++ b/plugins/sourceview/plugin.c
@@ -366,7 +366,7 @@ ipreferences_merge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError**
plugin->check_font = GTK_WIDGET (gtk_builder_get_object (builder,
FONT_USE_THEME_BUTTON));
g_signal_connect(G_OBJECT(plugin->check_font), "toggled",
- G_CALLBACK(on_font_check_toggled), builder);
+ G_CALLBACK(on_font_check_toggled), plugin);
on_font_check_toggled (GTK_TOGGLE_BUTTON (plugin->check_font), plugin);
/* Init styles combo */
diff --git a/plugins/sourceview/sourceview-prefs.c b/plugins/sourceview/sourceview-prefs.c
index 1c4da58..d9cfec7 100644
--- a/plugins/sourceview/sourceview-prefs.c
+++ b/plugins/sourceview/sourceview-prefs.c
@@ -46,7 +46,8 @@
#define FONT_THEME "font-use-theme"
#define FONT "font"
-#define DESKTOP_FIXED_FONT "/desktop/gnome/interface/monospace_font_name"
+#define FONT_SCHEMA "org.gnome.desktop.interface"
+#define GNOME_DOCUMENT_FONT "document-font-name"
static void
on_notify_view_spaces (GSettings* settings,
@@ -173,18 +174,16 @@ on_notify_font_theme (GSettings* settings,
if (g_settings_get_boolean (settings, key))
{
- /* FIXME: GSettings */
-#if 0
- GConfClient *gclient = gconf_client_get_default ();
- gchar *desktop_fixed_font;
- desktop_fixed_font =
- gconf_client_get_string (gclient, DESKTOP_FIXED_FONT, NULL);
- if (desktop_fixed_font)
- anjuta_view_set_font(sv->priv->view, FALSE, desktop_fixed_font);
+ GSettings* font_settings = g_settings_new (FONT_SCHEMA);
+ gchar* desktop_font = g_settings_get_string (font_settings,
+ GNOME_DOCUMENT_FONT);
+
+ if (desktop_font)
+ anjuta_view_set_font(sv->priv->view, FALSE, desktop_font);
else
anjuta_view_set_font(sv->priv->view, TRUE, NULL);
- g_free (desktop_fixed_font);
-#endif
+ g_free (desktop_font);
+ g_object_unref (font_settings);
}
else
{
@@ -223,34 +222,7 @@ on_notify_indic_colors (GSettings* settings,
static void
init_fonts(Sourceview* sv)
{
- gboolean font_theme;
-
- font_theme = FALSE; //g_settings_get_boolean (sv->priv->settings, FONT_THEME);
-
- if (!font_theme)
- {
- gchar* font = g_settings_get_string (sv->priv->settings, FONT);
- anjuta_view_set_font(sv->priv->view, FALSE, font);
- g_free (font);
- }
-#if 0
- else
- {
- /* FIXME: Get font from GSettings */
- GConfClient *gclient;
- gchar *desktop_fixed_font;
-
- gclient = gconf_client_get_default ();
- desktop_fixed_font =
- gconf_client_get_string (gclient, DESKTOP_FIXED_FONT, NULL);
- if (desktop_fixed_font)
- anjuta_view_set_font(sv->priv->view, FALSE, desktop_fixed_font);
- else
- anjuta_view_set_font(sv->priv->view, TRUE, NULL);
- g_free (desktop_fixed_font);
- g_object_unref (gclient);
- }
-#endif
+ on_notify_font_theme (sv->priv->settings, FONT_THEME, sv);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]