コード例 #1
0
static void
impl_dispose (GObject *object)
{
	RBGenericPlayerSourcePrivate *priv = GENERIC_PLAYER_SOURCE_GET_PRIVATE (object);

	if (priv->load_playlists_id != 0) {
		g_source_remove (priv->load_playlists_id);
		priv->load_playlists_id = 0;
	}

	if (priv->db != NULL) {
		if (priv->ignore_type != RHYTHMDB_ENTRY_TYPE_INVALID) {
			rhythmdb_entry_delete_by_type (priv->db, priv->ignore_type);
			g_boxed_free (RHYTHMDB_TYPE_ENTRY_TYPE, priv->ignore_type);
			priv->ignore_type = RHYTHMDB_ENTRY_TYPE_INVALID;
		}
		if (priv->error_type != RHYTHMDB_ENTRY_TYPE_INVALID) {
			rhythmdb_entry_delete_by_type (priv->db, priv->error_type);
			g_boxed_free (RHYTHMDB_TYPE_ENTRY_TYPE, priv->error_type);
			priv->error_type = RHYTHMDB_ENTRY_TYPE_INVALID;
		}

		g_object_unref (priv->db);
		priv->db = NULL;
	}

	if (priv->import_job != NULL) {
		rhythmdb_import_job_cancel (priv->import_job);
		g_object_unref (priv->import_job);
		priv->import_job = NULL;
	}

	G_OBJECT_CLASS (rb_generic_player_source_parent_class)->dispose (object);
}
コード例 #2
0
ファイル: mex-tile.c プロジェクト: frankopt/media-explorer
static void
mex_tile_style_changed_cb (MexTile *self, MxStyleChangedFlags flags)
{
  MexTilePrivate *priv = self->priv;
  MxBorderImage *image;

  if (priv->header_padding)
    {
      g_boxed_free (MX_TYPE_PADDING, priv->header_padding);
      priv->header_padding = NULL;
    }

  if (priv->header_background_color)
    {
      g_boxed_free (CLUTTER_TYPE_COLOR, priv->header_background_color);
      priv->header_background_color = NULL;
    }

  mx_stylable_get (MX_STYLABLE (self),
                   "x-mex-header-background", &image,
                   "x-mex-header-background-color", &priv->header_background_color,
                   "x-mex-header-padding", &priv->header_padding,
                   NULL);

  mx_stylable_apply_clutter_text_attributes (MX_STYLABLE (self),
                                             CLUTTER_TEXT (priv->label));

  mx_stylable_apply_clutter_text_attributes (MX_STYLABLE (self),
                                             CLUTTER_TEXT (priv->secondary_label));

  if (image && image->uri)
    {
      CoglObject *background;

      background =
        mx_texture_cache_get_cogl_texture (mx_texture_cache_get_default (),
                                           image->uri);
      cogl_material_set_layer (priv->material, 0, background);
    }
  else
    {
      if (cogl_material_get_n_layers (priv->material))
        cogl_material_remove_layer (priv->material, 0);
    }

  if (image)
    g_boxed_free (MX_TYPE_BORDER_IMAGE, image);

  if (priv->icon1)
    mx_stylable_style_changed (MX_STYLABLE (priv->icon1), flags);

  if (priv->icon2)
    mx_stylable_style_changed (MX_STYLABLE (priv->icon2), flags);

  clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
}
コード例 #3
0
ファイル: gtktreedatalist.c プロジェクト: Pfiver/gtk
void
_gtk_tree_data_list_free (GtkTreeDataList *list,
			  GType           *column_headers)
{
  GtkTreeDataList *tmp, *next;
  gint i = 0;

  tmp = list;

  while (tmp)
    {
      next = tmp->next;
      if (g_type_is_a (column_headers [i], G_TYPE_STRING))
	g_free ((gchar *) tmp->data.v_pointer);
      else if (g_type_is_a (column_headers [i], G_TYPE_OBJECT) && tmp->data.v_pointer != NULL)
	g_object_unref (tmp->data.v_pointer);
      else if (g_type_is_a (column_headers [i], G_TYPE_BOXED) && tmp->data.v_pointer != NULL)
	g_boxed_free (column_headers [i], (gpointer) tmp->data.v_pointer);
      else if (g_type_is_a (column_headers [i], G_TYPE_VARIANT) && tmp->data.v_pointer != NULL)
	g_variant_unref ((gpointer) tmp->data.v_pointer);

      g_slice_free (GtkTreeDataList, tmp);
      i++;
      tmp = next;
    }
}
コード例 #4
0
void
empathy_tls_verifier_store_exception (EmpathyTLSVerifier *self)
{
  GArray *data;
  GcrCertificate *cert;
  GPtrArray *cert_data = NULL;
  GError *error = NULL;
  EmpathyTLSVerifierPriv *priv = GET_PRIV (self);

  g_object_get (priv->certificate, "cert-data", &cert_data, NULL);
  g_return_if_fail (cert_data);

  if (!cert_data->len)
    {
      DEBUG ("No certificate to pin.");
      return;
    }

  /* The first certificate in the chain is for the host */
  data = g_ptr_array_index (cert_data, 0);
  cert = gcr_simple_certificate_new ((gpointer)data->data, data->len);

  DEBUG ("Storing pinned certificate:");
  debug_certificate (cert);

  if (!gcr_trust_add_pinned_certificate (cert, GCR_PURPOSE_CLIENT_AUTH,
          priv->hostname, NULL, &error))
      DEBUG ("Can't store the pinned certificate: %s", error->message);

  g_object_unref (cert);
  g_boxed_free (TP_ARRAY_TYPE_UCHAR_ARRAY_LIST, cert_data);
}
コード例 #5
0
/**
 * aran_solver3d_set_development:
 * @solver: an #AranSolver3d.
 * @devel_type: #GType of development to be used by the solver.
 * @devel: instance of type @devel_type for cloning.
 * @zero: @devel_type zeroing function.
 *
 * Associates @solver with a new development definition.
 */
void aran_solver3d_set_development (AranSolver3d *solver,
				    GType devel_type,
				    gpointer devel,
				    AranZeroFunc zero)
{
  g_return_if_fail (solver != NULL);

  g_return_if_fail ((devel_type == G_TYPE_NONE) ||
		    G_TYPE_IS_BOXED (devel_type));

  if (solver->devel != NULL)
    g_boxed_free (solver->devel_type, solver->devel);

  solver->devel_type = devel_type;
  solver->devel = devel;
  solver->zero = zero;

  if (devel != NULL)
    {
      vsg_prtree3d_set_node_data (solver->prtree, devel_type, devel);
    }
  else
    {
      vsg_prtree3d_set_node_data (solver->prtree,
                                  G_TYPE_NONE,
                                  NULL);
    }
}
コード例 #6
0
ファイル: boxed.c プロジェクト: Katyunechka/gjs
static void
boxed_finalize(JSContext *context,
               JSObject  *obj)
{
    Boxed *priv;

    priv = priv_from_js(context, obj);
    gjs_debug_lifecycle(GJS_DEBUG_GBOXED,
                        "finalize, obj %p priv %p", obj, priv);
    if (priv == NULL)
        return; /* wrong class? */

    if (priv->gboxed && !priv->not_owning_gboxed) {
        if (priv->allocated_directly) {
            g_slice_free1(g_struct_info_get_size (priv->info), priv->gboxed);
        } else {
            if (g_type_is_a (priv->gtype, G_TYPE_BOXED))
                g_boxed_free (priv->gtype,  priv->gboxed);
            else if (g_type_is_a (priv->gtype, G_TYPE_VARIANT))
                g_variant_unref (priv->gboxed);
            else
                g_assert_not_reached ();
        }

        priv->gboxed = NULL;
    }

    if (priv->info) {
        g_base_info_unref( (GIBaseInfo*) priv->info);
        priv->info = NULL;
    }

    GJS_DEC_COUNTER(boxed);
    g_slice_free(Boxed, priv);
}
コード例 #7
0
void
_foo_tree_data_list_free (FooTreeDataList *list,
			  GType           *column_headers)
{
  FooTreeDataList *tmp, *next;
  gint i = 0;

  tmp = list;

  while (tmp)
    {
      next = tmp->next;
      if (g_type_is_a (column_headers [i], G_TYPE_STRING))
	g_free ((gchar *) tmp->data.v_pointer);
      else if (g_type_is_a (column_headers [i], G_TYPE_OBJECT) && tmp->data.v_pointer != NULL)
	g_object_unref (tmp->data.v_pointer);
      else if (g_type_is_a (column_headers [i], G_TYPE_BOXED) && tmp->data.v_pointer != NULL)
	g_boxed_free (column_headers [i], (gpointer) tmp->data.v_pointer);

      tmp->next = cache;
      cache = tmp;
      
      i++;
      tmp = next;
    }
}
static void
free_source_progress_item (char *source,
                           GValueArray *progress_array)
{
    g_free (source);
    g_boxed_free (SYNCEVO_TYPE_SOURCE_PROGRESS, progress_array);
}
static void
free_source_status_item (char *source,
                         GValueArray *status_array)
{
    g_free (source);
    g_boxed_free (SYNCEVO_TYPE_SOURCE_STATUS, status_array);
}
コード例 #10
0
static void
load_playlist_file (RBGenericPlayerSource *source,
		    const char *playlist_path,
		    const char *rel_path)
{
	RhythmDBEntryType entry_type;
	RBGenericPlayerPlaylistSource *playlist;
	RBShell *shell;
	char *mount_path;

	g_object_get (source,
		      "shell", &shell,
		      "entry-type", &entry_type,
		      NULL);

	mount_path = rb_generic_player_source_get_mount_path (source);
	rb_debug ("loading playlist %s", playlist_path);
	playlist = RB_GENERIC_PLAYER_PLAYLIST_SOURCE (
			rb_generic_player_playlist_source_new (shell,
							       source,
							       playlist_path,
							       mount_path,
							       entry_type));

	if (playlist != NULL) {
		rb_generic_player_source_add_playlist (source, shell, RB_SOURCE (playlist));
	}

	g_boxed_free (RHYTHMDB_TYPE_ENTRY_TYPE, entry_type);
	g_object_unref (shell);
	g_free (mount_path);
}
コード例 #11
0
ファイル: xfburn-transcoder.c プロジェクト: Pjotr123/xfburn
XfburnAudioTrack *
xfburn_transcoder_get_audio_track (XfburnTranscoder *trans, const gchar *fn, GError **error)
{
  XfburnTranscoderInterface *iface = XFBURN_TRANSCODER_GET_INTERFACE (trans);

  if (iface->get_audio_track) {
    XfburnAudioTrack *atrack = g_new0 (XfburnAudioTrack, 1);
    gboolean valid_track;

    atrack->inputfile = g_strdup (fn);
    atrack->pos = -1;

    valid_track = iface->get_audio_track (trans, atrack, error);
    
    if (valid_track)
      return atrack;
    
    /* not a valid track, clean up */
    g_boxed_free (XFBURN_TYPE_AUDIO_TRACK, atrack);
    return NULL;
  }
  
  g_warning ("Falling back to base implementation for xfburn_transcoder_get_audio_track, which always says false.");
  g_set_error (error, XFBURN_ERROR, XFBURN_ERROR_NOT_IMPLEMENTED, _("not implemented"));
  return NULL;
}
コード例 #12
0
ファイル: field-part.c プロジェクト: svn2github/gwyddion
void
test_field_part_boxed(void)
{
    GwyFieldPart fpart = { 1, 2, 3, 4 };
    GwyFieldPart *copy = serialize_boxed_and_back(&fpart,
                                                  GWY_TYPE_FIELD_PART);
    field_part_assert_equal(copy, &fpart);
    g_boxed_free(GWY_TYPE_FIELD_PART, copy);
}
コード例 #13
0
/**
 * geoclue_accuracy_free:
 * @accuracy: A #GeoclueAccuracy
 *
 * Frees the #GeoclueAccuracy.
 */
void
geoclue_accuracy_free (GeoclueAccuracy *accuracy)
{
	if (!accuracy) {
		return;
	}

        g_boxed_free (GEOCLUE_ACCURACY_TYPE, accuracy);
}
コード例 #14
0
ファイル: mx-tooltip.c プロジェクト: 3v1n0/mx
/**
 * mx_tooltip_set_tip_area:
 * @tooltip: A #MxTooltip
 * @area: A #ClutterGeometry
 *
 * Set the area on the stage that the tooltip applies to.
 */
void
mx_tooltip_set_tip_area (MxTooltip             *tooltip,
                         const ClutterGeometry *area)
{
  g_return_if_fail (MX_IS_TOOLTIP (tooltip));

  if (tooltip->priv->tip_area)
    g_boxed_free (CLUTTER_TYPE_GEOMETRY, tooltip->priv->tip_area);
  tooltip->priv->tip_area = g_boxed_copy (CLUTTER_TYPE_GEOMETRY, area);
}
コード例 #15
0
static void
gst_moz_video_buffer_finalize(GstMozVideoBuffer* self)
{
  g_return_if_fail(GST_IS_MOZ_VIDEO_BUFFER(self));

  if(self->data)
    g_boxed_free(GST_TYPE_MOZ_VIDEO_BUFFER_DATA, self->data);

  GST_MINI_OBJECT_CLASS(gst_moz_video_buffer_parent_class)->finalize(GST_MINI_OBJECT(self));
}
コード例 #16
0
ファイル: boxed.c プロジェクト: ifreedom/lgob
static int priv_boxed_gc(lua_State* L)
{
	#ifdef IDEBUG
	g_debug("Garbage collecting a Boxed!");
	#endif

	Boxed* b = lua_touserdata(L, 1);
	g_boxed_free(b->type, b->pointer);

	return 0;
}
コード例 #17
0
/**
 * aran_solver3d_free:
 * @solver: an #AranSolver3d.
 *
 * Deallocates all memory associated with @solver (Even the #VsgPRTree3d is
 * freed).
 */
void aran_solver3d_free (AranSolver3d *solver)
{
  if (solver == NULL) return;

  vsg_prtree3d_free (solver->prtree);

  if (solver->devel != NULL)
    g_boxed_free (solver->devel_type, solver->devel);

  _solver3d_dealloc (solver);
}
コード例 #18
0
ファイル: mex-tile.c プロジェクト: frankopt/media-explorer
static void
mex_tile_finalize (GObject *object)
{
  MexTile *self = MEX_TILE (object);

  if (self->priv->header_background_color)
    {
      g_boxed_free (CLUTTER_TYPE_COLOR, self->priv->header_background_color);
      self->priv->header_background_color = NULL;
    }

  G_OBJECT_CLASS (mex_tile_parent_class)->finalize (object);
}
コード例 #19
0
ファイル: mx-tooltip.c プロジェクト: 3v1n0/mx
static void
mx_tooltip_finalize (GObject *object)
{
  MxTooltip *tooltip = MX_TOOLTIP (object);

  if (tooltip->priv->tip_area)
    {
      g_boxed_free (CLUTTER_TYPE_GEOMETRY, tooltip->priv->tip_area);
      tooltip->priv->tip_area = NULL;
    }

  G_OBJECT_CLASS (mx_tooltip_parent_class)->finalize (object);
}
コード例 #20
0
static void
boxed_free(boxed_holder* p)
{
    const RGObjClassInfo* cinfo = GTYPE2CINFO(p->type);

    if (cinfo && cinfo->free)
        cinfo->free(p->boxed);
    
    if (p->own && p->boxed)
        g_boxed_free(p->type, p->boxed);

    free(p);
}
コード例 #21
0
static void
clear_data (GkmCredential *self)
{
	if (!self->pv->user_data)
		return;
	if (G_TYPE_IS_BOXED (self->pv->user_type))
		g_boxed_free (self->pv->user_type, self->pv->user_data);
	else if (G_TYPE_IS_OBJECT (self->pv->user_type))
		g_object_unref (self->pv->user_data);
	else
		g_assert_not_reached ();
	self->pv->user_data = NULL;
	self->pv->user_type = 0;
}
コード例 #22
0
/**
 * _rb_source_check_entry_type:
 * @source: a #RBSource
 * @entry: a #RhythmDBEntry
 *
 * Checks if a database entry matches the entry type for the source.
 *
 * Return value: %TRUE if the entry matches the source's entry type.
 */
gboolean
_rb_source_check_entry_type (RBSource *source, RhythmDBEntry *entry)
{
	RhythmDBEntryType entry_type;
	gboolean ret = TRUE;

	g_object_get (source, "entry-type", &entry_type, NULL);
	if (entry_type != RHYTHMDB_ENTRY_TYPE_INVALID &&
	    rhythmdb_entry_get_entry_type (entry) != entry_type) {
		ret = FALSE;
	}
	g_boxed_free (RHYTHMDB_TYPE_ENTRY_TYPE, entry_type);
	return ret;
}
コード例 #23
0
ファイル: hsgclosure.c プロジェクト: gitter-badger/haskell-gi
/* Auxiliary function for freeing boxed types */
void boxed_free_helper (GType *gtype, void *boxed)
{
  if (print_debug_info()) {
    fprintf(stderr, "Freeing a boxed object at %p\n", boxed);
    fprintf(stderr, "\tIt is of type %s\n", g_type_name(*gtype));
  }

  g_boxed_free (*gtype, boxed);
  g_free (gtype);

  if (print_debug_info()) {
    fprintf(stderr, "\tdone\n");
  }
}
コード例 #24
0
ファイル: rbgobj_boxed.c プロジェクト: pkorenev/ruby-gnome2
static void
boxed_free(boxed_holder *holder)
{
    const RGObjClassInfo *cinfo;

    cinfo = GTYPE2CINFO(holder->type);
    if (cinfo && cinfo->free)
        cinfo->free(holder->boxed);

    if (holder->own && holder->boxed)
        g_boxed_free(holder->type, holder->boxed);

    free(holder);
}
コード例 #25
0
static gboolean
visit_playlist_dirs (GFile *file,
		     gboolean dir,
		     RBGenericPlayerSource *source)
{
	char *basename;
	char *uri;
	RhythmDBEntry *entry;
	RhythmDBEntryType entry_type;
	RBGenericPlayerSourcePrivate *priv = GENERIC_PLAYER_SOURCE_GET_PRIVATE (source);

	if (dir) {
		return TRUE;
	}

	/* check if we've already got an entry 
	 * for this file, just to save some i/o.
	 */
	uri = g_file_get_uri (file);
	entry = rhythmdb_entry_lookup_by_location (priv->db, uri);
	g_free (uri);
	if (entry != NULL) {
		gboolean is_song;

		is_song = FALSE;

		g_object_get (source, "entry-type", &entry_type, NULL);
		is_song = (rhythmdb_entry_get_entry_type (entry) == entry_type);
		g_boxed_free (RHYTHMDB_TYPE_ENTRY_TYPE, entry_type);

		if (is_song) {
			rb_debug ("%s was loaded as a song",
				  rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION));
			return TRUE;
		}
	}

	basename = g_file_get_basename (file);
	if (strcmp (basename, ".is_audio_player") != 0) {
		char *playlist_path;
		playlist_path = g_file_get_path (file);
		load_playlist_file (source, playlist_path, basename);
		g_free (playlist_path);
	}

	g_free (basename);

	return TRUE;
}
コード例 #26
0
ファイル: scptreedata.c プロジェクト: BYC/geany-plugins
void scp_tree_data_free(ScpTreeData *data, GType type)
{
	if (data->v_pointer)
	{
		switch (scp_tree_data_get_fundamental_type(type))
		{
			case G_TYPE_STRING  : g_free(data->v_string); break;
			case G_TYPE_OBJECT  : g_object_unref(data->v_pointer); break;
			case G_TYPE_BOXED   : g_boxed_free(type, data->v_pointer); break;
		#if GLIB_CHECK_VERSION(2, 26, 0)
			case G_TYPE_VARIANT : g_variant_unref(data->v_pointer);
		#endif
		}
	}
}
コード例 #27
0
ファイル: mex-tile.c プロジェクト: frankopt/media-explorer
static void
mex_tile_dispose (GObject *object)
{
  MexTile *self = MEX_TILE (object);
  MexTilePrivate *priv = self->priv;

  /* Use icon setting functions to remove icons */
  mex_tile_set_primary_icon (self, NULL);
  mex_tile_set_secondary_icon (self, NULL);

  if (priv->box_layout)
    {
      clutter_actor_destroy (priv->box_layout);
      priv->box_layout = NULL;

      /* box_layout contains label and secondary_label */
      priv->label = NULL;
      priv->secondary_label = NULL;
    }

  if (priv->header_padding)
    {
      g_boxed_free (MX_TYPE_PADDING, priv->header_padding);
      priv->header_padding = NULL;
    }

  if (priv->important_alpha)
    {
      g_object_unref (priv->important_alpha);
      priv->important_alpha = NULL;
    }

  if (priv->timeline)
    {
      clutter_timeline_stop (priv->timeline);
      g_object_unref (priv->timeline);
      priv->timeline = NULL;
    }

  if (priv->material)
    {
      cogl_object_unref (priv->material);
      priv->material = NULL;
    }

  G_OBJECT_CLASS (mex_tile_parent_class)->dispose (object);
}
コード例 #28
0
ファイル: nm-types.c プロジェクト: T100012/NetworkManager
gboolean
_nm_object_array_demarshal (GValue *value,
                           GPtrArray **dest,
                           DBusGConnection *connection,
                           NMObjectCreatorFunc func)
{
	GPtrArray *temp = NULL;
	GPtrArray *array;

	if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH))
		return FALSE;

	array = (GPtrArray *) g_value_get_boxed (value);
	if (array && array->len) {
		int i;

		temp = g_ptr_array_sized_new (array->len);
		for (i = 0; i < array->len; i++) {
			const char *path;
			GObject *object;

			path = g_ptr_array_index (array, i);
			object = G_OBJECT (_nm_object_cache_get (path));
			if (object)
				g_ptr_array_add (temp, object);
			else {
				object = (*func) (connection, path);
				if (object)
					g_ptr_array_add (temp, object);
				else
					g_warning ("%s: couldn't create object for %s", __func__, path);
			}
		}
	} else
		temp = g_ptr_array_new ();

	/* Deallocate after to ensure that an object that might already
	 * be in the array doesn't get destroyed due to refcounting.
	 */
	if (*dest)
		g_boxed_free (NM_TYPE_OBJECT_ARRAY, *dest);
	*dest = temp;

	return TRUE;
}
コード例 #29
0
ファイル: mx-tooltip.c プロジェクト: 3v1n0/mx
static void
mx_tooltip_dispose (GObject *object)
{
  MxTooltipPrivate *priv = MX_TOOLTIP (object)->priv;

  if (priv->border_image)
    {
      g_boxed_free (MX_TYPE_BORDER_IMAGE, priv->border_image);
      priv->border_image = NULL;
    }

  if (priv->border_image_texture)
    {
      cogl_handle_unref (priv->border_image_texture);
      priv->border_image_texture = NULL;
    }

  G_OBJECT_CLASS (mx_tooltip_parent_class)->dispose (object);
}
コード例 #30
0
ファイル: usage.c プロジェクト: kknd/cairoplot
int main(int argc, char* argv[])
{
    g_type_init();

    CpPlot* plot = cp_bar_plot_new();
    CpHandler* handler = cp_png_handler_new("out-usage.png");
    CpColor* color = cp_color_new_rgba(0.9, 0.9, 0.9, 0.5);

    g_object_set(plot, "handler", handler, "bg-color", color, NULL);
    g_signal_connect(plot, "pre-render", G_CALLBACK(callback), "pre");
    g_signal_connect(plot, "pos-render", G_CALLBACK(callback), "pos");
    cp_plot_render(plot);

    g_boxed_free(CP_TYPE_COLOR, color);
    g_object_unref(plot);
    g_object_unref(handler);

    return 0;
}