Пример #1
7
int main(int argc, char **argv)
{
	GOptionContext *context;
	GMainLoop *loop;
	GError *err = NULL;
	DBusGProxy *dev;
	char *username;

	g_type_init();

	dbus_g_object_register_marshaller (fprintd_marshal_VOID__STRING_BOOLEAN,
					   G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);

	context = g_option_context_new ("Verify a fingerprint");
	g_option_context_add_main_entries (context, entries, NULL);

	if (g_option_context_parse (context, &argc, &argv, &err) == FALSE) {
		g_print ("couldn't parse command-line options: %s\n", err->message);
		g_error_free (err);
		return 1;
	}

	if (usernames == NULL) {
		username = "";
	} else {
		username = usernames[0];
	}

	if (g_fatal_warnings) {
		GLogLevelFlags fatal_mask;

		fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
		fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
		g_log_set_always_fatal (fatal_mask);
	}

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

	dev = open_device(username);
	find_finger(dev, username);
	do_verify(dev);
	release_device(dev);
	return 0;
}
Пример #2
0
DBusGProxy *iskufx_dbus_proxy_new(void) {
	DBusGProxy *proxy;

	proxy = dbus_roccat_proxy_new_for_name(
			ROCCAT_DBUS_SERVER_NAME,
			ISKUFX_DBUS_SERVER_PATH,
			ISKUFX_DBUS_SERVER_INTERFACE);

	if (!proxy)
		return NULL;

	dbus_g_object_register_marshaller(g_cclosure_marshal_VOID__UCHAR,
			G_TYPE_NONE, G_TYPE_UCHAR, G_TYPE_INVALID);

	dbus_g_object_register_marshaller(g_cclosure_roccat_marshal_VOID__UCHAR_UCHAR,
			G_TYPE_NONE, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_INVALID);

	dbus_g_object_register_marshaller(g_cclosure_roccat_marshal_VOID__UCHAR_UCHAR_STRING,
			G_TYPE_NONE, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING, G_TYPE_INVALID);

	dbus_g_proxy_add_signal(proxy, "ProfileChanged", G_TYPE_UCHAR, G_TYPE_INVALID);
	dbus_g_proxy_add_signal(proxy, "BrightnessChanged", G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_INVALID);
	dbus_g_proxy_add_signal(proxy, "MacroChanged", G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING, G_TYPE_INVALID);

	return proxy;
}
DBusGProxy *
_notify_get_g_proxy (void)
{
        GError          *error;
        DBusGConnection *bus;

        if (_proxy != NULL)
                return _proxy;

        /* lazily initialize D-Bus connection */
        error = NULL;
        bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
        if (error != NULL) {
                g_error_free (error);
                return NULL;
        }

        _proxy = dbus_g_proxy_new_for_name (bus,
                                            NOTIFY_DBUS_NAME,
                                            NOTIFY_DBUS_CORE_OBJECT,
                                            NOTIFY_DBUS_CORE_INTERFACE);
        dbus_g_connection_unref (bus);

        g_signal_connect (_proxy,
                          "destroy",
                          G_CALLBACK (on_proxy_destroy),
                          NULL);

        dbus_g_object_register_marshaller (notify_marshal_VOID__UINT_UINT,
                                           G_TYPE_NONE,
                                           G_TYPE_UINT,
                                           G_TYPE_UINT,
                                           G_TYPE_INVALID);

        dbus_g_object_register_marshaller (notify_marshal_VOID__UINT_STRING,
                                           G_TYPE_NONE,
                                           G_TYPE_UINT,
                                           G_TYPE_STRING,
                                           G_TYPE_INVALID);

        dbus_g_proxy_add_signal (_proxy,
                                 "NotificationClosed",
                                 G_TYPE_UINT,
                                 G_TYPE_UINT,
                                 G_TYPE_INVALID);
        dbus_g_proxy_add_signal (_proxy,
                                 "ActionInvoked",
                                 G_TYPE_UINT,
                                 G_TYPE_STRING,
                                 G_TYPE_INVALID);

        if (!_notify_update_spec_version ()) {
               return NULL;
        }

        return _proxy;
}
Пример #4
0
void
geoclue_types_init (void)
{
	if (initted != FALSE)
		return;

	dbus_g_object_register_marshaller (geoclue_marshal_VOID__INT_INT_DOUBLE_DOUBLE_DOUBLE,
					   G_TYPE_NONE,
					   G_TYPE_INT,
					   G_TYPE_INT,
					   G_TYPE_DOUBLE,
					   G_TYPE_DOUBLE,
					   G_TYPE_DOUBLE,
					   G_TYPE_INVALID);
        dbus_g_object_register_marshaller (geoclue_marshal_VOID__INT_INT_DOUBLE_DOUBLE_DOUBLE_BOXED,
                                           G_TYPE_NONE,
                                           G_TYPE_INT,
					   G_TYPE_INT,
					   G_TYPE_DOUBLE,
					   G_TYPE_DOUBLE,
					   G_TYPE_DOUBLE,
                                           G_TYPE_BOXED,
					   G_TYPE_INVALID);
	
	dbus_g_object_register_marshaller (geoclue_marshal_VOID__INT_BOXED_BOXED,
					   G_TYPE_NONE,
					   G_TYPE_INT,
					   G_TYPE_BOXED,
					   G_TYPE_BOXED,
					   G_TYPE_INVALID);
	
	dbus_g_object_register_marshaller (geoclue_marshal_VOID__STRING_STRING_STRING_STRING,
	                                   G_TYPE_NONE,
	                                   G_TYPE_STRING,
	                                   G_TYPE_STRING,
	                                   G_TYPE_STRING,
	                                   G_TYPE_STRING,
	                                   G_TYPE_INVALID);

	dbus_g_object_register_marshaller (geoclue_marshal_VOID__INT_INT_INT_POINTER_POINTER,
					   G_TYPE_NONE,
					   G_TYPE_INT,
					   G_TYPE_INT,
					   G_TYPE_INT,
					   DBUS_TYPE_G_INT_ARRAY,
					   GEOCLUE_SATELLITE_INFO_ARRAY,
					   G_TYPE_INVALID);

	dbus_g_error_domain_register (GEOCLUE_ERROR,
				      GEOCLUE_ERROR_DBUS_INTERFACE,
				      GEOCLUE_TYPE_ERROR);

	initted = TRUE;
}
static void
interface_add_done (NMSupplicantInterface *self, char *path)
{
	NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);

	nm_log_dbg (LOGD_SUPPLICANT, "(%s): interface added to supplicant", priv->dev);

	priv->object_path = path;

	priv->iface_proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (priv->dbus_mgr),
	                                               WPAS_DBUS_SERVICE,
	                                               path,
	                                               WPAS_DBUS_IFACE_INTERFACE);

	dbus_g_object_register_marshaller (g_cclosure_marshal_VOID__BOXED,
	                                   G_TYPE_NONE,
	                                   DBUS_TYPE_G_MAP_OF_VARIANT,
	                                   G_TYPE_INVALID);
	dbus_g_proxy_add_signal (priv->iface_proxy, "PropertiesChanged",
	                         DBUS_TYPE_G_MAP_OF_VARIANT, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->iface_proxy, "PropertiesChanged",
	                             G_CALLBACK (wpas_iface_properties_changed),
	                             self, NULL);

	dbus_g_proxy_add_signal (priv->iface_proxy, "ScanDone",
	                         G_TYPE_BOOLEAN, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->iface_proxy, "ScanDone",
	                             G_CALLBACK (wpas_iface_scan_done),
	                             self,
	                             NULL);

	dbus_g_object_register_marshaller (_nm_marshal_VOID__STRING_BOXED,
	                                   G_TYPE_NONE,
	                                   DBUS_TYPE_G_OBJECT_PATH, DBUS_TYPE_G_MAP_OF_VARIANT,
	                                   G_TYPE_INVALID);
	dbus_g_proxy_add_signal (priv->iface_proxy, "BSSAdded", 
	                         DBUS_TYPE_G_OBJECT_PATH, DBUS_TYPE_G_MAP_OF_VARIANT,
	                         G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->iface_proxy, "BSSAdded",
	                             G_CALLBACK (wpas_iface_bss_added),
	                             self,
	                             NULL);

	priv->props_proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (priv->dbus_mgr),
	                                               WPAS_DBUS_SERVICE,
	                                               path,
	                                               DBUS_INTERFACE_PROPERTIES);
	/* Get initial properties */
	wpas_iface_get_props (self);

	set_state (self, NM_SUPPLICANT_INTERFACE_STATE_READY);
}
Пример #6
0
static void listen_tracker (GtkListStore *model)
{
#if 0

	DBusGConnection *bus;
	DBusGProxy *wrap;

	bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
	dbus_g_object_register_marshaller (marshal_VOID__BOXED_BOXED, G_TYPE_NONE, G_TYPE_STRV, G_TYPE_STRV, G_TYPE_INVALID);

	wrap = dbus_g_proxy_new_for_name (bus,
					  "org.freedesktop.Tracker1",
					  "/org/freedesktop/Tracker1/Resources/Classes/mfo/FeedChannel",
					  "org.freedesktop.Tracker1.Resources.Class");

	dbus_g_proxy_add_signal (wrap, "SubjectsAdded", G_TYPE_STRV, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (wrap, "SubjectsAdded", G_CALLBACK (channel_added_cb), model, NULL);

	dbus_g_proxy_add_signal (wrap, "SubjectsChanged", G_TYPE_STRV, G_TYPE_STRV, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (wrap, "SubjectsChanged", G_CALLBACK (channel_changed_cb), model, NULL);

	dbus_g_proxy_add_signal (wrap, "SubjectsRemoved", G_TYPE_STRV, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (wrap, "SubjectsRemoved", G_CALLBACK (channel_removed_cb), model, NULL);

#endif
}
Пример #7
0
static void
set_session_over_handler (DBusGConnection *bus, MateSettingsManager *manager)
{
        DBusGProxy *session_proxy;

        g_assert (bus != NULL);

        mate_settings_profile_start (NULL);

        session_proxy =
                 dbus_g_proxy_new_for_name (bus,
                                            MATE_SESSION_DBUS_NAME,
                                            MATE_SESSION_DBUS_OBJECT,
                                            MATE_SESSION_DBUS_INTERFACE);

        dbus_g_object_register_marshaller (
                g_cclosure_marshal_VOID__VOID,
                G_TYPE_NONE,
                G_TYPE_INVALID);

        dbus_g_proxy_add_signal (session_proxy,
                                 "SessionOver",
                                 G_TYPE_INVALID);

        dbus_g_proxy_connect_signal (session_proxy,
                                     "SessionOver",
                                     G_CALLBACK (on_session_over),
                                     manager,
                                     NULL);

        watch_for_term_signal (manager);
        mate_settings_profile_end (NULL);
}
Пример #8
0
static void start_avahi_service_browser(DBusGConnection *bus_system){
    GError *error = NULL;
    char *service_browser_path;
    if (!dbus_g_proxy_call(proxy_avahi_service, "ServiceBrowserNew", &error,
            G_TYPE_INT, -1, G_TYPE_INT, -1, G_TYPE_STRING, "_http._tcp",
            G_TYPE_STRING, "local", G_TYPE_UINT, 0, G_TYPE_INVALID,
            DBUS_TYPE_G_OBJECT_PATH, &service_browser_path, G_TYPE_INVALID))
        lose_gerror("Failed to call ServiceBrowserNew", error);

    printf("new service browser (%s) has started.\n", service_browser_path);

    proxy_avahi_service_browser = dbus_g_proxy_new_for_name(bus_system,
            "org.freedesktop.Avahi", service_browser_path,
            "org.freedesktop.Avahi.ServiceBrowser");
    dbus_g_object_register_marshaller(
            _avahi_marshal_VOID__INT_INT_STRING_STRING_STRING_UINT, G_TYPE_NONE,
            G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
            G_TYPE_UINT, G_TYPE_INVALID);
//    dbus_g_object_register_marshaller(
//            _avahi_marshal_VOID__INT_INT_STRING_STRING_STRING_INT_UINT,
//            G_TYPE_NONE, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING,
//            G_TYPE_STRING, G_TYPE_INT, G_TYPE_UINT, G_TYPE_INVALID);
    dbus_g_proxy_add_signal(proxy_avahi_service_browser, "ItemNew", G_TYPE_INT,
            G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
            G_TYPE_UINT, G_TYPE_INVALID);
    dbus_g_proxy_connect_signal(proxy_avahi_service_browser, "ItemNew",
            G_CALLBACK(service_browser_ItemNew), NULL, NULL);
    dbus_g_proxy_add_signal(proxy_avahi_service_browser, "ItemRemove", G_TYPE_INT,
            G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
            G_TYPE_UINT, G_TYPE_INVALID);
    dbus_g_proxy_connect_signal(proxy_avahi_service_browser, "ItemRemove",
            G_CALLBACK(service_browser_ItemRemove), NULL, NULL);    
}
static void
geoclue_gsmloc_ofono_class_init (GeoclueGsmlocOfonoClass *klass)
{
	GObjectClass *o_class = (GObjectClass *)klass;
	GParamSpec *pspec;

	g_type_class_add_private (klass, sizeof (GeoclueGsmlocOfonoPrivate));

	o_class->dispose = geoclue_gsmloc_ofono_dispose;
	o_class->get_property = geoclue_gsmloc_ofono_get_property;

	dbus_g_object_register_marshaller (ofono_marshal_VOID__STRING_BOXED,
	                                   G_TYPE_NONE,
	                                   G_TYPE_STRING,
	                                   G_TYPE_VALUE,
	                                   G_TYPE_INVALID);

	signals[NETWORK_DATA_CHANGED] = g_signal_new (
			"network-data-changed",
			G_OBJECT_CLASS_TYPE (klass),
			G_SIGNAL_RUN_LAST, 0,
			NULL, NULL,
			ofono_marshal_VOID__STRING_STRING_STRING_STRING,
			G_TYPE_NONE, 4,
			G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);

	pspec = g_param_spec_boolean ("available",
	                              "Available",
	                              "Is oFono available",
	                              FALSE,
	                              G_PARAM_READABLE);
	g_object_class_install_property (o_class, PROP_AVAILABLE, pspec);
}
static gboolean
online_init (void)
{
  DBusGConnection *conn;

  if (proxy)
    return TRUE;

  conn = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
  if (!conn) {
    g_warning ("Cannot get connection to system message bus");
    return FALSE;
  }

  proxy = dbus_g_proxy_new_for_name (conn,
                                     "net.connman",
                                     "/",
                                     "net.connman.Manager");

  dbus_g_object_register_marshaller (g_cclosure_marshal_VOID__STRING,
                                     G_TYPE_NONE, G_TYPE_STRING,
				     G_TYPE_INVALID);
  dbus_g_proxy_add_signal (proxy, "StateChanged", G_TYPE_STRING, NULL);
  dbus_g_proxy_connect_signal (proxy, "StateChanged",
                               (GCallback)state_changed, NULL, NULL);

  current_state = FALSE;

  /* Get the current state */
  dbus_g_proxy_begin_call (proxy, "GetState", got_state_cb,
                           NULL, NULL, G_TYPE_INVALID);

  return TRUE;
}
Пример #11
0
void gnome_remote_init ()
{
    DBusGConnection *bus;
    GError *error = NULL;
    dbus_g_thread_init();

    bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
    if ((bus == NULL) || error) {
        g_warning ("Error connecting to DBus: %s", error->message);
    } else {
        media_player_keys_proxy = dbus_g_proxy_new_for_name (bus,
         "org.gnome.SettingsDaemon",
         "/org/gnome/SettingsDaemon/MediaKeys",
         "org.gnome.SettingsDaemon.MediaKeys");
        if (media_player_keys_proxy == NULL) return;

        dbus_g_proxy_call (media_player_keys_proxy,
         "GrabMediaPlayerKeys", &error,
         G_TYPE_STRING, "Audacious",
         G_TYPE_UINT, 0,
         G_TYPE_INVALID,
         G_TYPE_INVALID);
        if (error != NULL) {
            g_error_free (error);
            error = NULL;
            g_object_unref(media_player_keys_proxy);
            media_player_keys_proxy = NULL;
             media_player_keys_proxy = dbus_g_proxy_new_for_name (bus,
             "org.gnome.SettingsDaemon",
             "/org/gnome/SettingsDaemon",
             "org.gnome.SettingsDaemon");
            if (media_player_keys_proxy == NULL) return;

            dbus_g_proxy_call (media_player_keys_proxy,
             "GrabMediaPlayerKeys", &error,
             G_TYPE_STRING, "Audacious",
             G_TYPE_UINT, 0,
             G_TYPE_INVALID,
             G_TYPE_INVALID);
            if (error != NULL) {
                g_warning ("Could not grab media player keys: %s", error->message);
                g_error_free (error);
                g_object_unref(media_player_keys_proxy);
                media_player_keys_proxy = NULL;
                return;
            }
        }

        dbus_g_object_register_marshaller (hotkey_marshal_VOID__STRING_STRING,
         G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);

        dbus_g_proxy_add_signal (media_player_keys_proxy, "MediaPlayerKeyPressed",
         G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);

        dbus_g_proxy_connect_signal (media_player_keys_proxy, "MediaPlayerKeyPressed",
         G_CALLBACK (on_media_player_key_pressed), NULL, NULL);
    }
}
Пример #12
0
static void _cd_connect_to_resuming_signal (GldiModuleInstance *myApplet)
{
	if ((s_bUsedLogind = cairo_dock_dbus_detect_system_application ("org.freedesktop.login1")))
		myData.pProxyResuming = cairo_dock_create_new_system_proxy (
			"org.freedesktop.login1",
			"/org/freedesktop/login1",
			"org.freedesktop.login1.Manager");
	else if (cairo_dock_dbus_detect_system_application ("org.freedesktop.UPower"))
		myData.pProxyResuming = cairo_dock_create_new_system_proxy (
			"org.freedesktop.UPower",
			"/org/freedesktop/UPower",
			"org.freedesktop.UPower");

	if (myData.pProxyResuming == NULL) // no proxy found
	{
		cd_debug ("LoginD and UPower bus are not available, can't connect to 'resuming' signal");
		return;
	}

	if (s_bUsedLogind)
	{
		dbus_g_object_register_marshaller (
			g_cclosure_marshal_VOID__BOOLEAN,
			G_TYPE_BOOLEAN,
			G_TYPE_INVALID);

		dbus_g_proxy_add_signal (myData.pProxyResuming, "PrepareForSleep",
			G_TYPE_BOOLEAN, G_TYPE_INVALID);
		dbus_g_proxy_connect_signal (myData.pProxyResuming, "PrepareForSleep",
			G_CALLBACK (_on_prepare_for_sleep), myApplet, NULL);
	}
	else // UPower
	{
		dbus_g_object_register_marshaller (
			g_cclosure_marshal_VOID__VOID,
			G_TYPE_NONE,
			G_TYPE_INVALID);

		dbus_g_proxy_add_signal (myData.pProxyResuming, "Resuming",
			G_TYPE_INVALID);
		dbus_g_proxy_connect_signal (myData.pProxyResuming, "Resuming",
			G_CALLBACK (_on_resuming), myApplet, NULL);
	}
}
Пример #13
0
/**
 * gpm_phone_service_appeared_cb:
 */
static void
gpm_phone_service_appeared_cb (GDBusConnection *connection,
                               const gchar *name, const gchar *name_owner,
                               GpmPhone *phone)
{
    GError *error = NULL;

    g_return_if_fail (GPM_IS_PHONE (phone));

    if (phone->priv->connection == NULL) {
        egg_debug ("get connection");
        g_clear_error (&error);
        phone->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
        if (error != NULL) {
            egg_warning ("Could not connect to DBUS daemon: %s", error->message);
            g_error_free (error);
            phone->priv->connection = NULL;
            return;
        }
    }
    if (phone->priv->proxy == NULL) {
        egg_debug ("get proxy");
        g_clear_error (&error);
        phone->priv->proxy = dbus_g_proxy_new_for_name_owner (phone->priv->connection,
                             MATE_PHONE_MANAGER_DBUS_SERVICE,
                             MATE_PHONE_MANAGER_DBUS_PATH,
                             MATE_PHONE_MANAGER_DBUS_INTERFACE,
                             &error);
        if (error != NULL) {
            egg_warning ("Cannot connect, maybe the daemon is not running: %s", error->message);
            g_error_free (error);
            phone->priv->proxy = NULL;
            return;
        }

        /* complicated type. ick */
        dbus_g_object_register_marshaller(gpm_marshal_VOID__UINT_UINT_BOOLEAN,
                                          G_TYPE_NONE, G_TYPE_UINT, G_TYPE_UINT,
                                          G_TYPE_BOOLEAN, G_TYPE_INVALID);

        /* get BatteryStateChanged */
        dbus_g_proxy_add_signal (phone->priv->proxy, "BatteryStateChanged",
                                 G_TYPE_UINT, G_TYPE_UINT, G_TYPE_BOOLEAN, G_TYPE_INVALID);
        dbus_g_proxy_connect_signal (phone->priv->proxy, "BatteryStateChanged",
                                     G_CALLBACK (gpm_phone_battery_state_changed),
                                     phone, NULL);

        /* get NumberBatteriesChanged */
        dbus_g_proxy_add_signal (phone->priv->proxy, "NumberBatteriesChanged",
                                 G_TYPE_UINT, G_TYPE_INVALID);
        dbus_g_proxy_connect_signal (phone->priv->proxy, "NumberBatteriesChanged",
                                     G_CALLBACK (gpm_phone_num_batteries_changed),
                                     phone, NULL);

    }
}
gboolean cd_NetworkMonitor_connect_to_bus (void)
{
	cd_debug ("%s ()", __func__);
	//\_____________ On verifie la presence de NM sur le bus.
	if (! cairo_dock_dbus_detect_system_application("org.freedesktop.NetworkManager"))
		return FALSE;
	dbus_g_object_register_marshaller(g_cclosure_marshal_VOID__GHashTable_GHashTable,
		G_TYPE_NONE, CD_DBUS_TYPE_HASH_TABLE_OF_HASH_TABLE, G_TYPE_INVALID);  // pour la methode GetSettings (il faut le faire avant de recuperer tout proxy, sinon les signaux ne passent plus !)
	
	//\_____________ On recupere l'objet principal de NM.
	myData.dbus_proxy_NM = cairo_dock_create_new_system_proxy (
		"org.freedesktop.NetworkManager",
		"/org/freedesktop/NetworkManager",
		"org.freedesktop.NetworkManager");
	g_return_val_if_fail (DBUS_IS_G_PROXY (myData.dbus_proxy_NM), FALSE);
	myData.dbus_proxy_NM_prop = cairo_dock_create_new_system_proxy (
		"org.freedesktop.NetworkManager",
		"/org/freedesktop/NetworkManager",
		"org.freedesktop.DBus.Properties");
	g_return_val_if_fail (DBUS_IS_G_PROXY (myData.dbus_proxy_NM_prop), FALSE);
	
	//\_____________ On se connecte aux signaux de base : wifi active (WirelessEnabled && WirelessHardwareEnabled ), etat de NM (State).
	dbus_g_object_register_marshaller(g_cclosure_marshal_VOID__BOXED,
		G_TYPE_NONE, G_TYPE_HASH_TABLE ,G_TYPE_INVALID);  // enregistrement d'un marshaller specifique au signal (sinon impossible de le recuperer ni de le voir
	
	dbus_g_proxy_add_signal(myData.dbus_proxy_NM, "PropertiesChanged", CD_DBUS_TYPE_HASH_TABLE, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal(myData.dbus_proxy_NM, "PropertiesChanged",
		G_CALLBACK(onChangeNMProperties), NULL, NULL);
	
	//\_____________ On recupere l'objet des connections.
	myData.cServiceName = g_strdup ("org.freedesktop.NetworkManagerUserSettings");
	
	myData.dbus_proxy_Settings = cairo_dock_create_new_system_proxy (
		myData.cServiceName,
		"/org/freedesktop/NetworkManagerSettings",
		"org.freedesktop.NetworkManagerSettings");
	dbus_g_proxy_add_signal(myData.dbus_proxy_Settings, "NewConnection", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal(myData.dbus_proxy_Settings, "NewConnection",
		G_CALLBACK(onNewConnection), NULL, NULL);
	
	return TRUE;
}
int
main (int argc, char **argv)
{
  GtkTreeModel *model;
  GtkWidget    *tree;
  GtkWidget    *window;
  GtkWidget    *scrolled;

  if (!g_thread_supported ())
    {
      g_thread_init (NULL);
    }
  gtk_init (&argc, &argv);
  dbus_g_thread_init ();

  dbus_g_object_register_marshaller (connman_marshal_VOID__STRING_BOXED,
                                     /* return */
                                     G_TYPE_NONE,
                                     /* args */
                                     G_TYPE_STRING,
                                     G_TYPE_VALUE,
                                     /* eom */
                                     G_TYPE_INVALID);

  model = carrick_network_model_new ();
  tree = create_tree (model);
  gtk_tree_view_set_model (GTK_TREE_VIEW (tree),
                           GTK_TREE_MODEL (model));
  gtk_widget_show (tree);

  scrolled = gtk_scrolled_window_new (NULL, NULL);
  gtk_container_add (GTK_CONTAINER (scrolled),
                     tree);
  gtk_widget_show (scrolled);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (window,
                    "delete-event",
                    G_CALLBACK (gtk_main_quit),
                    NULL);
  gtk_container_add (GTK_CONTAINER (window),
                     scrolled);
  gtk_widget_show (window);

  gtk_main ();

  return 0;
}
Пример #16
0
void
uprof_init_real (void)
{
  static gboolean initialized = FALSE;

  if (initialized)
    return;

  g_type_init ();

#ifndef USE_RDTSC
  int ret;
  struct timespec ts;

  ret = clock_getcpuclockid(0, &clockid);
  if (ret == ENOENT)
    {
      g_warning ("Using the CPU clock will be unreliable on this system if "
                 "you don't assure processor affinity");
    }
  else if (ret != 0)
    {
      const char *str = strerror (errno);
      g_warning ("Failed to get CPU clock ID: %s", str);
    }

  if (clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &ts) == -1)
    {
      const char *str = strerror (errno);
      g_warning ("Failed to query CLOCK_PROCESS_CPUTIME_ID clock: %s", str);
    }
#endif

  mainloop_context = uprof_context_new ("Mainloop context");

  dbus_g_object_register_marshaller (_uprof_marshal_VOID__STRING_STRING,
                                     G_TYPE_NONE,
                                     G_TYPE_STRING,
                                     G_TYPE_STRING,
                                     G_TYPE_INVALID);

  _uprof_report_register_dbus_type_info ();
  _uprof_service_register_dbus_type_info ();

  service = _uprof_service_new ();

  initialized = TRUE;
}
Пример #17
0
static Modem *
modem_new (DBusGConnection *bus, const char *path, gpointer owner)
{
	Modem *modem;

	modem = g_slice_new0 (Modem);
	modem->owner = owner;
	modem->path = g_strdup (path);

	modem->loc_proxy = dbus_g_proxy_new_for_name (bus,
	                                              MM_DBUS_SERVICE,
	                                              path,
	                                              MM_DBUS_LOC_INTERFACE);

	modem->modem_proxy = dbus_g_proxy_new_for_name (bus,
	                                                MM_DBUS_SERVICE,
	                                                path,
	                                                MM_DBUS_MODEM_INTERFACE);

	/* Listen for property changes */
	modem->props_proxy = dbus_g_proxy_new_for_name (bus,
	                                                MM_DBUS_SERVICE,
	                                                path,
	                                                "org.freedesktop.DBus.Properties");
	dbus_g_object_register_marshaller (mm_marshal_VOID__STRING_BOXED,
	                                   G_TYPE_NONE,
	                                   G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT,
	                                   G_TYPE_INVALID);
	dbus_g_proxy_add_signal (modem->props_proxy, "MmPropertiesChanged",
	                         G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT,
	                         G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (modem->props_proxy, "MmPropertiesChanged",
	                             G_CALLBACK (modem_properties_changed),
	                             modem,
	                             NULL);

	debugmsg ("%s: (%s) modem created", __func__, path);

	/* Check if the Location interface is actually supported before doing
	 * anything with the modem, because if it's not, we don't care about
	 * the modem at all.
	 */
	dbus_g_proxy_begin_call (modem->props_proxy, "GetAll",
	                         loc_props_cb, modem, NULL,
	                         G_TYPE_STRING, MM_DBUS_LOC_INTERFACE, G_TYPE_INVALID);

	return modem;
}
Пример #18
0
DBusGProxy *kovaplus_dbus_proxy_new(void) {
	DBusGProxy *proxy;

	proxy = dbus_roccat_proxy_new_for_name(ROCCAT_DBUS_SERVER_NAME,
			KOVAPLUS_DBUS_SERVER_PATH,
			KOVAPLUS_DBUS_SERVER_INTERFACE);

	if (!proxy)
		return NULL;

	dbus_g_object_register_marshaller(g_cclosure_marshal_VOID__UCHAR,
			G_TYPE_NONE, G_TYPE_UCHAR, G_TYPE_INVALID);

	dbus_g_proxy_add_signal(proxy, "ProfileChanged", G_TYPE_UCHAR, G_TYPE_INVALID);

	return proxy;
}
Пример #19
0
static void
gupnp_network_manager_class_init (GUPnPNetworkManagerClass *klass)
{
        GObjectClass *object_class;

        object_class = G_OBJECT_CLASS (klass);

        object_class->constructed  = gupnp_network_manager_constructed;
        object_class->dispose      = gupnp_network_manager_dispose;

        dbus_g_object_register_marshaller (gupnp_marshal_VOID__UINT_UINT_UINT,
                                           G_TYPE_NONE,
                                           G_TYPE_UINT,
                                           G_TYPE_UINT,
                                           G_TYPE_UINT,
                                           G_TYPE_INVALID);

        g_type_class_add_private (klass, sizeof (GUPnPNetworkManagerPrivate));
}
Пример #20
0
FcitxIMClient* FcitxIMClientOpen(FcitxIMClientConnectCallback connectcb, FcitxIMClientDestroyCallback destroycb, GObject* data)
{
    FcitxIMClient* client = fcitx_malloc0(sizeof(FcitxIMClient));
    GError *error = NULL;
    client->connectcb = connectcb;
    client->destroycb = destroycb;
    client->data = data;
    client->conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
    client->id = -1;

    /* You must have dbus to make it works */
    if (client->conn == NULL)
    {
        g_warning("%s", error->message);
        free(client);
        return NULL;
    }

    client->dbusproxy = dbus_g_proxy_new_for_name(client->conn,
                        DBUS_SERVICE_DBUS,
                        DBUS_PATH_DBUS,
                        DBUS_INTERFACE_DBUS);

    if (!client->dbusproxy)
    {
        g_object_unref(client->conn);
        free(client);
        return NULL;
    }
    sprintf(client->servicename, "%s-%d", FCITX_DBUS_SERVICE, FcitxGetDisplayNumber());
    dbus_g_object_register_marshaller(fcitx_marshall_VOID__STRING_STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
    dbus_g_proxy_add_signal(client->dbusproxy, "NameOwnerChanged", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
    dbus_g_proxy_connect_signal(client->dbusproxy, "NameOwnerChanged",
                                G_CALLBACK(_changed_cb), client, NULL);

    client->triggerkey[0].sym = client->triggerkey[0].state = client->triggerkey[1].sym = client->triggerkey[1].state = 0;

    FcitxIMClientCreateIC(client);
    return client;
}
Пример #21
0
static GObject*
constructor (GType type,
			 guint n_construct_params,
			 GObjectConstructParam *construct_params)
{
	NMObject *object;
	NMDevicePrivate *priv;

	object = (NMObject *) G_OBJECT_CLASS (nm_device_parent_class)->constructor (type,
																				n_construct_params,
																				construct_params);
	if (!object)
		return NULL;

	priv = NM_DEVICE_GET_PRIVATE (object);

	priv->proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (object),
											 NM_DBUS_SERVICE,
											 nm_object_get_path (object),
											 NM_DBUS_INTERFACE_DEVICE);

	register_for_property_changed (NM_DEVICE (object));

	dbus_g_object_register_marshaller (_nm_marshal_VOID__UINT_UINT_UINT,
									   G_TYPE_NONE,
									   G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT,
									   G_TYPE_INVALID);

	dbus_g_proxy_add_signal (priv->proxy,
	                         "StateChanged",
	                         G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT,
	                         G_TYPE_INVALID);

	dbus_g_proxy_connect_signal (priv->proxy, "StateChanged",
								 G_CALLBACK (device_state_changed),
								 NM_DEVICE (object),
								 NULL);

	return G_OBJECT (object);
}
Пример #22
0
static void
constructed (GObject *object)
{
	NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (object);

	G_OBJECT_CLASS (nm_vpn_connection_parent_class)->constructed (object);

	priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_VPN_CONNECTION);

	dbus_g_object_register_marshaller (g_cclosure_marshal_generic,
	                                   G_TYPE_NONE,
	                                   G_TYPE_UINT, G_TYPE_UINT,
	                                   G_TYPE_INVALID);
	dbus_g_proxy_add_signal (priv->proxy, "VpnStateChanged", G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->proxy,
						    "VpnStateChanged",
						    G_CALLBACK (vpn_state_changed_proxy),
						    object,
						    NULL);

	register_properties (NM_VPN_CONNECTION (object));
}
Пример #23
0
gboolean wmvm_do_udisks_init(void)
{
	GPtrArray *devices;
	GError *error;
	int n;

#if !GLIB_CHECK_VERSION(2,35,0)
	g_type_init();
#endif

	dbus_g_object_register_marshaller (udisks_marshal_VOID__BOXED_BOOLEAN_STRING_UINT_BOOLEAN_DOUBLE,
									   G_TYPE_NONE,
									   DBUS_TYPE_G_OBJECT_PATH,
									   G_TYPE_BOOLEAN,
									   G_TYPE_STRING,
									   G_TYPE_UINT,
									   G_TYPE_BOOLEAN,
									   G_TYPE_DOUBLE,
									   G_TYPE_INVALID);

	if (!init_udisks_connection()) {
		return FALSE;
	}

	/* prime the list of devices */
	error = NULL;
	if (!org_freedesktop_UDisks_enumerate_devices(udisks_proxy, &devices, &error)) {
		g_message("Error enumerating devices: %s", error->message);
		g_error_free(error);
		return FALSE;
	}

	for (n = 0; n < (int) devices->len; n++)
		udisks_device_added(udisks_proxy, g_ptr_array_index(devices, n), NULL);
	g_ptr_array_foreach(devices, (GFunc) g_free, NULL);
	g_ptr_array_free(devices, TRUE);

	return TRUE;
}
Пример #24
0
NMBluezDevice *
nm_bluez_device_new (const char *path)
{
	NMBluezDevice *self;
	NMBluezDevicePrivate *priv;
	NMDBusManager *dbus_mgr;
	DBusGConnection *connection;


	self = (NMBluezDevice *) g_object_new (NM_TYPE_BLUEZ_DEVICE,
	                                       NM_BLUEZ_DEVICE_PATH, path,
	                                       NULL);
	if (!self)
		return NULL;

	priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self);
	dbus_mgr = nm_dbus_manager_get ();
	connection = nm_dbus_manager_get_connection (dbus_mgr);

	priv->proxy = dbus_g_proxy_new_for_name (connection,
	                                         BLUEZ_SERVICE,
	                                         priv->path,
	                                         BLUEZ_DEVICE_INTERFACE);
	g_object_unref (dbus_mgr);

	dbus_g_object_register_marshaller (_nm_marshal_VOID__STRING_BOXED,
	                                   G_TYPE_NONE,
	                                   G_TYPE_STRING, G_TYPE_VALUE,
	                                   G_TYPE_INVALID);
	dbus_g_proxy_add_signal (priv->proxy, "PropertyChanged",
	                         G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->proxy, "PropertyChanged",
	                             G_CALLBACK (property_changed), self, NULL);

	query_properties (self);
	return self;
}
Пример #25
0
static void
dun_start (PluginInfo *info)
{
	GError *error = NULL;
	GtkTreeIter iter;

	g_message ("%s: starting DUN device discovery...", __func__);

	/* Set up dbus */
	info->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
	if (error || !info->bus) {
		dun_error (info, __func__, error, _("could not connect to the system bus."));
		g_clear_error (&error);
		goto out;
	}

	gtk_label_set_text (GTK_LABEL (info->label), _("Detecting phone configuration..."));

	/* Start the spinner */
	if (!info->spinner) {
		info->spinner = nma_bling_spinner_new ();
		gtk_box_pack_start (GTK_BOX (info->hbox), info->spinner, FALSE, FALSE, 6);
	}
	nma_bling_spinner_start (BMA_BLING_SPINNER (info->spinner));
	gtk_widget_show_all (info->hbox);

	gtk_widget_set_sensitive (info->dun_button, FALSE);

	/* ModemManager stuff */
	info->mm_proxy = dbus_g_proxy_new_for_name (info->bus,
	                                            MM_SERVICE,
	                                            MM_PATH,
	                                            MM_INTERFACE);
	g_assert (info->mm_proxy);

	dbus_g_object_register_marshaller (g_cclosure_marshal_VOID__BOXED,
	                                   G_TYPE_NONE,
	                                   G_TYPE_BOXED,
	                                   G_TYPE_INVALID);
	dbus_g_proxy_add_signal (info->mm_proxy, "DeviceAdded",
	                         DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (info->mm_proxy, "DeviceAdded",
								 G_CALLBACK (modem_added), info,
								 NULL);

	dbus_g_proxy_add_signal (info->mm_proxy, "DeviceRemoved",
	                         DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (info->mm_proxy, "DeviceRemoved",
								 G_CALLBACK (modem_removed), info,
								 NULL);

	/* Get the device we're looking for */
	info->dun_proxy = NULL;
	if (get_device_iter (info->btmodel, info->bdaddr, &iter))
		gtk_tree_model_get (info->btmodel, &iter, BLUETOOTH_COLUMN_PROXY, &info->dun_proxy, -1);

	if (info->dun_proxy) {
		info->dun_timeout_id = g_timeout_add_seconds (45, dun_timeout_cb, info);

		dbus_g_proxy_set_interface (info->dun_proxy, BLUEZ_SERIAL_INTERFACE);

		g_message ("%s: calling Connect...", __func__);

		/* Watch for BT device property changes */
		dbus_g_object_register_marshaller (nma_marshal_VOID__STRING_BOXED,
		                                   G_TYPE_NONE,
		                                   G_TYPE_STRING, G_TYPE_VALUE,
		                                   G_TYPE_INVALID);
		dbus_g_proxy_add_signal (info->dun_proxy, "PropertyChanged",
		                         G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
		dbus_g_proxy_connect_signal (info->dun_proxy, "PropertyChanged",
		                             G_CALLBACK (dun_property_changed), info, NULL);

		/* Request a connection to the device and get the port */
		dbus_g_proxy_begin_call_with_timeout (info->dun_proxy, "Connect",
		                                      dun_connect_cb,
		                                      info,
		                                      NULL,
		                                      20000,
		                                      G_TYPE_STRING, "dun",
		                                      G_TYPE_INVALID);
	} else
		dun_error (info, __func__, error, _("could not find the Bluetooth device."));

out:
	g_message ("%s: finished", __func__);
}
static void
dun_start (NmaBtDevice *self)
{
	NmaBtDevicePrivate *priv = NMA_BT_DEVICE_GET_PRIVATE (self);
	gboolean have_mm = FALSE, have_mm1 = TRUE;

	g_message ("%s: starting DUN device discovery...", __func__);

	_set_status (self, _("Detecting phone configuration..."));

	/* ModemManager stuff */
	priv->mm_proxy = dbus_g_proxy_new_for_name (priv->bus,
	                                            MM_SERVICE,
	                                            MM_PATH,
	                                            MM_INTERFACE);
	g_assert (priv->mm_proxy);
	have_mm = _name_has_owner (priv->bus, MM_SERVICE);

	dbus_g_object_register_marshaller (g_cclosure_marshal_VOID__BOXED,
	                                   G_TYPE_NONE,
	                                   G_TYPE_BOXED,
	                                   G_TYPE_INVALID);
	dbus_g_proxy_add_signal (priv->mm_proxy, "DeviceAdded",
	                         DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->mm_proxy, "DeviceAdded",
								 G_CALLBACK (modem_added), self,
								 NULL);

	dbus_g_proxy_add_signal (priv->mm_proxy, "DeviceRemoved",
	                         DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->mm_proxy, "DeviceRemoved",
								 G_CALLBACK (modem_removed), self,
								 NULL);

#if WITH_MODEM_MANAGER_1
	/* ModemManager1 stuff */
	{
		priv->dbus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
		if (priv->dbus_connection) {
			priv->modem_manager_1 = mm_manager_new_sync (priv->dbus_connection,
			                                             G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
			                                             NULL,
			                                             NULL);
			if (priv->modem_manager_1) {
				g_signal_connect (priv->modem_manager_1,
				                  "object-added",
				                  G_CALLBACK (modem_object_added),
				                  self);
				g_signal_connect (priv->modem_manager_1,
				                  "object-removed",
				                  G_CALLBACK (modem_object_removed),
				                  self);
			}
		}

		have_mm1 = !!priv->modem_manager_1;
	}
#endif

	/* Ensure at least one of ModemManager or ModemManager1 are around */
	if (!have_mm && !have_mm1) {
		dun_error (self, __func__, NULL, _("ModemManager is not running"));
		return;
	}

	/* Bluez */
	priv->dun_proxy = dbus_g_proxy_new_for_name (priv->bus,
	                                             BLUEZ_SERVICE,
	                                             priv->object_path,
	                                             BLUEZ_SERIAL_INTERFACE);
	g_assert (priv->dun_proxy);

	priv->dun_timeout_id = g_timeout_add_seconds (45, dun_timeout_cb, self);

	g_message ("%s: calling Connect...", __func__);

	/* Watch for BT device property changes */
	dbus_g_object_register_marshaller (_nma_marshal_VOID__STRING_BOXED,
	                                   G_TYPE_NONE,
	                                   G_TYPE_STRING, G_TYPE_VALUE,
	                                   G_TYPE_INVALID);
	dbus_g_proxy_add_signal (priv->dun_proxy, "PropertyChanged",
	                         G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->dun_proxy, "PropertyChanged",
	                             G_CALLBACK (dun_property_changed), self, NULL);

	/* Request a connection to the device and get the port */
	dbus_g_proxy_begin_call_with_timeout (priv->dun_proxy, "Connect",
	                                      dun_connect_cb,
	                                      self,
	                                      NULL,
	                                      20000,
	                                      G_TYPE_STRING, "dun",
	                                      G_TYPE_INVALID);

	g_message ("%s: waiting for Connect success...", __func__);
}
static void
sw_client_service_class_init (SwClientServiceClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  g_type_class_add_private (klass, sizeof (SwClientServicePrivate));

  object_class->get_property = sw_client_service_get_property;
  object_class->set_property = sw_client_service_set_property;
  object_class->dispose = sw_client_service_dispose;
  object_class->finalize = sw_client_service_finalize;

  signals[AVATAR_RETRIEVED_SIGNAL] =
    g_signal_new ("avatar-retrieved",
                  SW_CLIENT_TYPE_SERVICE,
                  G_SIGNAL_RUN_FIRST,
                  G_STRUCT_OFFSET (SwClientServiceClass, avatar_retrieved),
                  NULL,
                  NULL,
                  g_cclosure_marshal_VOID__STRING,
                  G_TYPE_NONE,
                  1,
                  G_TYPE_STRING);

  signals[CAPS_CHANGED_SIGNAL] =
    g_signal_new ("capabilities-changed",
                  SW_CLIENT_TYPE_SERVICE,
                  G_SIGNAL_RUN_FIRST,
                  G_STRUCT_OFFSET (SwClientServiceClass, capabilities_changed),
                  NULL,
                  NULL,
                  g_cclosure_marshal_VOID__BOXED,
                  G_TYPE_NONE,
                  1,
                  G_TYPE_STRV);

  signals[STATUS_UPDATED_SIGNAL] =
    g_signal_new ("status-updated",
                  SW_CLIENT_TYPE_SERVICE,
                  G_SIGNAL_RUN_FIRST,
                  G_STRUCT_OFFSET (SwClientServiceClass, status_updated),
                  NULL,
                  NULL,
                  g_cclosure_marshal_VOID__BOOLEAN,
                  G_TYPE_NONE,
                  1,
                  G_TYPE_BOOLEAN);

  signals[USER_CHANGED_SIGNAL] =
    g_signal_new ("user-changed",
                  SW_CLIENT_TYPE_SERVICE,
                  G_SIGNAL_RUN_FIRST,
                  G_STRUCT_OFFSET (SwClientServiceClass, user_changed),
                  NULL,
                  NULL,
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);

  dbus_g_object_register_marshaller (sw_marshal_VOID__INT_INT_STRING,
                                     G_TYPE_NONE,
                                     G_TYPE_INT,
                                     G_TYPE_INT,
                                     G_TYPE_STRING,
                                     G_TYPE_INVALID);
}
Пример #28
0
static GObject *
constructor (GType type,
             guint n_construct_params,
             GObjectConstructParam *construct_params)
{
	GObject *object;
	BMRemoteSettingsPrivate *priv;
	const char *service = BM_DBUS_SERVICE_USER_SETTINGS;
	GError *error = NULL;

	object = G_OBJECT_CLASS (bm_remote_settings_parent_class)->constructor (type, n_construct_params, construct_params);
	if (!object)
		return NULL;

	priv = BM_REMOTE_SETTINGS_GET_PRIVATE (object);

	/* D-Bus proxy for clearing connections on NameOwnerChanged */
	priv->dbus_proxy = dbus_g_proxy_new_for_name (priv->bus,
	                                              "org.freedesktop.DBus",
	                                              "/org/freedesktop/DBus",
	                                              "org.freedesktop.DBus");
	g_assert (priv->dbus_proxy);

	dbus_g_object_register_marshaller (_bm_marshal_VOID__STRING_STRING_STRING,
	                                   G_TYPE_NONE,
	                                   G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
	                                   G_TYPE_INVALID);
	dbus_g_proxy_add_signal (priv->dbus_proxy, "NameOwnerChanged",
	                         G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
	                         G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->dbus_proxy,
	                             "NameOwnerChanged",
	                             G_CALLBACK (name_owner_changed),
	                             object, NULL);

	/* Settings service proxy */
	if (priv->scope == BM_CONNECTION_SCOPE_SYSTEM)
		service = BM_DBUS_SERVICE_SYSTEM_SETTINGS;

	if (!dbus_g_proxy_call (priv->dbus_proxy, "NameHasOwner", &error,
	                        G_TYPE_STRING, service,
	                        G_TYPE_INVALID,
	                        G_TYPE_BOOLEAN, &priv->service_running,
	                        G_TYPE_INVALID)) {
		g_warning ("%s (BMRemoteSettings) error getting remote settings service status: (%d) %s\n",
		           __func__,
		           error ? error->code : -1,
		           error && error->message ? error->message : "(unknown)");
		g_error_free (error);
		priv->service_running = FALSE;
	}

	priv->proxy = dbus_g_proxy_new_for_name (priv->bus,
	                                         service,
	                                         BM_DBUS_PATH_SETTINGS,
	                                         BM_DBUS_IFACE_SETTINGS);
	g_assert (priv->proxy);
	dbus_g_proxy_set_default_timeout (priv->proxy, G_MAXINT);

	dbus_g_proxy_add_signal (priv->proxy, "NewConnection",
	                         DBUS_TYPE_G_OBJECT_PATH,
	                         G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->proxy, "NewConnection",
	                             G_CALLBACK (new_connection_cb),
	                             object,
	                             NULL);

	priv->fetch_id = g_idle_add (fetch_connections, object);

	return object;
}
Пример #29
0
static GObject*
constructor (GType type,
			 guint n_construct_params,
			 GObjectConstructParam *construct_params)
{
	GObject *object;
	NMModemPrivate *priv;
	DBusGConnection *bus;

	object = G_OBJECT_CLASS (nm_modem_parent_class)->constructor (type,
																  n_construct_params,
																  construct_params);
	if (!object)
		return NULL;

	priv = NM_MODEM_GET_PRIVATE (object);

	if (!priv->device) {
		nm_log_err (LOGD_HW, "modem parent device not provided");
		goto err;
	}

	if (!priv->device) {
		nm_log_err (LOGD_HW, "modem command interface not provided");
		goto err;
	}

	if (!priv->path) {
		nm_log_err (LOGD_HW, "D-Bus path not provided");
		goto err;
	}

	bus = nm_dbus_manager_get_connection (priv->dbus_mgr);
	priv->proxy = dbus_g_proxy_new_for_name (bus,
	                                         MM_DBUS_SERVICE,
	                                         priv->path,
	                                         MM_DBUS_INTERFACE_MODEM);

	priv->props_proxy = dbus_g_proxy_new_for_name (bus,
	                                               MM_DBUS_SERVICE,
	                                               priv->path,
	                                               DBUS_INTERFACE_PROPERTIES);
	dbus_g_object_register_marshaller (_nm_marshal_VOID__STRING_BOXED,
	                                   G_TYPE_NONE,
	                                   G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT,
	                                   G_TYPE_INVALID);
	dbus_g_proxy_add_signal (priv->props_proxy, "MmPropertiesChanged",
	                         G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT,
	                         G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->props_proxy, "MmPropertiesChanged",
	                             G_CALLBACK (modem_properties_changed),
	                             object,
	                             NULL);

	query_mm_enabled (NM_MODEM (object));

	return object;

 err:
	g_object_unref (object);
	return NULL;
}
static void
mnb_panel_oop_class_init (MnbPanelOopClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  g_type_class_add_private (klass, sizeof (MnbPanelOopPrivate));

  object_class->get_property     = mnb_panel_oop_get_property;
  object_class->set_property     = mnb_panel_oop_set_property;
  object_class->dispose          = mnb_panel_oop_dispose;
  object_class->finalize         = mnb_panel_oop_finalize;
  object_class->constructed      = mnb_panel_oop_constructed;

  g_object_class_install_property (object_class,
                                   PROP_DBUS_NAME,
                                   g_param_spec_string ("dbus-name",
                                                        "Dbus name",
                                                        "Dbus name",
                                                        NULL,
                                                        G_PARAM_READWRITE |
                                                        G_PARAM_CONSTRUCT_ONLY));

  g_object_class_install_property (object_class,
                                   PROP_X,
                                   g_param_spec_int ("x",
                                                     "X coordinate",
                                                     "X coordiante",
                                                      0, G_MAXINT,
                                                      0,
                                                      G_PARAM_READWRITE |
                                                      G_PARAM_CONSTRUCT));

  g_object_class_install_property (object_class,
                                   PROP_Y,
                                   g_param_spec_int ("y",
                                                     "Y coordinate",
                                                     "Y coordiante",
                                                      0, G_MAXINT,
                                                      0,
                                                      G_PARAM_READWRITE |
                                                      G_PARAM_CONSTRUCT));

  g_object_class_install_property (object_class,
                                   PROP_WIDTH,
                                   g_param_spec_uint ("width",
                                                      "Width",
                                                      "Width",
                                                      0, G_MAXUINT,
                                                      1024,
                                                      G_PARAM_READWRITE |
                                                      G_PARAM_CONSTRUCT));

  g_object_class_install_property (object_class,
                                   PROP_HEIGHT,
                                   g_param_spec_uint ("height",
                                                      "Height",
                                                      "Height",
                                                      0, G_MAXUINT,
                                                      1024,
                                                      G_PARAM_READWRITE |
                                                      G_PARAM_CONSTRUCT));

  g_object_class_install_property (object_class,
                                   PROP_MODAL,
                                   g_param_spec_boolean ("modal",
                                          "Modal",
                                          "Whether panel has modal transients",
                                                         FALSE,
                                                         G_PARAM_READABLE));

  signals[READY] =
    g_signal_new ("ready",
                  G_TYPE_FROM_CLASS (object_class),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (MnbPanelOopClass, ready),
                  NULL, NULL,
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);

  signals[REMOTE_PROCESS_DIED] =
    g_signal_new ("remote-process-died",
                  G_TYPE_FROM_CLASS (object_class),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (MnbPanelOopClass, remote_process_died),
                  NULL, NULL,
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);

  signals[DESTROY] =
    g_signal_new ("destroy",
		  G_TYPE_FROM_CLASS (object_class),
                  G_SIGNAL_RUN_CLEANUP |
                  G_SIGNAL_NO_RECURSE  |
                  G_SIGNAL_NO_HOOKS,
		  0,
		  NULL, NULL,
		  g_cclosure_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);

  dbus_g_object_register_marshaller (meego_netbook_marshal_VOID__UINT_UINT,
                                     G_TYPE_NONE,
                                     G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID);
  dbus_g_object_register_marshaller (meego_netbook_marshal_VOID__INT_INT,
                                     G_TYPE_NONE,
                                     G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID);
  dbus_g_object_register_marshaller (meego_netbook_marshal_VOID__ENUM,
                                     G_TYPE_NONE,
                                     G_TYPE_ENUM, G_TYPE_INVALID);
}