Port PidginStatusEditor to GTK4 gtk4

Tue, 10 May 2022 03:44:38 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 10 May 2022 03:44:38 -0500
branch
gtk4
changeset 41544
53ba39406c86
parent 41543
d6ba57accc0e
child 41545
b02de51a738e

Port PidginStatusEditor to GTK4

Testing Done:
Compiled.

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

pidgin/pidginstatuseditor.c file | annotate | diff | comparison | revisions
pidgin/resources/Status/editor.ui file | annotate | diff | comparison | revisions
--- a/pidgin/pidginstatuseditor.c	Tue May 10 03:19:55 2022 -0500
+++ b/pidgin/pidginstatuseditor.c	Tue May 10 03:44:38 2022 -0500
@@ -84,7 +84,7 @@
 		message = "";
 	}
 
-	gtk_entry_set_text(GTK_ENTRY(editor->title), title);
+	gtk_editable_set_text(GTK_EDITABLE(editor->title), title);
 	chooser = PIDGIN_STATUS_PRIMITIVE_CHOOSER(editor->primitive);
 	pidgin_status_primitive_chooser_set_selected(chooser, primitive);
 	talkatu_markup_set_html(TALKATU_BUFFER(editor->buffer), message, -1);
@@ -99,7 +99,7 @@
 	gchar *message = NULL;
 	const gchar *title = NULL;
 
-	title = gtk_entry_get_text(GTK_ENTRY(editor->title));
+	title = gtk_editable_get_text(GTK_EDITABLE(editor->title));
 
 	chooser = PIDGIN_STATUS_PRIMITIVE_CHOOSER(editor->primitive);
 	primitive = pidgin_status_primitive_chooser_get_selected(chooser);
@@ -147,7 +147,7 @@
 			break;
 	}
 
-	gtk_widget_destroy(GTK_WIDGET(dialog));
+	gtk_window_destroy(GTK_WINDOW(dialog));
 }
 
 static void
@@ -156,7 +156,7 @@
 	gboolean title_changed = FALSE, sensitive = FALSE;
 	const gchar *title = NULL;
 
-	title = gtk_entry_get_text(GTK_ENTRY(editor->title));
+	title = gtk_editable_get_text(GTK_EDITABLE(editor->title));
 
 	if(editor->status != NULL) {
 		/* If we're editing a status, check if the title is the same. */
--- a/pidgin/resources/Status/editor.ui	Tue May 10 03:19:55 2022 -0500
+++ b/pidgin/resources/Status/editor.ui	Tue May 10 03:44:38 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>
 
@@ -14,12 +13,11 @@
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, see <https://www.gnu.org/licenses/>.
-
+You should have received a copy of the GNU General Public License
+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"/>
   <requires lib="Talkatu" version="0.1"/>
   <requires lib="pidgin" version="3.0"/>
   <!-- interface-license-type gplv2 -->
@@ -27,244 +25,138 @@
   <!-- interface-description Internet Messenger -->
   <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
   <template class="PidginStatusEditor" parent="GtkDialog">
-    <property name="can-focus">False</property>
-    <property name="title" translatable="yes">Status</property>
-    <property name="type-hint">dialog</property>
-    <property name="destroy-with-parent">True</property>
+    <property name="title" translatable="1">Status</property>
+    <property name="destroy-with-parent">1</property>
     <signal name="response" handler="pidgin_status_editor_response_cb" swapped="no"/>
-    <child internal-child="vbox">
+    <child internal-child="content_area">
       <object class="GtkBox">
-        <property name="can-focus">False</property>
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox">
-            <property name="can-focus">False</property>
-            <property name="layout-style">end</property>
-            <child>
-              <object class="GtkButton" id="cancel">
-                <property name="label" translatable="yes">_Cancel</property>
-                <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">True</property>
-                <property name="use-underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="use">
-                <property name="label" translatable="yes">_Use</property>
-                <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">True</property>
-                <property name="sensitive">False</property>
-                <property name="use-underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="save">
-                <property name="label" translatable="yes">_Save</property>
-                <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">True</property>
-                <property name="sensitive">False</property>
-                <property name="use-underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
         <child>
           <object class="GtkBox">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
+            <property name="vexpand">1</property>
             <property name="orientation">vertical</property>
             <child>
               <object class="GtkBox">
-                <property name="visible">True</property>
-                <property name="can-focus">False</property>
+                <property name="vexpand">1</property>
+                <property name="valign">GTK_ALIGN_FILL</property>
                 <child>
                   <object class="GtkLabel" id="label1">
-                    <property name="visible">True</property>
-                    <property name="can-focus">False</property>
-                    <property name="label" translatable="yes">_Title:</property>
-                    <property name="use-underline">True</property>
+                    <property name="label" translatable="1">_Title:</property>
+                    <property name="use-underline">1</property>
                     <property name="xalign">0</property>
                     <property name="yalign">0</property>
                     <property name="mnemonic-widget">title</property>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="GtkEntry" id="title">
-                    <property name="visible">True</property>
-                    <property name="can-focus">True</property>
+                    <property name="hexpand">1</property>
+                    <property name="halign">GTK_ALIGN_FILL</property>
+                    <property name="focusable">1</property>
                     <signal name="changed" handler="pidgin_status_editor_title_changed_cb" object="PidginStatusEditor" swapped="no"/>
                   </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
                 </child>
               </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
             </child>
             <child>
               <object class="GtkBox">
-                <property name="visible">True</property>
-                <property name="can-focus">False</property>
+                <property name="vexpand">1</property>
+                <property name="valign">GTK_ALIGN_FILL</property>
                 <child>
                   <object class="GtkLabel" id="label2">
-                    <property name="visible">True</property>
-                    <property name="can-focus">False</property>
-                    <property name="label" translatable="yes">St_atus:</property>
-                    <property name="use-underline">True</property>
+                    <property name="label" translatable="1">St_atus:</property>
+                    <property name="use-underline">1</property>
                     <property name="xalign">0</property>
                     <property name="yalign">0</property>
                     <property name="mnemonic-widget">primitive</property>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="PidginStatusPrimitiveChooser" id="primitive">
-                    <property name="visible">True</property>
-                    <property name="can-focus">False</property>
+                    <property name="hexpand">1</property>
+                    <property name="halign">GTK_ALIGN_FILL</property>
                     <property name="id-column">0</property>
                     <property name="model">primitive_store</property>
                   </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
                 </child>
               </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
             </child>
             <child>
               <object class="GtkBox">
-                <property name="visible">True</property>
-                <property name="can-focus">False</property>
+                <property name="vexpand">1</property>
+                <property name="valign">GTK_ALIGN_FILL</property>
                 <child>
                   <object class="GtkLabel" id="label3">
-                    <property name="visible">True</property>
-                    <property name="can-focus">False</property>
-                    <property name="label" translatable="yes">_Message:</property>
-                    <property name="use-underline">True</property>
+                    <property name="label" translatable="1">_Message:</property>
+                    <property name="use-underline">1</property>
                     <property name="xalign">0</property>
                     <property name="yalign">0</property>
                     <property name="mnemonic-widget">message</property>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="TalkatuEditor">
-                    <property name="visible">True</property>
-                    <property name="can-focus">False</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="halign">GTK_ALIGN_FILL</property>
+                    <property name="hexpand">1</property>
                     <property name="orientation">vertical</property>
+                    <property name="valign">GTK_ALIGN_FILL</property>
+                    <property name="vexpand">1</property>
                     <child internal-child="send_button">
                       <object class="GtkButton">
-                        <property name="can-focus">False</property>
-                        <property name="receives-default">False</property>
+                        <property name="visible">0</property>
                       </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">0</property>
-                      </packing>
                     </child>
                     <child internal-child="toolbar">
-                      <object class="TalkatuToolbar">
-                        <property name="visible">True</property>
-                        <property name="can-focus">False</property>
-                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">0</property>
-                      </packing>
+                      <object class="TalkatuToolbar"/>
                     </child>
                     <child internal-child="input">
                       <object class="TalkatuInput" id="message">
+                        <property name="buffer">buffer</property>
+                        <property name="halign">GTK_ALIGN_FILL</property>
+                        <property name="hexpand">1</property>
+                        <property name="valign">GTK_ALIGN_FILL</property>
+                        <property name="vexpand">1</property>
                         <property name="width-request">450</property>
-                        <property name="visible">True</property>
-                        <property name="can-focus">True</property>
-                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                         <property name="wrap-mode">word</property>
-                        <property name="buffer">buffer</property>
                       </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">0</property>
-                      </packing>
                     </child>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
                 </child>
               </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
-              </packing>
             </child>
           </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
       </object>
     </child>
+    <child type="action">
+      <object class="GtkButton" id="cancel">
+        <property name="label" translatable="1">_Cancel</property>
+        <property name="focusable">1</property>
+        <property name="receives-default">1</property>
+        <property name="use-underline">1</property>
+      </object>
+    </child>
+    <child type="action">
+      <object class="GtkButton" id="use">
+        <property name="label" translatable="1">_Use</property>
+        <property name="focusable">1</property>
+        <property name="receives-default">1</property>
+        <property name="sensitive">0</property>
+        <property name="use-underline">1</property>
+      </object>
+    </child>
+    <child type="action">
+      <object class="GtkButton" id="save">
+        <property name="label" translatable="1">_Save</property>
+        <property name="focusable">1</property>
+        <property name="receives-default">1</property>
+        <property name="sensitive">0</property>
+        <property name="use-underline">1</property>
+      </object>
+    </child>
     <action-widgets>
-      <action-widget response="-6">cancel</action-widget>
+      <action-widget response="cancel">cancel</action-widget>
       <action-widget response="0">use</action-widget>
       <action-widget response="1">save</action-widget>
     </action-widgets>

mercurial