/* To create a new project * returns a newly created Project object */ Project * project_new (const gchar *name, const gchar *main_file, const gchar *file_name, const gchar *current_dir, const gchar *version, const gchar **argv, const gchar **env_vars) { Project *proj = g_try_malloc (sizeof (Project)); if (!proj) return NULL; proj->name = g_strdup (name); proj->proj_dir = g_path_get_dirname (file_name); gchar *s = g_strstr_len (main_file, -1, proj->proj_dir); gchar *_main_file = (gchar *)main_file; if (s == main_file) _main_file = s + strlen (proj->proj_dir); proj->main_file = g_strdup (_main_file); proj->current_dir = g_strdup (current_dir); proj->version = g_strdup (version); proj->file_name = g_strdup (file_name); proj->argv = g_strdupv ((gchar **)argv); proj->env_vars = g_strdupv ((gchar **)env_vars); return proj; }
static void gtk_file_chooser_native_add_choice (GtkFileChooser *chooser, const char *id, const char *label, const char **options, const char **option_labels) { GtkFileChooserNative *self = GTK_FILE_CHOOSER_NATIVE (chooser); GtkFileChooserNativeChoice *choice = find_choice (self, id); if (choice != NULL) { g_warning ("Choice with id %s already added to %s %p", id, G_OBJECT_TYPE_NAME (self), self); return; } g_assert ((options == NULL && option_labels == NULL) || g_strv_length ((char **)options) == g_strv_length ((char **)option_labels)); choice = g_new0 (GtkFileChooserNativeChoice, 1); choice->id = g_strdup (id); choice->label = g_strdup (label); choice->options = g_strdupv ((char **)options); choice->option_labels = g_strdupv ((char **)option_labels); self->choices = g_slist_prepend (self->choices, choice); gtk_file_chooser_add_choice (GTK_FILE_CHOOSER (self->dialog), id, label, options, option_labels); }
void EscalateTestSetMockHelperMessages(gchar **expected_messages, gchar **response_messages) { g_strfreev(mock_helper_expected_messages); g_strfreev(mock_helper_response_messages); mock_helper_expected_messages = g_strdupv(expected_messages); mock_helper_response_messages = g_strdupv(response_messages); }
void mex_action_manager_add_action (MexActionManager *manager, MexActionInfo *info) { MexActionInfo *info_copy; MexActionManagerPrivate *priv; g_return_if_fail (MEX_IS_ACTION_MANAGER (manager)); priv = manager->priv; if (g_hash_table_lookup (priv->actions, mx_action_get_name (info->action))) { g_warning (G_STRLOC ": Action '%s' already exists", mx_action_get_name (info->action)); return; } info_copy = g_slice_dup (MexActionInfo, info); info_copy->action = g_object_ref_sink (info->action); info_copy->mime_types = g_strdupv (info->mime_types); info_copy->exclude_mime_types = g_strdupv (info->exclude_mime_types); g_hash_table_insert (priv->actions, (gpointer)mx_action_get_name (info->action), info_copy); g_signal_emit (manager, signals[ACTION_ADDED], 0, info_copy); }
void gconf_defaults_unset_mandatory (GConfDefaults *mechanism, const char **includes, const char **excludes, DBusGMethodInvocation *context) { UnsetData *udata; ActionData *adata; start_operation (); udata = g_new0 (UnsetData, 1); udata->mechanism = g_object_ref (mechanism); udata->context = context; udata->includes = g_strdupv ((gchar **)includes); udata->excludes = g_strdupv ((gchar **)excludes); adata = g_new0 (ActionData, 1); adata->mechanism = g_object_ref (mechanism); adata->context = context; adata->includes = g_strdupv ((gchar **)includes); adata->auth_obtained_callback = do_unset_authorized; adata->data = udata; adata->destroy = unset_data_free; adata->annotation_key = "org.gnome.gconf.defaults.set-mandatory.prefix"; adata->default_action = "org.gnome.gconf.defaults.set-mandatory"; polkit_authority_enumerate_actions (mechanism->priv->auth, NULL, actions_ready_cb, adata); }
static void builder_options_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BuilderOptions *self = BUILDER_OPTIONS (object); gchar **tmp; switch (prop_id) { case PROP_CFLAGS: g_clear_pointer (&self->cflags, g_free); self->cflags = g_value_dup_string (value); break; case PROP_CXXFLAGS: g_clear_pointer (&self->cxxflags, g_free); self->cxxflags = g_value_dup_string (value); break; case PROP_PREFIX: g_clear_pointer (&self->prefix, g_free); self->prefix = g_value_dup_string (value); break; case PROP_ENV: tmp = self->env; self->env = g_strdupv (g_value_get_boxed (value)); g_strfreev (tmp); break; case PROP_ARCH: g_hash_table_destroy (self->arch); /* NOTE: This takes ownership of the hash table! */ self->arch = g_value_dup_boxed (value); break; case PROP_BUILD_ARGS: tmp = self->build_args; self->build_args = g_strdupv (g_value_get_boxed (value)); g_strfreev (tmp); break; case PROP_STRIP: self->strip = g_value_get_boolean (value); break; case PROP_NO_DEBUGINFO: self->no_debuginfo = g_value_get_boolean (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } }
static void do_copy (GConfDefaults *mechanism, gboolean mandatory, const gchar **includes, const gchar **excludes, GConfValue *value, DBusGMethodInvocation *context, ChangeSetCallback changeset_callback, gpointer user_data, GDestroyNotify destroy) { CopyData *cdata; ActionData *adata; start_operation (); cdata = g_new0 (CopyData, 1); cdata->mechanism = g_object_ref (mechanism); cdata->context = context; cdata->includes = g_strdupv ((gchar **)includes); cdata->excludes = g_strdupv ((gchar **)excludes); cdata->value = value; cdata->actions = NULL; cdata->changeset_callback = changeset_callback; cdata->user_data = user_data; cdata->destroy = destroy; adata = g_new0 (ActionData, 1); adata->mechanism = g_object_ref (mechanism); adata->context = context; adata->includes = g_strdupv ((gchar **)includes); adata->actions_ready_callback = check_polkit_for_actions; adata->auth_obtained_callback = do_copy_authorized; adata->data = cdata; adata->destroy = copy_data_free; /* check privileges for each include */ if (mandatory) { adata->annotation_key = "org.gnome.gconf.defaults.set-mandatory.prefix"; adata->default_action = "org.gnome.gconf.defaults.set-mandatory"; cdata->dest_address = "xml:merged:" SYSGCONFDIR "/gconf.xml.mandatory"; } else { adata->annotation_key = "org.gnome.gconf.defaults.set-system.prefix"; adata->default_action = "org.gnome.gconf.defaults.set-system"; cdata->dest_address = "xml:merged:" SYSGCONFDIR "/gconf.xml.system"; } polkit_authority_enumerate_actions (mechanism->priv->auth, NULL, actions_ready_cb, adata); }
void mdm_layout_activate (const char *layout) { #ifdef HAVE_LIBXKLAVIER XklConfigRec *config; char *p; int ii, ic; init_xkl (); config = xkl_config_rec_new (); config->model = g_strdup (initial_config->model); if (layout == NULL) { config->layouts = g_strdupv (initial_config->layouts); config->variants = g_strdupv (initial_config->variants); config->options = g_strdupv (initial_config->options); } else { config->layouts = g_new0 (char *, g_strv_length (initial_config->layouts) + 2); config->variants = g_new0 (char *, g_strv_length (initial_config->variants) + 2); config->layouts[0] = g_strdup (layout); p = strchr (config->layouts[0], '\t'); if (p != NULL) { config->layouts[0][p - config->layouts[0]] = 0; config->variants[0] = g_strdup (p + 1); } else { config->variants[0] = g_strdup (""); } /* append other layouts from the initial configuration, so that * the session gets all of them */ ic = 1; for (ii = 0; ii < g_strv_length (initial_config->layouts); ++ii) { if (g_strcmp0 (config->layouts[0], initial_config->layouts[ii]) || strcmp_null_empty (config->variants[0], initial_config->variants[ii])) { config->layouts[ic] = g_strdup (initial_config->layouts[ii]); if (initial_config->variants[ii] != NULL) config->variants[ic] = g_strdup (initial_config->variants[ii]); else config->variants[ic] = g_strdup (""); ++ic; } } config->options = g_strdupv (initial_config->options); } xkl_config_rec_activate (config, engine); g_object_unref (config); #endif }
static gint write_output_mem(wshc_output_info_t* out, const gchar* hostname, const wsh_cmd_res_t* res) { // Freed on destruction wshc_host_output_t* host_out = g_slice_new0(wshc_host_output_t); host_out->error = g_strdupv(res->std_error); host_out->output = g_strdupv(res->std_output); host_out->exit_code = res->exit_status; g_mutex_lock(out->mut); g_hash_table_insert(out->output, g_strdup(hostname), host_out); g_mutex_unlock(out->mut); return EXIT_SUCCESS; }
static void tp_contact_factory_got_avatar_requirements_cb (TpConnection *proxy, const gchar **mime_types, guint min_width, guint min_height, guint max_width, guint max_height, guint max_size, const GError *error, gpointer user_data, GObject *tp_factory) { EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory); if (error) { DEBUG ("Failed to get avatar requirements: %s", error->message); /* We'll just leave avatar_mime_types as NULL; the * avatar-setting code can use this as a signal that you can't * set avatars. */ } else { priv->avatar_mime_types = g_strdupv ((gchar **) mime_types); priv->avatar_min_width = min_width; priv->avatar_min_height = min_height; priv->avatar_max_width = max_width; priv->avatar_max_height = max_height; priv->avatar_max_size = max_size; } }
static void add_hostent (MonoAddressInfo *info, int flags, struct hostent *h) { MonoAddressEntry *cur, *prev = info->entries; int idx = 0; if (!h) return; if (!info->aliases) info->aliases = g_strdupv (h->h_aliases); while (h->h_addr_list [idx]) { cur = g_new0 (MonoAddressEntry, 1); if (prev) prev->next = cur; else info->entries = cur; if (flags & MONO_HINT_CANONICAL_NAME && h->h_name) cur->canonical_name = g_strdup (h->h_name); cur->family = h->h_addrtype; cur->socktype = SOCK_STREAM; cur->protocol = 0; /* Zero means the default stream protocol */ cur->address_len = h->h_length; memcpy (&cur->address, h->h_addr_list [idx], h->h_length); prev = cur; ++idx; } }
static void wpad_result(GResolvResultStatus status, char **results, gpointer user_data) { struct connman_wpad *wpad = user_data; const char *ptr; char *hostname; DBG("status %d", status); if (status == G_RESOLV_RESULT_STATUS_SUCCESS) { char *url; if (!results || g_strv_length(results) == 0) goto failed; url = g_strdup_printf("http://%s/wpad.dat", wpad->hostname); __connman_service_set_proxy_autoconfig(wpad->service, url); wpad->addrlist = g_strdupv(results); if (wpad->addrlist) download_pac(wpad, "wpad.dat"); g_free(url); __connman_wispr_start(wpad->service, CONNMAN_IPCONFIG_TYPE_IPV4); return; } hostname = wpad->hostname; if (strlen(hostname) < 6) goto failed; ptr = strchr(hostname + 5, '.'); if (!ptr || strlen(ptr) < 2) goto failed; if (!strchr(ptr + 1, '.')) goto failed; wpad->hostname = g_strdup_printf("wpad.%s", ptr + 1); g_free(hostname); DBG("hostname %s", wpad->hostname); g_resolv_lookup_hostname(wpad->resolv, wpad->hostname, wpad_result, wpad); return; failed: connman_service_set_proxy_method(wpad->service, CONNMAN_SERVICE_PROXY_METHOD_DIRECT); __connman_wispr_start(wpad->service, CONNMAN_IPCONFIG_TYPE_IPV4); }
void test_module_arguments (void) { gchar *function_name = NULL; gint argc = 3; gchar *argv[] = { "test program", "-f", "stub-function", NULL, }; gchar **copy_argv; copy_argv = g_strdupv(argv); factory = cut_module_factory_new("type1", "module1", NULL); cut_assert(factory); option_context = g_option_context_new(NULL); cut_module_factory_set_option_group(factory, option_context); cut_assert(g_option_context_parse(option_context, &argc, ©_argv, NULL)); g_strfreev(copy_argv); object = cut_module_factory_create(factory); cut_assert(object); g_object_get(object, "name", &function_name, NULL); cut_assert_equal_string_with_free("stub-function", function_name); g_object_unref(factory); factory = NULL; }
void _g_file_attribute_value_set_from_pointer (GFileAttributeValue *value, GFileAttributeType type, gpointer value_p, gboolean dup) { _g_file_attribute_value_clear (value); value->type = type; switch (type) { case G_FILE_ATTRIBUTE_TYPE_STRING: case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING: if (dup) value->u.string = g_strdup (value_p); else value->u.string = value_p; break; case G_FILE_ATTRIBUTE_TYPE_STRINGV: if (dup) value->u.stringv = g_strdupv (value_p); else value->u.stringv = value_p; break; case G_FILE_ATTRIBUTE_TYPE_OBJECT: if (dup) value->u.obj = g_object_ref (value_p); else value->u.obj = value_p; break; case G_FILE_ATTRIBUTE_TYPE_BOOLEAN: value->u.boolean = *(gboolean *)value_p; break; case G_FILE_ATTRIBUTE_TYPE_UINT32: value->u.uint32 = *(guint32 *)value_p; break; case G_FILE_ATTRIBUTE_TYPE_INT32: value->u.int32 = *(gint32 *)value_p; break; case G_FILE_ATTRIBUTE_TYPE_UINT64: value->u.uint64 = *(guint64 *)value_p; break; case G_FILE_ATTRIBUTE_TYPE_INT64: value->u.int64 = *(gint64 *)value_p; break; case G_FILE_ATTRIBUTE_TYPE_INVALID: break; default: g_warning ("Unknown type specified in g_file_info_set_attribute\n"); break; } }
gboolean dmap_mdns_publisher_publish (DMAPMdnsPublisher * publisher, const char *name, guint port, const char *type_of_service, gboolean password_required, gchar ** txt_records, GError ** error) { struct DMAPMdnsPublisherService *service; if (publisher->priv->client == NULL) { g_set_error (error, DMAP_MDNS_PUBLISHER_ERROR, DMAP_MDNS_PUBLISHER_ERROR_NOT_RUNNING, "%s", _("The avahi MDNS service is not running")); return FALSE; } service = g_new (struct DMAPMdnsPublisherService, 1); service->name = g_strdup (name); service->port = port; service->type_of_service = g_strdup (type_of_service); service->password_required = password_required; service->txt_records = g_strdupv (txt_records); publisher->priv->service = g_slist_append (publisher->priv->service, service); return create_services (publisher, error); }
/** * asb_package_set_filelist: * @pkg: A #AsbPackage * @filelist: package filelist * * Sets the package filelist. * * Since: 0.1.0 **/ void asb_package_set_filelist (AsbPackage *pkg, gchar **filelist) { AsbPackagePrivate *priv = GET_PRIVATE (pkg); g_strfreev (priv->filelist); priv->filelist = g_strdupv (filelist); }
/** * tp_connection_request_handles: * @self: a connection * @timeout_ms: the timeout in milliseconds, or -1 to use the default * @handle_type: the handle type * @ids: (array zero-terminated=1): an array of string identifiers for which * handles are required, terminated by %NULL (must not be %NULL or empty) * @callback: called on success or failure (unless @weak_object has become * unreferenced) * @user_data: arbitrary user-supplied data * @destroy: called to destroy @user_data after calling @callback, or when * @weak_object becomes unreferenced (whichever occurs sooner) * @weak_object: if not %NULL, an object to be weakly referenced: if it is * destroyed, @callback will not be called * * Request the handles corresponding to the given identifiers, and if they * are valid, hold (ensure a reference to) the corresponding handles. * * If they are valid, the callback will later be called with the given * handles; if not all of them are valid, the callback will be called with * an error. * * Deprecated: If @handle_type is TP_HANDLE_TYPE_CONTACT, use * tp_connection_dup_contact_by_id_async() instead. For channel requests, * use tp_account_channel_request_set_target_id() instead. */ void tp_connection_request_handles (TpConnection *self, gint timeout_ms, TpHandleType handle_type, const gchar * const *ids, TpConnectionRequestHandlesCb callback, gpointer user_data, GDestroyNotify destroy, GObject *weak_object) { RequestHandlesContext *context; g_return_if_fail (TP_IS_CONNECTION (self)); g_return_if_fail (handle_type > TP_HANDLE_TYPE_NONE); g_return_if_fail (handle_type < TP_NUM_HANDLE_TYPES); g_return_if_fail (ids != NULL); g_return_if_fail (ids[0] != NULL); g_return_if_fail (callback != NULL); context = g_slice_new0 (RequestHandlesContext); context->handle_type = handle_type; context->ids = g_strdupv ((GStrv) ids); context->user_data = user_data; context->destroy = destroy; context->callback = callback; tp_cli_connection_call_request_handles (self, timeout_ms, handle_type, (const gchar **) context->ids, connection_requested_handles, context, request_handles_context_free, weak_object); }
static gboolean goo_application_local_command_line (GApplication *application, char ***arguments, int *exit_status) { char **local_argv; int local_argc; GOptionContext *options_context; GError *error = NULL; gboolean handled_locally = FALSE; local_argv = g_strdupv (*arguments); local_argc = g_strv_length (local_argv); program_argv0 = g_strdup (local_argv[0]); *exit_status = EXIT_SUCCESS; options_context = goo_application_create_option_context (); if (! g_option_context_parse (options_context, &local_argc, &local_argv, &error)) { *exit_status = EXIT_FAILURE; g_critical ("Failed to parse arguments: %s", error->message); g_clear_error (&error); handled_locally = TRUE; } if (arg_version) { g_printf ("%s %s, Copyright © 2001-2013 Free Software Foundation, Inc.\n", PACKAGE_NAME, PACKAGE_VERSION); handled_locally = TRUE; } g_option_context_free (options_context); g_strfreev (local_argv); return handled_locally; }
static void do_check (GConfDefaults *mechanism, gboolean mandatory, const gchar **includes, DBusGMethodInvocation *context) { ActionData *adata; start_operation (); adata = g_new0 (ActionData, 1); adata->mechanism = g_object_ref (mechanism); adata->context = context; adata->includes = g_strdupv ((gchar **)includes); adata->actions_ready_callback = check_permissions_only; adata->auth_obtained_callback = NULL; adata->data = NULL; adata->destroy = NULL; if (mandatory) { adata->annotation_key = "org.gnome.gconf.defaults.set-mandatory.prefix"; adata->default_action = "org.gnome.gconf.defaults.set-mandatory"; } else { adata->annotation_key = "org.gnome.gconf.defaults.set-system.prefix"; adata->default_action = "org.gnome.gconf.defaults.set-system"; } polkit_authority_enumerate_actions (mechanism->priv->auth, NULL, actions_ready_cb, adata); }
EosUpdateInfo * eos_update_info_new (const gchar *checksum, GVariant *commit, const gchar *refspec, const gchar *original_refspec, const gchar * const *urls, EosExtensions *extensions) { EosUpdateInfo *info; g_return_val_if_fail (checksum != NULL, NULL); g_return_val_if_fail (commit != NULL, NULL); g_return_val_if_fail (refspec != NULL, NULL); g_return_val_if_fail (original_refspec != NULL, NULL); g_return_val_if_fail (EOS_IS_EXTENSIONS (extensions), NULL); info = g_object_new (EOS_TYPE_UPDATE_INFO, NULL); info->checksum = g_strdup (checksum); info->commit = g_variant_ref (commit); info->refspec = g_strdup (refspec); info->original_refspec = g_strdup (original_refspec); info->urls = g_strdupv ((gchar **) urls); info->extensions = g_object_ref (extensions); return info; }
/** * gst_meta_api_type_register: * @api: an API to register * @tags: tags for @api * * Register and return a GType for the @api and associate it with * @tags. * * Returns: a unique GType for @api. */ GType gst_meta_api_type_register (const gchar * api, const gchar ** tags) { GType type; g_return_val_if_fail (api != NULL, 0); g_return_val_if_fail (tags != NULL, 0); GST_CAT_DEBUG (GST_CAT_META, "register API \"%s\"", api); type = g_pointer_type_register_static (api); if (type != 0) { gint i; for (i = 0; tags[i]; i++) { GST_CAT_DEBUG (GST_CAT_META, " adding tag \"%s\"", tags[i]); g_type_set_qdata (type, g_quark_from_string (tags[i]), GINT_TO_POINTER (TRUE)); } } g_type_set_qdata (type, g_quark_from_string ("tags"), g_strdupv ((gchar **) tags)); return type; }
/** * signon_auth_session_query_available_mechanisms: * @self: the #SignonAuthSession. * @wanted_mechanisms: a %NULL-terminated list of mechanisms supported by the client. * @cb: (scope async): a callback which will be called with the result. * @user_data: user data to be passed to the callback. * * Queries the mechanisms available for this authentication session. the result * will be the intersection between @wanted_mechanisms and the mechanisms * supported by the authentication plugin. */ void signon_auth_session_query_available_mechanisms (SignonAuthSession *self, const gchar **wanted_mechanisms, SignonAuthSessionQueryAvailableMechanismsCb cb, gpointer user_data) { g_return_if_fail (SIGNON_IS_AUTH_SESSION (self)); SignonAuthSessionPrivate* priv = self->priv; g_return_if_fail (priv != NULL); AuthSessionQueryAvailableMechanismsCbData *cb_data = g_slice_new0 (AuthSessionQueryAvailableMechanismsCbData); cb_data->self = self; cb_data->cb = cb; cb_data->user_data = user_data; AuthSessionQueryAvailableMechanismsData *operation_data = g_slice_new0 (AuthSessionQueryAvailableMechanismsData); operation_data->wanted_mechanisms = g_strdupv ((gchar **)wanted_mechanisms); operation_data->cb_data = cb_data; auth_session_check_remote_object(self); _signon_object_call_when_ready (self, auth_session_object_quark(), auth_session_query_available_mechanisms_ready_cb, operation_data); }
static Request * request_new (NMSecretAgent *agent, NMConnection *connection, const char *connection_path, const char *setting_name, const char **hints, guint32 flags, NMSecretAgentGetSecretsFunc get_callback, NMSecretAgentSaveSecretsFunc save_callback, NMSecretAgentDeleteSecretsFunc delete_callback, gpointer callback_data) { static guint32 counter = 1; Request *r; r = g_slice_new0 (Request); r->id = counter++; r->agent = agent; r->connection = g_object_ref (connection); r->path = g_strdup (connection_path); r->setting_name = g_strdup (setting_name); if (hints) r->hints = g_strdupv ((gchar **) hints); r->flags = flags; r->get_callback = get_callback; r->save_callback = save_callback; r->delete_callback = delete_callback; r->callback_data = callback_data; r->cancellable = g_cancellable_new (); return r; }
static void bday_changed_cb (TpawCalendarButton *button, GDate *date, TpawUserInfo *self) { const gchar *strv[] = { NULL, NULL }; TpContactInfoField *field; self->priv->details_changed = TRUE; field = g_object_get_data ((GObject *) button, DATA_FIELD); g_assert (field != NULL); if (date != NULL) { gchar tmp[255]; g_date_strftime (tmp, sizeof (tmp), TPAW_DATE_FORMAT_DISPLAY_SHORT, date); strv[0] = tmp; } if (field->field_value != NULL) g_strfreev (field->field_value); field->field_value = g_strdupv ((GStrv) strv); }
void builder_context_set_global_cleanup_platform (BuilderContext *self, const char **cleanup) { g_strfreev (self->cleanup_platform); self->cleanup_platform = g_strdupv ((char **) cleanup); }
static void builder_source_script_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BuilderSourceScript *self = BUILDER_SOURCE_SCRIPT (object); gchar **tmp; switch (prop_id) { case PROP_COMMANDS: tmp = self->commands; self->commands = g_strdupv (g_value_get_boxed (value)); g_strfreev (tmp); break; case PROP_DEST_FILENAME: g_free (self->dest_filename); self->dest_filename = g_value_dup_string (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } }
static void ppp_connect(const char *iface, const char *local, const char *peer, const char *dns1, const char *dns2, gpointer user_data) { DBusConnection *conn = ofono_dbus_get_connection(); struct dundee_device *device = user_data; const char *dns[3] = { dns1, dns2, 0 }; DBG("%p", device); DBG("Network Device: %s\n", iface); DBG("IP Address: %s\n", local); DBG("Peer IP Address: %s\n", peer); DBG("Primary DNS Server: %s\n", dns1); DBG("Secondary DNS Server: %s\n", dns2); if (device->connect_timeout > 0) { g_source_remove(device->connect_timeout); device->connect_timeout = 0; } g_free(device->settings.interface); device->settings.interface = g_strdup(iface); if (device->settings.interface == NULL) goto err; g_free(device->settings.ip); device->settings.ip = g_strdup(local); if (device->settings.ip == NULL) goto err; g_strfreev(device->settings.nameservers); device->settings.nameservers = g_strdupv((gchar **)dns); if (device->settings.nameservers == NULL) goto err; __ofono_dbus_pending_reply(&device->pending, dbus_message_new_method_return(device->pending)); device->pending = NULL; device->active = TRUE; settings_changed(device); ofono_dbus_signal_property_changed(conn, device->path, DUNDEE_DEVICE_INTERFACE, "Active", DBUS_TYPE_BOOLEAN, &device->active); return; err: g_free(device->settings.interface); g_free(device->settings.ip); g_strfreev(device->settings.nameservers); device->settings.interface = NULL; device->settings.ip = NULL; device->settings.nameservers = NULL; __ofono_dbus_pending_reply(&device->pending, __dundee_error_failed(device->pending)); device->pending = NULL; }
static void mex_queue_plugin_init (MexQueuePlugin *self) { MexQueuePluginPrivate *priv = GET_PRIVATE (self); MexActionInfo *action_info; MexModelInfo *model_info; MexModel *queue_model; queue_model = mex_queue_model_dup_singleton (); g_object_set (queue_model, "icon-name", "icon-panelheader-queue", NULL); /* * Attention! Fake action .. this then causes MexContentBox to put an * MexQueueButton in its place */ action_info = g_new0 (MexActionInfo, 1); action_info->action = mx_action_new_full ("enqueue", _("Add to queue"), NULL, self); action_info->mime_types = g_strdupv ((gchar **)all_data_mimetypes); action_info->priority = 100; priv->actions = g_list_append (priv->actions, action_info); model_info = mex_model_info_new (queue_model, "queue", 0, NULL); priv->models = g_list_append (priv->models, model_info); }
static void gst_ss_demux_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstSSDemux *demux = GST_SS_DEMUX (object); switch (prop_id) { case PROP_COOKIES: g_strfreev (demux->cookies); demux->cookies = g_strdupv (g_value_get_boxed (value)); break; case PROP_ALLOW_AUDIO_ONLY: demux->allow_audio_only = g_value_get_boolean (value); break; case PROP_FRAGMENTS_CACHE: demux->fragments_cache = g_value_get_uint (value); break; case PROP_BITRATE_SWITCH_TOLERANCE: demux->bitrate_switch_tol = g_value_get_float (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
GError* meta0_remote_get_meta1_info(const char *m0, gchar ***out) { GError *e = NULL; gchar **result = NULL; gboolean on_reply(gpointer c1, MESSAGE reply) { (void) c1; gchar **tmpResult = NULL; if (NULL != (e = metautils_message_extract_body_strv (reply, &tmpResult))) { GRID_WARN("GetMeta1Info : invalid reply"); g_clear_error (&e); return FALSE; } if (tmpResult) { guint len,resultlen,i; gchar **v0; if ( result != NULL ) resultlen=g_strv_length(result); else resultlen=0; len = g_strv_length(tmpResult); v0 = g_realloc(result, sizeof(gchar*) * (len + resultlen+1)); for ( i=0; i<len ; i++) { v0[resultlen+i] = g_strdup(tmpResult[i]); } v0[len+resultlen]=NULL; result = g_strdupv(v0); g_strfreev(v0); g_strfreev(tmpResult); } return TRUE; }