cleanup
[platform/upstream/glib.git] / gio / gsettings-tool.c
index 451dcf1..cf3ef19 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Ryan Lortie <desrt@desrt.ca>
  */
@@ -410,6 +408,8 @@ value_changed (GSettings   *settings,
 static void
 gsettings_monitor (void)
 {
+  gchar **keys;
+
   if (global_key)
     {
       gchar *name;
@@ -420,6 +420,17 @@ gsettings_monitor (void)
   else
     g_signal_connect (global_settings, "changed", G_CALLBACK (value_changed), NULL);
 
+  /* We have to read a value from GSettings before we start receiving
+   * signals...
+   *
+   * If the schema has zero keys then we won't be displaying any
+   * notifications anyway.
+   */
+  keys = g_settings_list_keys (global_settings);
+  if (keys[0])
+    g_variant_unref (g_settings_get_value (global_settings, keys[0]));
+  g_strfreev (keys);
+
   for (;;)
     g_main_context_iteration (NULL, TRUE);
 }