void msd_ldsm_setup (gboolean check_now) { if (ldsm_notified_hash || ldsm_timeout_id || ldsm_monitor) { g_warning ("Low disk space monitor already initialized."); return; } ldsm_notified_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, ldsm_free_mount_info); settings = g_settings_new (SETTINGS_HOUSEKEEPING_SCHEMA); msd_ldsm_get_config (); g_signal_connect (settings, "changed", G_CALLBACK (msd_ldsm_update_config), NULL); #if GLIB_CHECK_VERSION (2, 44, 0) ldsm_monitor = g_unix_mount_monitor_get (); #else ldsm_monitor = g_unix_mount_monitor_new (); g_unix_mount_monitor_set_rate_limit (ldsm_monitor, 1000); #endif g_signal_connect (ldsm_monitor, "mounts-changed", G_CALLBACK (ldsm_mounts_changed), NULL); if (check_now) ldsm_check_all_mounts (NULL); ldsm_timeout_id = g_timeout_add_seconds (CHECK_EVERY_X_SECONDS, ldsm_check_all_mounts, NULL); }
void csd_ldsm_setup (gboolean check_now) { if (ldsm_notified_hash || ldsm_timeout_id || ldsm_monitor) { g_warning ("Low disk space monitor already initialized."); return; } ldsm_notified_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, ldsm_free_mount_info); settings = g_settings_new (SETTINGS_HOUSEKEEPING_DIR); csd_ldsm_get_config (); g_signal_connect (G_OBJECT (settings), "changed", G_CALLBACK (csd_ldsm_update_config), NULL); ldsm_monitor = g_unix_mount_monitor_get (); g_signal_connect (ldsm_monitor, "mounts-changed", G_CALLBACK (ldsm_mounts_changed), NULL); if (check_now) ldsm_check_all_mounts (NULL); ldsm_timeout_id = g_timeout_add_seconds (CHECK_EVERY_X_SECONDS, ldsm_check_all_mounts, NULL); }
static void g_unix_volume_monitor_init (GUnixVolumeMonitor *unix_monitor) { unix_monitor->mount_monitor = g_unix_mount_monitor_get (); g_signal_connect (unix_monitor->mount_monitor, "mounts-changed", G_CALLBACK (mounts_changed), unix_monitor); g_signal_connect (unix_monitor->mount_monitor, "mountpoints-changed", G_CALLBACK (mountpoints_changed), unix_monitor); _g_unix_volume_monitor_update (unix_monitor); }