Port the media window to GTK4 gtk4

Thu, 25 Aug 2022 22:53:49 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 25 Aug 2022 22:53:49 -0500
branch
gtk4
changeset 41597
46a6267a35e6
parent 41596
2f0fec76cfbc
child 41598
2b34cd990c16

Port the media window to GTK4

Testing Done:
Compiled and ran, but there's no way to start a call at the moment.

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

pidgin/gtkmedia.c file | annotate | diff | comparison | revisions
pidgin/gtkrequest.c file | annotate | diff | comparison | revisions
pidgin/resources/Media/window.ui file | annotate | diff | comparison | revisions
--- a/pidgin/gtkmedia.c	Thu Aug 25 22:45:58 2022 -0500
+++ b/pidgin/gtkmedia.c	Thu Aug 25 22:53:49 2022 -0500
@@ -116,12 +116,14 @@
 };
 
 static gboolean
-pidgin_media_delete_event_cb(GtkWidget *widget,
-		GdkEvent *event, PidginMedia *media)
-{
-	if (media->priv->media)
+pidgin_media_close_request_cb(GtkWindow *window, gpointer data) {
+	PidginMedia *media = data;
+
+	if(media->priv->media) {
 		g_action_group_activate_action(G_ACTION_GROUP(media),
 				"Hangup", NULL);
+	}
+
 	return FALSE;
 }
 
@@ -160,7 +162,7 @@
 	                                             statusbar);
 
 	gtk_widget_class_bind_template_callback(widget_class,
-	                                        pidgin_media_delete_event_cb);
+	                                        pidgin_media_close_request_cb);
 
 }
 
--- a/pidgin/gtkrequest.c	Thu Aug 25 22:45:58 2022 -0500
+++ b/pidgin/gtkrequest.c	Thu Aug 25 22:53:49 2022 -0500
@@ -318,8 +318,7 @@
 }
 
 static gboolean
-destroy_multifield_cb(GtkWidget *dialog, GdkEvent *event,
-					  PidginRequestData *data)
+destroy_multifield_cb(GtkWidget *self, PidginRequestData *data)
 {
 	multifield_cancel_cb(NULL, data);
 	return FALSE;
@@ -1262,10 +1261,8 @@
 
 static GtkWidget *
 create_choice_field(PurpleRequestField *field,
-	PurpleRequestCommonParameters *cpar)
+                    PurpleRequestCommonParameters *cpar)
 {
-#warning please rewrite me
-#if 0
 	GtkWidget *widget;
 	GList *elements = purple_request_field_choice_get_elements(field);
 	guint num_labels = g_list_length(elements);
@@ -1361,7 +1358,6 @@
 	g_object_set_data_full(G_OBJECT(widget), "values", values, g_free);
 
 	return widget;
-#endif
 
 	return NULL;
 }
@@ -1944,7 +1940,7 @@
 
 	data->dialog = win = pidgin_dialog_new(title, 12, "multifield", TRUE) ;
 
-	g_signal_connect(G_OBJECT(win), "delete_event",
+	g_signal_connect(G_OBJECT(win), "close-request",
 					 G_CALLBACK(destroy_multifield_cb), data);
 
 	/* Setup the main horizontal box */
--- a/pidgin/resources/Media/window.ui	Thu Aug 25 22:45:58 2022 -0500
+++ b/pidgin/resources/Media/window.ui	Thu Aug 25 22:53:49 2022 -0500
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 
-
+<!--
 Pidgin - Internet Messenger
 Copyright (C) Pidgin Developers <devel@pidgin.im>
 
@@ -15,85 +14,53 @@
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
+along with this library; if not, see <https://www.gnu.org/licenses/>.
 -->
 <interface>
-  <requires lib="gtk+" version="3.24"/>
+  <requires lib="gtk" version="4.0"/>
   <!-- interface-license-type gplv2 -->
   <!-- interface-name Pidgin -->
   <!-- interface-description Internet Messenger -->
   <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
   <template class="PidginMedia" parent="GtkApplicationWindow">
-    <property name="can-focus">False</property>
-    <signal name="delete-event" handler="pidgin_media_delete_event_cb" swapped="no"/>
+    <signal name="close-request" handler="pidgin_media_close_request_cb" swapped="no"/>
     <child>
       <object class="GtkBox">
-        <property name="visible">True</property>
-        <property name="can-focus">False</property>
         <property name="orientation">vertical</property>
         <child>
-          <object class="GtkToolbar">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="toolbar-style">both</property>
+          <object class="GtkBox">
+            <property name="css-classes">toolbar</property>
+            <property name="can-focus">0</property>
             <child>
-              <object class="GtkToolButton">
-                <property name="visible">True</property>
-                <property name="can-focus">False</property>
-                <property name="tooltip-text" translatable="yes">Hangup</property>
+              <object class="GtkButton">
+                <property name="can-focus">0</property>
+                <property name="tooltip-text" translatable="1">Hangup</property>
                 <property name="action-name">win.Hangup</property>
-                <property name="label" translatable="yes">Hangup</property>
-                <property name="use-underline">True</property>
+                <property name="label" translatable="1">Hangup</property>
+                <property name="use-underline">1</property>
                 <property name="icon-name">media-playback-stop</property>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="homogeneous">True</property>
-              </packing>
             </child>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
         </child>
         <child>
           <object class="GtkBox" id="display">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
+            <property name="vexpand">1</property>
+            <property name="valign">fill</property>
             <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
               <placeholder/>
             </child>
           </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
         <child>
           <object class="GtkStatusbar" id="statusbar">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="margin-left">10</property>
-            <property name="margin-right">10</property>
             <property name="margin-start">10</property>
             <property name="margin-end">10</property>
             <property name="margin-top">6</property>
             <property name="margin-bottom">6</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">2</property>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
         </child>
       </object>
     </child>

mercurial