Exemplo n.º 1
0
void _fcitx_im_widget_load(FcitxImWidget* self)
{
    gtk_list_store_clear(self->imstore);

    if (self->array) {
        g_ptr_array_set_free_func(self->array, (GDestroyNotify) fcitx_im_item_free);
        g_ptr_array_free(self->array, FALSE);
        self->array = NULL;
    }

    self->array = fcitx_input_method_get_imlist(self->improxy);

    if (self->array) {
        g_ptr_array_set_free_func(self->array, NULL);
        foreach_ct context;
        context.widget = self;
        context.flag = FALSE;
        g_ptr_array_foreach(self->array, _fcitx_inputmethod_insert_foreach_cb, &context);

        if (context.flag)
            gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(self->imview)), &context.iter);
        g_free(self->focus);
        self->focus = NULL;

        _fcitx_im_widget_im_selection_changed(gtk_tree_view_get_selection(GTK_TREE_VIEW(self->imview)), self);
    }
}
static void
my_timeline_model_init (MyTimelineModel * self)
{
    GPtrArray *timeline_first_n;

    MyTimelineModelPrivate *priv =
        my_timeline_model_get_instance_private (MY_TIMELINE_MODEL (self));

    priv->systems = g_ptr_array_new ();
    priv->std_systems_data = g_ptr_array_new ();   
    priv->tl_systems_data = g_ptr_array_new ();
    priv->tl_arrows = g_ptr_array_new ();

    g_ptr_array_set_free_func (priv->systems, g_object_unref);
    g_ptr_array_set_free_func (priv->std_systems_data, g_object_unref);
    g_ptr_array_set_free_func (priv->tl_systems_data,
                               (GDestroyNotify) g_ptr_array_unref);
    g_ptr_array_set_free_func (priv->tl_arrows,
                               (GDestroyNotify) g_ptr_array_unref);

    /* The page size is normally 0 for GtkScale */
    priv->adjust =
        gtk_adjustment_new (priv->tl_systems_data->len, 1.0, 1.0, 1.0, 0.5,
                            0.0);

    g_signal_connect_swapped (priv->adjust, "value-changed",
                              G_CALLBACK (my_timeline_index_changed), self);

    g_signal_connect (self, "time-pos-added",
                      G_CALLBACK (tl_systems_data_fill_new_n_at_pos), NULL);

    my_timeline_model_append_to_timeline (self);
}
Exemplo n.º 3
0
static void
finalize (GObject *object)
{
	NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (object);

	g_free (priv->gateway);

	g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip6_address_unref);
	g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip6_route_unref);
	g_slist_free_full (priv->nameservers, g_free);

	if (priv->domains) {
		g_ptr_array_set_free_func (priv->domains, g_free);
		g_ptr_array_free (priv->domains, TRUE);
	}

	if (priv->searches) {
		g_ptr_array_set_free_func (priv->searches, g_free);
		g_ptr_array_free (priv->searches, TRUE);
	}

	g_object_unref (priv->proxy);

	G_OBJECT_CLASS (nm_ip6_config_parent_class)->finalize (object);
}
Exemplo n.º 4
0
/**
 * fuzzy_new:
 * @case_sensitive: %TRUE if case should be preserved.
 *
 * Create a new #Fuzzy for fuzzy matching strings.
 *
 * Returns: A newly allocated #Fuzzy that should be freed with fuzzy_unref().
 */
Fuzzy *
fuzzy_new (gboolean case_sensitive)
{
   GArray *table;
   Fuzzy *fuzzy;
   gint i;

   fuzzy = g_new0(Fuzzy, 1);
   fuzzy->ref_count = 1;
   fuzzy->heap_length = FUZZY_GROW_HEAP_BY;
   fuzzy->heap = g_malloc(fuzzy->heap_length);
   fuzzy->heap_offset = 0;
   fuzzy->id_to_value = g_ptr_array_new();
   fuzzy->id_to_text_offset = g_array_new(FALSE, FALSE, sizeof(gsize));
   fuzzy->char_tables = g_ptr_array_new();
   fuzzy->case_sensitive = case_sensitive;
   g_ptr_array_set_free_func(fuzzy->char_tables,
                             (GDestroyNotify)g_array_unref);

   for (i = 0; i < 256; i++) {
      table = g_array_new(FALSE, FALSE, sizeof(FuzzyItem));
      g_ptr_array_add(fuzzy->char_tables, table);
   }

   return fuzzy;
}
Exemplo n.º 5
0
static void
finalize (GObject *object)
{
	NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE (object);

	g_free (priv->port);
	g_free (priv->duplex);
	g_free (priv->s390_nettype);

	g_hash_table_destroy (priv->s390_options);

	if (priv->device_mac_address)
		g_byte_array_free (priv->device_mac_address, TRUE);

	if (priv->cloned_mac_address)
		g_byte_array_free (priv->cloned_mac_address, TRUE);

	g_slist_free_full (priv->mac_address_blacklist, g_free);

	if (priv->s390_subchannels) {
		g_ptr_array_set_free_func (priv->s390_subchannels, g_free);
		g_ptr_array_free (priv->s390_subchannels, TRUE);
	}

	G_OBJECT_CLASS (nm_setting_wired_parent_class)->finalize (object);
}
Exemplo n.º 6
0
static
struct bt_ctf_field *bt_ctf_field_array_create(struct bt_ctf_field_type *type)
{
	struct bt_ctf_field_array *array = g_new0(struct bt_ctf_field_array, 1);
	struct bt_ctf_field_type_array *array_type;
	unsigned int array_length;

	if (!array || !type) {
		goto error;
	}

	array_type = container_of(type, struct bt_ctf_field_type_array, parent);
	array_length = array_type->length;
	array->elements = g_ptr_array_sized_new(array_length);
	if (!array->elements) {
		goto error;
	}

	g_ptr_array_set_free_func(array->elements,
		(GDestroyNotify)bt_ctf_field_put);
	g_ptr_array_set_size(array->elements, array_length);
	return &array->parent;
error:
	g_free(array);
	return NULL;
}
Exemplo n.º 7
0
ZeitgeistLog *
biji_zeitgeist_init (void)
{
  GPtrArray *ptr_arr;
  ZeitgeistEvent *event;
  ZeitgeistDataSource *ds;
  ZeitgeistDataSourceRegistry *zg_dsr = NULL;
  ZeitgeistLog *log;

  log = zeitgeist_log_new ();
  event = zeitgeist_event_new_full (
    NULL, NULL, "application://bijiben.desktop", NULL, NULL);

  ptr_arr = g_ptr_array_new ();
  g_ptr_array_add (ptr_arr, event);

  ds = zeitgeist_data_source_new_full ("org.gnome.bijiben,dataprovider",
                                       "Notes dataprovider",
                                       "Logs events about accessed notes",
                                       ptr_arr),

  zg_dsr = zeitgeist_data_source_registry_new ();
  zeitgeist_data_source_registry_register_data_source (zg_dsr, ds,
                                                       NULL, NULL, NULL);
  g_ptr_array_set_free_func (ptr_arr, g_object_unref);
  g_ptr_array_unref (ptr_arr);

  return log;
}
static void
tf_call_channel_get_property (GObject    *object,
    guint       property_id,
    GValue     *value,
    GParamSpec *pspec)
{
  TfCallChannel *self = TF_CALL_CHANNEL (object);

  switch (property_id)
    {
    case PROP_FS_CONFERENCES:
      {
        GPtrArray *array = g_ptr_array_sized_new (
            g_hash_table_size (self->fsconferences));

        g_ptr_array_set_free_func (array, gst_object_unref);
        g_hash_table_foreach (self->fsconferences, conf_into_ptr_array, array);
        g_value_take_boxed (value, array);
      }
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
      break;
    }
}
Exemplo n.º 9
0
/**
 * fcitx_kbd_get_layouts: (skip)
 **/
FCITX_EXPORT_API
GPtrArray *fcitx_kbd_get_layouts(FcitxKbd *kbd) {
    GPtrArray *array = fcitx_kbd_get_layouts_nofree(kbd);
    if (array)
        g_ptr_array_set_free_func(array, fcitx_layout_item_free);
    return array;
}
Exemplo n.º 10
0
GtkCssValue *
_gtk_css_shadows_value_parse (GtkCssParser *parser,
                              gboolean      box_shadow_mode)
{
  GtkCssValue *value, *result;
  GPtrArray *values;

  if (_gtk_css_parser_try (parser, "none", TRUE))
    return _gtk_css_shadows_value_new_none ();

  values = g_ptr_array_new ();

  do {
    value = _gtk_css_shadow_value_parse (parser, box_shadow_mode);

    if (value == NULL)
      {
        g_ptr_array_set_free_func (values, (GDestroyNotify) _gtk_css_value_unref);
        g_ptr_array_free (values, TRUE);
        return NULL;
      }

    g_ptr_array_add (values, value);
  } while (_gtk_css_parser_try (parser, ",", TRUE));

  result = gtk_css_shadows_value_new ((GtkCssValue **) values->pdata, values->len);
  g_ptr_array_free (values, TRUE);
  return result;
}
Exemplo n.º 11
0
/**
 * fcitx_input_method_get_imlist: (skip)
 **/
FCITX_EXPORT_API
GPtrArray *fcitx_input_method_get_imlist(FcitxInputMethod *im) {
    GPtrArray *array = fcitx_input_method_get_imlist_nofree(im);
    if (array)
        g_ptr_array_set_free_func(array, (GDestroyNotify)fcitx_im_item_free);
    return array;
}
Exemplo n.º 12
0
void fcitx_im_dialog_dispose(GObject* object)
{
    FcitxImDialog* self = FCITX_IM_DIALOG(object);
    if (self->array) {
        g_ptr_array_set_free_func(self->array, (GDestroyNotify) fcitx_im_item_free);
        g_ptr_array_free(self->array, FALSE);
        self->array = NULL;
    }

    if (self->improxy) {
        g_signal_handlers_disconnect_by_func(self->improxy, G_CALLBACK(_fcitx_im_dialog_imlist_changed_cb), self);
        g_object_unref(self->improxy);
        self->improxy = NULL;
    }

    if (self->langset) {
        g_hash_table_destroy(self->langset);
        self->langset = NULL;
    }

    if (self->language) {
        g_free(self->language);
        self->language = NULL;
    }

    G_OBJECT_CLASS (fcitx_im_dialog_parent_class)->dispose (object);
}
Exemplo n.º 13
0
void
fuzzy_set_free_func (Fuzzy          *fuzzy,
                     GDestroyNotify  free_func)
{
   g_return_if_fail(fuzzy);

   g_ptr_array_set_free_func(fuzzy->id_to_value, free_func);
}
Exemplo n.º 14
0
static void
ncm_diff_init (NcmDiff *diff)
{
  diff->priv           = G_TYPE_INSTANCE_GET_PRIVATE (diff, NCM_TYPE_DIFF, NcmDiffPrivate);
  diff->priv->maxorder = 0;
  diff->priv->rs       = 0.0;
  diff->priv->roff_pad = 0.0;
	diff->priv->ini_h    = 0.0;

  diff->priv->central_tables  = g_ptr_array_new ();
  diff->priv->forward_tables  = g_ptr_array_new ();
  diff->priv->backward_tables = g_ptr_array_new ();

  g_ptr_array_set_free_func (diff->priv->central_tables,  &_ncm_diff_table_free);
  g_ptr_array_set_free_func (diff->priv->forward_tables,  &_ncm_diff_table_free);
  g_ptr_array_set_free_func (diff->priv->backward_tables, &_ncm_diff_table_free);
}
void
gpa_str_free(GPtrArray *gpa)
{
	if (!gpa)
		return;
	g_ptr_array_set_free_func (gpa, g_free);
	g_ptr_array_free(gpa, TRUE);
}
Exemplo n.º 16
0
/**
 * g_ptr_array_new_with_free_func:
 * @element_free_func: A function to free elements with destroy @array or %NULL.
 *
 * Creates a new #GPtrArray with a reference count of 1 and use @element_free_func
 * for freeing each element when the array is destroyed either via
 * g_ptr_array_unref(), when g_ptr_array_free() is called with @free_segment
 * set to %TRUE or when removing elements.
 *
 * Returns: A new #GPtrArray.
 *
 * Since: 2.22
 **/
GPtrArray *
g_ptr_array_new_with_free_func (GDestroyNotify element_free_func)
{
  GPtrArray *array;

  array = g_ptr_array_new ();
  g_ptr_array_set_free_func (array, element_free_func);
  return array;
}
Exemplo n.º 17
0
void _fcitx_im_dialog_load(FcitxImDialog* self)
{
    gtk_list_store_clear(self->availimstore);

    if (self->array) {
        g_ptr_array_set_free_func(self->array, fcitx_im_item_free);
        g_ptr_array_free(self->array, FALSE);
        self->array = NULL;
    }

    self->array = fcitx_input_method_get_imlist(self->improxy);

    if (self->array) {
        g_ptr_array_set_free_func(self->array, NULL);
        g_ptr_array_foreach(self->array, _fcitx_inputmethod_insert_foreach_cb, self);

        _fcitx_im_dialog_im_selection_changed(gtk_tree_view_get_selection(GTK_TREE_VIEW(self->availimview)), self);
    }
}
Exemplo n.º 18
0
/**
 * g_ptr_array_new_full:
 * @reserved_size: number of pointers preallocated.
 * @element_free_func: A function to free elements with destroy @array or %NULL.
 *
 * Creates a new #GPtrArray with @reserved_size pointers preallocated
 * and a reference count of 1. This avoids frequent reallocation, if
 * you are going to add many pointers to the array. Note however that
 * the size of the array is still 0. It also set @element_free_func
 * for freeing each element when the array is destroyed either via
 * g_ptr_array_unref(), when g_ptr_array_free() is called with @free_segment
 * set to %TRUE or when removing elements.
 *
 * Returns: A new #GPtrArray.
 *
 * Since: 2.30
 **/
GPtrArray *
g_ptr_array_new_full (guint          reserved_size,
                      GDestroyNotify element_free_func)
{
  GPtrArray *array;

  array = g_ptr_array_sized_new (reserved_size);
  g_ptr_array_set_free_func (array, element_free_func);
  return array;
}
GPtrArray *backend_detect_threads_new(void) {
	GPtrArray *detect_threads = NULL;
	/**
	 * 为了在添加backend时,方便的增加后端检测线程,现将detect_threads放在了chas里面
	 */
	detect_threads = g_ptr_array_new();
	if (detect_threads != NULL) {
		g_ptr_array_set_free_func(detect_threads, backend_detect_thread_free_wrapper);
	}
	return detect_threads;
}
Exemplo n.º 20
0
///unoconv_pid_watch wird aufgerufen sobald der unoconv-Prozess beendet ist
void unoconv_child_watch_func (GPid unoconv_pid,gint status,gpointer user_data){
	GError *error = NULL;

	//Status abfragen
	g_spawn_check_exit_status (status,&error);
	if (error!=NULL){
		g_warning("%s",error->message);
		g_error_free(error);
		error = NULL;
	}
	//Pid schließen (ist unter UNIX nicht nötig)
	g_spawn_close_pid(unoconv_pid);

	//pdftk aufruf bauen
	GPtrArray *pdftk_argv= g_ptr_array_new ();
	//Funktion zum aufräumen setzten
	g_ptr_array_set_free_func(pdftk_argv,ptr_array_clean);

	GPid pdftk_pid=0;
	fill_g_ptr_array (pdftk_argv,"pdftk");

	//den ListStore durchlaufen lassen, und pfad bauen
	gtk_tree_model_foreach(gtk_tree_view_get_model(gui_get_gtk_tree_viewer()),treemodel_ausgabe_pdftk,(gpointer)pdftk_argv);
	fill_g_ptr_array (pdftk_argv,"output");
	//speichert den Pfad
	g_ptr_array_add(pdftk_argv,(gpointer)keyfile_get_pdf_full_path());
	g_ptr_array_add(pdftk_argv,(gpointer)NULL);

	//PDF zusammenfügen
	g_spawn_async_with_pipes (NULL,
														(gchar**)pdftk_argv->pdata,
														NULL,
														G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD,
														NULL,
														NULL,
														&pdftk_pid,
														NULL,
														NULL,
														NULL,
														&error);
	if (error!=NULL){
		g_warning("%s",error->message);
		g_error_free(error);
		error = NULL;
	}

	//g_child_watch einrichten, um über Programmende(pdftk) informiert zu werden
	g_child_watch_add(pdftk_pid,pdftk_child_watch_func,NULL);
	//aufräumen
	g_ptr_array_free(pdftk_argv,TRUE);
	//g_print("das PDF \"%s\" wurde unter \"%s\" erstellt\n",keyfile_get_pdf_name(),keyfile_get_outputdir());
	//Buttons wieder aktivieren
		interface_ausgrauen(TRUE);
}
Exemplo n.º 21
0
static void
gb_source_view_snippet_init (GbSourceViewSnippet *snippet)
{
   snippet->priv = G_TYPE_INSTANCE_GET_PRIVATE(snippet,
                                               GB_TYPE_SOURCE_VIEW_SNIPPET,
                                               GbSourceViewSnippetPrivate);
   snippet->priv->tab_stop = -1;
   snippet->priv->chunks = g_ptr_array_new();
   g_ptr_array_set_free_func(snippet->priv->chunks,
                             (GDestroyNotify)g_ptr_array_unref);
}
Exemplo n.º 22
0
static void
joy_x11_screen_init(JoyX11Screen *self)
{
    self->priv = ASSIGN_PRIVATE(self);
    struct Private *priv = GET_PRIVATE(self);
    priv->windows = g_ptr_array_sized_new(1);
    if (G_LIKELY(priv->windows)) {
        g_ptr_array_set_free_func(priv->windows, destroy);
    }
    priv->timer = joy_timer_new();
}
Exemplo n.º 23
0
GDBusClient *g_dbus_client_new(DBusConnection *connection,
					const char *service, const char *path)
{
	GDBusClient *client;
	unsigned int i;

	if (connection == NULL)
		return NULL;

	client = g_try_new0(GDBusClient, 1);
	if (client == NULL)
		return NULL;

	if (dbus_connection_add_filter(connection, message_filter,
						client, NULL) == FALSE) {
		g_free(client);
		return NULL;
	}

	client->dbus_conn = dbus_connection_ref(connection);
	client->service_name = g_strdup(service);
	client->base_path = g_strdup(path);

	client->match_rules = g_ptr_array_sized_new(1);
	g_ptr_array_set_free_func(client->match_rules, g_free);

	client->watch = g_dbus_add_service_watch(connection, service,
						service_connect,
						service_disconnect,
						client, NULL);
	client->added_watch = g_dbus_add_signal_watch(connection, service,
						"/",
						DBUS_INTERFACE_OBJECT_MANAGER,
						"InterfacesAdded",
						interfaces_added,
						client, NULL);
	client->removed_watch = g_dbus_add_signal_watch(connection, service,
						"/",
						DBUS_INTERFACE_OBJECT_MANAGER,
						"InterfacesRemoved",
						interfaces_removed,
						client, NULL);
	g_ptr_array_add(client->match_rules, g_strdup_printf("type='signal',"
				"sender='%s',path_namespace='%s'",
				client->service_name, client->base_path));

	for (i = 0; i < client->match_rules->len; i++) {
		modify_match(client->dbus_conn, "AddMatch",
				g_ptr_array_index(client->match_rules, i));
	}

	return g_dbus_client_ref(client);
}
Exemplo n.º 24
0
Arquivo: main.c Projeto: hiciu/ekg2
/*
 * otwarcie pliku do zapisu/odczytu
 * tworzy wszystkie katalogi po drodze, jeśli nie istnieją i mkdir =1
 * ff - xml 2 || irssi 3 || simple 1
 * zwraca numer deskryptora bądź NULL
 */
static int logs_open_file(logs_log_t *ll) {

	g_return_val_if_fail(ll != NULL, -1);

	if (ll->file)
		return fseek(ll->file, 0, SEEK_END);

	g_return_val_if_fail(ll->fname != NULL, -1);
	g_return_val_if_fail(ll->format != LOG_FORMAT_NONE, -1);

// XXX temp
debug("[logs] opening log file %s ff:%d\n", __(ll->fname), ll->format);

	if (!g_file_test(ll->fname, G_FILE_TEST_IS_REGULAR) && mkdir_recursive(ll->fname, 0)) {
		print("directory_cant_create", ll->fname, strerror(errno));
		return -1;
	}

	if (!(ll->file = fopen(ll->fname, "a+")))
		return -1;

	if (ll->format == LOG_FORMAT_XML) {
		/* prepare xml file */
		fputs(EKG_EMPTY_XML_LOG, ll->file);
	}

	// move ll on top
	if (ll != g_ptr_array_index(logs_logs, logs_logs->len - 1)) {
		g_ptr_array_set_free_func(logs_logs, NULL);
		g_ptr_array_remove(logs_logs, ll);
		g_ptr_array_add(logs_logs, ll);
		g_ptr_array_set_free_func(logs_logs, logs_log_destroy);
	}

	open_files_count++;
	logs_open_files_check();

	return fseek(ll->file, 0, SEEK_END);
}
Exemplo n.º 25
0
void fcitx_im_widget_finalize(GObject* object)
{
    FcitxImWidget* self = FCITX_IM_WIDGET(object);
    if (self->array) {
        g_ptr_array_set_free_func(self->array, fcitx_im_item_free);
        g_ptr_array_free(self->array, FALSE);
        self->array = NULL;
    }
    g_object_unref(self->improxy);
    g_free(self->focus);

    G_OBJECT_CLASS (fcitx_im_widget_parent_class)->finalize (object);
}
Exemplo n.º 26
0
Population Population_from_db(sqlite3 *db, const Meta *meta) {
	Population population;
	population.schedules = g_ptr_array_sized_new(meta->n_population);
	g_ptr_array_set_free_func(population.schedules,
	                          (GDestroyNotify)Schedule_free);
	gint individual;
	for(individual = 0; individual < meta->n_population; individual++) {
		g_ptr_array_add(population.schedules,
		                Schedule_from_db(individual, db, meta));
	}
	population.n_schedules = individual;
	return population;
}
Exemplo n.º 27
0
void
print_dates_sorted (void)
{

  /* Choose five dates randomly from a time interval, sort them, and
     send to stdio. */

  GTimeZone *tz;
  GPtrArray *dates;
  GDateTime *dt;
  gchar *str;
  gint i;

  tz = (GTimeZone *)g_time_zone_new_local();
  
  dates = g_ptr_array_new();
  g_ptr_array_set_free_func(dates, (GDestroyNotify)g_date_time_unref);
  
  /*
   * Insert some random dates into the array.
   */
  for (i = 0; i < 5; i++) {
    dt = (GDateTime *)g_date_time_new(tz,
				      g_random_int_range(1900, 2020),
				      g_random_int_range(1, 12),
				      g_random_int_range(1, 28),
				      0, 0, 0);
    g_ptr_array_add(dates, dt);
  }

	/*
	 * Sort dates.  Remember that GPtrArray returns a pointer to the
	 * pointer type in sorting methods so they need to be dereferenced.
	 */
	g_ptr_array_sort(dates, gdt_sorter);

	/*
	 * Print out the dates
	 */
	g_print("Dates sorted in order:\n");
	for (i = 0; i < dates->len; i++) {
		dt = g_ptr_array_index(dates, i);
		str = g_date_time_format(dt, "%b %d, %Y");
		g_print("  %s\n", str);
		g_free(str);
	}

	g_ptr_array_unref(dates);
	g_time_zone_unref(tz);

}
Exemplo n.º 28
0
int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field,
		struct bt_ctf_field *length_field)
{
	int ret = 0;
	struct bt_ctf_field_type_integer *length_type;
	struct bt_ctf_field_integer *length;
	struct bt_ctf_field_sequence *sequence;
	uint64_t sequence_length;

	if (!field || !length_field) {
		ret = -1;
		goto end;
	}
	if (bt_ctf_field_type_get_type_id(length_field->type) !=
		CTF_TYPE_INTEGER) {
		ret = -1;
		goto end;
	}

	length_type = container_of(length_field->type,
		struct bt_ctf_field_type_integer, parent);
	/* The length field must be unsigned */
	if (length_type->declaration.signedness) {
		ret = -1;
		goto end;
	}

	length = container_of(length_field, struct bt_ctf_field_integer,
		parent);
	sequence_length = length->definition.value._unsigned;
	sequence = container_of(field, struct bt_ctf_field_sequence, parent);
	if (sequence->elements) {
		g_ptr_array_free(sequence->elements, TRUE);
		bt_ctf_field_put(sequence->length);
	}

	sequence->elements = g_ptr_array_sized_new((size_t)sequence_length);
	if (!sequence->elements) {
		ret = -1;
		goto end;
	}

	g_ptr_array_set_free_func(sequence->elements,
		(GDestroyNotify)bt_ctf_field_put);
	g_ptr_array_set_size(sequence->elements, (size_t)sequence_length);
	bt_ctf_field_get(length_field);
	sequence->length = length_field;
end:
	return ret;
}
Exemplo n.º 29
0
void fcitx_im_dialog_finalize(GObject* object)
{
    FcitxImDialog* self = FCITX_IM_DIALOG(object);
    if (self->array) {
        g_ptr_array_set_free_func(self->array, fcitx_im_item_free);
        g_ptr_array_free(self->array, FALSE);
        self->array = NULL;
    }

    if (self->improxy)
        g_object_unref(self->improxy);

    G_OBJECT_CLASS (fcitx_im_dialog_parent_class)->finalize (object);
}
Exemplo n.º 30
0
static void
dispose (GObject *object)
{
	NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (object);

	g_clear_object (&priv->proxy);

	if (priv->slaves) {
		g_ptr_array_set_free_func (priv->slaves, g_object_unref);
		g_ptr_array_free (priv->slaves, TRUE);
		priv->slaves = NULL;
	}

	G_OBJECT_CLASS (nm_device_bond_parent_class)->dispose (object);
}