void
kolab_util_backend_koma_table_cleanup_cb (gpointer data,
                                          GObject *object,
                                          gboolean is_last_ref)
{
	KolabMailAccess *koma = KOLAB_MAIL_ACCESS (object);
	GHashTable *koma_table = (GHashTable *) data;
	const gchar *host = NULL;
	const gchar *user = NULL;
	gchar *user_at_host = NULL;
	KolabSettingsHandler *ksettings = NULL;
	CamelKolabIMAPXSettings *camel_settings;
	CamelNetworkSettings *network_settings;
	/* gboolean ok; */
	g_debug ("%s()[%u] called.", __func__, __LINE__);

	g_assert (data != NULL);
	g_assert (G_IS_OBJECT (object));
	(void)is_last_ref;

	ksettings = kolab_mail_access_get_settings_handler (koma);
	camel_settings = kolab_settings_handler_get_camel_settings (ksettings);

	network_settings = CAMEL_NETWORK_SETTINGS (camel_settings);
	host = camel_network_settings_get_host (network_settings);
	user = camel_network_settings_get_user (network_settings);

	user_at_host = g_strdup_printf ("%s@%s", user, host);
	(void)g_hash_table_remove (koma_table, user_at_host);

	g_free (user_at_host);
	g_object_remove_toggle_ref (object,
	                            kolab_util_backend_koma_table_cleanup_cb,
	                            data);
} /* kolab_util_backend_koma_table_cleanup_cb () */
static void
dispose (GObject *object)
{
	NMSupplicantManager *self = (NMSupplicantManager *) object;
	NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self);
	GSList *ifaces;

	nm_clear_g_source (&priv->die_count_reset_id);

	if (priv->cancellable) {
		g_cancellable_cancel (priv->cancellable);
		g_clear_object (&priv->cancellable);
	}

	if (priv->ifaces) {
		for (ifaces = priv->ifaces; ifaces; ifaces = ifaces->next)
			g_object_remove_toggle_ref (ifaces->data, _sup_iface_last_ref, self);
		g_slist_free (priv->ifaces);
		priv->ifaces = NULL;
	}

	g_clear_object (&priv->proxy);

	G_OBJECT_CLASS (nm_supplicant_manager_parent_class)->dispose (object);
}
static gboolean
master_timeout_timed_out_cb (MasterTimeout *master_timeout)
{
  FlowSshMasterRegistryPrivate *priv = master_timeout->registry->priv;

  g_object_remove_toggle_ref ((GObject *) master_timeout->master, (GToggleNotify) toggle_ref_cb, master_timeout->registry);
  g_hash_table_remove (priv->masters, master_timeout->master);
  g_hash_table_remove (priv->timeouts, master_timeout->master);
  return TRUE;
}
static void
pixbuf_toggle_notify (gpointer      info,
		      GObject      *object,
		      gboolean      is_last_ref)
{
	NautilusIconInfo  *icon = info;
	
	if (is_last_ref) {
		icon->sole_owner = TRUE;	
		g_object_remove_toggle_ref (object,
					    pixbuf_toggle_notify,
					    info);
		icon->last_use_time = g_thread_gettime ();
		schedule_reap_cache ();
	}
}
Exemple #5
0
static void
pixbuf_toggle_notify (gpointer      info,
                      GObject      *object,
                      gboolean      is_last_ref)
{
    CajaIconInfo  *icon = info;

    if (is_last_ref)
    {
        icon->sole_owner = TRUE;
        g_object_remove_toggle_ref (object,
                                    pixbuf_toggle_notify,
                                    info);
        icon->last_use_time = g_get_monotonic_time () * 1000;
        schedule_reap_cache ();
    }
}
Exemple #6
0
static void
shell_ready_for_quit (EShell *shell,
                      EActivity *activity,
                      gboolean is_last_ref)
{
	GtkApplication *application;
	GList *list;

	if (!is_last_ref)
		return;

	application = GTK_APPLICATION (shell);

	/* Increment the reference count so we can safely emit
	 * a signal without triggering the toggle reference. */
	g_object_ref (activity);

	e_activity_set_state (activity, E_ACTIVITY_COMPLETED);

	g_object_remove_toggle_ref (
		G_OBJECT (activity), (GToggleNotify)
		shell_ready_for_quit, shell);

	/* Finalize the activity. */
	g_object_unref (activity);

	/* XXX Inhibiting session manager actions currently only
	 *     works on GNOME, so check that we obtained a valid
	 *     inhibit cookie before attempting to uninhibit. */
	if (shell->priv->inhibit_cookie > 0) {
		gtk_application_uninhibit (
			application, shell->priv->inhibit_cookie);
		shell->priv->inhibit_cookie = 0;
	}

	/* Destroy all watched windows.  Note, we iterate over a -copy-
	 * of the watched windows list because the act of destroying a
	 * watched window will modify the watched windows list, which
	 * would derail the iteration. */
	list = g_list_copy (gtk_application_get_windows (application));
	g_list_foreach (list, (GFunc) gtk_widget_destroy, NULL);
	g_list_free (list);

	if (gtk_main_level () > 0)
		gtk_main_quit ();
}
gboolean
_g_object_wait_for_single_ref_do (gpointer object)
{
  WaitSingleRefData data;
  guint timeout_id;

  data.timed_out = FALSE;

  if (G_OBJECT (object)->ref_count == 1)
    goto out;

  data.loop = g_main_loop_new (NULL, FALSE);
  timeout_id = g_timeout_add (30 * 1000,
                              on_wait_single_ref_timeout,
                              &data);

  g_object_add_toggle_ref (G_OBJECT (object),
                           on_wait_for_single_ref_toggled,
                           &data);
  /* the reference could have been removed between us checking the
   * ref_count and the toggle ref being added
   */
  if (G_OBJECT (object)->ref_count == 2)
    goto single_ref_already;

  g_object_unref (object);
  g_main_loop_run (data.loop);
  g_object_ref (object);

single_ref_already:
  g_object_remove_toggle_ref (object,
                              on_wait_for_single_ref_toggled,
                              &data);

  g_source_remove (timeout_id);
  g_main_loop_unref (data.loop);

 out:
  if (data.timed_out)
    {
      g_printerr ("b ref_count is %d\n", G_OBJECT (object)->ref_count);
    }
  return data.timed_out;
}
static void
nautilus_icon_info_finalize (GObject *object)
{
        NautilusIconInfo *icon;

        icon = NAUTILUS_ICON_INFO (object);

	if (!icon->sole_owner && icon->pixbuf) {
		g_object_remove_toggle_ref (G_OBJECT (icon->pixbuf),
					    pixbuf_toggle_notify,
					    icon);
	}

	if (icon->pixbuf) {
		g_object_unref (icon->pixbuf);
	}
	g_free (icon->icon_name);

        G_OBJECT_CLASS (nautilus_icon_info_parent_class)->finalize (object);
}
Exemple #9
0
static void
nemo_icon_info_finalize (GObject *object)
{
        NemoIconInfo *icon;

        icon = NEMO_ICON_INFO (object);

	if (!icon->sole_owner && icon->pixbuf) {
		g_object_remove_toggle_ref (G_OBJECT (icon->pixbuf),
					    pixbuf_toggle_notify,
					    icon);
	}

	if (icon->pixbuf) {
		g_object_unref (icon->pixbuf);
	}
	g_free (icon->attach_points);
	g_free (icon->display_name);
	g_free (icon->icon_name);

        G_OBJECT_CLASS (nemo_icon_info_parent_class)->finalize (object);
}
static void
_sup_iface_last_ref (gpointer data,
                     GObject *object,
                     gboolean is_last_ref)
{
	NMSupplicantManager *self = data;
	NMSupplicantManagerPrivate *priv;
	NMSupplicantInterface *sup_iface = (NMSupplicantInterface *) object;
	const char *op;

	g_return_if_fail (NM_IS_SUPPLICANT_MANAGER (self));
	g_return_if_fail (NM_IS_SUPPLICANT_INTERFACE (sup_iface));
	g_return_if_fail (is_last_ref);

	priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self);

	if (!g_slist_find (priv->ifaces, sup_iface))
		g_return_if_reached ();

	/* Ask wpa_supplicant to remove this interface */
	if (   priv->running
	    && priv->proxy
	    && (op = nm_supplicant_interface_get_object_path (sup_iface))) {
		g_dbus_proxy_call (priv->proxy,
		                   "RemoveInterface",
		                   g_variant_new ("(o)", op),
		                   G_DBUS_CALL_FLAGS_NONE,
		                   3000,
		                   NULL,
		                   NULL,
		                   NULL);
	}

	priv->ifaces = g_slist_remove (priv->ifaces, sup_iface);
	g_object_remove_toggle_ref ((GObject *) sup_iface, _sup_iface_last_ref, self);
}
Exemple #11
0
static void
shell_ready_for_online (EShell *shell,
                        EActivity *activity,
                        gboolean is_last_ref)
{
	if (!is_last_ref)
		return;

	/* Increment the reference count so we can safely emit
	 * a signal without triggering the toggle reference. */
	g_object_ref (activity);

	e_activity_set_state (activity, E_ACTIVITY_COMPLETED);

	g_object_remove_toggle_ref (
		G_OBJECT (activity), (GToggleNotify)
		shell_ready_for_online, shell);

	/* Finalize the activity. */
	g_object_unref (activity);

	shell->priv->online = TRUE;
	g_object_notify (G_OBJECT (shell), "online");
}
static void
remove_toggle_ref_foreach (gpointer key, FlowSshMaster *ssh_master, FlowSshMasterRegistry *ssh_master_registry)
{
  g_object_remove_toggle_ref ((GObject *) ssh_master, (GToggleNotify) toggle_ref_cb, ssh_master_registry);
}