diff options
author | Gary Kramlich <grim@reaperworld.com> | 2023-03-30 22:55:10 -0500 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2023-03-30 22:55:10 -0500 |
commit | 59bc819ed04fcb9b9a55d56d7a6473f9fddf9f7c (patch) | |
tree | 835917837d55afad855a3f85dc2c8e8835a20e9f /pidgin | |
parent | f6965499277f8b18b3a6f157919359bfa033a11e (diff) | |
download | pidgin-59bc819ed04fcb9b9a55d56d7a6473f9fddf9f7c.tar.gz |
Add notifications when a saved plugin fails to load
I also did a first run at generic notifications.
Testing Done:
Forced some saved plugins to fail to load and verified in the notification list.
Bugs closed: PIDGIN-17711
Reviewed at https://reviews.imfreedom.org/r/2401/
Diffstat (limited to 'pidgin')
-rw-r--r-- | pidgin/pidginnotificationlist.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/pidgin/pidginnotificationlist.c b/pidgin/pidginnotificationlist.c index 3df6100404..c9db9e04f4 100644 --- a/pidgin/pidginnotificationlist.c +++ b/pidgin/pidginnotificationlist.c @@ -41,6 +41,17 @@ G_DEFINE_TYPE(PidginNotificationList, pidgin_notification_list, GTK_TYPE_BOX) /****************************************************************************** * Helpers *****************************************************************************/ +static gboolean +pidgin_notification_gpointer_to_char(G_GNUC_UNUSED GBinding *binding, + const GValue *from_value, + GValue *to_value, + G_GNUC_UNUSED gpointer user_data) +{ + g_value_set_string(to_value, (char *)g_value_get_pointer(from_value)); + + return TRUE; +} + static GtkWidget * pidgin_notification_list_unknown_notification(PurpleNotification *notification) { GtkWidget *widget = NULL; @@ -65,6 +76,25 @@ pidgin_notification_list_unknown_notification(PurpleNotification *notification) } static GtkWidget * +pidgin_notification_generic_new(PurpleNotification *notification) { + GtkWidget *row = NULL; + + row = adw_action_row_new(); + g_object_bind_property(notification, "title", row, "title", + G_BINDING_SYNC_CREATE); + g_object_bind_property(notification, "icon-name", row, "icon-name", + G_BINDING_SYNC_CREATE); + g_object_bind_property_full(notification, "data", row, "subtitle", + G_BINDING_SYNC_CREATE, + pidgin_notification_gpointer_to_char, + NULL, + NULL, + NULL); + + return row; +} + +static GtkWidget * pidgin_notification_list_create_widget_func(gpointer item, G_GNUC_UNUSED gpointer data) { @@ -72,6 +102,9 @@ pidgin_notification_list_create_widget_func(gpointer item, GtkWidget *widget = NULL; switch(purple_notification_get_notification_type(notification)) { + case PURPLE_NOTIFICATION_TYPE_GENERIC: + widget = pidgin_notification_generic_new(notification); + break; case PURPLE_NOTIFICATION_TYPE_CONNECTION_ERROR: widget = pidgin_notification_connection_error_new(notification); break; |