当前位置: 首页>>代码示例>>C++>>正文


C++ dbus_g_method_return_error函数代码示例

本文整理汇总了C++中dbus_g_method_return_error函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_g_method_return_error函数的具体用法?C++ dbus_g_method_return_error怎么用?C++ dbus_g_method_return_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dbus_g_method_return_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: up_device_get_statistics

/**
 * up_device_get_statistics:
 **/
gboolean
up_device_get_statistics (UpDevice *device, const gchar *type, DBusGMethodInvocation *context)
{
	GError *error;
	GPtrArray *array = NULL;
	GPtrArray *complex;
	UpStatsItem *item;
	GValue *value;
	guint i;

	g_return_val_if_fail (UP_IS_DEVICE (device), FALSE);
	g_return_val_if_fail (type != NULL, FALSE);

	/* doesn't even try to support this */
	if (!device->priv->has_statistics) {
		error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "device does not support getting stats");
		dbus_g_method_return_error (context, error);
		goto out;
	}

	/* get the correct data */
	if (g_strcmp0 (type, "charging") == 0)
		array = up_history_get_profile_data (device->priv->history, TRUE);
	else if (g_strcmp0 (type, "discharging") == 0)
		array = up_history_get_profile_data (device->priv->history, FALSE);

	/* maybe the device doesn't support histories */
	if (array == NULL) {
		error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "device has no statistics");
		dbus_g_method_return_error (context, error);
		goto out;
	}

	/* always 101 items of data */
	if (array->len != 101) {
		error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "statistics invalid as have %i items", array->len);
		dbus_g_method_return_error (context, error);
		goto out;
	}

	/* copy data to dbus struct */
	complex = g_ptr_array_sized_new (array->len);
	for (i=0; i<array->len; i++) {
		item = (UpStatsItem *) g_ptr_array_index (array, i);
		value = g_new0 (GValue, 1);
		g_value_init (value, UP_DBUS_STRUCT_DOUBLE_DOUBLE);
		g_value_take_boxed (value, dbus_g_type_specialized_construct (UP_DBUS_STRUCT_DOUBLE_DOUBLE));
		dbus_g_type_struct_set (value,
					0, up_stats_item_get_value (item),
					1, up_stats_item_get_accuracy (item), -1);
		g_ptr_array_add (complex, g_value_get_boxed (value));
		g_free (value);
	}

	dbus_g_method_return (context, complex);
out:
	if (array != NULL)
		g_ptr_array_unref (array);
	return TRUE;
}
开发者ID:Kalvados,项目名称:upower,代码行数:63,代码来源:up-device.c

示例2: room_list_list_rooms

static void
room_list_list_rooms (TpSvcChannelTypeRoomList *chan,
    DBusGMethodInvocation *context)
{
  TpTestsRoomListChan *self = TP_TESTS_ROOM_LIST_CHAN (chan);

  if (self->priv->listing)
    {
      GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
          "Already listing" };

      dbus_g_method_return_error (context, &error);
      return;
    }

  if (!tp_strdiff (self->priv->server, "ListRoomsFail"))
    {
      GError error = { TP_ERROR, TP_ERROR_SERVICE_CONFUSED,
          "Computer says no" };

      dbus_g_method_return_error (context, &error);
      return;
    }

  self->priv->listing = TRUE;
  tp_svc_channel_type_room_list_emit_listing_rooms (self, TRUE);

  g_idle_add (find_rooms, self);

  tp_svc_channel_type_room_list_return_from_list_rooms (context);
}
开发者ID:GNOME,项目名称:folks,代码行数:31,代码来源:room-list-chan.c

示例3: impl_settings_add_connection

static void
impl_settings_add_connection (NMSettingsService *self,
                              GHashTable *settings,
                              DBusGMethodInvocation *context)
{
	NMConnection *tmp;
	GError *error = NULL;

	/* Check if the settings are valid first */
	tmp = nm_connection_new_from_hash (settings, &error);
	if (!tmp) {
		g_assert (error);
		dbus_g_method_return_error (context, error);
		g_error_free (error);
		return;
	}

	if (NM_SETTINGS_SERVICE_GET_CLASS (self)->add_connection) {
		NM_SETTINGS_SERVICE_GET_CLASS (self)->add_connection (NM_SETTINGS_SERVICE (self),
		                                                      tmp,
		                                                      context,
		                                                      dbus_add_connection_cb,
		                                                      context);
	} else {
		error = g_error_new (NM_SETTINGS_INTERFACE_ERROR,
		                     NM_SETTINGS_INTERFACE_ERROR_INTERNAL_ERROR,
		                     "%s: %s:%d add_connection() not implemented",
		                     __func__, __FILE__, __LINE__);
		dbus_g_method_return_error (context, error);
		g_error_free (error);
	}

	g_object_unref (tmp);
}
开发者ID:wsowa,项目名称:NetworkManager-gsoc2009,代码行数:34,代码来源:nm-settings-service.c

示例4: _sync_hwclock

static gboolean
_sync_hwclock (DBusGMethodInvocation *context)
{
        GError *error;

        error = NULL;

        if (g_file_test ("/sbin/hwclock",
                         G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_EXECUTABLE)) {
                int exit_status;
                if (!g_spawn_command_line_sync ("/sbin/hwclock --systohc", NULL, NULL, &exit_status, &error)) {
                        GError *error2;
                        error2 = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
                                              GSD_DATETIME_MECHANISM_ERROR_GENERAL,
                                              "Error spawning /sbin/hwclock: %s", error->message);
                        g_error_free (error);
                        dbus_g_method_return_error (context, error2);
                        g_error_free (error2);
                        return FALSE;
                }
                if (WEXITSTATUS (exit_status) != 0) {
                        error = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
                                             GSD_DATETIME_MECHANISM_ERROR_GENERAL,
                                             "/sbin/hwclock returned %d", exit_status);
                        dbus_g_method_return_error (context, error);
                        g_error_free (error);
                        return FALSE;
                }
        }

        return TRUE;
}
开发者ID:ebroder,项目名称:gnome-settings-daemon,代码行数:32,代码来源:gsd-datetime-mechanism.c

示例5: location_set_location

static void
location_set_location (TpSvcConnectionInterfaceLocation *iface,
                       GHashTable *location,
                       DBusGMethodInvocation *context)
{
  GabbleConnection *conn = GABBLE_CONNECTION (iface);
  LmMessage *msg;
  LmMessageNode *geoloc;
  WockyNode *item;
  GHashTableIter iter;
  gpointer key, value;
  GError *err = NULL;

  TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED ((TpBaseConnection *) conn,
    context);

  if (!(conn->features & GABBLE_CONNECTION_FEATURES_PEP))
    {
      GError error = { TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
          "Server does not support PEP, cannot publish geolocation" };

      dbus_g_method_return_error (context, &error);
      return;
    }

  gabble_connection_ensure_capabilities (conn,
      gabble_capabilities_get_geoloc_notify ());
  msg = wocky_pep_service_make_publish_stanza (conn->pep_location, &item);
  geoloc = wocky_node_add_child_ns (item, "geoloc", NS_GEOLOC);

  DEBUG ("SetLocation to");

  build_mapping_tables ();
  g_hash_table_iter_init (&iter, location);
  while (g_hash_table_iter_next (&iter, &key, &value))
    {
      if (!add_to_geoloc_node ((const gchar *) key, (GValue *) value, geoloc,
            &err))
        {
          DEBUG ("%s", err->message);
          dbus_g_method_return_error (context, err);
          g_error_free (err);
          goto out;
        }
    }

  if (!_gabble_connection_send_with_reply (conn, msg, set_location_sent_cb,
        G_OBJECT (conn), context, NULL))
    {
      GError error = { TP_ERRORS, TP_ERROR_NETWORK_ERROR,
          "Failed to send msg" };

      dbus_g_method_return_error (context, &error);
    }

out:
  lm_message_unref (msg);
}
开发者ID:jku,项目名称:telepathy-gabble,代码行数:58,代码来源:conn-location.c

示例6: gsd_datetime_mechanism_get_hardware_clock_using_utc

gboolean
gsd_datetime_mechanism_get_hardware_clock_using_utc (GsdDatetimeMechanism  *mechanism,
                                                     DBusGMethodInvocation *context)
{
        char **lines;
        char *data;
        gsize len;
        GError *error;
        gboolean is_utc;

        error = NULL;

        if (!g_file_get_contents ("/etc/adjtime", &data, &len, &error)) {
                GError *error2;
                error2 = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
                                      GSD_DATETIME_MECHANISM_ERROR_GENERAL,
                                      "Error reading /etc/adjtime file: %s", error->message);
                g_error_free (error);
                dbus_g_method_return_error (context, error2);
                g_error_free (error2);
                return FALSE;
        }

        lines = g_strsplit (data, "\n", 0);
        g_free (data);

        if (g_strv_length (lines) < 3) {
                error = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
                                     GSD_DATETIME_MECHANISM_ERROR_GENERAL,
                                     "Cannot parse /etc/adjtime");
                dbus_g_method_return_error (context, error);
                g_error_free (error);
                g_strfreev (lines);
                return FALSE;
        }

        if (strcmp (lines[2], "UTC") == 0) {
                is_utc = TRUE;
        } else if (strcmp (lines[2], "LOCAL") == 0) {
                is_utc = FALSE;
        } else {
                error = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
                                     GSD_DATETIME_MECHANISM_ERROR_GENERAL,
                                     "Expected UTC or LOCAL at line 3 of /etc/adjtime; found '%s'", lines[2]);
                dbus_g_method_return_error (context, error);
                g_error_free (error);
                g_strfreev (lines);
                return FALSE;
        }
        g_strfreev (lines);
        dbus_g_method_return (context, is_utc);
        return TRUE;
}
开发者ID:ebroder,项目名称:gnome-settings-daemon,代码行数:53,代码来源:gsd-datetime-mechanism.c

示例7: _set_using_ntp_fedora

gboolean
_set_using_ntp_fedora  (DBusGMethodInvocation   *context,
                        gboolean                 using_ntp)
{
        GError *error;
        int exit_status;
        const char *ntp_client;
        char *cmd;

        error = NULL;

        ntp_client = get_ntp_client ();

        /* We omit --level 2345 so that systemd doesn't try to use the
         * SysV init scripts */
        cmd = g_strconcat ("/sbin/chkconfig ", ntp_client, " ", using_ntp ? "on" : "off", NULL);

        if (!g_spawn_command_line_sync (cmd,
                                        NULL, NULL, &exit_status, &error)) {
                GError *error2;
                error2 = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
                                      GSD_DATETIME_MECHANISM_ERROR_GENERAL,
                                      "Error spawning '%s': %s", cmd, error->message);
                g_error_free (error);
                dbus_g_method_return_error (context, error2);
                g_error_free (error2);
                g_free (cmd);
                return FALSE;
        }

        g_free (cmd);

        cmd = g_strconcat ("/sbin/service ", ntp_client, " ", using_ntp ? "restart" : "stop", NULL);;

        if (!g_spawn_command_line_sync (cmd,
                                        NULL, NULL, &exit_status, &error)) {
                GError *error2;
                error2 = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
                                      GSD_DATETIME_MECHANISM_ERROR_GENERAL,
                                      "Error spawning '%s': %s", cmd, error->message);
                g_error_free (error);
                dbus_g_method_return_error (context, error2);
                g_error_free (error2);
                g_free (cmd);
                return FALSE;
        }

        g_free (cmd);

        dbus_g_method_return (context);
        return TRUE;
}
开发者ID:ebroder,项目名称:gnome-settings-daemon,代码行数:52,代码来源:gsd-datetime-mechanism-fedora.c

示例8: check_polkit_for_action

static gboolean
check_polkit_for_action (GConfDefaults         *mechanism,
                         DBusGMethodInvocation *context,
                         const char            *action)
{
	const char *sender;
	GError *error;
	DBusError dbus_error;
	PolKitCaller *pk_caller;
	PolKitAction *pk_action;
	PolKitResult pk_result;

	error = NULL;

	/* Check that caller is privileged */
	sender = dbus_g_method_get_sender (context);
	dbus_error_init (&dbus_error);
	pk_caller = polkit_caller_new_from_dbus_name (
	dbus_g_connection_get_connection (mechanism->priv->system_bus_connection),
					  sender,
					  &dbus_error);
	if (pk_caller == NULL) {
		error = g_error_new (GCONF_DEFAULTS_ERROR,
				     GCONF_DEFAULTS_ERROR_GENERAL,
				     "Error getting information about caller: %s: %s",
				     dbus_error.name, dbus_error.message);
		dbus_error_free (&dbus_error);
		dbus_g_method_return_error (context, error);
		g_error_free (error);
		return FALSE;
	}

	pk_action = polkit_action_new ();
	polkit_action_set_action_id (pk_action, action);
	pk_result = polkit_context_is_caller_authorized (mechanism->priv->pol_ctx, pk_action, pk_caller, TRUE, NULL);
	polkit_caller_unref (pk_caller);

	if (pk_result != POLKIT_RESULT_YES) {
		dbus_error_init (&dbus_error);
		polkit_dbus_error_generate (pk_action, pk_result, &dbus_error);
		dbus_set_g_error (&error, &dbus_error);
		dbus_g_method_return_error (context, error);
		dbus_error_free (&dbus_error);
		g_error_free (error);
		polkit_action_unref (pk_action);
		return FALSE;
	}

	polkit_action_unref (pk_action);
	return TRUE;
}
开发者ID:DOICHE,项目名称:gconf,代码行数:51,代码来源:gconf-defaults.c

示例9: _set_date

static gboolean
_set_date (GsdDatetimeMechanism  *mechanism,
           guint                  day,
           guint                  month,
           guint                  year,
           DBusGMethodInvocation *context)
{
        GDateTime *time;
        char *date_str, *time_str;
        char *date_cmd;
        int exit_status;
        GError *error;

        date_str = g_strdup_printf ("%02d/%02d/%d", month, day, year);
        error = NULL;

        time = g_date_time_new_now_local ();
        time_str = g_date_time_format (time, "%R:%S");
        g_date_time_unref (time);

        date_cmd = g_strdup_printf ("/bin/date -s \"%s %s\" +\"%%D %%R:%%S\"", date_str, time_str);
        g_free (date_str);
        g_free (time_str);

        if (!g_spawn_command_line_sync (date_cmd, NULL, NULL, &exit_status, &error)) {
                GError *error2;
                error2 = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
                                      GSD_DATETIME_MECHANISM_ERROR_GENERAL,
                                      "Error spawning /bin/date: %s", error->message);
                g_error_free (error);
                dbus_g_method_return_error (context, error2);
                g_error_free (error2);
                g_free (date_cmd);
                return FALSE;
        }
        g_free (date_cmd);
        if (WEXITSTATUS (exit_status) != 0) {
                error = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
                                     GSD_DATETIME_MECHANISM_ERROR_GENERAL,
                                     "/bin/date returned %d", exit_status);
                dbus_g_method_return_error (context, error);
                g_error_free (error);
                return FALSE;
        }

        if (!_sync_hwclock (context))
                return FALSE;

        return TRUE;
}
开发者ID:ebroder,项目名称:gnome-settings-daemon,代码行数:50,代码来源:gsd-datetime-mechanism.c

示例10: _check_polkit_for_action

static gboolean
_check_polkit_for_action (GnomeClockAppletMechanism *mechanism, DBusGMethodInvocation *context, const char *action)
{
        const char *sender;
        GError *error;
        DBusError dbus_error;
        PolKitCaller *pk_caller;
        PolKitAction *pk_action;
        PolKitResult pk_result;

        error = NULL;

        /* Check that caller is privileged */
        sender = dbus_g_method_get_sender (context);
        dbus_error_init (&dbus_error);
        pk_caller = polkit_caller_new_from_dbus_name (
                dbus_g_connection_get_connection (mechanism->priv->system_bus_connection),
                sender, 
                &dbus_error);
        if (pk_caller == NULL) {
                error = g_error_new (GNOME_CLOCK_APPLET_MECHANISM_ERROR,
                                     GNOME_CLOCK_APPLET_MECHANISM_ERROR_GENERAL,
                                     "Error getting information about caller: %s: %s",
                                     dbus_error.name, dbus_error.message);
                dbus_error_free (&dbus_error);
                dbus_g_method_return_error (context, error);
                g_error_free (error);
                return FALSE;
        }

        pk_action = polkit_action_new ();
        polkit_action_set_action_id (pk_action, action);
        pk_result = polkit_context_can_caller_do_action (mechanism->priv->pol_ctx, pk_action, pk_caller);
        polkit_caller_unref (pk_caller);
        polkit_action_unref (pk_action);

        if (pk_result != POLKIT_RESULT_YES) {
                error = g_error_new (GNOME_CLOCK_APPLET_MECHANISM_ERROR,
                                     GNOME_CLOCK_APPLET_MECHANISM_ERROR_NOT_PRIVILEGED,
                                     "%s %s <-- (action, result)",
                                     action,
                                     polkit_result_to_string_representation (pk_result));
                dbus_error_free (&dbus_error);
                dbus_g_method_return_error (context, error);
                g_error_free (error);
                return FALSE;
        }

        return TRUE;
}
开发者ID:guadalinex-archive,项目名称:guadalinex-v5,代码行数:50,代码来源:gnome-clock-applet-mechanism.c

示例11: Resources_invoke

gboolean
Resources_invoke(Matahari *matahari, const char *name, const char *standard,
                 const char *provider, const char *agent, const char *action,
                 unsigned int interval, GHashTable *parameters,
                 unsigned int timeout, unsigned int expected_rc,
                 const char *userdata_in, DBusGMethodInvocation *context)
{
    GError* error = NULL;
    svc_action_t *op = NULL;
    GList *standards;
    struct invoke_cb_data *data;

    if (!check_authorization(RESOURCES_INTERFACE_NAME ".invoke",
                             &error, context)) {
        dbus_g_method_return_error(context, error);
        g_error_free(error);
        return FALSE;
    }

    // Check if standard is valid
    standards = resources_list_standards();

    if (g_list_find_custom(standards, standard, (GCompareFunc) strcasecmp) == NULL) {
        mh_err("%s is not a known resource standard", standard);
        error = g_error_new(MATAHARI_ERROR, MH_RES_NOT_IMPLEMENTED,
                            "%s is not a known resource standard", standard);
        dbus_g_method_return_error(context, error);
        g_error_free(error);
        g_list_free_full(standards, free);
        return FALSE;
    }
    g_list_free_full(standards, free);

    op = resources_action_create(name, standard, provider, agent, action,
                                 0, timeout, g_hash_table_ref(parameters));
    op->expected_rc = expected_rc;

    if (!(data = malloc(1 * sizeof(struct invoke_cb_data)))) {
        services_action_free(op);
        return FALSE;
    }

    data->context = context;
    data->userdata = strdup(userdata_in);
    op->cb_data = data;

    services_action_async(op, invoke_cb);
    return FALSE;
}
开发者ID:russellb,项目名称:matahari,代码行数:49,代码来源:service-dbus.c

示例12: gsd_datetime_mechanism_set_hardware_clock_using_utc

gboolean
gsd_datetime_mechanism_set_hardware_clock_using_utc (GsdDatetimeMechanism  *mechanism,
                                                     gboolean               using_utc,
                                                     DBusGMethodInvocation *context)
{
        GError *error;

        error = NULL;

        if (!_check_polkit_for_action (mechanism, context))
                return FALSE;

        if (g_file_test ("/sbin/hwclock", 
                         G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_EXECUTABLE)) {
                int exit_status;
                char *cmd;
                cmd = g_strdup_printf ("/sbin/hwclock %s --systohc", using_utc ? "--utc" : "--localtime");
                if (!g_spawn_command_line_sync (cmd, NULL, NULL, &exit_status, &error)) {
                        GError *error2;
                        error2 = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
                                              GSD_DATETIME_MECHANISM_ERROR_GENERAL,
                                              "Error spawning /sbin/hwclock: %s", error->message);
                        g_error_free (error);
                        dbus_g_method_return_error (context, error2);
                        g_error_free (error2);
                        g_free (cmd);
                        return FALSE;
                }
                g_free (cmd);
                if (WEXITSTATUS (exit_status) != 0) {
                        error = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
                                             GSD_DATETIME_MECHANISM_ERROR_GENERAL,
                                             "/sbin/hwclock returned %d", exit_status);
                        dbus_g_method_return_error (context, error);
                        g_error_free (error);
                        return FALSE;
                }

                if (g_file_test ("/etc/fedora-release", G_FILE_TEST_EXISTS)) { /* Fedora */
                        if (!_update_etc_sysconfig_clock_fedora (context, "UTC=", using_utc ? "true" : "false"))
                                return FALSE;
		} else if (g_file_test ("/etc/SuSE-release", G_FILE_TEST_EXISTS)) { /* SUSE variant */
                        if (!_update_etc_sysconfig_clock_suse (context, "HWCLOCK=", using_utc ? "-u" : "--localtime"))
                                return FALSE;
		}
        }
        dbus_g_method_return (context);
        return TRUE;
}
开发者ID:ebroder,项目名称:gnome-settings-daemon,代码行数:49,代码来源:gsd-datetime-mechanism.c

示例13: Services_describe

gboolean
Services_describe(Matahari *matahari, const char *name,
                  DBusGMethodInvocation *context)
{
    GError* error = NULL;
    if (!check_authorization(SERVICES_BUS_NAME ".describe", &error, context)) {
        dbus_g_method_return_error(context, error);
        return FALSE;
    }
    // TODO: Implement when implemented in backend
    error = g_error_new(MATAHARI_ERROR, MATAHARI_NOT_IMPLEMENTED,
                        "Action describe is not implemented yet!");
    dbus_g_method_return_error(context, error);
    return TRUE;
}
开发者ID:antoinevg,项目名称:matahari,代码行数:15,代码来源:service-dbus.c

示例14: tp_base_media_call_stream_add_candidates

static void
tp_base_media_call_stream_add_candidates (TpSvcCallStreamInterfaceMedia *iface,
    const GPtrArray *candidates,
    DBusGMethodInvocation *context)
{
  TpBaseMediaCallStream *self = TP_BASE_MEDIA_CALL_STREAM (iface);
  TpBaseMediaCallStreamClass *klass =
      TP_BASE_MEDIA_CALL_STREAM_GET_CLASS (self);
  GPtrArray *accepted_candidates = NULL;
  guint i;
  GError *error = NULL;

  if (klass->add_local_candidates == NULL)
    {
      GError e = { TP_ERROR, TP_ERROR_NOT_IMPLEMENTED,
          "Connection Manager did not implement "
          "TpBaseMediaCallStream::add_local_candidates vmethod" };
      dbus_g_method_return_error (context, &e);
      return;
    }

  DEBUG ("Adding %d candidates to stream %s", candidates->len,
      tp_base_call_stream_get_object_path ((TpBaseCallStream *) self));

  accepted_candidates = klass->add_local_candidates (self, candidates, &error);
  if (accepted_candidates == NULL)
    {
      dbus_g_method_return_error (context, error);
      g_clear_error (&error);
      return;
    }

  for (i = 0; i < accepted_candidates->len; i++)
    {
      GValueArray *c = g_ptr_array_index (accepted_candidates, i);

      G_GNUC_BEGIN_IGNORE_DEPRECATIONS
      g_ptr_array_add (self->priv->local_candidates,
          g_value_array_copy (c));
      G_GNUC_END_IGNORE_DEPRECATIONS
    }

  tp_svc_call_stream_interface_media_emit_local_candidates_added (self,
      accepted_candidates);
  tp_svc_call_stream_interface_media_return_from_add_candidates (context);

  g_ptr_array_unref (accepted_candidates);
}
开发者ID:Distrotech,项目名称:telepathy-glib,代码行数:48,代码来源:base-media-call-stream.c

示例15: gsd_datetime_mechanism_set_using_ntp

gboolean
gsd_datetime_mechanism_set_using_ntp  (GsdDatetimeMechanism    *mechanism,
                                       gboolean                 using_ntp,
                                       DBusGMethodInvocation   *context)
{
        GError *error;
        gboolean ret;

        error = NULL;

        if (!_check_polkit_for_action (mechanism, context))
                return FALSE;

        if (g_file_test ("/etc/fedora-release", G_FILE_TEST_EXISTS)) /* Fedora */
                ret = _set_using_ntp_fedora (context, using_ntp);
        else if (g_file_test ("/usr/sbin/update-rc.d", G_FILE_TEST_EXISTS)) /* Debian */
                ret = _set_using_ntp_debian (context, using_ntp);
	else if (g_file_test ("/etc/SuSE-release", G_FILE_TEST_EXISTS)) /* SUSE variant */
                ret = _set_using_ntp_suse (context, using_ntp);
        else {
                error = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
                                     GSD_DATETIME_MECHANISM_ERROR_GENERAL,
                                     "Error enabling NTP: OS variant not supported");
                dbus_g_method_return_error (context, error);
                g_error_free (error);
                return FALSE;
        }

        return ret;
}
开发者ID:ebroder,项目名称:gnome-settings-daemon,代码行数:30,代码来源:gsd-datetime-mechanism.c


注:本文中的dbus_g_method_return_error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。