Rename icon field to iconname
This commit is contained in:
parent
4043e1a18e
commit
088907488c
@ -183,7 +183,7 @@ static struct notification *dbus_message_to_notification(const gchar *sender, GV
|
|||||||
|
|
||||||
g_variant_iter_next(&i, "s", &n->appname);
|
g_variant_iter_next(&i, "s", &n->appname);
|
||||||
g_variant_iter_next(&i, "u", &n->id);
|
g_variant_iter_next(&i, "u", &n->id);
|
||||||
g_variant_iter_next(&i, "s", &n->icon);
|
g_variant_iter_next(&i, "s", &n->iconname);
|
||||||
g_variant_iter_next(&i, "s", &n->summary);
|
g_variant_iter_next(&i, "s", &n->summary);
|
||||||
g_variant_iter_next(&i, "s", &n->body);
|
g_variant_iter_next(&i, "s", &n->body);
|
||||||
g_variant_iter_next(&i, "^a&s", &actions);
|
g_variant_iter_next(&i, "^a&s", &actions);
|
||||||
@ -230,8 +230,8 @@ static struct notification *dbus_message_to_notification(const gchar *sender, GV
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((dict_value = g_variant_lookup_value(hints, "image-path", G_VARIANT_TYPE_STRING))) {
|
if ((dict_value = g_variant_lookup_value(hints, "image-path", G_VARIANT_TYPE_STRING))) {
|
||||||
g_free(n->icon);
|
g_free(n->iconname);
|
||||||
n->icon = g_variant_dup_string(dict_value, NULL);
|
n->iconname = g_variant_dup_string(dict_value, NULL);
|
||||||
g_variant_unref(dict_value);
|
g_variant_unref(dict_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,8 +228,8 @@ cairo_surface_t *icon_get_for_notification(const struct notification *n)
|
|||||||
|
|
||||||
if (n->raw_icon)
|
if (n->raw_icon)
|
||||||
pixbuf = get_pixbuf_from_raw_image(n->raw_icon);
|
pixbuf = get_pixbuf_from_raw_image(n->raw_icon);
|
||||||
else if (n->icon)
|
else if (n->iconname)
|
||||||
pixbuf = get_pixbuf_from_icon(n->icon);
|
pixbuf = get_pixbuf_from_icon(n->iconname);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ void notification_print(const struct notification *n)
|
|||||||
printf("\tappname: '%s'\n", n->appname);
|
printf("\tappname: '%s'\n", n->appname);
|
||||||
printf("\tsummary: '%s'\n", n->summary);
|
printf("\tsummary: '%s'\n", n->summary);
|
||||||
printf("\tbody: '%s'\n", n->body);
|
printf("\tbody: '%s'\n", n->body);
|
||||||
printf("\ticon: '%s'\n", n->icon);
|
printf("\ticon: '%s'\n", n->iconname);
|
||||||
printf("\traw_icon set: %s\n", (n->raw_icon ? "true" : "false"));
|
printf("\traw_icon set: %s\n", (n->raw_icon ? "true" : "false"));
|
||||||
printf("\tcategory: %s\n", n->category);
|
printf("\tcategory: %s\n", n->category);
|
||||||
printf("\ttimeout: %ld\n", n->timeout/1000);
|
printf("\ttimeout: %ld\n", n->timeout/1000);
|
||||||
@ -103,7 +103,7 @@ void notification_run_script(struct notification *n)
|
|||||||
const char *appname = n->appname ? n->appname : "";
|
const char *appname = n->appname ? n->appname : "";
|
||||||
const char *summary = n->summary ? n->summary : "";
|
const char *summary = n->summary ? n->summary : "";
|
||||||
const char *body = n->body ? n->body : "";
|
const char *body = n->body ? n->body : "";
|
||||||
const char *icon = n->icon ? n->icon : "";
|
const char *icon = n->iconname ? n->iconname : "";
|
||||||
|
|
||||||
const char *urgency = notification_urgency_to_string(n->urgency);
|
const char *urgency = notification_urgency_to_string(n->urgency);
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ int notification_is_duplicate(const struct notification *a, const struct notific
|
|||||||
return STR_EQ(a->appname, b->appname)
|
return STR_EQ(a->appname, b->appname)
|
||||||
&& STR_EQ(a->summary, b->summary)
|
&& STR_EQ(a->summary, b->summary)
|
||||||
&& STR_EQ(a->body, b->body)
|
&& STR_EQ(a->body, b->body)
|
||||||
&& (settings.icon_position != ICON_OFF ? STR_EQ(a->icon, b->icon) : 1)
|
&& (settings.icon_position != ICON_OFF ? STR_EQ(a->iconname, b->iconname) : 1)
|
||||||
&& a->urgency == b->urgency;
|
&& a->urgency == b->urgency;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ void notification_unref(struct notification *n)
|
|||||||
g_free(n->appname);
|
g_free(n->appname);
|
||||||
g_free(n->summary);
|
g_free(n->summary);
|
||||||
g_free(n->body);
|
g_free(n->body);
|
||||||
g_free(n->icon);
|
g_free(n->iconname);
|
||||||
g_free(n->msg);
|
g_free(n->msg);
|
||||||
g_free(n->dbus_client);
|
g_free(n->dbus_client);
|
||||||
g_free(n->category);
|
g_free(n->category);
|
||||||
@ -328,10 +328,10 @@ void notification_init(struct notification *n)
|
|||||||
n->timeout = settings.timeouts[n->urgency];
|
n->timeout = settings.timeouts[n->urgency];
|
||||||
|
|
||||||
/* Icon handling */
|
/* Icon handling */
|
||||||
if (STR_EMPTY(n->icon))
|
if (STR_EMPTY(n->iconname))
|
||||||
g_clear_pointer(&n->icon, g_free);
|
g_clear_pointer(&n->iconname, g_free);
|
||||||
if (!n->raw_icon && !n->icon)
|
if (!n->raw_icon && !n->iconname)
|
||||||
n->icon = g_strdup(settings.icons[n->urgency]);
|
n->iconname = g_strdup(settings.icons[n->urgency]);
|
||||||
|
|
||||||
/* Color hints */
|
/* Color hints */
|
||||||
struct notification_colors defcolors;
|
struct notification_colors defcolors;
|
||||||
@ -404,7 +404,7 @@ static void notification_format_message(struct notification *n)
|
|||||||
n->markup);
|
n->markup);
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
icon_tmp = g_strdup(n->icon);
|
icon_tmp = g_strdup(n->iconname);
|
||||||
notification_replace_single_field(
|
notification_replace_single_field(
|
||||||
&n->msg,
|
&n->msg,
|
||||||
&substr,
|
&substr,
|
||||||
@ -416,7 +416,7 @@ static void notification_format_message(struct notification *n)
|
|||||||
notification_replace_single_field(
|
notification_replace_single_field(
|
||||||
&n->msg,
|
&n->msg,
|
||||||
&substr,
|
&substr,
|
||||||
n->icon ? n->icon : "",
|
n->iconname ? n->iconname : "",
|
||||||
MARKUP_NO);
|
MARKUP_NO);
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
|
@ -56,7 +56,7 @@ struct notification {
|
|||||||
char *category;
|
char *category;
|
||||||
enum urgency urgency;
|
enum urgency urgency;
|
||||||
|
|
||||||
char *icon; /**< plain icon information (may be a path or just a name) */
|
char *iconname; /**< plain icon information (may be a path or just a name) */
|
||||||
struct raw_image *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 */
|
||||||
|
@ -27,8 +27,8 @@ void rule_apply(struct rule *r, struct notification *n)
|
|||||||
if (r->markup != MARKUP_NULL)
|
if (r->markup != MARKUP_NULL)
|
||||||
n->markup = r->markup;
|
n->markup = r->markup;
|
||||||
if (r->new_icon) {
|
if (r->new_icon) {
|
||||||
g_free(n->icon);
|
g_free(n->iconname);
|
||||||
n->icon = g_strdup(r->new_icon);
|
n->iconname = g_strdup(r->new_icon);
|
||||||
g_clear_pointer(&n->raw_icon, rawimage_free);
|
g_clear_pointer(&n->raw_icon, rawimage_free);
|
||||||
}
|
}
|
||||||
if (r->fg) {
|
if (r->fg) {
|
||||||
@ -102,7 +102,7 @@ bool rule_matches_notification(struct rule *r, struct notification *n)
|
|||||||
return ( (!r->appname || (n->appname && !fnmatch(r->appname, n->appname, 0)))
|
return ( (!r->appname || (n->appname && !fnmatch(r->appname, n->appname, 0)))
|
||||||
&& (!r->summary || (n->summary && !fnmatch(r->summary, n->summary, 0)))
|
&& (!r->summary || (n->summary && !fnmatch(r->summary, n->summary, 0)))
|
||||||
&& (!r->body || (n->body && !fnmatch(r->body, n->body, 0)))
|
&& (!r->body || (n->body && !fnmatch(r->body, n->body, 0)))
|
||||||
&& (!r->icon || (n->icon && !fnmatch(r->icon, n->icon, 0)))
|
&& (!r->icon || (n->iconname && !fnmatch(r->icon, n->iconname,0)))
|
||||||
&& (!r->category || (n->category && !fnmatch(r->category, n->category, 0)))
|
&& (!r->category || (n->category && !fnmatch(r->category, n->category, 0)))
|
||||||
&& (!r->stack_tag || (n->stack_tag && !fnmatch(r->stack_tag, n->stack_tag, 0)))
|
&& (!r->stack_tag || (n->stack_tag && !fnmatch(r->stack_tag, n->stack_tag, 0)))
|
||||||
&& (r->match_transient == -1 || (r->match_transient == n->transient))
|
&& (r->match_transient == -1 || (r->match_transient == n->transient))
|
||||||
|
@ -511,7 +511,7 @@ TEST test_hint_icons(void)
|
|||||||
|
|
||||||
n = queues_debug_find_notification_by_id(id);
|
n = queues_debug_find_notification_by_id(id);
|
||||||
|
|
||||||
ASSERT_STR_EQ(iconname, n->icon);
|
ASSERT_STR_EQ(iconname, n->iconname);
|
||||||
|
|
||||||
dbus_notification_free(n_dbus);
|
dbus_notification_free(n_dbus);
|
||||||
|
|
||||||
|
@ -25,14 +25,14 @@ TEST test_notification_is_duplicate(void)
|
|||||||
a->appname = g_strdup("Test");
|
a->appname = g_strdup("Test");
|
||||||
a->summary = g_strdup("Summary");
|
a->summary = g_strdup("Summary");
|
||||||
a->body = g_strdup("Body");
|
a->body = g_strdup("Body");
|
||||||
a->icon = g_strdup("Icon");
|
a->iconname = g_strdup("Icon");
|
||||||
a->urgency = URG_NORM;
|
a->urgency = URG_NORM;
|
||||||
|
|
||||||
struct notification *b = notification_create();
|
struct notification *b = notification_create();
|
||||||
b->appname = g_strdup("Test");
|
b->appname = g_strdup("Test");
|
||||||
b->summary = g_strdup("Summary");
|
b->summary = g_strdup("Summary");
|
||||||
b->body = g_strdup("Body");
|
b->body = g_strdup("Body");
|
||||||
b->icon = g_strdup("Icon");
|
b->iconname = g_strdup("Icon");
|
||||||
b->urgency = URG_NORM;
|
b->urgency = URG_NORM;
|
||||||
|
|
||||||
CHECK_CALL(test_notification_is_duplicate_field(&(b->appname), a, b));
|
CHECK_CALL(test_notification_is_duplicate_field(&(b->appname), a, b));
|
||||||
@ -52,13 +52,13 @@ TEST test_notification_is_duplicate(void)
|
|||||||
b->raw_icon = NULL;
|
b->raw_icon = NULL;
|
||||||
|
|
||||||
settings.icon_position = ICON_LEFT;
|
settings.icon_position = ICON_LEFT;
|
||||||
CHECK_CALL(test_notification_is_duplicate_field(&(b->icon), a, b));
|
CHECK_CALL(test_notification_is_duplicate_field(&(b->iconname), a, b));
|
||||||
b->raw_icon = (struct raw_image*)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 = ICON_RIGHT;
|
settings.icon_position = ICON_RIGHT;
|
||||||
CHECK_CALL(test_notification_is_duplicate_field(&(b->icon), a, b));
|
CHECK_CALL(test_notification_is_duplicate_field(&(b->iconname), a, b));
|
||||||
b->raw_icon = (struct raw_image*)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;
|
||||||
@ -173,7 +173,7 @@ SUITE(suite_notification)
|
|||||||
a->appname = g_strdup("MyApp");
|
a->appname = g_strdup("MyApp");
|
||||||
a->summary = g_strdup("I've got a summary!");
|
a->summary = g_strdup("I've got a summary!");
|
||||||
a->body = g_strdup("Look at my shiny <notification>");
|
a->body = g_strdup("Look at my shiny <notification>");
|
||||||
a->icon = g_strdup("/this/is/my/icoknpath.png");
|
a->iconname = g_strdup("/this/is/my/icoknpath.png");
|
||||||
a->progress = 95;
|
a->progress = 95;
|
||||||
|
|
||||||
const char *strings[] = {
|
const char *strings[] = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user