~ubuntu-branches/ubuntu/utopic/gconf/utopic

« back to all changes in this revision

Viewing changes to gconf/gconfd.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2011-11-01 08:48:09 UTC
  • mfrom: (1.2.1) (76.1.1 oneiric-proposed)
  • Revision ID: package-import@ubuntu.com-20111101084809-f6skp1hyp3gni1ru
Tags: 3.2.3-0ubuntu1
* New upstream release.
  - Fixes gconf crasher regression in 3.2.2 (LP: #882525)

Show diffs side-by-side

added added

removed removed

Lines of Context:
149
149
 
150
150
static void                 init_databases (void);
151
151
static void                 shutdown_databases (void);
 
152
#ifdef HAVE_DBUS
 
153
static void                 reload_databases (void);
 
154
#endif
152
155
static void                 set_default_database (GConfDatabase* db);
153
156
static void                 register_database (GConfDatabase* db);
154
157
static void                 unregister_database (GConfDatabase* db);
353
356
 
354
357
/* This needs to be called before we register with OAF
355
358
 */
356
 
static void
357
 
gconf_server_load_sources(void)
 
359
static GConfSources *
 
360
gconf_server_get_default_sources(void)
358
361
{
359
362
  GSList* addresses;
360
363
  GList* tmp;
406
409
      /* don't request error since there aren't any addresses */
407
410
      sources = gconf_sources_new_from_addresses(NULL, NULL);
408
411
 
409
 
      /* Install the sources as the default database */
410
 
      set_default_database (gconf_database_new(sources));
 
412
      return sources;
411
413
    }
412
414
  else
413
415
    {
446
448
      if (!have_writable)
447
449
        gconf_log(GCL_WARNING, _("No writable configuration sources successfully resolved. May be unable to save some configuration changes"));
448
450
 
449
 
        
450
 
      /* Install the sources as the default database */
451
 
      set_default_database (gconf_database_new(sources));
 
451
      return sources;
452
452
    }
453
453
}
454
454
 
 
455
static void
 
456
gconf_server_load_sources(void)
 
457
{
 
458
  GConfSources* sources;
 
459
 
 
460
  sources = gconf_server_get_default_sources();
 
461
 
 
462
  /* Install the sources as the default database */
 
463
  set_default_database (gconf_database_new(sources));
 
464
}
 
465
 
455
466
/*
456
467
 * Signal handlers should not log debug messages as this code is non-reentrant.
457
468
 * Please avoid calling gconf_log in this function.
1030
1041
      need_db_reload = FALSE;
1031
1042
#ifdef HAVE_CORBA
1032
1043
      logfile_save ();
1033
 
#endif
1034
1044
      shutdown_databases ();
1035
1045
      init_databases ();
1036
1046
      gconf_server_load_sources ();
1037
 
#ifdef HAVE_CORBA
1038
1047
      logfile_read ();
1039
1048
#endif
 
1049
#ifdef HAVE_DBUS
 
1050
      reload_databases ();
 
1051
#endif
1040
1052
    }
1041
1053
  
1042
1054
  gconf_log (GCL_DEBUG, "Performing periodic cleanup, expiring cache cruft");
1268
1280
      
1269
1281
      if (db->listeners &&                             /* not already hibernating */
1270
1282
          gconf_listeners_count(db->listeners) == 0 && /* Can hibernate */
 
1283
#ifdef HAVE_DBUS
 
1284
          db->listening_clients &&
 
1285
          g_hash_table_size (db->listening_clients) == 0 &&
 
1286
#endif
1271
1287
          (now - db->last_access) > (60*20))           /* 20 minutes without access */
1272
1288
        {
1273
1289
          dead = g_list_prepend (dead, db);
1319
1335
  default_db = NULL;
1320
1336
}
1321
1337
 
 
1338
#ifdef HAVE_DBUS
 
1339
static void
 
1340
reload_databases (void)
 
1341
{
 
1342
  GConfSources* sources;
 
1343
  GList *tmp_list;
 
1344
 
 
1345
  sources = gconf_server_get_default_sources ();
 
1346
  gconf_database_set_sources (default_db, sources);
 
1347
 
 
1348
  tmp_list = db_list;
 
1349
  while (tmp_list)
 
1350
    {
 
1351
      GConfDatabase* db = tmp_list->data;
 
1352
      GList *l;
 
1353
      GConfSource *source;
 
1354
      GSList *addresses = NULL;
 
1355
      GError *error = NULL;
 
1356
 
 
1357
      if (db == default_db)
 
1358
        {
 
1359
          tmp_list = g_list_next (tmp_list);
 
1360
          continue;
 
1361
        }
 
1362
 
 
1363
      for (l = db->sources->sources; l != NULL; l = l->next)
 
1364
        {
 
1365
          source = l->data;
 
1366
          addresses = g_slist_prepend (addresses, source->address);
 
1367
        }
 
1368
 
 
1369
      addresses = g_slist_reverse (addresses);
 
1370
      sources = gconf_sources_new_from_addresses (addresses, &error);
 
1371
 
 
1372
      if (error == NULL)
 
1373
        {
 
1374
          gconf_database_set_sources (db, sources);
 
1375
        }
 
1376
      else
 
1377
        {
 
1378
          /* if we got an error, keep our old sources -- that's better than
 
1379
           * nothing */
 
1380
          g_error_free (error);
 
1381
        }
 
1382
 
 
1383
      tmp_list = g_list_next (tmp_list);
 
1384
    }
 
1385
}
 
1386
#endif
 
1387
 
1322
1388
static gboolean
1323
1389
no_databases_in_use (void)
1324
1390
{