int
main (int argc, char *argv[])
{
	guint watcher_id;
	GMainLoop *loop;
	GBusNameWatcherFlags flags;

#if !GLIB_CHECK_VERSION (2, 35, 0)
	/* Initialize GType system */
	g_type_init ();
#endif

	g_print ("Monitor 'org.freedesktop.NetworkManager' D-Bus name\n");
	g_print ("===================================================\n");

	flags = G_BUS_NAME_WATCHER_FLAGS_NONE;

	/* Start to watch "org.freedesktop.NetworkManager" bus name */
	watcher_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
	                               "org.freedesktop.NetworkManager",
	                               flags,
	                               on_name_appeared,
	                               on_name_vanished,
	                               NULL,
	                               NULL);

	/* Run main loop */
	loop = g_main_loop_new (NULL, FALSE);
	g_main_loop_run (loop);

	/* Stop watching the name */
	g_bus_unwatch_name (watcher_id);

	return 0;
}
Exemplo n.º 2
0
static void
setup_dbus_condition (NemoAction *action, const gchar *condition)
{
    gchar **split = g_strsplit (condition, " ", 2);

    if (g_strv_length (split) != 2) {
        g_strfreev (split);
        return;
    }

    if (g_strcmp0 (split[0], "dbus") != 0) {
        g_strfreev (split);
        return;
    }

    DBusCondition *cond = g_new0 (DBusCondition, 1);

    cond->name = g_strdup (split[0]);
    cond->exists = FALSE;
    cond->action = action;
    action->dbus = g_list_append (action->dbus, cond);
    cond->watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
                                       split[1],
                                       0,
                                       on_dbus_appeared,
                                       on_dbus_disappeared,
                                       cond,
                                       NULL);

    g_strfreev (split);
}
Exemplo n.º 3
0
int
location_geoclue2_get_location(void *state,
			       float *lat, float *lon)
{
	get_location_data_t data;
	data.available = 0;

	guint watcher_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM,
					    "org.freedesktop.GeoClue2",
					    G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
					    on_name_appeared,
					    on_name_vanished,
					    &data, NULL);
	data.loop = g_main_loop_new(NULL, FALSE);
	g_main_loop_run(data.loop);

	g_bus_unwatch_name(watcher_id);

	if (!data.available) return -1;

	*lat = data.latitude;
	*lon = data.longitude;

	return 0;
}
static gboolean prv_connector_watch_client(const gchar *client_name)
{
    guint watch_id;
    guint *client_id;
    gboolean added = TRUE;

    DLEYNA_LOG_DEBUG("Enter");

    if (g_hash_table_lookup(g_context.clients, client_name)) {
        added = FALSE;
        goto out;
    }

    watch_id = g_bus_watch_name(G_BUS_TYPE_SESSION, client_name,
                                G_BUS_NAME_WATCHER_FLAGS_NONE,
                                NULL, prv_lost_client, NULL,
                                NULL);
    client_id = g_new(guint, 1);
    *client_id = watch_id;
    g_hash_table_insert(g_context.clients, g_strdup(client_name),
                        client_id);

out:
    DLEYNA_LOG_DEBUG("Exit");

    return added;
}
Exemplo n.º 5
0
static gpointer create_queue_consumer_thread(gpointer data)
{
    while (create_thread != NULL)
    {
        gchar *busname = g_async_queue_try_pop(create_queue);

        if (busname != NULL)
        {
            g_bus_unwatch_name(
                g_bus_watch_name(
                    G_BUS_TYPE_SESSION,
                    busname,
                    G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
                    NULL,
                    NULL,
                    NULL,
                    NULL));

            g_free(busname);
        }

        /*
        ** Wait two seconds to prevent flooding the server if
        ** all instances just vanished and they are all queued
        ** to respawn.
        */
        g_usleep(2000000L);
    }

    return NULL;
}
static void
gis_privacy_page_constructed (GObject *object)
{
  GisPrivacyPage *page = GIS_PRIVACY_PAGE (object);
  GisPrivacyPagePrivate *priv = gis_privacy_page_get_instance_private (page);

  G_OBJECT_CLASS (gis_privacy_page_parent_class)->constructed (object);

  gis_page_set_complete (GIS_PAGE (page), TRUE);

  priv->location_settings = g_settings_new ("org.gnome.system.location");
  priv->privacy_settings = g_settings_new ("org.gnome.desktop.privacy");

  gtk_switch_set_active (GTK_SWITCH (priv->location_switch), TRUE);
  gtk_switch_set_active (GTK_SWITCH (priv->reporting_switch), TRUE);

  update_os_data (page);

  priv->abrt_watch_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
                                          "org.freedesktop.problems.daemon",
                                          G_BUS_NAME_WATCHER_FLAGS_NONE,
                                          abrt_appeared_cb,
                                          abrt_vanished_cb,
                                          page,
                                          NULL);
}
Exemplo n.º 7
0
static void
on_dbus_ready(GObject *object, GAsyncResult *res, gpointer user_data)
{
  IndicatorWorkrave *self = INDICATOR_WORKRAVE(user_data);
  IndicatorWorkravePrivate *priv = INDICATOR_WORKRAVE_GET_PRIVATE(self);

  GError *error = NULL;
  GDBusProxy *proxy = g_dbus_proxy_new_for_bus_finish(res, &error);

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

  if (error != NULL)
    {
      g_warning("Could not grab DBus proxy for %s: %s", WORKRAVE_INDICATOR_SERVICE_NAME, error->message);
      g_error_free(error);
    }
  else
    {
      g_signal_connect(proxy, "g-signal", G_CALLBACK(on_dbus_signal), self);
      priv->workrave_proxy = proxy;

      priv->watch_id = g_bus_watch_name(G_BUS_TYPE_SESSION,
                                        "org.workrave.Workrave",
                                        G_BUS_NAME_WATCHER_FLAGS_NONE,
                                        on_workrave_appeared,
                                        on_workrave_vanished,
                                        self,
                                        NULL);
    }
}
static void
enterprise_init (UmAccountDialog *self,
                 GtkBuilder *builder)
{
        GtkWidget *widget;

        self->enterprise_realms = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_OBJECT);

        widget = (GtkWidget *) gtk_builder_get_object (builder, "enterprise-domain");
        g_signal_connect (widget, "changed", G_CALLBACK (on_domain_changed), self);
        self->enterprise_domain = GTK_COMBO_BOX (widget);
        gtk_combo_box_set_model (self->enterprise_domain,
                                 GTK_TREE_MODEL (self->enterprise_realms));
        gtk_combo_box_set_entry_text_column (self->enterprise_domain, 0);
        self->enterprise_domain_entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (widget)));

        widget = (GtkWidget *) gtk_builder_get_object (builder, "enterprise-login");
        g_signal_connect (widget, "changed", G_CALLBACK (on_entry_changed), self);
        self->enterprise_login = GTK_ENTRY (widget);

        widget = (GtkWidget *) gtk_builder_get_object (builder, "enterprise-password");
        g_signal_connect (widget, "changed", G_CALLBACK (on_entry_changed), self);
        self->enterprise_password = GTK_ENTRY (widget);

        /* Initially we hide the 'Enterprise Login' stuff */
        widget = (GtkWidget *) gtk_builder_get_object (builder, "enterprise-button");
        self->enterprise_button = widget;
        gtk_widget_hide (widget);

        self->realmd_watch = g_bus_watch_name (G_BUS_TYPE_SYSTEM, "org.freedesktop.realmd",
                                               G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
                                               on_realmd_appeared, on_realmd_disappeared,
                                               self, NULL);
}
Exemplo n.º 9
0
/* Quit running application and restart application */
static gboolean _restart(XfdashboardApplication *inApplication)
{
	GMainLoop			*mainLoop;
	guint				dbusWatcherID;
	GSource				*timeoutSource;
	RestartData			restartData;

	g_return_val_if_fail(XFDASHBOARD_IS_APPLICATION(inApplication), FALSE);

	/* Create main loop for watching DBUS for application to disappear */
	mainLoop=g_main_loop_new(NULL, FALSE);

	/* Set up user data for callbacks */
	restartData.mainLoop=mainLoop;
	restartData.application=inApplication;
	restartData.appHasQuitted=FALSE;

	/* Set up DBUS watcher to get noticed when application disappears
	 * which means it is safe to start a new instance. But if it takes
	 * too long assume that either application did not quit and is still
	 * running or we did get notified although we set up DBUS watcher
	 * before quitting application.
	 */
	dbusWatcherID=g_bus_watch_name(G_BUS_TYPE_SESSION,
									g_application_get_application_id(G_APPLICATION(inApplication)),
									G_BUS_NAME_WATCHER_FLAGS_NONE,
									_on_dbus_watcher_name_appeared,
									_on_dbus_watcher_name_vanished,
									&restartData,
									NULL);

	/* Add an idle source to main loop to quit running application _after_
	 * the main loop is running and the DBUS watcher was set up.
	 */
	timeoutSource=g_timeout_source_new(DEFAULT_RESTART_WAIT_TIMEOUT);
	g_source_set_callback(timeoutSource, _on_quit_timeout, &restartData, NULL);
	g_source_attach(timeoutSource, g_main_loop_get_context(mainLoop));
	g_source_unref(timeoutSource);

	/* Run main loop */
	g_debug("Starting main loop for waiting the application to quit");
	g_main_loop_run(mainLoop);
	g_debug("Returned from main loop for waiting the application to quit");

	/* Show warning if timeout had been reached */
	if(!restartData.appHasQuitted)
	{
		g_warning(_("Cannot restart application: Failed to quit running instance"));
	}

	/* Destroy DBUS watcher */
	g_bus_unwatch_name(dbusWatcherID);

	/* Return TRUE if application was quitted successfully
	 * otherwise FALSE.
	 */
	return(restartData.appHasQuitted);
}
Exemplo n.º 10
0
void startWatchDbus(jlogger jlog, jrunnable onAppmenuServiceAppeared, jrunnable onAppmenuServiceVanished) {
  // NOTE: main-loop is necessary for communication with dbus (via glib and it's signals)
  // It is started in java (see invocation com.sun.javafx.application.PlatformImpl.startup())
  _ourLogger = jlog;
  _ourOnServiceAppearedCallback = onAppmenuServiceAppeared;
  _ourOnServiceVanishedCallback = onAppmenuServiceVanished;
  _ourServiceNameWatcher = g_bus_watch_name(G_BUS_TYPE_SESSION, DBUS_NAME, G_BUS_NAME_WATCHER_FLAGS_NONE, _onNameAppeared, _onNameVanished, NULL, NULL);
  // _info("start watching for dbus name 'com.canonical.AppMenu.Registrar'");
}
Exemplo n.º 11
0
int ofono_wan_probe(struct wan_service *service)
{
	struct ofono_wan_data *data;

	data = g_try_new0(struct ofono_wan_data, 1);
	if (!data)
		return -ENOMEM;

	wan_service_set_data(service, data);
	data->service = service;

	data->service_watch = g_bus_watch_name(G_BUS_TYPE_SYSTEM, "org.ofono", G_BUS_NAME_WATCHER_FLAGS_NONE,
					 service_appeared_cb, service_vanished_cb, data, NULL);

	data->connman_watch = g_bus_watch_name(G_BUS_TYPE_SYSTEM, "net.connman", G_BUS_NAME_WATCHER_FLAGS_NONE,
					connman_appeared_cb, connman_vanished_cb, data, NULL);

	return 0;
}
static void
gpm_phone_init (GpmPhone *phone)
{
        phone->priv = GPM_PHONE_GET_PRIVATE (phone);
        phone->priv->watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
                                                  CINNAMON_PHONE_MANAGER_DBUS_SERVICE,
                                                  G_BUS_NAME_WATCHER_FLAGS_NONE,
                                                  (GBusNameAppearedCallback) gpm_phone_service_appeared_cb,
                                                  (GBusNameVanishedCallback) gpm_phone_service_vanished_cb,
                                                  phone, NULL);
}
Exemplo n.º 13
0
static void
carrick_connman_manager_init (CarrickConnmanManager *self)
{
  self->priv = CONNMAN_MANAGER_PRIVATE (self);

  g_bus_watch_name (G_BUS_TYPE_SYSTEM,
                    "net.connman",
                    G_BUS_NAME_WATCHER_FLAGS_NONE,
                    (GBusNameAppearedCallback)_connman_appeared_cb,
                    (GBusNameVanishedCallback)_connman_vanished_cb,
                    self, NULL);
}
Exemplo n.º 14
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));
}
Exemplo n.º 16
0
/**
 * g_bus_watch_name_with_closures: (rename-to g_bus_watch_name)
 * @bus_type: The type of bus to watch a name on.
 * @name: The name (well-known or unique) to watch.
 * @flags: Flags from the #GBusNameWatcherFlags enumeration.
 * @name_appeared_closure: (nullable): #GClosure to invoke when @name is known
 * to exist or %NULL.
 * @name_vanished_closure: (nullable): #GClosure to invoke when @name is known
 * to not exist or %NULL.
 *
 * Version of g_bus_watch_name() using closures instead of callbacks for
 * easier binding in other languages.
 *
 * Returns: An identifier (never 0) that an be used with
 * g_bus_unwatch_name() to stop watching the name.
 *
 * Since: 2.26
 */
guint
g_bus_watch_name_with_closures (GBusType                 bus_type,
                                const gchar             *name,
                                GBusNameWatcherFlags     flags,
                                GClosure                *name_appeared_closure,
                                GClosure                *name_vanished_closure)
{
  return g_bus_watch_name (bus_type,
          name,
          flags,
          name_appeared_closure != NULL ? watch_with_closures_on_name_appeared : NULL,
          name_vanished_closure != NULL ? watch_with_closures_on_name_vanished : NULL,
          watch_name_data_new (name_appeared_closure, name_vanished_closure),
          bus_watch_name_free_func);
}
Exemplo n.º 17
0
GtkWidget *
do_application (GtkWidget *toplevel)
{
  static guint watch = 0;

  if (watch == 0)
    watch = g_bus_watch_name (G_BUS_TYPE_SESSION,
                              "org.gtk.Demo2",
                              0,
                              on_name_appeared,
                              on_name_vanished,
                              NULL, NULL);

  if (placeholder == NULL)
    {
      const gchar *command;
      GError *error = NULL;

      if (g_file_test ("./gtk3-demo-application" APP_EXTENSION, G_FILE_TEST_IS_EXECUTABLE))
        command = "./gtk3-demo-application" APP_EXTENSION;
      else
        command = "gtk3-demo-application";

      if (!g_spawn_command_line_async (command, &error))
        {
          g_warning ("%s", error->message);
          g_error_free (error);
        }

      placeholder = gtk_label_new ("");
      g_object_ref_sink (placeholder);
    }
  else
    {
      g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL),
                              "org.gtk.Demo2",
                              "/org/gtk/Demo2",
                              "org.gtk.Actions",
                              "Activate",
                              g_variant_new ("(sava{sv})", "quit", NULL, NULL),
                              NULL,
                              0,
                              G_MAXINT,
                              NULL, NULL);
    }

  return placeholder;
}
static void
cc_ua_panel_init_seeing (CcUaPanel *self)
{
  CcUaPanelPrivate *priv = self->priv;

  g_settings_bind_with_mapping (priv->interface_settings, KEY_GTK_THEME,
                                WID (priv->builder, "seeing_contrast_switch"),
                                "active", G_SETTINGS_BIND_DEFAULT,
                                get_contrast_mapping,
                                set_contrast_mapping,
                                self,
                                NULL);
  g_settings_bind_with_mapping (priv->interface_settings, KEY_TEXT_SCALING_FACTOR,
                                WID (priv->builder, "seeing_large_text_switch"),
                                "active", G_SETTINGS_BIND_DEFAULT,
                                get_large_text_mapping,
                                set_large_text_mapping,
                                priv->interface_settings,
                                NULL);

  g_settings_bind (priv->kb_settings, "togglekeys-enable",
                   WID (priv->builder, "seeing_toggle_keys_switch"), "active",
                   G_SETTINGS_BIND_DEFAULT);

  priv->shell_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
					   "org.gnome.Shell",
					   G_BUS_NAME_WATCHER_FLAGS_NONE,
					   (GBusNameAppearedCallback) shell_appeared_cb,
					   (GBusNameVanishedCallback) shell_vanished_cb,
					   self,
					   NULL);
  g_signal_connect (WID (priv->builder, "seeing_zoom_preferences_button"),
                    "clicked",
                    G_CALLBACK (zoom_options_launch_cb), self);
  g_settings_bind (priv->application_settings, "screen-magnifier-enabled",
                   WID (priv->builder, "seeing_zoom_switch"), "active",
                   G_SETTINGS_BIND_DEFAULT);

  settings_on_off_editor_new (priv, priv->application_settings,
                              "screen-reader-enabled",
                              WID (priv->builder, "seeing_reader_switch"),
                              NULL);

  cc_ua_panel_set_shortcut_label (self, "seeing_zoom_enable_keybinding_label", "magnifier");
  cc_ua_panel_set_shortcut_label (self, "seeing_zoom_in_keybinding_label", "magnifier-zoom-in");
  cc_ua_panel_set_shortcut_label (self, "seeing_zoom_out_keybinding_label", "magnifier-zoom-out");
  cc_ua_panel_set_shortcut_label (self, "seeing_reader_enable_keybinding_label", "screenreader");
}
Exemplo n.º 19
0
int main (int argc, char **argv)
{
	watch_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
				     "net.hadess.SensorProxy",
				     G_BUS_NAME_WATCHER_FLAGS_NONE,
				     appeared_cb,
				     vanished_cb,
				     NULL, NULL);

	accel_claimed = als_claimed = FALSE;

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

	return 0;
}
static void
add_abrt (CcPrivacyPanel *self)
{
  GtkWidget *w;
  GtkWidget *dialog;
  char *os_name, *url, *msg;

  w = get_abrt_label (self->priv->privacy_settings, REPORT_TECHNICAL_PROBLEMS);
  self->priv->abrt_row = add_row (self, _("Problem Reporting"), "abrt_dialog", w);
  gtk_widget_hide (self->priv->abrt_row);

  dialog = self->priv->abrt_dialog;
  g_signal_connect (dialog, "delete-event",
                    G_CALLBACK (gtk_widget_hide_on_delete), NULL);

  w = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "abrt_switch"));
  g_settings_bind (self->priv->privacy_settings, REPORT_TECHNICAL_PROBLEMS,
                   w, "active",
                   G_SETTINGS_BIND_DEFAULT);

  os_name = get_os_name ();
  /* translators: '%s' is the distributor's name, such as 'Fedora' */
  msg = g_strdup_printf (_("Sending reports of technical problems helps us improve %s. Reports are sent anonymously and are scrubbed of personal data."),
                         os_name);
  g_free (os_name);
  gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (self->priv->builder, "abrt_explanation_label")), msg);
  g_free (msg);

  url = get_privacy_policy_url ();
  if (!url)
    {
      g_debug ("Not watching for ABRT appearing, /etc/os-release lacks a privacy policy URL");
      return;
    }
  msg = g_strdup_printf ("<a href=\"%s\">%s</a>", url, _("Privacy Policy"));
  g_free (url);
  gtk_label_set_markup (GTK_LABEL (gtk_builder_get_object (self->priv->builder, "abrt_policy_linklabel")), msg);
  g_free (msg);

  self->priv->abrt_watch_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
                                                "org.freedesktop.problems.daemon",
                                                G_BUS_NAME_WATCHER_FLAGS_NONE,
                                                abrt_appeared_cb,
                                                abrt_vanished_cb,
                                                self,
                                                NULL);
}
Exemplo n.º 21
0
static void
cc_ua_panel_init_seeing (CcUaPanel *self)
{
  CcUaPanelPrivate *priv = self->priv;

  text_scaling_factor_notify_cb (priv->interface_settings, "text-scaling-factor", self);
  g_signal_connect (priv->interface_settings, "changed::text-scaling-factor", G_CALLBACK (text_scaling_factor_notify_cb), self);

  g_signal_connect (WID (priv->builder, "seeing_contrast_combobox"), "changed",
                    G_CALLBACK (contrast_combobox_changed_cb), self);

  g_signal_connect (WID (priv->builder, "seeing_text_size_combobox"), "changed",
                    G_CALLBACK (text_scaling_factor_combo_box_changed), self);

  g_settings_bind (priv->kb_settings, "togglekeys-enable",
                   WID (priv->builder, "seeing_enable_toggle_keys_checkbutton"), "active",
                   G_SETTINGS_BIND_DEFAULT);

  priv->shell_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
					   "org.gnome.Shell",
					   G_BUS_NAME_WATCHER_FLAGS_NONE,
					   (GBusNameAppearedCallback) shell_appeared_cb,
					   (GBusNameVanishedCallback) shell_vanished_cb,
					   self,
					   NULL);
  g_signal_connect (WID (priv->builder, "seeing_zoom_preferences_button"),
                    "clicked",
                    G_CALLBACK (zoom_options_launch_cb), self);
  g_settings_bind (priv->application_settings, "screen-magnifier-enabled",
                   WID (priv->builder, "seeing_zoom_switch"), "active",
                   G_SETTINGS_BIND_DEFAULT);

  settings_on_off_editor_new (priv, priv->application_settings,
                              "screen-reader-enabled",
                              WID (priv->builder, "seeing_reader_switch"),
                              NULL);

  cc_ua_panel_set_shortcut_label (self, "seeing_contrast_toggle_keybinding_label", "toggle-contrast");
  cc_ua_panel_set_shortcut_label (self, "seeing_increase_size_keybinding_label", "increase-text-size");
  cc_ua_panel_set_shortcut_label (self, "seeing_decrease_size_keybinding_label", "decrease-text-size");
  cc_ua_panel_set_shortcut_label (self, "seeing_zoom_enable_keybinding_label", "magnifier");
  cc_ua_panel_set_shortcut_label (self, "seeing_zoom_in_keybinding_label", "magnifier-zoom-in");
  cc_ua_panel_set_shortcut_label (self, "seeing_zoom_out_keybinding_label", "magnifier-zoom-out");
  cc_ua_panel_set_shortcut_label (self, "seeing_reader_enable_keybinding_label", "screenreader");
}
Exemplo n.º 22
0
/**
 * gpm_phone_init:
 * @phone: This class instance
 **/
static void
gpm_phone_init (GpmPhone *phone)
{
    phone->priv = GPM_PHONE_GET_PRIVATE (phone);

    phone->priv->connection = NULL;
    phone->priv->proxy = NULL;
    phone->priv->present = FALSE;
    phone->priv->percentage = 0;
    phone->priv->onac = FALSE;

    phone->priv->watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
                            MATE_PHONE_MANAGER_DBUS_SERVICE,
                            G_BUS_NAME_WATCHER_FLAGS_NONE,
                            (GBusNameAppearedCallback) gpm_phone_service_appeared_cb,
                            (GBusNameVanishedCallback) gpm_phone_service_vanished_cb,
                            phone, NULL);
}
Exemplo n.º 23
0
static void
cockpit_fake_manager_constructed (GObject *object)
{
  CockpitFakeManager *self = COCKPIT_FAKE_MANAGER (object);
  GBusNameWatcherFlags flags;

  G_OBJECT_CLASS (cockpit_fake_manager_parent_class)->constructed (object);

  flags = G_BUS_NAME_WATCHER_FLAGS_NONE;
  if (!(self->flags & G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START))
    flags |= G_BUS_NAME_WATCHER_FLAGS_AUTO_START;

  g_debug ("fakemanager: watching bus name: %s", self->bus_name);
  self->bus_name_watch = g_bus_watch_name (self->bus_type, self->bus_name, flags,
                                           on_bus_name_appeared,
                                           on_bus_name_vanished,
                                           self, NULL);
}
static void
initialize (GoaProvider *provider)
{
  static gsize once_init_value = 0;

  if (g_once_init_enter (&once_init_value))
    {
      name_watcher_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
                                          "org.gnome.OnlineAccounts",
                                          G_BUS_NAME_WATCHER_FLAGS_NONE,
                                          on_name_acquired,
                                          NULL,
                                          NULL,
                                          NULL);

      g_once_init_leave (&once_init_value, 1);
    }
}
Exemplo n.º 25
0
static void
fcitx_client_init(FcitxClient *self)
{
    self->priv = FCITX_CLIENT_GET_PRIVATE(self);

    sprintf(self->priv->servicename, "%s-%d", FCITX_DBUS_SERVICE, fcitx_utils_get_display_number());

    self->priv->watch_id = g_bus_watch_name(
                       G_BUS_TYPE_SESSION,
                       self->priv->servicename,
                       G_BUS_NAME_WATCHER_FLAGS_NONE,
                       _fcitx_client_appear,
                       _fcitx_client_vanish,
                       self,
                       NULL
                   );
    self->priv->improxy = NULL;
    self->priv->icproxy = NULL;
}
Exemplo n.º 26
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
_fprint_device_add_client (FprintDevice *rdev, const char *sender)
{
	FprintDevicePrivate *priv = DEVICE_GET_PRIVATE(rdev);
	guint id;

	id = GPOINTER_TO_UINT (g_hash_table_lookup (priv->clients, sender));
	if (id == 0) {
		id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
				       sender,
				       G_BUS_NAME_WATCHER_FLAGS_NONE,
				       NULL,
				       (GBusNameVanishedCallback) _fprint_device_client_vanished,
				       rdev,
				       NULL);
		g_hash_table_insert (priv->clients, g_strdup (sender), GUINT_TO_POINTER(id));
		g_object_notify (G_OBJECT (rdev), "in-use");
	}
}
Exemplo n.º 28
0
static void
constructed (GObject *object)
{
	NMDevice *device = NM_DEVICE (object);
	NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (object);
	char *tmp_str = NULL;

	G_OBJECT_CLASS (nm_device_team_parent_class)->constructed (object);

	/* Register D-Bus name watcher */
	tmp_str = g_strdup_printf ("org.libteam.teamd.%s", nm_device_get_ip_iface (device));
	priv->teamd_dbus_watch = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
	                                           tmp_str,
	                                           G_BUS_NAME_WATCHER_FLAGS_NONE,
	                                           teamd_dbus_appeared,
	                                           teamd_dbus_vanished,
	                                           NM_DEVICE (device),
	                                           NULL);
	g_free (tmp_str);
}
Exemplo n.º 29
0
con_gnome_media_keys *
init_gnome_media_keys (PraghaApplication *pragha)
{
    con_gnome_media_keys *gmk = g_slice_new0(con_gnome_media_keys);

    gmk->pragha = pragha;

    gmk->watch_id = g_bus_watch_name(G_BUS_TYPE_SESSION,
                                     "org.gnome.SettingsDaemon",
                                     G_BUS_NAME_WATCHER_FLAGS_NONE,
                                     (GBusNameAppearedCallback) name_appeared_cb,
                                     (GBusNameVanishedCallback) name_vanished_cb,
                                     gmk,
                                     NULL);

    gmk->handler_id = g_signal_connect(G_OBJECT(pragha_application_get_window(pragha)), "focus-in-event",
                                       G_CALLBACK(on_window_focus_in_event), gmk);

    return gmk;
}
Exemplo n.º 30
0
int ofono_probe(struct telephony_service *service)
{
	struct ofono_data *data;

	data = g_try_new0(struct ofono_data, 1);
	if (!data)
		return -ENOMEM;

	telephony_service_set_data(service, data);
	data->service = service;

	data->sim_status = TELEPHONY_SIM_STATUS_SIM_INVALID;
	data->initializing = false;
	data->calls = g_hash_table_new_full(g_str_hash, g_str_equal,
										g_free, (GDestroyNotify) g_hash_table_destroy);

	data->service_watch = g_bus_watch_name(G_BUS_TYPE_SYSTEM, "org.ofono", G_BUS_NAME_WATCHER_FLAGS_NONE,
					 service_appeared_cb, service_vanished_cb, data, NULL);

	return 0;
}