static void
free_client_watch (gpointer data)
{
	guint watch_id = GPOINTER_TO_UINT (data);

	if (watch_id == 0)
		return;
	g_bus_unwatch_name (watch_id);
}
static void
on_name_acquired (GDBusConnection *connection,
                  const gchar     *name,
                  const gchar     *name_owner,
                  gpointer         user_data)
{
  tp_linker = goa_tp_account_linker_new ();
  g_bus_unwatch_name (name_watcher_id);
  name_watcher_id = 0;
}
示例#3
0
static void
watch_name (TcmmdDbus *self,
    const gchar *name)
{
  if (self->priv->watch_id != 0)
    g_bus_unwatch_name (self->priv->watch_id);

  self->priv->watch_id = g_bus_watch_name_on_connection (self->priv->connection,
      name, G_BUS_NAME_WATCHER_FLAGS_NONE, NULL,
      name_vanished_cb, self, NULL);
}
示例#4
0
static void
destroy_dbus_watch (gpointer data)
{
  DBusWatch *watch = data;

  g_object_unref (watch->dbus_monitor);
  g_object_unref (watch->monitor);
  g_free (watch->dbus_name);
  g_bus_unwatch_name (watch->name_watcher_id);

  g_slice_free (DBusWatch, watch);
}
示例#5
0
static void
name_vanished_cb (GDBusConnection *connection,
    const gchar *name,
    gpointer user_data)
{
  TcmmdDbus *self = user_data;

  g_bus_unwatch_name (self->priv->watch_id);
  self->priv->watch_id = 0;

  g_signal_emit (self, signals[UNSET_POLICY], 0);
}
示例#6
0
static void
invocation_client_unref (gpointer data)
{
  InvocationClient *client = data;
  if (g_atomic_int_dec_and_test (&client->refs))
    {
      g_object_unref (client->subject);
      if (client->watch)
        g_bus_unwatch_name (client->watch);
      g_free (client->bus_name);
      g_free (client);
    }
}
示例#7
0
void ofono_wan_remove(struct wan_service *service)
{
	struct ofono_wan_data *data;

	data = wan_service_get_data(service);

	g_bus_unwatch_name(data->service_watch);

	free_used_instances(data);
	g_free(data);

	wan_service_set_data(service, NULL);
}
示例#8
0
static void
ev_doc_free (EvDoc *doc)
{
	if (!doc)
		return;

	g_free (doc->dbus_name);
	g_free (doc->uri);

        g_bus_unwatch_name (doc->watch_id);

	g_free (doc);
}
示例#9
0
static void
indicator_workrave_dispose(GObject *object)
{
  IndicatorWorkrave *self = INDICATOR_WORKRAVE(object);
  IndicatorWorkravePrivate *priv = INDICATOR_WORKRAVE_GET_PRIVATE(self);

  if (priv->watch_id != 0)
    {
      g_bus_unwatch_name(priv->watch_id);
    }
  
  if (priv->owner_id != 0)
    {
      g_bus_unown_name(priv->owner_id);
    }
  
  if (priv->timer != 0)
    {
      g_source_remove(priv->timer);
      priv->timer = 0;
    }

  if (priv->label != NULL)
    {
      g_object_unref(priv->label);
      priv->label = NULL;
    }

  if (priv->image != NULL)
    {
      g_object_unref(priv->image);
      priv->image = NULL;
    }

  if (priv->menu != NULL)
    {
      g_object_unref(G_OBJECT(priv->menu));
      priv->menu = NULL;
    }

  //if (priv->sm != NULL)
  //  {
  //    g_object_unref(G_OBJECT(priv->sm));
  //    priv->sm = NULL;
  //  }

  
  G_OBJECT_CLASS(indicator_workrave_parent_class)->dispose(object);
  return;
}
示例#10
0
void gnome_media_keys_free(con_gnome_media_keys *gmk)
{
    PraghaApplication *pragha = gmk->pragha;

    g_bus_unwatch_name(gmk->watch_id);

    if (gmk->handler_id != 0)
        g_signal_handler_disconnect(G_OBJECT(pragha_application_get_window(pragha)), gmk->handler_id);

    if (gmk->proxy != NULL)
        g_object_unref(gmk->proxy);

    g_slice_free(con_gnome_media_keys, gmk);
}
示例#11
0
int
main (int argc, char *argv[])
{
  guint watcher_id;
  GMainLoop *loop;
  GOptionContext *opt_context;
  GError *error;
  GBusNameWatcherFlags flags;

  error = NULL;
  opt_context = g_option_context_new ("g_bus_watch_name() example");
  g_option_context_set_summary (opt_context,
                                "Example: to watch the power manager on the session bus, use:\n"
                                "\n"
                                "  ./example-watch-name -n org.gnome.PowerManager");
  g_option_context_add_main_entries (opt_context, opt_entries, NULL);
  if (!g_option_context_parse (opt_context, &argc, &argv, &error))
    {
      g_printerr ("Error parsing options: %s", error->message);
      goto out;
    }
  if (opt_name == NULL)
    {
      g_printerr ("Incorrect usage, try --help.\n");
      goto out;
    }

  flags = G_BUS_NAME_WATCHER_FLAGS_NONE;
  if (opt_auto_start)
    flags |= G_BUS_NAME_WATCHER_FLAGS_AUTO_START;

  watcher_id = g_bus_watch_name (opt_system_bus ? G_BUS_TYPE_SYSTEM : G_BUS_TYPE_SESSION,
                                 opt_name,
                                 flags,
                                 on_name_appeared,
                                 on_name_vanished,
                                 NULL,
                                 NULL);

  loop = g_main_loop_new (NULL, FALSE);
  g_main_loop_run (loop);

  g_bus_unwatch_name (watcher_id);

 out:
  g_option_context_free (opt_context);
  g_free (opt_name);

  return 0;
}
static void
maybe_start_ibus (void)
{
  /* IBus doesn't export API in the session bus. The only thing
   * we have there is a well known name which we can use as a
   * sure-fire way to activate it. */
  g_bus_unwatch_name (g_bus_watch_name (G_BUS_TYPE_SESSION,
                                        IBUS_SERVICE_IBUS,
                                        G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
                                        NULL,
                                        NULL,
                                        NULL,
                                        NULL));
}
static void prv_connector_unwatch_client(const gchar *client_name)
{
	guint client_id;

	DLEYNA_LOG_DEBUG("Enter");

	client_id = GPOINTER_TO_UINT(g_hash_table_lookup(g_context.clients,
							 client_name));
	(void) g_hash_table_remove(g_context.clients, client_name);

	g_bus_unwatch_name(client_id);

	DLEYNA_LOG_DEBUG("Exit");
}
static void
gpm_phone_finalize (GObject *object)
{
        GpmPhone *phone;
        g_return_if_fail (GPM_IS_PHONE (object));

        phone = GPM_PHONE (object);
        phone->priv = GPM_PHONE_GET_PRIVATE (phone);

        if (phone->priv->proxy != NULL)
                g_object_unref (phone->priv->proxy);
        g_bus_unwatch_name (phone->priv->watch_id);

        G_OBJECT_CLASS (gpm_phone_parent_class)->finalize (object);
}
示例#15
0
static void
dispose (GObject *object)
{
	NMDevice *device = NM_DEVICE (object);
	NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (object);

	if (priv->teamd_dbus_watch) {
		g_bus_unwatch_name (priv->teamd_dbus_watch);
		priv->teamd_dbus_watch = 0;
	}

	teamd_cleanup (device, TRUE);

	G_OBJECT_CLASS (nm_device_team_parent_class)->dispose (object);
}
static void
pk_vanished_cb (GDBusConnection *conn,
                const gchar *name,
                gpointer user_data)
{
  GtkAppChooserOnlinePk *self = user_data;

  /* just return */
  g_simple_async_result_set_op_res_gboolean (self->priv->init_result, FALSE);
  g_simple_async_result_complete (self->priv->init_result);

  g_bus_unwatch_name (self->priv->watch_id);

  g_clear_object (&self->priv->init_result);
}
示例#17
0
void ofono_remove(struct telephony_service *service)
{
	struct ofono_data *data = 0;

	data = telephony_service_get_data(service);

	g_hash_table_destroy(data->calls);

	free_used_instances(data);

	g_bus_unwatch_name(data->service_watch);

	g_free(data);

	telephony_service_set_data(service, NULL);
}
示例#18
0
static void
gclue_client_info_finalize (GObject *object)
{
        GClueClientInfoPrivate *priv = GCLUE_CLIENT_INFO (object)->priv;

        if (priv->watch_id != 0) {
                g_bus_unwatch_name (priv->watch_id);
                priv->watch_id = 0;
        }

        g_clear_pointer (&priv->bus_name, g_free);
        g_clear_pointer (&priv->xdg_id, g_free);
        g_clear_object (&priv->connection);

        /* Chain up to the parent class */
        G_OBJECT_CLASS (gclue_client_info_parent_class)->finalize (object);
}
static void
gis_privacy_page_dispose (GObject *object)
{
  GisPrivacyPage *page = GIS_PRIVACY_PAGE (object);
  GisPrivacyPagePrivate *priv = gis_privacy_page_get_instance_private (page);

  g_clear_object (&priv->location_settings);
  g_clear_object (&priv->privacy_settings);

  if (priv->abrt_watch_id > 0)
    {
      g_bus_unwatch_name (priv->abrt_watch_id);
      priv->abrt_watch_id = 0;
    }

  G_OBJECT_CLASS (gis_privacy_page_parent_class)->dispose (object);
}
示例#20
0
static gboolean
gdm_display_real_unmanage (GdmDisplay *display)
{
    gdouble elapsed;

    g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE);

    g_debug ("GdmDisplay: unmanage display");

    g_timer_stop (display->priv->slave_timer);

    if (display->priv->slave_proxy != NULL) {
        gdm_slave_proxy_stop (display->priv->slave_proxy);

        g_object_unref (display->priv->slave_proxy);
        display->priv->slave_proxy = NULL;
    }

    if (display->priv->user_access_file != NULL) {
        gdm_display_access_file_close (display->priv->user_access_file);
        g_object_unref (display->priv->user_access_file);
        display->priv->user_access_file = NULL;
    }

    if (display->priv->access_file != NULL) {
        gdm_display_access_file_close (display->priv->access_file);
        g_object_unref (display->priv->access_file);
        display->priv->access_file = NULL;
    }

    elapsed = g_timer_elapsed (display->priv->slave_timer, NULL);
    if (elapsed < 3) {
        g_warning ("GdmDisplay: display lasted %lf seconds", elapsed);
        _gdm_display_set_status (display, GDM_DISPLAY_FAILED);
    } else {
        _gdm_display_set_status (display, GDM_DISPLAY_UNMANAGED);
    }

    if (display->priv->slave_name_id > 0) {
        g_bus_unwatch_name (display->priv->slave_name_id);
        display->priv->slave_name_id = 0;
    }

    return TRUE;
}
示例#21
0
GDBusProxy* WebKitTestBus::createProxy(const char* serviceName, const char* objectPath, const char* interfaceName, GMainLoop* mainLoop)
{
    unsigned watcherID = g_bus_watch_name_on_connection(getOrCreateConnection(), serviceName, G_BUS_NAME_WATCHER_FLAGS_NONE, onNameAppeared, 0, mainLoop, 0);
    g_main_loop_run(mainLoop);
    g_bus_unwatch_name(watcherID);

    GDBusProxy* proxy = g_dbus_proxy_new_sync(
        connection(),
        G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
        0, // GDBusInterfaceInfo
        serviceName,
        objectPath,
        interfaceName,
        0, // GCancellable
        0);
    g_assert(proxy);
    return proxy;
}
static void
plugin_object_deallocate (NPObject *npobj)
{
  PluginObject *obj = (PluginObject*)npobj;

  g_signal_handler_disconnect (obj->proxy, obj->signal_id);
  g_object_unref (obj->proxy);

  if (obj->listener)
    funcs.releaseobject (obj->listener);

  if (obj->watch_name_id)
    g_bus_unwatch_name (obj->watch_name_id);

  g_debug ("plugin object destroyed");

  g_slice_free (PluginObject, obj);
}
示例#23
0
/*
** Destroy an instance watch
*/
static void watch_instance_free(struct watch_instance *watch)
{
    if (watch->timeout_id > 0)
        g_source_remove(watch->timeout_id);
    watch->timeout_id = 0;

    if (watch->id > 0)
        g_bus_unwatch_name(watch->id);
    watch->id = 0;

    g_free(watch->path);
    watch->path = NULL;

    g_free(watch->name);
    watch->name = NULL;

    g_free(watch);
}
示例#24
0
/*
** Tell DBus to auto-launch a daemon based on a busname
** if it doesn't exists. DBus will look for a service file
** corresponding to the given well-known name.
*/
static inline void autolaunch_process_by_busname(const gchar *busname)
{
    g_bus_unwatch_name(
        g_bus_watch_name(
            G_BUS_TYPE_SESSION,
            busname,
            G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
            NULL,
            NULL,
            NULL,
            NULL));

    /*
    ** Wait one second to prevent flooding the server if
    ** all instances just vanished and they are all queued
    ** to respawn.
    */
    g_usleep(1000000L);
}
static void
pk_appeared_cb (GDBusConnection *conn,
                const gchar *name,
                const gchar *owner,
                gpointer user_data)
{
  GtkAppChooserOnlinePk *self = user_data;

  /* create the proxy */
  g_dbus_proxy_new (conn, 0, NULL,
                    "org.freedesktop.PackageKit",
                    "/org/freedesktop/PackageKit",
                    "org.freedesktop.PackageKit.Modify",
                    NULL,
                    pk_proxy_created_cb,
                    self);

  g_bus_unwatch_name (self->priv->watch_id);
}
static void
gis_account_page_enterprise_dispose (GObject *object)
{
  GisAccountPageEnterprise *page = GIS_ACCOUNT_PAGE_ENTERPRISE (object);
  GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);

  if (priv->realmd_watch)
    g_bus_unwatch_name (priv->realmd_watch);

  priv->realmd_watch = 0;

  g_cancellable_cancel (priv->cancellable);

  g_clear_object (&priv->realm_manager);
  g_clear_object (&priv->realm);
  g_clear_object (&priv->cancellable);

  G_OBJECT_CLASS (gis_account_page_enterprise_parent_class)->dispose (object);
}
示例#27
0
static gboolean
handle_unset_policy_cb (TcmmdManagedConnections *iface,
    GDBusMethodInvocation *invocation,
    gpointer user_data)
{
  TcmmdDbus *self = user_data;

  g_print ("UnsetPolicy\n");

  if (self->priv->watch_id != 0)
    {
      g_bus_unwatch_name (self->priv->watch_id);
      self->priv->watch_id = 0;
    }

  g_signal_emit (self, signals[UNSET_POLICY], 0);

  return TRUE;
}
示例#28
0
static void
fcitx_client_finalize(GObject *object)
{
    FcitxClient *self = FCITX_CLIENT(object);

    if (self->priv->icproxy) {
        g_dbus_proxy_call(self->priv->icproxy, "DestroyIC", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
    }
    g_bus_unwatch_name(self->priv->watch_id);
    GDBusProxy* icproxy = self->priv->icproxy;
    GDBusProxy* improxy = self->priv->improxy;
    self->priv->icproxy = NULL;
    self->priv->improxy = NULL;
    if (icproxy)
        g_object_unref(icproxy);
    if (improxy)
        g_object_unref(improxy);

    if (G_OBJECT_CLASS(fcitx_client_parent_class)->finalize != NULL)
        G_OBJECT_CLASS(fcitx_client_parent_class)->finalize(object);
}
示例#29
0
static void
g_menu_exporter_remote_free (gpointer data)
{
  GMenuExporterRemote *remote = data;
  GHashTableIter iter;
  gpointer key, val;

  g_hash_table_iter_init (&iter, remote->watches);
  while (g_hash_table_iter_next (&iter, &key, &val))
    {
      GMenuExporterGroup *group;

      group = g_menu_exporter_lookup_group (remote->exporter, GPOINTER_TO_INT (key));
      g_menu_exporter_group_unsubscribe (group, GPOINTER_TO_INT (val));
    }

  g_bus_unwatch_name (remote->watch_id);
  g_hash_table_unref (remote->watches);

  g_slice_free (GMenuExporterRemote, remote);
}
示例#30
0
static void
cockpit_fake_manager_dispose (GObject *object)
{
  CockpitFakeManager *self = COCKPIT_FAKE_MANAGER (object);
  guint watch;

  if (self->bus_name_watch)
    {
      watch = self->bus_name_watch;
      self->bus_name_watch = 0;
      g_debug ("fakemanager: unwatching bus name: %s", self->bus_name);
      g_bus_unwatch_name (watch);
    }

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

  maybe_complete_async_init (self);

  G_OBJECT_CLASS (cockpit_fake_manager_parent_class)->dispose (object);
}