mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-22 18:22:11 +01:00
Deprecate GEmblemedIcon and GEmblem
Reasons for deprecating them: - Not many consumers - GTK4 dropped support for it - It's easy enough to implement the same feature without this special GIcon - Any place that accepts a GIcon is supposed to also support GEmblemedIcon e.g GNotification::set_icon(), but none of the backends supports it. See the attached issue for more details. Closes: https://gitlab.gnome.org/GNOME/glib/-/issues/3544
This commit is contained in:
parent
b6da230b8f
commit
3d31d99c45
@ -39,6 +39,8 @@
|
|||||||
*
|
*
|
||||||
* Currently, only metainformation about the emblem's origin is
|
* Currently, only metainformation about the emblem's origin is
|
||||||
* supported. More may be added in the future.
|
* supported. More may be added in the future.
|
||||||
|
*
|
||||||
|
* Deprecated: 2.84
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void g_emblem_iface_init (GIconIface *iface);
|
static void g_emblem_iface_init (GIconIface *iface);
|
||||||
@ -48,7 +50,10 @@ struct _GEmblem
|
|||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
|
|
||||||
GIcon *icon;
|
GIcon *icon;
|
||||||
|
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
GEmblemOrigin origin;
|
GEmblemOrigin origin;
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GEmblemClass
|
struct _GEmblemClass
|
||||||
@ -140,13 +145,14 @@ g_emblem_class_init (GEmblemClass *klass)
|
|||||||
* The origin the emblem is derived from.
|
* The origin the emblem is derived from.
|
||||||
*
|
*
|
||||||
* Since: 2.18
|
* Since: 2.18
|
||||||
|
* Deprecated: 2.84
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_ORIGIN,
|
PROP_ORIGIN,
|
||||||
g_param_spec_enum ("origin", NULL, NULL,
|
g_param_spec_enum ("origin", NULL, NULL,
|
||||||
G_TYPE_EMBLEM_ORIGIN,
|
G_TYPE_EMBLEM_ORIGIN,
|
||||||
G_EMBLEM_ORIGIN_UNKNOWN,
|
G_EMBLEM_ORIGIN_UNKNOWN,
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_DEPRECATED));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GEmblem:icon:
|
* GEmblem:icon:
|
||||||
@ -154,12 +160,13 @@ g_emblem_class_init (GEmblemClass *klass)
|
|||||||
* The actual icon of the emblem.
|
* The actual icon of the emblem.
|
||||||
*
|
*
|
||||||
* Since: 2.18
|
* Since: 2.18
|
||||||
|
* Deprecated: 2.84
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_ICON,
|
PROP_ICON,
|
||||||
g_param_spec_object ("icon", NULL, NULL,
|
g_param_spec_object ("icon", NULL, NULL,
|
||||||
G_TYPE_OBJECT,
|
G_TYPE_OBJECT,
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_DEPRECATED));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,6 +184,7 @@ g_emblem_init (GEmblem *emblem)
|
|||||||
* Returns: a new #GEmblem.
|
* Returns: a new #GEmblem.
|
||||||
*
|
*
|
||||||
* Since: 2.18
|
* Since: 2.18
|
||||||
|
* Deprecated: 2.84
|
||||||
*/
|
*/
|
||||||
GEmblem *
|
GEmblem *
|
||||||
g_emblem_new (GIcon *icon)
|
g_emblem_new (GIcon *icon)
|
||||||
@ -194,6 +202,7 @@ g_emblem_new (GIcon *icon)
|
|||||||
return emblem;
|
return emblem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
/**
|
/**
|
||||||
* g_emblem_new_with_origin:
|
* g_emblem_new_with_origin:
|
||||||
* @icon: a GIcon containing the icon.
|
* @icon: a GIcon containing the icon.
|
||||||
@ -204,6 +213,7 @@ g_emblem_new (GIcon *icon)
|
|||||||
* Returns: a new #GEmblem.
|
* Returns: a new #GEmblem.
|
||||||
*
|
*
|
||||||
* Since: 2.18
|
* Since: 2.18
|
||||||
|
* Deprecated: 2.84
|
||||||
*/
|
*/
|
||||||
GEmblem *
|
GEmblem *
|
||||||
g_emblem_new_with_origin (GIcon *icon,
|
g_emblem_new_with_origin (GIcon *icon,
|
||||||
@ -221,6 +231,7 @@ g_emblem_new_with_origin (GIcon *icon,
|
|||||||
|
|
||||||
return emblem;
|
return emblem;
|
||||||
}
|
}
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_emblem_get_icon:
|
* g_emblem_get_icon:
|
||||||
@ -232,6 +243,7 @@ g_emblem_new_with_origin (GIcon *icon,
|
|||||||
* the emblem and should not be modified or freed.
|
* the emblem and should not be modified or freed.
|
||||||
*
|
*
|
||||||
* Since: 2.18
|
* Since: 2.18
|
||||||
|
* Deprecated: 2.84
|
||||||
*/
|
*/
|
||||||
GIcon *
|
GIcon *
|
||||||
g_emblem_get_icon (GEmblem *emblem)
|
g_emblem_get_icon (GEmblem *emblem)
|
||||||
@ -241,7 +253,7 @@ g_emblem_get_icon (GEmblem *emblem)
|
|||||||
return emblem->icon;
|
return emblem->icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
/**
|
/**
|
||||||
* g_emblem_get_origin:
|
* g_emblem_get_origin:
|
||||||
* @emblem: a #GEmblem
|
* @emblem: a #GEmblem
|
||||||
@ -251,6 +263,7 @@ g_emblem_get_icon (GEmblem *emblem)
|
|||||||
* Returns: (transfer none): the origin of the emblem
|
* Returns: (transfer none): the origin of the emblem
|
||||||
*
|
*
|
||||||
* Since: 2.18
|
* Since: 2.18
|
||||||
|
* Deprecated: 2.84
|
||||||
*/
|
*/
|
||||||
GEmblemOrigin
|
GEmblemOrigin
|
||||||
g_emblem_get_origin (GEmblem *emblem)
|
g_emblem_get_origin (GEmblem *emblem)
|
||||||
@ -259,6 +272,7 @@ g_emblem_get_origin (GEmblem *emblem)
|
|||||||
|
|
||||||
return emblem->origin;
|
return emblem->origin;
|
||||||
}
|
}
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
static guint
|
static guint
|
||||||
g_emblem_hash (GIcon *icon)
|
g_emblem_hash (GIcon *icon)
|
||||||
@ -266,7 +280,9 @@ g_emblem_hash (GIcon *icon)
|
|||||||
GEmblem *emblem = G_EMBLEM (icon);
|
GEmblem *emblem = G_EMBLEM (icon);
|
||||||
guint hash;
|
guint hash;
|
||||||
|
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
hash = g_icon_hash (g_emblem_get_icon (emblem));
|
hash = g_icon_hash (g_emblem_get_icon (emblem));
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
hash ^= emblem->origin;
|
hash ^= emblem->origin;
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
@ -320,6 +336,7 @@ g_emblem_from_tokens (gchar **tokens,
|
|||||||
{
|
{
|
||||||
GEmblem *emblem;
|
GEmblem *emblem;
|
||||||
GIcon *icon;
|
GIcon *icon;
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
GEmblemOrigin origin;
|
GEmblemOrigin origin;
|
||||||
|
|
||||||
emblem = NULL;
|
emblem = NULL;
|
||||||
@ -352,6 +369,7 @@ g_emblem_from_tokens (gchar **tokens,
|
|||||||
origin = atoi (tokens[1]);
|
origin = atoi (tokens[1]);
|
||||||
|
|
||||||
emblem = g_emblem_new_with_origin (icon, origin);
|
emblem = g_emblem_new_with_origin (icon, origin);
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
g_object_unref (icon);
|
g_object_unref (icon);
|
||||||
|
|
||||||
return G_ICON (emblem);
|
return G_ICON (emblem);
|
||||||
|
@ -43,16 +43,20 @@ typedef struct _GEmblemClass GEmblemClass;
|
|||||||
GIO_AVAILABLE_IN_ALL
|
GIO_AVAILABLE_IN_ALL
|
||||||
GType g_emblem_get_type (void) G_GNUC_CONST;
|
GType g_emblem_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GIO_AVAILABLE_IN_ALL
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
|
GIO_DEPRECATED_IN_2_84
|
||||||
GEmblem *g_emblem_new (GIcon *icon);
|
GEmblem *g_emblem_new (GIcon *icon);
|
||||||
GIO_AVAILABLE_IN_ALL
|
GIO_DEPRECATED_IN_2_84
|
||||||
GEmblem *g_emblem_new_with_origin (GIcon *icon,
|
GEmblem *g_emblem_new_with_origin (GIcon *icon,
|
||||||
GEmblemOrigin origin);
|
GEmblemOrigin origin);
|
||||||
GIO_AVAILABLE_IN_ALL
|
GIO_DEPRECATED_IN_2_84
|
||||||
GIcon *g_emblem_get_icon (GEmblem *emblem);
|
GIcon *g_emblem_get_icon (GEmblem *emblem);
|
||||||
GIO_AVAILABLE_IN_ALL
|
GIO_DEPRECATED_IN_2_84
|
||||||
GEmblemOrigin g_emblem_get_origin (GEmblem *emblem);
|
GEmblemOrigin g_emblem_get_origin (GEmblem *emblem);
|
||||||
|
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __G_EMBLEM_H__ */
|
#endif /* __G_EMBLEM_H__ */
|
||||||
|
@ -41,6 +41,8 @@
|
|||||||
*
|
*
|
||||||
* Note that `GEmblemedIcon` allows no control over the position
|
* Note that `GEmblemedIcon` allows no control over the position
|
||||||
* of the emblems. See also [class@Gio.Emblem] for more information.
|
* of the emblems. See also [class@Gio.Emblem] for more information.
|
||||||
|
*
|
||||||
|
* Deprecated: 2.84
|
||||||
**/
|
**/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -129,11 +131,12 @@ g_emblemed_icon_class_init (GEmblemedIconClass *klass)
|
|||||||
* The [iface@Gio.Icon] to attach emblems to.
|
* The [iface@Gio.Icon] to attach emblems to.
|
||||||
*
|
*
|
||||||
* Since: 2.18
|
* Since: 2.18
|
||||||
|
* Deprecated: 2.84
|
||||||
*/
|
*/
|
||||||
properties[PROP_GICON] =
|
properties[PROP_GICON] =
|
||||||
g_param_spec_object ("gicon", NULL, NULL,
|
g_param_spec_object ("gicon", NULL, NULL,
|
||||||
G_TYPE_ICON,
|
G_TYPE_ICON,
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS | G_PARAM_DEPRECATED);
|
||||||
|
|
||||||
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
|
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
|
||||||
}
|
}
|
||||||
@ -154,6 +157,7 @@ g_emblemed_icon_init (GEmblemedIcon *emblemed)
|
|||||||
* Returns: (transfer full) (type GEmblemedIcon): a new #GIcon
|
* Returns: (transfer full) (type GEmblemedIcon): a new #GIcon
|
||||||
*
|
*
|
||||||
* Since: 2.18
|
* Since: 2.18
|
||||||
|
* Deprecated: 2.84
|
||||||
**/
|
**/
|
||||||
GIcon *
|
GIcon *
|
||||||
g_emblemed_icon_new (GIcon *icon,
|
g_emblemed_icon_new (GIcon *icon,
|
||||||
@ -168,13 +172,14 @@ g_emblemed_icon_new (GIcon *icon,
|
|||||||
"gicon", icon,
|
"gicon", icon,
|
||||||
NULL));
|
NULL));
|
||||||
|
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
if (emblem != NULL)
|
if (emblem != NULL)
|
||||||
g_emblemed_icon_add_emblem (emblemed, emblem);
|
g_emblemed_icon_add_emblem (emblemed, emblem);
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
return G_ICON (emblemed);
|
return G_ICON (emblemed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_emblemed_icon_get_icon:
|
* g_emblemed_icon_get_icon:
|
||||||
* @emblemed: a #GEmblemedIcon
|
* @emblemed: a #GEmblemedIcon
|
||||||
@ -184,6 +189,7 @@ g_emblemed_icon_new (GIcon *icon,
|
|||||||
* Returns: (transfer none): a #GIcon that is owned by @emblemed
|
* Returns: (transfer none): a #GIcon that is owned by @emblemed
|
||||||
*
|
*
|
||||||
* Since: 2.18
|
* Since: 2.18
|
||||||
|
* Deprecated: 2.84
|
||||||
**/
|
**/
|
||||||
GIcon *
|
GIcon *
|
||||||
g_emblemed_icon_get_icon (GEmblemedIcon *emblemed)
|
g_emblemed_icon_get_icon (GEmblemedIcon *emblemed)
|
||||||
@ -203,6 +209,7 @@ g_emblemed_icon_get_icon (GEmblemedIcon *emblemed)
|
|||||||
* #GEmblems that is owned by @emblemed
|
* #GEmblems that is owned by @emblemed
|
||||||
*
|
*
|
||||||
* Since: 2.18
|
* Since: 2.18
|
||||||
|
* Deprecated: 2.84
|
||||||
**/
|
**/
|
||||||
|
|
||||||
GList *
|
GList *
|
||||||
@ -220,6 +227,7 @@ g_emblemed_icon_get_emblems (GEmblemedIcon *emblemed)
|
|||||||
* Removes all the emblems from @icon.
|
* Removes all the emblems from @icon.
|
||||||
*
|
*
|
||||||
* Since: 2.28
|
* Since: 2.28
|
||||||
|
* Deprecated: 2.84
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
g_emblemed_icon_clear_emblems (GEmblemedIcon *emblemed)
|
g_emblemed_icon_clear_emblems (GEmblemedIcon *emblemed)
|
||||||
@ -257,6 +265,7 @@ g_emblem_comp (GEmblem *a,
|
|||||||
* Adds @emblem to the #GList of #GEmblems.
|
* Adds @emblem to the #GList of #GEmblems.
|
||||||
*
|
*
|
||||||
* Since: 2.18
|
* Since: 2.18
|
||||||
|
* Deprecated: 2.84
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
g_emblemed_icon_add_emblem (GEmblemedIcon *emblemed,
|
g_emblemed_icon_add_emblem (GEmblemedIcon *emblemed,
|
||||||
|
@ -60,19 +60,23 @@ struct _GEmblemedIconClass
|
|||||||
GIO_AVAILABLE_IN_ALL
|
GIO_AVAILABLE_IN_ALL
|
||||||
GType g_emblemed_icon_get_type (void) G_GNUC_CONST;
|
GType g_emblemed_icon_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GIO_AVAILABLE_IN_ALL
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
|
GIO_DEPRECATED_IN_2_84
|
||||||
GIcon *g_emblemed_icon_new (GIcon *icon,
|
GIcon *g_emblemed_icon_new (GIcon *icon,
|
||||||
GEmblem *emblem);
|
GEmblem *emblem);
|
||||||
GIO_AVAILABLE_IN_ALL
|
GIO_DEPRECATED_IN_2_84
|
||||||
GIcon *g_emblemed_icon_get_icon (GEmblemedIcon *emblemed);
|
GIcon *g_emblemed_icon_get_icon (GEmblemedIcon *emblemed);
|
||||||
GIO_AVAILABLE_IN_ALL
|
GIO_DEPRECATED_IN_2_84
|
||||||
GList *g_emblemed_icon_get_emblems (GEmblemedIcon *emblemed);
|
GList *g_emblemed_icon_get_emblems (GEmblemedIcon *emblemed);
|
||||||
GIO_AVAILABLE_IN_ALL
|
GIO_DEPRECATED_IN_2_84
|
||||||
void g_emblemed_icon_add_emblem (GEmblemedIcon *emblemed,
|
void g_emblemed_icon_add_emblem (GEmblemedIcon *emblemed,
|
||||||
GEmblem *emblem);
|
GEmblem *emblem);
|
||||||
GIO_AVAILABLE_IN_ALL
|
GIO_DEPRECATED_IN_2_84
|
||||||
void g_emblemed_icon_clear_emblems (GEmblemedIcon *emblemed);
|
void g_emblemed_icon_clear_emblems (GEmblemedIcon *emblemed);
|
||||||
|
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __G_EMBLEMED_ICON_H__ */
|
#endif /* __G_EMBLEMED_ICON_H__ */
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
*
|
*
|
||||||
* If you want to consume `GIcon` (for example, in a toolkit) you must
|
* If you want to consume `GIcon` (for example, in a toolkit) you must
|
||||||
* be prepared to handle at least the three following cases:
|
* be prepared to handle at least the three following cases:
|
||||||
* [iface@Gio.LoadableIcon], [class@Gio.ThemedIcon] and [class@Gio.EmblemedIcon].
|
* [iface@Gio.LoadableIcon], [class@Gio.ThemedIcon] and [class@Gio.EmblemedIcon] (deprecated since 2.84).
|
||||||
* It may also make sense to have fast-paths for other cases (like handling
|
* It may also make sense to have fast-paths for other cases (like handling
|
||||||
* [`GdkPixbuf`](https://docs.gtk.org/gdk-pixbuf/class.Pixbuf.html) directly,
|
* [`GdkPixbuf`](https://docs.gtk.org/gdk-pixbuf/class.Pixbuf.html) directly,
|
||||||
* for example) but all compliant `GIcon` implementations outside of GIO must
|
* for example) but all compliant `GIcon` implementations outside of GIO must
|
||||||
@ -471,6 +471,7 @@ g_icon_new_for_string (const gchar *str,
|
|||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
static GEmblem *
|
static GEmblem *
|
||||||
g_icon_deserialize_emblem (GVariant *value)
|
g_icon_deserialize_emblem (GVariant *value)
|
||||||
{
|
{
|
||||||
@ -555,6 +556,7 @@ g_icon_deserialize_emblemed (GVariant *value)
|
|||||||
|
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_icon_deserialize:
|
* g_icon_deserialize:
|
||||||
|
@ -701,13 +701,14 @@ typedef enum {
|
|||||||
* to #GEmblem.
|
* to #GEmblem.
|
||||||
*
|
*
|
||||||
* Since: 2.18
|
* Since: 2.18
|
||||||
|
* Deprecated: 2.84
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
G_EMBLEM_ORIGIN_UNKNOWN,
|
G_EMBLEM_ORIGIN_UNKNOWN,
|
||||||
G_EMBLEM_ORIGIN_DEVICE,
|
G_EMBLEM_ORIGIN_DEVICE,
|
||||||
G_EMBLEM_ORIGIN_LIVEMETADATA,
|
G_EMBLEM_ORIGIN_LIVEMETADATA,
|
||||||
G_EMBLEM_ORIGIN_TAG
|
G_EMBLEM_ORIGIN_TAG
|
||||||
} GEmblemOrigin;
|
} GEmblemOrigin GIO_DEPRECATED_TYPE_IN_2_84;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GResolverError:
|
* GResolverError:
|
||||||
|
@ -244,17 +244,21 @@ test_g_icon_to_string (void)
|
|||||||
location = g_file_new_for_uri ("file:///some/path/somewhere.png");
|
location = g_file_new_for_uri ("file:///some/path/somewhere.png");
|
||||||
icon3 = g_file_icon_new (location);
|
icon3 = g_file_icon_new (location);
|
||||||
g_object_unref (location);
|
g_object_unref (location);
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
emblem1 = g_emblem_new_with_origin (icon2, G_EMBLEM_ORIGIN_DEVICE);
|
emblem1 = g_emblem_new_with_origin (icon2, G_EMBLEM_ORIGIN_DEVICE);
|
||||||
emblem2 = g_emblem_new_with_origin (icon3, G_EMBLEM_ORIGIN_LIVEMETADATA);
|
emblem2 = g_emblem_new_with_origin (icon3, G_EMBLEM_ORIGIN_LIVEMETADATA);
|
||||||
icon4 = g_emblemed_icon_new (icon, emblem1);
|
icon4 = g_emblemed_icon_new (icon, emblem1);
|
||||||
g_emblemed_icon_add_emblem (G_EMBLEMED_ICON (icon4), emblem2);
|
g_emblemed_icon_add_emblem (G_EMBLEMED_ICON (icon4), emblem2);
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
data = g_icon_to_string (icon4);
|
data = g_icon_to_string (icon4);
|
||||||
icon5 = g_icon_new_for_string (data, &error);
|
icon5 = g_icon_new_for_string (data, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (g_icon_equal (icon4, icon5));
|
g_assert (g_icon_equal (icon4, icon5));
|
||||||
|
|
||||||
g_object_get (emblem1, "origin", &origin, "icon", &i, NULL);
|
g_object_get (emblem1, "origin", &origin, "icon", &i, NULL);
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
g_assert (origin == G_EMBLEM_ORIGIN_DEVICE);
|
g_assert (origin == G_EMBLEM_ORIGIN_DEVICE);
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
g_assert (i == icon2);
|
g_assert (i == icon2);
|
||||||
g_object_unref (i);
|
g_object_unref (i);
|
||||||
|
|
||||||
@ -364,10 +368,12 @@ test_g_icon_serialize (void)
|
|||||||
location = g_file_new_for_uri ("file:///some/path/somewhere.png");
|
location = g_file_new_for_uri ("file:///some/path/somewhere.png");
|
||||||
icon3 = g_file_icon_new (location);
|
icon3 = g_file_icon_new (location);
|
||||||
g_object_unref (location);
|
g_object_unref (location);
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
emblem1 = g_emblem_new_with_origin (icon2, G_EMBLEM_ORIGIN_DEVICE);
|
emblem1 = g_emblem_new_with_origin (icon2, G_EMBLEM_ORIGIN_DEVICE);
|
||||||
emblem2 = g_emblem_new_with_origin (icon3, G_EMBLEM_ORIGIN_LIVEMETADATA);
|
emblem2 = g_emblem_new_with_origin (icon3, G_EMBLEM_ORIGIN_LIVEMETADATA);
|
||||||
icon4 = g_emblemed_icon_new (icon, emblem1);
|
icon4 = g_emblemed_icon_new (icon, emblem1);
|
||||||
g_emblemed_icon_add_emblem (G_EMBLEMED_ICON (icon4), emblem2);
|
g_emblemed_icon_add_emblem (G_EMBLEMED_ICON (icon4), emblem2);
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
data = g_icon_serialize (icon4);
|
data = g_icon_serialize (icon4);
|
||||||
icon5 = g_icon_deserialize (data);
|
icon5 = g_icon_deserialize (data);
|
||||||
g_assert (g_icon_equal (icon4, icon5));
|
g_assert (g_icon_equal (icon4, icon5));
|
||||||
@ -450,6 +456,7 @@ test_emblemed_icon (void)
|
|||||||
|
|
||||||
icon1 = g_themed_icon_new ("testicon");
|
icon1 = g_themed_icon_new ("testicon");
|
||||||
icon2 = g_themed_icon_new ("testemblem");
|
icon2 = g_themed_icon_new ("testemblem");
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
emblem1 = g_emblem_new (icon2);
|
emblem1 = g_emblem_new (icon2);
|
||||||
emblem2 = g_emblem_new_with_origin (icon2, G_EMBLEM_ORIGIN_TAG);
|
emblem2 = g_emblem_new_with_origin (icon2, G_EMBLEM_ORIGIN_TAG);
|
||||||
|
|
||||||
@ -461,6 +468,7 @@ test_emblemed_icon (void)
|
|||||||
icon4 = g_emblemed_icon_new (icon1, emblem1);
|
icon4 = g_emblemed_icon_new (icon1, emblem1);
|
||||||
g_emblemed_icon_add_emblem (G_EMBLEMED_ICON (icon4), emblem2);
|
g_emblemed_icon_add_emblem (G_EMBLEMED_ICON (icon4), emblem2);
|
||||||
emblems = g_emblemed_icon_get_emblems (G_EMBLEMED_ICON (icon4));
|
emblems = g_emblemed_icon_get_emblems (G_EMBLEMED_ICON (icon4));
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
g_assert_cmpint (g_list_length (emblems), ==, 2);
|
g_assert_cmpint (g_list_length (emblems), ==, 2);
|
||||||
|
|
||||||
g_assert (!g_icon_equal (icon3, icon4));
|
g_assert (!g_icon_equal (icon3, icon4));
|
||||||
@ -472,6 +480,7 @@ test_emblemed_icon (void)
|
|||||||
g_variant_unref (variant);
|
g_variant_unref (variant);
|
||||||
|
|
||||||
emblem = emblems->data;
|
emblem = emblems->data;
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
g_assert (g_emblem_get_icon (emblem) == icon2);
|
g_assert (g_emblem_get_icon (emblem) == icon2);
|
||||||
g_assert (g_emblem_get_origin (emblem) == G_EMBLEM_ORIGIN_UNKNOWN);
|
g_assert (g_emblem_get_origin (emblem) == G_EMBLEM_ORIGIN_UNKNOWN);
|
||||||
|
|
||||||
@ -481,6 +490,7 @@ test_emblemed_icon (void)
|
|||||||
|
|
||||||
g_emblemed_icon_clear_emblems (G_EMBLEMED_ICON (icon4));
|
g_emblemed_icon_clear_emblems (G_EMBLEMED_ICON (icon4));
|
||||||
g_assert (g_emblemed_icon_get_emblems (G_EMBLEMED_ICON (icon4)) == NULL);
|
g_assert (g_emblemed_icon_get_emblems (G_EMBLEMED_ICON (icon4)) == NULL);
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
g_assert (g_icon_hash (icon4) != g_icon_hash (icon2));
|
g_assert (g_icon_hash (icon4) != g_icon_hash (icon2));
|
||||||
g_object_get (icon4, "gicon", &icon, NULL);
|
g_object_get (icon4, "gicon", &icon, NULL);
|
||||||
@ -611,6 +621,9 @@ int
|
|||||||
main (int argc,
|
main (int argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
|
/* Disable deprecation warnings because GEmblemedIcon is deprecated and has deprecated properties */
|
||||||
|
g_setenv ("G_ENABLE_DIAGNOSTIC", "0", TRUE);
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
g_test_add_func ("/icons/to-string", test_g_icon_to_string);
|
g_test_add_func ("/icons/to-string", test_g_icon_to_string);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user