GParamSpec * gimp_param_spec_duplicate (GParamSpec *pspec) { GParamSpec *copy = NULL; GParamFlags flags; g_return_val_if_fail (pspec != NULL, NULL); flags = pspec->flags | GIMP_CONFIG_PARAM_SERIALIZE; if (G_IS_PARAM_SPEC_STRING (pspec)) { GParamSpecString *spec = G_PARAM_SPEC_STRING (pspec); if (GEGL_IS_PARAM_SPEC_FILE_PATH (pspec)) { copy = gimp_param_spec_config_path (pspec->name, g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec), GIMP_CONFIG_PATH_FILE, spec->default_value, flags); } else { static GQuark multiline_quark = 0; if (! multiline_quark) multiline_quark = g_quark_from_static_string ("multiline"); copy = g_param_spec_string (pspec->name, g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec), spec->default_value, flags); if (GEGL_IS_PARAM_SPEC_MULTILINE (pspec)) { g_param_spec_set_qdata (copy, multiline_quark, GINT_TO_POINTER (TRUE)); } } } else if (G_IS_PARAM_SPEC_BOOLEAN (pspec)) { GParamSpecBoolean *spec = G_PARAM_SPEC_BOOLEAN (pspec); copy = g_param_spec_boolean (pspec->name, g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec), spec->default_value, flags); } else if (G_IS_PARAM_SPEC_ENUM (pspec)) { GParamSpecEnum *spec = G_PARAM_SPEC_ENUM (pspec); copy = g_param_spec_enum (pspec->name, g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec), G_TYPE_FROM_CLASS (spec->enum_class), spec->default_value, flags); } else if (GEGL_IS_PARAM_SPEC_DOUBLE (pspec)) { GeglParamSpecDouble *gspec = GEGL_PARAM_SPEC_DOUBLE (pspec); GParamSpecDouble *spec = G_PARAM_SPEC_DOUBLE (pspec); copy = gegl_param_spec_double (pspec->name, g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec), spec->minimum, spec->maximum, spec->default_value, gspec->ui_minimum, gspec->ui_maximum, gspec->ui_gamma, flags); } else if (G_IS_PARAM_SPEC_DOUBLE (pspec)) { GParamSpecDouble *spec = G_PARAM_SPEC_DOUBLE (pspec); copy = g_param_spec_double (pspec->name, g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec), spec->minimum, spec->maximum, spec->default_value, flags); } else if (G_IS_PARAM_SPEC_FLOAT (pspec)) { GParamSpecFloat *spec = G_PARAM_SPEC_FLOAT (pspec); copy = g_param_spec_float (pspec->name, g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec), spec->minimum, spec->maximum, spec->default_value, flags); } else if (GEGL_IS_PARAM_SPEC_INT (pspec)) { GeglParamSpecInt *gspec = GEGL_PARAM_SPEC_INT (pspec); GParamSpecInt *spec = G_PARAM_SPEC_INT (pspec); copy = gegl_param_spec_int (pspec->name, g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec), spec->minimum, spec->maximum, spec->default_value, gspec->ui_minimum, gspec->ui_maximum, gspec->ui_gamma, flags); } else if (GEGL_IS_PARAM_SPEC_SEED (pspec)) { copy = gegl_param_spec_seed (pspec->name, g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec), pspec->flags | GIMP_CONFIG_PARAM_SERIALIZE); } else if (G_IS_PARAM_SPEC_INT (pspec)) { GParamSpecInt *spec = G_PARAM_SPEC_INT (pspec); copy = g_param_spec_int (pspec->name, g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec), spec->minimum, spec->maximum, spec->default_value, flags); } else if (G_IS_PARAM_SPEC_UINT (pspec)) { GParamSpecUInt *spec = G_PARAM_SPEC_UINT (pspec); copy = g_param_spec_uint (pspec->name, g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec), spec->minimum, spec->maximum, spec->default_value, flags); } else if (GIMP_IS_PARAM_SPEC_RGB (pspec)) { GValue value = G_VALUE_INIT; GimpRGB color; g_value_init (&value, GIMP_TYPE_RGB); g_param_value_set_default (pspec, &value); gimp_value_get_rgb (&value, &color); g_value_unset (&value); copy = gimp_param_spec_rgb (pspec->name, g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec), gimp_param_spec_rgb_has_alpha (pspec), &color, flags); } else if (GEGL_IS_PARAM_SPEC_COLOR (pspec)) { GeglColor *gegl_color; GimpRGB gimp_color; gdouble r = 0.0; gdouble g = 0.0; gdouble b = 0.0; gdouble a = 1.0; GValue value = { 0, }; g_value_init (&value, GEGL_TYPE_COLOR); g_param_value_set_default (pspec, &value); gegl_color = g_value_get_object (&value); if (gegl_color) gegl_color_get_rgba (gegl_color, &r, &g, &b, &a); gimp_rgba_set (&gimp_color, r, g, b, a); g_value_unset (&value); copy = gimp_param_spec_rgb (pspec->name, g_param_spec_get_nick (pspec), g_param_spec_get_blurb (pspec), TRUE, &gimp_color, flags); } else if (G_IS_PARAM_SPEC_OBJECT (pspec) || G_IS_PARAM_SPEC_POINTER (pspec)) { /* silently ignore object properties */ } else { g_warning ("%s: not supported: %s (%s)\n", G_STRFUNC, g_type_name (G_TYPE_FROM_INSTANCE (pspec)), pspec->name); } if (copy) { GQuark quark = g_quark_from_static_string ("gegl-property-keys"); GHashTable *keys = g_param_spec_get_qdata (pspec, quark); if (keys) g_param_spec_set_qdata (copy, quark, g_hash_table_ref (keys)); } return copy; }
GHashTable * git_ref_command_get_refs (GitRefCommand *self) { return g_hash_table_ref (self->priv->refs); }
nmc->common = mc->common; /* If there aren't more playlists (remaining == 0), this will send the results after calculating the duration of the playlist. So, don't call emit_metadatas_results in this case. */ mafw_tracker_source_get_playlist_duration( nmc->common->source, nmc->object_id, _add_playlist_duration_cb, nmc); } else { g_hash_table_insert( mc->common->metadatas, current_obj->data, g_hash_table_ref(current_result->data)); mc->common->remaining--; /* If there aren't more playlists, send results. */ if (mc->common->remaining == 0) { _emit_metadatas_results(mc->common); } } current_obj = current_obj->next; current_result = current_result->next; } /* Free closure */ /* The elements of the object_ids list were added to the metadatas results and will be released when freeing the common closure. */
GHashTable * git_list_tree_command_get_blobs (GitListTreeCommand *self) { return g_hash_table_ref (self->priv->blobs); }
static GHashTable * parse_resource_file (const gchar *filename, gboolean collect_data, GHashTable *files) { GMarkupParser parser = { start_element, end_element, text }; ParseState state = { 0, }; GMarkupParseContext *context; GError *error = NULL; gchar *contents; GHashTable *table = NULL; gsize size; if (!g_file_get_contents (filename, &contents, &size, &error)) { g_printerr ("%s\n", error->message); g_clear_error (&error); return NULL; } state.collect_data = collect_data; state.table = g_hash_table_ref (files); context = g_markup_parse_context_new (&parser, G_MARKUP_TREAT_CDATA_AS_TEXT | G_MARKUP_PREFIX_ERROR_POSITION, &state, NULL); if (!g_markup_parse_context_parse (context, contents, size, &error) || !g_markup_parse_context_end_parse (context, &error)) { g_printerr ("%s: %s.\n", filename, error->message); g_clear_error (&error); } else { GHashTableIter iter; const char *key; char *mykey; gsize key_len; FileData *data; GVariant *v_data; GVariantBuilder builder; GvdbItem *item; table = gvdb_hash_table_new (NULL, NULL); g_hash_table_iter_init (&iter, state.table); while (g_hash_table_iter_next (&iter, (gpointer *)&key, (gpointer *)&data)) { key_len = strlen (key); mykey = g_strdup (key); item = gvdb_hash_table_insert (table, key); gvdb_item_set_parent (item, get_parent (table, mykey, key_len)); g_free (mykey); g_variant_builder_init (&builder, G_VARIANT_TYPE ("(uuay)")); g_variant_builder_add (&builder, "u", data->size); /* Size */ g_variant_builder_add (&builder, "u", data->flags); /* Flags */ v_data = g_variant_new_from_data (G_VARIANT_TYPE("ay"), data->content, data->content_size, TRUE, g_free, data->content); g_variant_builder_add_value (&builder, v_data); data->content = NULL; /* Take ownership */ gvdb_item_set_value (item, g_variant_builder_end (&builder)); } } g_hash_table_unref (state.table); g_markup_parse_context_free (context); g_free (contents); return table; }
struct MessageNewViewData * message_new_view_init(GHashTable *options) { struct MessageNewViewData *view; int ret; GVariant *tmp; Evas_Object *win; view = malloc(sizeof(struct MessageNewViewData)); if (!view) { g_critical("Failed to allocate new message view"); if (options) { g_hash_table_unref(options); } return NULL; } ret = ui_utils_view_init(VIEW_PTR(*view), ELM_WIN_BASIC, D_("New Message"), NULL, NULL, _destroy_cb); if (ret) { g_critical("Failed to init new message view"); if (options) { g_hash_table_unref(options); } free(view); return NULL; } view->mode = MODE_CONTENT; view->content = NULL; view->recipients = g_ptr_array_new(); view->messages_sent = 0; view->contact_list_data.view = VIEW_PTR(*view); view->layout_content = NULL; view->layout_recipients = NULL; view->layout_contacts = NULL; view->layout_number = NULL; view->notify = NULL; if (options) { tmp = g_hash_table_lookup(options, "Content"); if (tmp) { view->content = g_variant_dup_string(tmp, NULL); g_hash_table_unref(options); } else { // FIXME: do we have to ref? or is that done by dbus for us? g_hash_table_ref(options); g_ptr_array_add(view->recipients, options); } } elm_theme_extension_add(NULL, phoneui_theme); win = ui_utils_view_window_get(VIEW_PTR(*view)); ui_utils_view_delete_callback_set(VIEW_PTR(*view), _delete_cb); view->pager = elm_naviframe_add(win); elm_win_resize_object_add(win, view->pager); evas_object_show(view->pager); _init_content_page(view); return view; }