Port notifications to GTK4 gtk4

Mon, 22 Aug 2022 23:35:44 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Mon, 22 Aug 2022 23:35:44 -0500
branch
gtk4
changeset 41570
750d7d2581fe
parent 41569
5a7a4bb5bfd4
child 41571
49f620ec5902

Port notifications to GTK4

Testing Done:
Compiled, and opened notifications window, eventually.

Reviewed at https://reviews.imfreedom.org/r/1622/

pidgin/pidginnotificationauthorizationrequest.c file | annotate | diff | comparison | revisions
pidgin/pidginnotificationauthorizationrequest.h file | annotate | diff | comparison | revisions
pidgin/resources/Notifications/authorizationrequest.ui file | annotate | diff | comparison | revisions
pidgin/resources/Notifications/connectionerror.ui file | annotate | diff | comparison | revisions
--- a/pidgin/pidginnotificationauthorizationrequest.c	Mon Aug 22 21:43:13 2022 -0500
+++ b/pidgin/pidginnotificationauthorizationrequest.c	Mon Aug 22 23:35:44 2022 -0500
@@ -29,7 +29,7 @@
 #include "pidgin/gtkdialogs.h"
 
 struct _PidginNotificationAuthorizationRequest {
-	HdyActionRow parent;
+	AdwActionRow parent;
 
 	PurpleNotification *notification;
 
@@ -46,7 +46,7 @@
 static GParamSpec *properties[N_PROPERTIES] = { NULL, };
 
 G_DEFINE_TYPE(PidginNotificationAuthorizationRequest,
-              pidgin_notification_authorization_request, HDY_TYPE_ACTION_ROW)
+              pidgin_notification_authorization_request, ADW_TYPE_ACTION_ROW)
 
 /******************************************************************************
  * Helpers
@@ -61,11 +61,11 @@
 	g_return_if_fail(PIDGIN_IS_NOTIFICATION_AUTHORIZATION_REQUEST(request));
 
 	if(!PURPLE_IS_NOTIFICATION(request->notification)) {
-		hdy_preferences_row_set_title(HDY_PREFERENCES_ROW(request),
+		adw_preferences_row_set_title(ADW_PREFERENCES_ROW(request),
 		                              _("Notification missing"));
 
-		hdy_action_row_set_icon_name(HDY_ACTION_ROW(request), NULL);
-		hdy_action_row_set_subtitle(HDY_ACTION_ROW(request), NULL);
+		adw_action_row_set_icon_name(ADW_ACTION_ROW(request), NULL);
+		adw_action_row_set_subtitle(ADW_ACTION_ROW(request), NULL);
 
 		gtk_widget_hide(request->accept);
 		gtk_widget_hide(request->deny);
@@ -76,11 +76,11 @@
 
 	account = purple_notification_get_account(request->notification);
 	if(!PURPLE_IS_ACCOUNT(account)) {
-		hdy_preferences_row_set_title(HDY_PREFERENCES_ROW(request),
+		adw_preferences_row_set_title(ADW_PREFERENCES_ROW(request),
 		                              _("Notification is missing an account"));
 
-		hdy_action_row_set_icon_name(HDY_ACTION_ROW(request), NULL);
-		hdy_action_row_set_subtitle(HDY_ACTION_ROW(request), NULL);
+		adw_action_row_set_icon_name(ADW_ACTION_ROW(request), NULL);
+		adw_action_row_set_subtitle(ADW_ACTION_ROW(request), NULL);
 
 		gtk_widget_hide(request->accept);
 		gtk_widget_hide(request->deny);
@@ -103,13 +103,13 @@
 			icon_name = "dialog-question";
 		}
 	}
-	hdy_action_row_set_icon_name(HDY_ACTION_ROW(request), icon_name);
+	adw_action_row_set_icon_name(ADW_ACTION_ROW(request), icon_name);
 
 	title = purple_notification_get_title(request->notification);
-	hdy_preferences_row_set_title(HDY_PREFERENCES_ROW(request), title);
+	adw_preferences_row_set_title(ADW_PREFERENCES_ROW(request), title);
 
 	message = purple_authorization_request_get_message(purple_request);
-	hdy_action_row_set_subtitle(HDY_ACTION_ROW(request), message);
+	adw_action_row_set_subtitle(ADW_ACTION_ROW(request), message);
 
 	gtk_widget_show(request->accept);
 	gtk_widget_show(request->deny);
--- a/pidgin/pidginnotificationauthorizationrequest.h	Mon Aug 22 21:43:13 2022 -0500
+++ b/pidgin/pidginnotificationauthorizationrequest.h	Mon Aug 22 23:35:44 2022 -0500
@@ -31,7 +31,7 @@
 
 #include <gtk/gtk.h>
 
-#include <handy.h>
+#include <adwaita.h>
 
 #include <purple.h>
 
@@ -49,7 +49,7 @@
 
 #define PIDGIN_TYPE_NOTIFICATION_AUTHORIZATION_REQUEST (pidgin_notification_authorization_request_get_type())
 G_DECLARE_FINAL_TYPE(PidginNotificationAuthorizationRequest, pidgin_notification_authorization_request,
-                     PIDGIN, NOTIFICATION_AUTHORIZATION_REQUEST, HdyActionRow)
+                     PIDGIN, NOTIFICATION_AUTHORIZATION_REQUEST, AdwActionRow)
 
 /**
  * pidgin_notification_authorization_request_new:
--- a/pidgin/resources/Notifications/authorizationrequest.ui	Mon Aug 22 21:43:13 2022 -0500
+++ b/pidgin/resources/Notifications/authorizationrequest.ui	Mon Aug 22 23:35:44 2022 -0500
@@ -19,24 +19,22 @@
 
 -->
 <interface>
-  <requires lib="gtk+" version="3.24"/>
-  <requires lib="libhandy" version="0.0"/>
+  <requires lib="gtk" version="4.0"/>
+  <requires lib="Adw" version="1.0"/>
   <!-- interface-license-type gplv2 -->
   <!-- interface-name Pidgin -->
   <!-- interface-description Internet Messenger -->
   <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
-  <template class="PidginNotificationAuthorizationRequest" parent="HdyActionRow">
-    <property name="visible">True</property>
-    <property name="can-focus">True</property>
-    <property name="activatable">False</property>
+  <template class="PidginNotificationAuthorizationRequest" parent="AdwActionRow">
+    <property name="focusable">1</property>
+    <property name="activatable">0</property>
     <property name="title-lines">3</property>
     <property name="subtitle-lines">3</property>
     <child>
       <object class="GtkButton" id="accept">
-        <property name="label" translatable="yes">Accept</property>
-        <property name="visible">True</property>
-        <property name="can-focus">True</property>
-        <property name="receives-default">True</property>
+        <property name="label" translatable="1">Accept</property>
+        <property name="focusable">1</property>
+        <property name="receives-default">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
         <signal name="clicked" handler="pidgin_notification_authorization_request_accept_cb" object="PidginNotificationAuthorizationRequest" swapped="no"/>
@@ -47,10 +45,9 @@
     </child>
     <child>
       <object class="GtkButton" id="deny">
-        <property name="label" translatable="yes">Deny</property>
-        <property name="visible">True</property>
-        <property name="can-focus">True</property>
-        <property name="receives-default">True</property>
+        <property name="label" translatable="1">Deny</property>
+        <property name="focusable">1</property>
+        <property name="receives-default">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
         <signal name="clicked" handler="pidgin_notification_authorization_request_deny_cb" object="PidginNotificationAuthorizationRequest" swapped="no"/>
@@ -61,10 +58,9 @@
     </child>
     <child>
       <object class="GtkButton" id="message">
-        <property name="label" translatable="yes">Message</property>
-        <property name="visible">True</property>
-        <property name="can-focus">True</property>
-        <property name="receives-default">True</property>
+        <property name="label" translatable="1">Message</property>
+        <property name="focusable">1</property>
+        <property name="receives-default">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
         <signal name="clicked" handler="pidgin_notification_authorization_request_message_cb" object="PidginNotificationAuthorizationRequest" swapped="no"/>
@@ -72,17 +68,16 @@
     </child>
     <child>
       <object class="GtkButton" id="remove">
-        <property name="visible">True</property>
-        <property name="can-focus">True</property>
-        <property name="receives-default">True</property>
+        <property name="focusable">1</property>
+        <property name="receives-default">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
-        <property name="relief">none</property>
         <signal name="clicked" handler="pidgin_notification_authorization_request_remove_cb" object="PidginNotificationAuthorizationRequest" swapped="no"/>
+        <style>
+          <class name="flat"/>
+        </style>
         <child>
           <object class="GtkImage">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
             <property name="icon-name">edit-delete-symbolic</property>
           </object>
         </child>
--- a/pidgin/resources/Notifications/connectionerror.ui	Mon Aug 22 21:43:13 2022 -0500
+++ b/pidgin/resources/Notifications/connectionerror.ui	Mon Aug 22 23:35:44 2022 -0500
@@ -24,9 +24,8 @@
   <!-- interface-description Internet Messenger -->
   <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
   <template class="PidginNotificationConnectionError" parent="AdwActionRow">
-    <property name="visible">True</property>
-    <property name="can-focus">True</property>
-    <property name="activatable">False</property>
+    <property name="focusable">1</property>
+    <property name="activatable">0</property>
     <property name="subtitle-lines">3</property>
     <child>
       <object class="GtkButton" id="reconnect">
@@ -64,8 +63,10 @@
         <property name="receives-default">1</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
-        <property name="relief">none</property>
         <signal name="clicked" handler="pidgin_notification_connection_error_remove_cb" object="PidginNotificationConnectionError" swapped="no"/>
+        <style>
+          <class name="flat"/>
+        </style>
         <child>
           <object class="GtkImage">
             <property name="icon-name">edit-delete-symbolic</property>

mercurial