Exemplo n.º 1
0
static void
dispose (GObject *object)
{
	NMVpnManagerPrivate *priv = NM_VPN_MANAGER_GET_PRIVATE (object);

	if (priv->monitor_etc) {
		if (priv->monitor_id_etc)
			g_signal_handler_disconnect (priv->monitor_etc, priv->monitor_id_etc);
		g_file_monitor_cancel (priv->monitor_etc);
		g_clear_object (&priv->monitor_etc);
	}

	if (priv->monitor_lib) {
		if (priv->monitor_id_lib)
			g_signal_handler_disconnect (priv->monitor_lib, priv->monitor_id_lib);
		g_file_monitor_cancel (priv->monitor_lib);
		g_clear_object (&priv->monitor_lib);
	}

	while (priv->plugins)
		nm_vpn_plugin_info_list_remove (&priv->plugins, priv->plugins->data);

	g_hash_table_unref (priv->active_services);

	G_OBJECT_CLASS (nm_vpn_manager_parent_class)->dispose (object);
}
Exemplo n.º 2
0
static void
g_keyfile_settings_backend_finalize (GObject *object)
{
  GKeyfileSettingsBackend *kfsb = G_KEYFILE_SETTINGS_BACKEND (object);

  g_key_file_free (kfsb->keyfile);
  g_object_unref (kfsb->permission);
  g_key_file_unref (kfsb->system_keyfile);
  g_hash_table_unref (kfsb->system_locks);
  g_free (kfsb->defaults_dir);

  g_file_monitor_cancel (kfsb->file_monitor);
  g_object_unref (kfsb->file_monitor);
  g_object_unref (kfsb->file);

  g_file_monitor_cancel (kfsb->dir_monitor);
  g_object_unref (kfsb->dir_monitor);
  g_object_unref (kfsb->dir);

  g_free (kfsb->root_group);
  g_free (kfsb->prefix);

  G_OBJECT_CLASS (g_keyfile_settings_backend_parent_class)
    ->finalize (object);
}
Exemplo n.º 3
0
static void
cheese_thumb_view_finalize (GObject *object)
{
  CheeseThumbView        *thumb_view = CHEESE_THUMB_VIEW (object);
  CheeseThumbViewPrivate *priv = cheese_thumb_view_get_instance_private (thumb_view);

  g_object_unref (priv->store);
  g_object_unref (priv->fileutil);
  g_object_unref (priv->factory);
  g_file_monitor_cancel (priv->photo_file_monitor);
  g_file_monitor_cancel (priv->video_file_monitor);
  g_queue_free (priv->thumbnails);

  G_OBJECT_CLASS (cheese_thumb_view_parent_class)->finalize (object);
}
static void
hd_plugin_configuration_finalize (GObject *object)
{
  HDPluginConfigurationPrivate *priv;

  g_return_if_fail (HD_IS_PLUGIN_CONFIGURATION (object));

  priv = HD_PLUGIN_CONFIGURATION (object)->priv;

  if (priv->config_file)
    priv->config_file = (g_object_unref (priv->config_file), NULL);

  if (priv->plugin_dirs != NULL)
    {
      guint i;

      for (i = 0; priv->plugin_dirs[i] != NULL; i++)
        {
          g_file_monitor_cancel (priv->plugin_dir_monitors[i]);
          g_object_unref (priv->plugin_dir_monitors[i]);
          g_object_unref (priv->plugin_dir_files[i]);
        }
      
      priv->plugin_dir_monitors = (g_free (priv->plugin_dir_monitors), NULL);
      priv->plugin_dir_files = (g_free (priv->plugin_dir_files), NULL);
      priv->plugin_dirs = (g_strfreev (priv->plugin_dirs), NULL);
    }

  if (priv->available_plugins)
    priv->available_plugins = (g_hash_table_destroy (priv->available_plugins), NULL);

  G_OBJECT_CLASS (hd_plugin_configuration_parent_class)->finalize (object);
}
Exemplo n.º 5
0
static void falcon_watcher_cancel(gpointer data)
{
	GFileMonitor *monitor = (GFileMonitor *)data;

	g_file_monitor_cancel(monitor);
	g_object_unref(monitor);
}
Exemplo n.º 6
0
static void
config_finalize (GObject *object)
{
	TrackerConfigFile *file;
	TrackerConfigFilePrivate *priv;

	file = TRACKER_CONFIG_FILE (object);
	priv = TRACKER_CONFIG_FILE_GET_PRIVATE (file);

	if (file->key_file) {
		g_key_file_free (file->key_file);
	}

	if (file->monitor) {
		g_file_monitor_cancel (file->monitor);
		g_object_unref (file->monitor);
	}

	if (file->file) {
		g_object_unref (file->file);
	}

	g_free (priv->domain);

	(G_OBJECT_CLASS (tracker_config_file_parent_class)->finalize) (object);
}
Exemplo n.º 7
0
static void watch_free(gpointer data)
{
    DirWatch * watch = (DirWatch *)data;
    g_file_monitor_cancel(watch->monitor);
    g_object_unref(watch->monitor);
    g_free(watch);
}
Exemplo n.º 8
0
static void
ide_git_vcs_dispose (GObject *object)
{
  IdeGitVcs *self = (IdeGitVcs *)object;

  IDE_ENTRY;

  if (self->changed_timeout)
    {
      g_source_remove (self->changed_timeout);
      self->changed_timeout = 0;
    }

  if (self->monitor)
    {
      if (!g_file_monitor_is_cancelled (self->monitor))
        g_file_monitor_cancel (self->monitor);
      g_clear_object (&self->monitor);
    }

  g_clear_object (&self->change_monitor_repository);
  g_clear_object (&self->repository);
  g_clear_object (&self->working_directory);

  G_OBJECT_CLASS (ide_git_vcs_parent_class)->dispose (object);

  IDE_EXIT;
}
Exemplo n.º 9
0
void
watcher_destroy_monitors(const watcher_t *watcher)
{
  GFileMonitor *monitor;
  gchar *path;
  GHashTableIter iter;
  gpointer key, value;

  g_hash_table_iter_init(&iter, watcher->monitors);
  while (g_hash_table_iter_next(&iter, &key, &value))
    {
      path = (gchar *) key;
      monitor = (GFileMonitor *) value;

      if (!g_file_monitor_is_cancelled(monitor))
        {
          g_file_monitor_cancel(monitor);

          LOG_DEBUG("%s: %s (%s)",
              watcher->name, N_("file monitor cancelled"), path);
        }
      else
        {
          LOG_DEBUG("%s: %s (%s)",
              watcher->name, N_("file monitor already cancelled"), path);
        }

      g_free(path);
      g_object_unref(monitor);
    }

  g_hash_table_remove_all(watcher->monitors);
}
Exemplo n.º 10
0
static void
dispose (GObject *object)
{
	SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (object);

	if (priv->monitor) {
		if (priv->monitor_id) {
			g_signal_handler_disconnect (priv->monitor, priv->monitor_id);
			priv->monitor_id = 0;
		}

		g_file_monitor_cancel (priv->monitor);
		g_clear_object (&priv->monitor);
	}

	if (priv->connections) {
		g_hash_table_destroy (priv->connections);
		priv->connections = NULL;
	}

	if (priv->config) {
		g_signal_handlers_disconnect_by_func (priv->config, config_changed_cb, object);
		g_clear_object (&priv->config);
	}

	G_OBJECT_CLASS (sc_plugin_keyfile_parent_class)->dispose (object);
}
Exemplo n.º 11
0
static void
cockpit_fslist_dispose (GObject *object)
{
  CockpitFslist *self = COCKPIT_FSLIST (object);

  if (self->cancellable)
    g_cancellable_cancel (self->cancellable);

  if (self->monitor)
    {
      if (self->sig_changed)
        g_signal_handler_disconnect (self->monitor, self->sig_changed);
      self->sig_changed = 0;

      // HACK - It is not generally safe to just unref a GFileMonitor.
      // Some events might be on their way to the main loop from its
      // worker thread and if they arrive after the GFileMonitor has
      // been destroyed, bad things will happen.
      //
      // As a workaround, we cancel the monitor and then spin the main
      // loop a bit until nothing is pending anymore.
      //
      // https://bugzilla.gnome.org/show_bug.cgi?id=740491

      g_file_monitor_cancel (self->monitor);
      for (int tries = 0; tries < 10; tries ++)
        {
          if (!g_main_context_iteration (NULL, FALSE))
            break;
        }
    }

  G_OBJECT_CLASS (cockpit_fslist_parent_class)->dispose (object);
}
static void
dispose (GObject *object)
{
	SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (object);
	SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin);
	NMInotifyHelper *ih;

	if (priv->bus) {
		dbus_g_connection_unref (priv->bus);
		priv->bus = NULL;
	}

	if (priv->ih_event_id) {
		ih = nm_inotify_helper_get ();

		g_signal_handler_disconnect (ih, priv->ih_event_id);
		priv->ih_event_id = 0;

		if (priv->sc_network_wd >= 0)
			nm_inotify_helper_remove_watch (ih, priv->sc_network_wd);
	}

	if (priv->hostname_monitor) {
		if (priv->hostname_monitor_id)
			g_signal_handler_disconnect (priv->hostname_monitor, priv->hostname_monitor_id);

		g_file_monitor_cancel (priv->hostname_monitor);
		g_object_unref (priv->hostname_monitor);
	}

	g_free (priv->hostname);

	if (priv->connections) {
		g_hash_table_destroy (priv->connections);
		priv->connections = NULL;
	}

	if (priv->ifcfg_monitor) {
		if (priv->ifcfg_monitor_id)
			g_signal_handler_disconnect (priv->ifcfg_monitor, priv->ifcfg_monitor_id);

		g_file_monitor_cancel (priv->ifcfg_monitor);
		g_object_unref (priv->ifcfg_monitor);
	}

	G_OBJECT_CLASS (sc_plugin_ifcfg_parent_class)->dispose (object);
}
Exemplo n.º 13
0
static void
unregister_monitor (gpointer ptr)
{
	GFileMonitor *monitor = (GFileMonitor *) ptr;

	g_file_monitor_cancel (monitor);
	g_object_unref (monitor);
}
Exemplo n.º 14
0
void gtodo_client_block_changed_callback(GTodoClient *cl)
{
	if(cl->timeout != NULL)
	{
		g_file_monitor_cancel(cl->timeout);
		g_object_unref (cl->timeout);
	}
	cl->timeout = NULL;
}
Exemplo n.º 15
0
static void
anjuta_dir_group_node_finalize (GObject *object)
{
	AnjutaDirGroupNode *node = ANJUTA_DIR_GROUP_NODE (object);
	
	if (node->monitor != NULL) g_file_monitor_cancel (node->monitor);
	
	G_OBJECT_CLASS (anjuta_dir_group_node_parent_class)->finalize (object);
}
Exemplo n.º 16
0
static void _vfs_backend_free_monitor_data (gpointer *data)
{
	if (data != NULL)
	{
		GFileMonitor *pHandle = data[2];
		g_file_monitor_cancel (pHandle);  // le GFileMonitor est-il libere lors du g_file_monitor_cancel () ?
		g_free (data);
	}
}
static void
cancel_monitors (NMIfnetConnection * connection, gpointer user_data)
{
	SCPluginIfnet *self = SC_PLUGIN_IFNET (user_data);
	SCPluginIfnetPrivate *priv = SC_PLUGIN_IFNET_GET_PRIVATE (self);

	if (priv->hostname_monitor) {
		g_file_monitor_cancel (priv->hostname_monitor);
		g_object_unref (priv->hostname_monitor);
	}
	if (priv->net_monitor) {
		g_file_monitor_cancel (priv->net_monitor);
		g_object_unref (priv->net_monitor);
	}
	if (priv->wpa_monitor) {
		g_file_monitor_cancel (priv->wpa_monitor);
		g_object_unref (priv->wpa_monitor);
	}
}
Exemplo n.º 18
0
void 
athena_monitor_cancel (AthenaMonitor *monitor)
{
	if (monitor->monitor != NULL) {
		g_signal_handlers_disconnect_by_func (monitor->monitor, dir_changed, monitor);
		g_file_monitor_cancel (monitor->monitor);
		g_object_unref (monitor->monitor);
	}

	g_free (monitor);
}
Exemplo n.º 19
0
void gtodo_client_destroy_changed_callback(GTodoClient *cl, void *(*function)(gpointer cl, gpointer data), gpointer data)
{
	cl->function = NULL;   
	if(cl->timeout != NULL)
	{
		g_file_monitor_cancel (cl->timeout);
		g_object_unref (cl->timeout);
		cl->timeout = NULL;
	}
	cl->data = NULL;    
}
Exemplo n.º 20
0
static void
git_status_command_stop_automatic_monitor (AnjutaCommand *command)
{
	GitStatusCommand *self;

	self = GIT_STATUS_COMMAND (command); 

	if (self->priv->head_monitor)
	{
		g_file_monitor_cancel (self->priv->head_monitor);
		g_object_unref (self->priv->head_monitor);
		self->priv->head_monitor = NULL;
	}

	if (self->priv->index_monitor)
	{
		g_file_monitor_cancel (self->priv->index_monitor);
		g_object_unref (self->priv->index_monitor);
		self->priv->index_monitor = NULL;
	}
}
Exemplo n.º 21
0
/* function should be of type  void functionname(GTodoType *cl, gpointer data); */
void gtodo_client_set_changed_callback(GTodoClient *cl, void *(*function)(gpointer cl, gpointer data), gpointer data)
{
	cl->function = function;    
	if(cl->timeout != NULL)
	{
		g_file_monitor_cancel (cl->timeout);
		g_object_unref (cl->timeout);
	}
	cl->timeout = g_file_monitor_file (cl->xml_file, G_FILE_MONITOR_NONE, NULL, NULL);
	g_signal_connect (G_OBJECT (cl->timeout), "changed", G_CALLBACK (check_item_changed), cl);
	cl->data = data; 
}
Exemplo n.º 22
0
static void
g_file_monitor_dispose (GObject *object)
{
  GFileMonitor *monitor;
  
  monitor = G_FILE_MONITOR (object);

  /* Make sure we cancel on last unref */
  g_file_monitor_cancel (monitor);
  
  if (G_OBJECT_CLASS (g_file_monitor_parent_class)->dispose)
    (*G_OBJECT_CLASS (g_file_monitor_parent_class)->dispose) (object);
}
Exemplo n.º 23
0
void
watcher_remove_monitor_for_recursive_path(const watcher_t *watcher,
    const gchar *path)
{
  GFile *w_file, *file;
  GFileMonitor *w_monitor;
  gchar *w_path;
  GHashTableIter iter;
  gpointer key, value;

  LOG_DEBUG("%s: %s (path=%s)",
      watcher->name, N_("removing file monitors for recursive path"), path);

  file = g_file_new_for_path(path);

  g_hash_table_iter_init(&iter, watcher->monitors);
  while (g_hash_table_iter_next(&iter, &key, &value))
    {
      w_path = (gchar *) key;
      w_monitor = (GFileMonitor *) value;

      if (g_strcmp0(w_path, watcher->path) == 0)
        continue;

      w_file = g_file_new_for_path(w_path);

      if (g_file_equal(w_file, file) || g_file_has_prefix(w_file, file))
        {
          if (!g_file_monitor_is_cancelled(w_monitor))
            {
              g_file_monitor_cancel(w_monitor);

              LOG_DEBUG("%s: %s (%s)",
                  watcher->name, N_("file monitor cancelled"), w_path);
            }
          else
            {
              LOG_DEBUG("%s: %s (%s)",
                  watcher->name, N_("file monitor already cancelled"), w_path);
            }

          g_hash_table_iter_remove(&iter);

          g_object_unref(w_file);
          g_free(w_path);
          g_object_unref(w_monitor);
        }
    }

  g_object_unref(file);
}
Exemplo n.º 24
0
static void
do_finalize (GObject *object)
{
	if (NAUTILUS_BOOKMARK_LIST (object)->monitor != NULL) {
		g_file_monitor_cancel (NAUTILUS_BOOKMARK_LIST (object)->monitor);
		NAUTILUS_BOOKMARK_LIST (object)->monitor = NULL;
	}

	g_queue_free (NAUTILUS_BOOKMARK_LIST (object)->pending_ops);

	clear (NAUTILUS_BOOKMARK_LIST (object));

	G_OBJECT_CLASS (nautilus_bookmark_list_parent_class)->finalize (object);
}
Exemplo n.º 25
0
static void
git_stash_list_command_stop_automatic_monitor (AnjutaCommand *command)
{
	GitStashListCommand *self;

	self = GIT_STASH_LIST_COMMAND (command);

	if (self->priv->file_monitor)
	{
		g_file_monitor_cancel (self->priv->file_monitor);
		g_object_unref (self->priv->file_monitor);
		self->priv->file_monitor = NULL;
	}
}
Exemplo n.º 26
0
static void
do_finalize (GObject *object)
{
	if (NEMO_BOOKMARK_LIST (object)->monitor != NULL) {
		g_file_monitor_cancel (NEMO_BOOKMARK_LIST (object)->monitor);
		NEMO_BOOKMARK_LIST (object)->monitor = NULL;
	}

	g_queue_free (NEMO_BOOKMARK_LIST (object)->pending_ops);

	clear_bookmarks (NEMO_BOOKMARK_LIST (object), NEMO_BOOKMARK_LIST (object)->list);

    g_object_unref (NEMO_BOOKMARK_LIST (object)->volume_monitor);

	G_OBJECT_CLASS (nemo_bookmark_list_parent_class)->finalize (object);
}
Exemplo n.º 27
0
void vnr_file_destroy_data(VnrFile *vnrfile) {
    if(vnrfile == NULL) {
        return;
    }
    if(vnrfile->monitoring_data != NULL) {
        free(vnrfile->monitoring_data);
    }
    if(vnrfile->monitor != NULL) {
        g_file_monitor_cancel(vnrfile->monitor);
        g_object_unref(vnrfile->monitor);
    }
    g_free(vnrfile->path);
    g_free(vnrfile->display_name);
    g_free((gpointer) vnrfile->display_name_collate);
    g_object_unref(vnrfile);
}
Exemplo n.º 28
0
void 
nautilus_monitor_cancel (NautilusMonitor *monitor)
{
	if (monitor->monitor != NULL) {
		g_signal_handlers_disconnect_by_func (monitor->monitor, dir_changed, monitor);
		g_file_monitor_cancel (monitor->monitor);
		g_object_unref (monitor->monitor);
	}

	if (monitor->volume_monitor != NULL) {
		g_signal_handlers_disconnect_by_func (monitor->volume_monitor, mount_removed, monitor);
		g_object_unref (monitor->volume_monitor);
	}

	g_clear_object (&monitor->location);
	g_slice_free (NautilusMonitor, monitor);
}
Exemplo n.º 29
0
/* ---------------------------------------------------------------------------------------------------- */
static void
sysroot_dispose (GObject *object)
{
  RpmostreedSysroot *self = RPMOSTREED_SYSROOT (object);
  GHashTableIter iter;
  gpointer value;
  gint tries;

  g_cancellable_cancel (self->cancellable);

  if (self->monitor)
    {
      if (self->sig_changed)
        g_signal_handler_disconnect (self->monitor, self->sig_changed);
      self->sig_changed = 0;

      /* HACK - It is not generally safe to just unref a GFileMonitor.
       * Some events might be on their way to the main loop from its
       * worker thread and if they arrive after the GFileMonitor has
       * been destroyed, bad things will happen.
       *
       * As a workaround, we cancel the monitor and then spin the main
       * loop a bit until nothing is pending anymore.
       *
       * https://bugzilla.gnome.org/show_bug.cgi?id=740491
       */

      g_file_monitor_cancel (self->monitor);
      for (tries = 0; tries < 10; tries ++)
        {
          if (!g_main_context_iteration (NULL, FALSE))
            break;
        }
    }

  /* Tracked os paths are responsible to unpublish themselves */
  g_hash_table_iter_init (&iter, self->os_interfaces);
  while (g_hash_table_iter_next (&iter, NULL, &value))
    g_object_run_dispose (value);
  g_hash_table_remove_all (self->os_interfaces);

  g_clear_object (&self->transaction_monitor);

  G_OBJECT_CLASS (rpmostreed_sysroot_parent_class)->dispose (object);
}
static void
ephy_greasemonkey_extension_finalize (GObject *object)
{
	EphyGreasemonkeyExtension *extension = EPHY_GREASEMONKEY_EXTENSION (object);

	LOG ("EphyGreasemonkeyExtension finalising");

	if (extension->priv->scripts != NULL)
	{
		g_hash_table_destroy (extension->priv->scripts);
	}

	if (extension->priv->monitor != NULL)
	{
		g_file_monitor_cancel (extension->priv->monitor);
	}

	G_OBJECT_CLASS (parent_class)->finalize (object);
}