[gnome-utils/gsettings-tutorial: 8/22] [gsettings-tutorial] Initialize subfolders tooltip visibility



commit a0f01e1d10df647d0b7ecd75340971c154d3df35
Author: Vincent Untz <vuntz gnome org>
Date:   Fri Apr 16 15:23:41 2010 -0400

    [gsettings-tutorial] Initialize subfolders tooltip visibility
    
    Instead of using gconf to get the value of this key, we use the
    GSettings API.
    
    It would have been easier to use g_settings_bind(), but the
    BaobabRingschart object doesn't have a real property for tooltip
    visibility. We can see here that implementing properties properly in
    objects makes the use of GSettings easier (even though this is still
    relatively easy).
    
    A few notes:
    
      + We're using an accessor here: g_settings_get_boolean(). It would
        have been possible to use g_settings_get() directly:
          g_settings_get (settings, key, "b", &variable);

 baobab/src/baobab.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/baobab/src/baobab.c b/baobab/src/baobab.c
index c67e5e0..69a3f78 100644
--- a/baobab/src/baobab.c
+++ b/baobab/src/baobab.c
@@ -952,6 +952,7 @@ initialize_charts (void)
 	GtkWidget *hpaned_main;
 	GtkWidget *chart_frame;
 	GtkWidget *hbox1;
+	gboolean   visible;
 
 	chart_frame = gtk_frame_new (NULL);
 	gtk_frame_set_label_align (GTK_FRAME (chart_frame), 0.0, 0.0);
@@ -1012,10 +1013,9 @@ initialize_charts (void)
 					     COL_H_PERC,
 					     COL_H_ELEMENTS,
 					     NULL);
-	baobab_ringschart_set_subfoldertips_enabled (baobab.rings_chart,
-						     gconf_client_get_bool (baobab.gconf_client,
-									    BAOBAB_SUBFLSTIPS_VISIBLE_KEY,
-									    NULL));
+	visible = g_settings_get_boolean (baobab.settings_ui,
+					  "baobab_subfoldertips_visible");
+	baobab_ringschart_set_subfoldertips_enabled (baobab.rings_chart, visible);
 	baobab_chart_set_max_depth (baobab.rings_chart, 1);
 	g_signal_connect (baobab.rings_chart, "item_activated",
 					G_CALLBACK (on_chart_item_activated), NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]