Pack type RawImage into raw_image struct
This commit is contained in:
parent
8010f83286
commit
de0f0bf3d9
@ -81,7 +81,7 @@ static void on_get_server_information(GDBusConnection *connection,
|
|||||||
const gchar *sender,
|
const gchar *sender,
|
||||||
const GVariant *parameters,
|
const GVariant *parameters,
|
||||||
GDBusMethodInvocation *invocation);
|
GDBusMethodInvocation *invocation);
|
||||||
static RawImage *get_raw_image_from_data_hint(GVariant *icon_data);
|
static struct raw_image *get_raw_image_from_data_hint(GVariant *icon_data);
|
||||||
|
|
||||||
void handle_method_call(GDBusConnection *connection,
|
void handle_method_call(GDBusConnection *connection,
|
||||||
const gchar *sender,
|
const gchar *sender,
|
||||||
@ -520,9 +520,9 @@ static void on_name_lost(GDBusConnection *connection,
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RawImage *get_raw_image_from_data_hint(GVariant *icon_data)
|
static struct raw_image *get_raw_image_from_data_hint(GVariant *icon_data)
|
||||||
{
|
{
|
||||||
RawImage *image = g_malloc(sizeof(RawImage));
|
struct raw_image *image = g_malloc(sizeof(struct raw_image));
|
||||||
GVariant *data_variant;
|
GVariant *data_variant;
|
||||||
gsize expected_len;
|
gsize expected_len;
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ GdkPixbuf *get_pixbuf_from_icon(const char *iconname)
|
|||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkPixbuf *get_pixbuf_from_raw_image(const RawImage *raw_image)
|
GdkPixbuf *get_pixbuf_from_raw_image(const struct raw_image *raw_image)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf = NULL;
|
GdkPixbuf *pixbuf = NULL;
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@ GdkPixbuf *get_pixbuf_from_file(const char *filename);
|
|||||||
*/
|
*/
|
||||||
GdkPixbuf *get_pixbuf_from_icon(const char *iconname);
|
GdkPixbuf *get_pixbuf_from_icon(const char *iconname);
|
||||||
|
|
||||||
/** Convert a RawImage to a `GdkPixbuf`
|
/** Convert a struct raw_image to a `GdkPixbuf`
|
||||||
*/
|
*/
|
||||||
GdkPixbuf *get_pixbuf_from_raw_image(const RawImage *raw_image);
|
GdkPixbuf *get_pixbuf_from_raw_image(const struct raw_image *raw_image);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a cairo surface with the appropriate icon for the notification, scaled
|
* Get a cairo surface with the appropriate icon for the notification, scaled
|
||||||
|
@ -197,7 +197,7 @@ void actions_free(struct actions *a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* see notification.h */
|
/* see notification.h */
|
||||||
void rawimage_free(RawImage *i)
|
void rawimage_free(struct raw_image *i)
|
||||||
{
|
{
|
||||||
if (!i)
|
if (!i)
|
||||||
return;
|
return;
|
||||||
|
@ -26,7 +26,7 @@ enum urgency {
|
|||||||
URG_MAX = 2, /**< Maximum value, useful for boundary checking */
|
URG_MAX = 2, /**< Maximum value, useful for boundary checking */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _raw_image {
|
struct raw_image {
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int rowstride;
|
int rowstride;
|
||||||
@ -34,7 +34,7 @@ typedef struct _raw_image {
|
|||||||
int bits_per_sample;
|
int bits_per_sample;
|
||||||
int n_channels;
|
int n_channels;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
} RawImage;
|
};
|
||||||
|
|
||||||
struct actions {
|
struct actions {
|
||||||
char **actions;
|
char **actions;
|
||||||
@ -53,7 +53,7 @@ typedef struct _notification {
|
|||||||
enum urgency urgency;
|
enum urgency urgency;
|
||||||
|
|
||||||
char *icon; /**< plain icon information (may be a path or just a name) */
|
char *icon; /**< plain icon information (may be a path or just a name) */
|
||||||
RawImage *raw_icon; /**< passed icon data of notification, takes precedence over icon */
|
struct raw_image *raw_icon; /**< passed icon data of notification, takes precedence over icon */
|
||||||
|
|
||||||
gint64 start; /**< begin of current display */
|
gint64 start; /**< begin of current display */
|
||||||
gint64 timestamp; /**< arrival time */
|
gint64 timestamp; /**< arrival time */
|
||||||
@ -111,11 +111,11 @@ void notification_init(notification *n);
|
|||||||
void actions_free(struct actions *a);
|
void actions_free(struct actions *a);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free a #RawImage
|
* Free a #raw_image
|
||||||
*
|
*
|
||||||
* @param i (nullable): pointer to #RawImage
|
* @param i (nullable): pointer to #raw_image
|
||||||
*/
|
*/
|
||||||
void rawimage_free(RawImage *i);
|
void rawimage_free(struct raw_image *i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free the memory used by the given notification.
|
* Free the memory used by the given notification.
|
||||||
|
@ -39,19 +39,19 @@ TEST test_notification_is_duplicate(void *notifications)
|
|||||||
settings.icon_position = icons_off;
|
settings.icon_position = icons_off;
|
||||||
ASSERT(notification_is_duplicate(a, b));
|
ASSERT(notification_is_duplicate(a, b));
|
||||||
//Setting pointer to a random value since we are checking for null
|
//Setting pointer to a random value since we are checking for null
|
||||||
b->raw_icon = (RawImage*)0xff;
|
b->raw_icon = (struct raw_image*)0xff;
|
||||||
ASSERT(notification_is_duplicate(a, b));
|
ASSERT(notification_is_duplicate(a, b));
|
||||||
b->raw_icon = NULL;
|
b->raw_icon = NULL;
|
||||||
|
|
||||||
settings.icon_position = icons_left;
|
settings.icon_position = icons_left;
|
||||||
ASSERT_FALSE(notification_is_duplicate(a, b));
|
ASSERT_FALSE(notification_is_duplicate(a, b));
|
||||||
b->raw_icon = (RawImage*)0xff;
|
b->raw_icon = (struct raw_image*)0xff;
|
||||||
ASSERT_FALSE(notification_is_duplicate(a, b));
|
ASSERT_FALSE(notification_is_duplicate(a, b));
|
||||||
b->raw_icon = NULL;
|
b->raw_icon = NULL;
|
||||||
|
|
||||||
settings.icon_position = icons_right;
|
settings.icon_position = icons_right;
|
||||||
ASSERT_FALSE(notification_is_duplicate(a, b));
|
ASSERT_FALSE(notification_is_duplicate(a, b));
|
||||||
b->raw_icon = (RawImage*)0xff;
|
b->raw_icon = (struct raw_image*)0xff;
|
||||||
ASSERT_FALSE(notification_is_duplicate(a, b));
|
ASSERT_FALSE(notification_is_duplicate(a, b));
|
||||||
b->raw_icon = NULL;
|
b->raw_icon = NULL;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user