static void gwy_scroller_init(GwyScroller *scroller) { scroller->priv = G_TYPE_INSTANCE_GET_PRIVATE(scroller, GWY_TYPE_SCROLLER, Scroller); set_hadjustment(scroller, g_object_newv(GTK_TYPE_ADJUSTMENT, 0, NULL)); set_vadjustment(scroller, g_object_newv(GTK_TYPE_ADJUSTMENT, 0, NULL)); }
/** * g_mime_pkcs7_context_new: * @request_passwd: a #GMimePasswordRequestFunc * * Creates a new pkcs7 crypto context object. * * Returns: (transfer full): a new pkcs7 crypto context object. **/ GMimeCryptoContext * g_mime_pkcs7_context_new (GMimePasswordRequestFunc request_passwd) { #ifdef ENABLE_SMIME GMimeCryptoContext *crypto; GMimePkcs7Context *pkcs7; gpgme_ctx_t ctx; /* make sure GpgMe supports the CMS protocols */ if (gpgme_engine_check_version (GPGME_PROTOCOL_CMS) != GPG_ERR_NO_ERROR) return NULL; /* create the GpgMe context */ if (gpgme_new (&ctx) != GPG_ERR_NO_ERROR) return NULL; pkcs7 = g_object_newv (GMIME_TYPE_PKCS7_CONTEXT, 0, NULL); gpgme_set_passphrase_cb (ctx, pkcs7_passphrase_cb, pkcs7); gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); pkcs7->priv->ctx = ctx; crypto = (GMimeCryptoContext *) pkcs7; crypto->request_passwd = request_passwd; return crypto; #else return NULL; #endif /* ENABLE_SMIME */ }
/** * g_mime_content_type_new_from_string: * @str: input string containing a content-type (and params) * * Constructs a new Content-Type object based on the input string. * * Returns: a new #GMimeContentType object based on the input string. **/ GMimeContentType * g_mime_content_type_new_from_string (const char *str) { GMimeContentType *mime_type; const char *inptr = str; char *type, *subtype; g_return_val_if_fail (str != NULL, NULL); if (!g_mime_parse_content_type (&inptr, &type, &subtype)) return g_mime_content_type_new ("application", "octet-stream"); mime_type = g_object_newv (GMIME_TYPE_CONTENT_TYPE, 0, NULL); mime_type->subtype = subtype; mime_type->type = type; /* skip past any remaining junk that shouldn't be here... */ decode_lwsp (&inptr); while (*inptr && *inptr != ';') inptr++; if (*inptr++ == ';' && *inptr) { GMimeParam *param; param = mime_type->params = g_mime_param_new_from_string (inptr); while (param != NULL) { g_hash_table_insert (mime_type->param_hash, param->name, param); param = param->next; } } return mime_type; }
RygelPlugin* rygel_plugin_construct (GType object_type, const char* name, const char* title) { RygelPlugin * self; char* _tmp1_; const char* _tmp0_; char* _tmp3_; const char* _tmp2_; GeeArrayList* _tmp6_; GeeArrayList* _tmp7_; RygelResourceInfo* resource_info; g_return_val_if_fail (name != NULL, NULL); self = g_object_newv (object_type, 0, NULL); _tmp1_ = NULL; _tmp0_ = NULL; self->name = (_tmp1_ = (_tmp0_ = name, (_tmp0_ == NULL) ? NULL : g_strdup (_tmp0_)), self->name = (g_free (self->name), NULL), _tmp1_); _tmp3_ = NULL; _tmp2_ = NULL; self->title = (_tmp3_ = (_tmp2_ = title, (_tmp2_ == NULL) ? NULL : g_strdup (_tmp2_)), self->title = (g_free (self->title), NULL), _tmp3_); rygel_plugin_set_available (self, TRUE); if (title == NULL) { char* _tmp5_; const char* _tmp4_; _tmp5_ = NULL; _tmp4_ = NULL; self->title = (_tmp5_ = (_tmp4_ = name, (_tmp4_ == NULL) ? NULL : g_strdup (_tmp4_)), self->title = (g_free (self->title), NULL), _tmp5_); } _tmp6_ = NULL; self->resource_infos = (_tmp6_ = gee_array_list_new (RYGEL_TYPE_RESOURCE_INFO, (GBoxedCopyFunc) rygel_resource_info_ref, rygel_resource_info_unref, g_direct_equal), (self->resource_infos == NULL) ? NULL : (self->resource_infos = (g_object_unref (self->resource_infos), NULL)), _tmp6_); _tmp7_ = NULL; self->icon_infos = (_tmp7_ = gee_array_list_new (RYGEL_TYPE_ICON_INFO, (GBoxedCopyFunc) rygel_icon_info_ref, rygel_icon_info_unref, g_direct_equal), (self->icon_infos == NULL) ? NULL : (self->icon_infos = (g_object_unref (self->icon_infos), NULL)), _tmp7_); resource_info = rygel_resource_info_new (RYGEL_CONNECTION_MANAGER_UPNP_ID, RYGEL_CONNECTION_MANAGER_UPNP_TYPE, RYGEL_CONNECTION_MANAGER_DESCRIPTION_PATH, RYGEL_TYPE_CONNECTION_MANAGER); rygel_plugin_add_resource (self, resource_info); (resource_info == NULL) ? NULL : (resource_info = (rygel_resource_info_unref (resource_info), NULL)); return self; }
GtkMateBundle* gtk_mate_bundle_construct (GType object_type, const char* name) { GtkMateBundle * self; g_return_val_if_fail (name != NULL, NULL); self = g_object_newv (object_type, 0, NULL); gtk_mate_bundle_set_name (self, name); return self; }
GObject * g_object_clone(GObject *src) { GObject *dst; GParameter *params; GParamSpec **specs; guint n, n_specs, n_params; specs = g_object_class_list_properties(G_OBJECT_GET_CLASS(src), &n_specs); params = g_new0(GParameter, n_specs); n_params = 0; for (n = 0; n < n_specs; ++n) if (strcmp(specs[n]->name, "parent") && (specs[n]->flags & G_PARAM_READWRITE) == G_PARAM_READWRITE) { params[n_params].name = g_intern_string(specs[n]->name); g_value_init(¶ms[n_params].value, specs[n]->value_type); g_object_get_property(src, specs[n]->name, ¶ms[n_params].value); ++ n_params; } dst = g_object_newv(G_TYPE_FROM_INSTANCE(src), n_params, params); g_free(specs); g_free(params); return dst; }
GObject* rbgobj_gobject_new(GType gtype, VALUE params_hash) { GObject* result; if (!g_type_is_a(gtype, G_TYPE_OBJECT)) rb_raise(rb_eArgError, "type \"%s\" is not descendant of GObject", g_type_name(gtype)); if (NIL_P(params_hash)) { result = g_object_newv(gtype, 0, NULL); } else { size_t param_size; struct param_setup_arg arg; param_size = NUM2INT(rb_funcall(params_hash, rb_intern("length"), 0)); arg.param_size = param_size; arg.gclass = G_OBJECT_CLASS(g_type_class_ref(gtype)); arg.params = ALLOCA_N(GParameter, param_size); memset(arg.params, 0, sizeof(GParameter) * param_size); arg.params_hash = params_hash; arg.index = 0; result = (GObject*)rb_ensure(&gobj_new_body, (VALUE)&arg, &gobj_new_ensure, (VALUE)&arg); } if (!result) rb_raise(rb_eRuntimeError, "g_object_newv failed"); return result; }
/** * g_mime_stream_mmap_new: * @fd: file descriptor * @prot: protection flags * @flags: map flags * * Creates a new #GMimeStreamMmap object around @fd. * * Returns: a stream using @fd. **/ GMimeStream * g_mime_stream_mmap_new (int fd, int prot, int flags) { #ifdef HAVE_MMAP GMimeStreamMmap *mstream; struct stat st; gint64 start; char *map; if ((start = lseek (fd, 0, SEEK_CUR)) == -1) return NULL; if (fstat (fd, &st) == -1) return NULL; map = mmap (NULL, st.st_size, prot, flags, fd, 0); if (map == MAP_FAILED) return NULL; mstream = g_object_newv (GMIME_TYPE_STREAM_MMAP, 0, NULL); g_mime_stream_construct ((GMimeStream *) mstream, start, -1); mstream->owner = TRUE; mstream->eos = FALSE; mstream->fd = fd; mstream->map = map; mstream->maplen = st.st_size; return (GMimeStream *) mstream; #else return NULL; #endif /* HAVE_MMAP */ }
/** * g_mime_stream_mmap_new_with_bounds: * @fd: file descriptor * @prot: protection flags * @flags: map flags * @start: start boundary * @end: end boundary * * Creates a new #GMimeStreamMmap object around @fd with bounds @start * and @end. * * Returns: a stream using @fd with bounds @start and @end. **/ GMimeStream * g_mime_stream_mmap_new_with_bounds (int fd, int prot, int flags, gint64 start, gint64 end) { #ifdef HAVE_MMAP GMimeStreamMmap *mstream; struct stat st; size_t len; char *map; if (end == -1) { if (fstat (fd, &st) == -1) return NULL; len = st.st_size; } else len = (size_t) end; if ((map = mmap (NULL, len, prot, flags, fd, 0)) == MAP_FAILED) return NULL; mstream = g_object_newv (GMIME_TYPE_STREAM_MMAP, 0, NULL); g_mime_stream_construct ((GMimeStream *) mstream, start, end); mstream->owner = TRUE; mstream->eos = FALSE; mstream->fd = fd; mstream->map = map; mstream->maplen = len; return (GMimeStream *) mstream; #else return NULL; #endif /* HAVE_MMAP */ }
static VALUE gobj_new_body(struct param_setup_arg* arg) { rb_iterate(rb_each, (VALUE)arg->params_hash, _params_setup, (VALUE)arg); return (VALUE)g_object_newv(G_TYPE_FROM_CLASS(arg->gclass), arg->param_size, arg->params); }
/** * g_mime_content_type_new: * @type: MIME type (or %NULL for "text") * @subtype: MIME subtype (or %NULL for "plain") * * Creates a Content-Type object with type @type and subtype @subtype. * * Returns: a new #GMimeContentType object. **/ GMimeContentType * g_mime_content_type_new (const char *type, const char *subtype) { GMimeContentType *mime_type; mime_type = g_object_newv (GMIME_TYPE_CONTENT_TYPE, 0, NULL); if (type && *type && subtype && *subtype) { mime_type->type = g_strdup (type); mime_type->subtype = g_strdup (subtype); } else { if (type && *type) { mime_type->type = g_strdup (type); if (!g_ascii_strcasecmp (type, "text")) { mime_type->subtype = g_strdup ("plain"); } else if (!g_ascii_strcasecmp (type, "multipart")) { mime_type->subtype = g_strdup ("mixed"); } else { g_free (mime_type->type); mime_type->type = g_strdup ("application"); mime_type->subtype = g_strdup ("octet-stream"); } } else { mime_type->type = g_strdup ("application"); mime_type->subtype = g_strdup ("octet-stream"); } w(g_warning ("Invalid or incomplete type: %s%s%s: defaulting to %s/%s", type ? type : "", subtype ? "/" : "", subtype ? subtype : "", mime_type->type, mime_type->subtype)); } return mime_type; }
EntryDialog* entry_dialog_construct (GType object_type) { EntryDialog * self; self = g_object_newv (object_type, 0, NULL); gtk_dialog_add_button ((GtkDialog*) self, GTK_STOCK_CANCEL, (gint) GTK_RESPONSE_CANCEL); gtk_dialog_add_button ((GtkDialog*) self, GTK_STOCK_OK, (gint) GTK_RESPONSE_OK); return self; }
GtkMateGrammar* gtk_mate_grammar_construct (GType object_type, PListDict* plist) { GtkMateGrammar * self; g_return_val_if_fail (plist != NULL, NULL); self = g_object_newv (object_type, 0, NULL); gtk_mate_grammar_set_plist (self, plist); return self; }
void ags_track_collection_add_mapper(AgsTrackCollection *track_collection, xmlNode *track, gchar *instrument, gchar *sequence) { AgsTrackCollectionMapper *track_collection_mapper; if(track == NULL || instrument == NULL || sequence == NULL){ return; } track_collection_mapper = (AgsTrackCollectionMapper *) g_object_newv(track_collection->child_type, track_collection->child_parameter_count, track_collection->child_parameter); g_object_set(track_collection_mapper, "track\0", track, "instrument\0", instrument, "sequence\0", sequence, NULL); gtk_box_pack_start(GTK_BOX(track_collection->child), GTK_WIDGET(track_collection_mapper), FALSE, FALSE, 0); }
/** * gwy_surface_new_sized: * @n: Number of points. * * Creates a new surface with preallocated size. * * The surface will contain the speficied number of points with uninitialised * values. * * Returns: A new surface. * * Since: 2.45 **/ GwySurface* gwy_surface_new_sized(guint n) { GwySurface *surface = g_object_newv(GWY_TYPE_SURFACE, 0, NULL); surface->n = n; alloc_data(surface); return surface; }
GConfDialog* gconf_dialog_construct (GType object_type, const char* dialog_title) { GConfDialog * self; g_return_val_if_fail (dialog_title != NULL, NULL); self = g_object_newv (object_type, 0, NULL); gtk_window_set_title ((GtkWindow*) self, dialog_title); gtk_window_set_icon_name ((GtkWindow*) self, "gtk-preferences"); return self; }
static GObject* item_new(const gchar *name, gint value) { GwyItemTest *itemtest = g_object_newv(GWY_TYPE_ITEM_TEST, 0, NULL); itemtest->name = g_strdup(name); itemtest->value = value; return (GObject*)itemtest; }
/** * gst_task_pool_new: * * Create a new default task pool. The default task pool will use a regular * GThreadPool for threads. * * Returns: (transfer full): a new #GstTaskPool. gst_object_unref() after usage. */ GstTaskPool * gst_task_pool_new (void) { GstTaskPool *pool; pool = g_object_newv (GST_TYPE_TASK_POOL, 0, NULL); return pool; }
/** * gst_collect_pads_new: * * Create a new instance of #GstCollectPads. * * Returns: a new #GstCollectPads, or NULL in case of an error. * * MT safe. */ GstCollectPads * gst_collect_pads_new (void) { GstCollectPads *newcoll; newcoll = g_object_newv (GST_TYPE_COLLECT_PADS, 0, NULL); return newcoll; }
static GObject* item_copy(const GObject *item) { const GwyItemTest *itemtest = (const GwyItemTest*)item; GwyItemTest *copy = g_object_newv(GWY_TYPE_ITEM_TEST, 0, NULL); copy->value = itemtest->value; copy->name = g_strdup(itemtest->name); return (GObject*)copy; }
/** * gst_index_new: * * Create a new dummy index object. Use gst_element_set_index() to assign that * to an element or pipeline. This index is not storing anything, but will * still emit e.g. the #GstIndex::entry-added signal. * * Returns: (transfer full): a new index object */ GstIndex * gst_index_new (void) { GstIndex *index; index = g_object_newv (gst_index_get_type (), 0, NULL); return index; }
GObject *json_gobject_deserialize (GType gtype, json_t *object) { GObjectClass *klass; GObject *ret; guint n_members, i; json_t *head, *member; const char *member_name; GArray *construct_params; klass = g_type_class_ref (gtype); n_members = json_object_size (object); construct_params = g_array_sized_new (FALSE, FALSE, sizeof (GParameter), n_members); head = json_object_iter (object); for (member=head; member; member=json_object_iter_next (object, member)) { GParamSpec *pspec; GParameter param = { NULL, }; const char *member_name = json_object_iter_key (member); json_t *val = json_object_iter_value(member); pspec = g_object_class_find_property (klass, member_name); if (!pspec) continue; if (pspec->flags & G_PARAM_CONSTRUCT_ONLY) continue; if (!(pspec->flags & G_PARAM_WRITABLE)) continue; g_value_init(¶m.value, G_PARAM_SPEC_VALUE_TYPE (pspec)); if (json_deserialize_pspec (¶m.value, pspec, val)) { param.name = g_strdup (pspec->name); g_array_append_val (construct_params, param); } else g_warning ("Failed to deserialize \"%s\" property of type \"%s\" for an object of type \"%s\"", pspec->name, g_type_name (G_VALUE_TYPE (¶m.value)), g_type_name (gtype)); } ret = g_object_newv (gtype, construct_params->len, (GParameter *) construct_params->data); for (i=0; i!= construct_params->len; ++i) { GParameter *param = &g_array_index (construct_params, GParameter, i); g_free ((gchar *) param->name); g_value_unset (¶m->value); } g_array_free(construct_params, TRUE); g_type_class_unref(klass); return ret; }
/** * internet_address_group_new: * @name: group name * * Creates a new #InternetAddressGroup object with the specified * @name. * * Returns: a new #InternetAddressGroup object. * * Note: The @name string should be in UTF-8. **/ InternetAddress * internet_address_group_new (const char *name) { InternetAddress *group; group = g_object_newv (INTERNET_ADDRESS_TYPE_GROUP, 0, NULL); _internet_address_set_name (group, name); return group; }
/** * g_mime_stream_null_new: * * Creates a new #GMimeStreamNull object. * * Returns: a new null stream (similar to /dev/null on Unix). **/ GMimeStream * g_mime_stream_null_new (void) { GMimeStream *null; null = g_object_newv (GMIME_TYPE_STREAM_NULL, 0, NULL); g_mime_stream_construct (null, 0, -1); return null; }
/** * gst_bus_new: * * Creates a new #GstBus instance. * * Returns: (transfer full): a new #GstBus instance */ GstBus * gst_bus_new (void) { GstBus *result; result = g_object_newv (gst_bus_get_type (), 0, NULL); GST_DEBUG_OBJECT (result, "created new bus"); return result; }
static GMimeStream * stream_substream (GMimeStream *stream, gint64 start, gint64 end) { GMimeStream *null; null = g_object_newv (GMIME_TYPE_STREAM_NULL, 0, NULL); g_mime_stream_construct (null, start, end); return null; }
/** * gst_buffer_pool_new: * * Creates a new #GstBufferPool instance. * * Returns: (transfer full): a new #GstBufferPool instance */ GstBufferPool * gst_buffer_pool_new (void) { GstBufferPool *result; result = g_object_newv (GST_TYPE_BUFFER_POOL, 0, NULL); GST_DEBUG_OBJECT (result, "created new buffer pool"); return result; }
/** * g_mime_filter_reply_new: * @encode: %TRUE if the filter should encode or %FALSE otherwise * @dots: encode/decode dots (as for SMTP) * * Creates a new #GMimeFilterReply filter. * * If @encode is %TRUE, then all lines will be prefixed by "> ", * otherwise any lines starting with "> " will have that removed * * Returns: a new #GMimeFilterReply filter. **/ GMimeFilter * g_mime_filter_reply_new (gboolean encode) { GMimeFilterReply *new_reply; new_reply = (GMimeFilterReply *) g_object_newv (GMIME_TYPE_FILTER_REPLY, 0, NULL); new_reply->encode = encode; return (GMimeFilter *) new_reply; }
RygelWMATranscoderBin* rygel_wma_transcoder_bin_construct (GType object_type, RygelMediaItem* item, GstElement* src, RygelWMATranscoder* transcoder, GError** error) { #line 147 "rygel-wma-transcoder-bin.c" GError * _inner_error_; RygelWMATranscoderBin * self; GstElement* decodebin; GstElement* _tmp0_; GstElement* _tmp1_; GstPad* src_pad; GstGhostPad* ghost; #line 32 "rygel-wma-transcoder-bin.vala" g_return_val_if_fail (item != NULL, NULL); #line 32 "rygel-wma-transcoder-bin.vala" g_return_val_if_fail (src != NULL, NULL); #line 32 "rygel-wma-transcoder-bin.vala" g_return_val_if_fail (transcoder != NULL, NULL); #line 161 "rygel-wma-transcoder-bin.c" _inner_error_ = NULL; self = g_object_newv (object_type, 0, NULL); #line 35 "rygel-wma-transcoder-bin.vala" decodebin = rygel_gst_utils_create_element (RYGEL_WMA_TRANSCODER_BIN_DECODEBIN, RYGEL_WMA_TRANSCODER_BIN_DECODEBIN, &_inner_error_); #line 166 "rygel-wma-transcoder-bin.c" if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); gst_object_unref (self); return NULL; } #line 37 "rygel-wma-transcoder-bin.vala" _tmp0_ = rygel_wma_transcoder_create_encoder (transcoder, item, RYGEL_WMA_TRANSCODER_BIN_AUDIO_SRC_PAD, RYGEL_WMA_TRANSCODER_BIN_AUDIO_SINK_PAD, &_inner_error_); #line 174 "rygel-wma-transcoder-bin.c" if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); _gst_object_unref0 (decodebin); gst_object_unref (self); return NULL; } #line 37 "rygel-wma-transcoder-bin.vala" self->priv->audio_enc = (_tmp1_ = _tmp0_, _gst_object_unref0 (self->priv->audio_enc), _tmp1_); #line 41 "rygel-wma-transcoder-bin.vala" gst_bin_add_many ((GstBin*) self, _gst_object_ref0 (src), _gst_object_ref0 (decodebin), _gst_object_ref0 (self->priv->audio_enc), NULL); #line 42 "rygel-wma-transcoder-bin.vala" gst_element_link (src, decodebin); #line 44 "rygel-wma-transcoder-bin.vala" src_pad = gst_element_get_static_pad (self->priv->audio_enc, RYGEL_WMA_TRANSCODER_BIN_AUDIO_SRC_PAD); #line 45 "rygel-wma-transcoder-bin.vala" ghost = (GstGhostPad*) gst_ghost_pad_new (NULL, src_pad); #line 46 "rygel-wma-transcoder-bin.vala" gst_element_add_pad ((GstElement*) self, _gst_object_ref0 ((GstPad*) ghost)); #line 48 "rygel-wma-transcoder-bin.vala" g_signal_connect_object (decodebin, "pad-added", (GCallback) _rygel_wma_transcoder_bin_decodebin_pad_added_gst_element_pad_added, self, 0); #line 195 "rygel-wma-transcoder-bin.c" _gst_object_unref0 (decodebin); _gst_object_unref0 (src_pad); _gst_object_unref0 (ghost); return self; }
RygelDIDLLiteWriter* rygel_didl_lite_writer_construct (GType object_type, RygelHTTPServer* http_server) { RygelDIDLLiteWriter * self; RygelHTTPServer* _tmp1_; RygelHTTPServer* _tmp0_; g_return_val_if_fail (http_server != NULL, NULL); self = g_object_newv (object_type, 0, NULL); _tmp1_ = NULL; _tmp0_ = NULL; self->priv->http_server = (_tmp1_ = (_tmp0_ = http_server, (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_)), (self->priv->http_server == NULL) ? NULL : (self->priv->http_server = (g_object_unref (self->priv->http_server), NULL)), _tmp1_); return self; }