Port about dialog to GTK4 gtk4

Thu, 25 Aug 2022 22:31:58 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Thu, 25 Aug 2022 22:31:58 -0500
branch
gtk4
changeset 41595
61d8f39f3d70
parent 41594
30ad4d17661f
child 41596
2f0fec76cfbc

Port about dialog to GTK4

Testing Done:
Opened the dialog, clicked the various options.

There is currently a warning about `markdown_link_target`, but that seems to be a bug in Talkatu (and the links all mush together, which I think is the same problem.) Also, strangely, the dialog sometimes opens exactly as wide as the bottom button box, but sometimes it opens a little bit wider (not sure if it's also Talkatu wrapping causing minor size request changes, or something else).

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

pidgin/pidginabout.c file | annotate | diff | comparison | revisions
pidgin/resources/About/about.ui file | annotate | diff | comparison | revisions
--- a/pidgin/pidginabout.c	Thu Aug 25 22:30:30 2022 -0500
+++ b/pidgin/pidginabout.c	Thu Aug 25 22:31:58 2022 -0500
@@ -324,9 +324,9 @@
 	GtkTreeIter section, iter;
 	gchar *markup = NULL;
 	gchar *cursor_theme_name = NULL, *theme_name = NULL;
-	gchar *icon_theme_name = NULL, *fallback_icon_theme = NULL;
+	gchar *icon_theme_name = NULL;
 	gchar *im_module = NULL;
-	gchar *key_theme_name = NULL, *sound_theme_name = NULL;
+	gchar *sound_theme_name = NULL;
 	gboolean enable_animations = FALSE;
 	gboolean shell_shows_app_menu = FALSE, shell_shows_menubar = FALSE;
 
@@ -343,10 +343,8 @@
 		gtk_settings_get_default(),
 		"gtk-cursor-theme-name", &cursor_theme_name,
 		"gtk-enable-animations", &enable_animations,
-		"gtk-fallback-icon-theme", &fallback_icon_theme,
 		"gtk-icon-theme-name", &icon_theme_name,
 		"gtk-im-module", &im_module,
-		"gtk-key-theme-name", &key_theme_name,
 		"gtk-shell-shows-app-menu", &shell_shows_app_menu,
 		"gtk-shell-shows-menubar", &shell_shows_menubar,
 		"gtk-sound-theme-name", &sound_theme_name,
@@ -367,12 +365,6 @@
 
 	gtk_tree_store_append(about->build_info_store, &iter, &section);
 	gtk_tree_store_set(about->build_info_store, &iter,
-	                   0, "gtk-fallback-icon-theme",
-	                   1, (fallback_icon_theme != NULL) ? fallback_icon_theme : _("(not set)"),
-	                   -1);
-
-	gtk_tree_store_append(about->build_info_store, &iter, &section);
-	gtk_tree_store_set(about->build_info_store, &iter,
 	                   0, "gtk-icon-theme-name",
 	                   1, (icon_theme_name != NULL) ? icon_theme_name : _("(not set)"),
 	                   -1);
@@ -385,12 +377,6 @@
 
 	gtk_tree_store_append(about->build_info_store, &iter, &section);
 	gtk_tree_store_set(about->build_info_store, &iter,
-	                   0, "gtk-key-theme-name",
-	                   1, (key_theme_name != NULL) ? key_theme_name : _("(not set)"),
-	                   -1);
-
-	gtk_tree_store_append(about->build_info_store, &iter, &section);
-	gtk_tree_store_set(about->build_info_store, &iter,
 	                   0, "gtk-shell-shows-app-menu",
 	                   1, shell_shows_app_menu ? _("yes") : _("no"),
 	                   -1);
@@ -414,10 +400,8 @@
 	                   -1);
 
 	g_free(cursor_theme_name);
-	g_free(fallback_icon_theme);
 	g_free(icon_theme_name);
 	g_free(im_module);
-	g_free(key_theme_name);
 	g_free(sound_theme_name);
 	g_free(theme_name);
 }
@@ -444,7 +428,7 @@
 
 		gtk_tree_store_append(about->build_info_store, &iter, &section);
 		gtk_tree_store_set(about->build_info_store, &iter,
-		                   0, (gchar*)(paths->data),
+		                   1, (gchar*)(paths->data),
 		                   -1);
 
 		paths = paths->next;
@@ -512,6 +496,7 @@
 {
 	switch(response_id) {
 		case GTK_RESPONSE_CLOSE:
+		case GTK_RESPONSE_DELETE_EVENT:
 			gtk_window_destroy(GTK_WINDOW(dialog));
 			break;
 	}
--- a/pidgin/resources/About/about.ui	Thu Aug 25 22:30:30 2022 -0500
+++ b/pidgin/resources/About/about.ui	Thu Aug 25 22:31:58 2022 -0500
@@ -20,7 +20,7 @@
 
 -->
 <interface>
-  <requires lib="gtk+" version="3.22"/>
+  <requires lib="gtk" version="4.0"/>
   <requires lib="Talkatu" version="0.0"/>
   <!-- interface-license-type gplv2 -->
   <!-- interface-name Pidgin -->
@@ -42,10 +42,7 @@
       <column type="gfloat"/>
     </columns>
   </object>
-  <object class="TalkatuTagTable" id="main_tag_table"/>
-  <object class="TalkatuMarkdownBuffer" id="main_buffer">
-    <property name="tag-table">main_tag_table</property>
-  </object>
+  <object class="TalkatuMarkdownBuffer" id="main_buffer"/>
   <object class="GtkTreeStore" id="translators_store">
     <columns>
       <!-- column-name markup -->
@@ -55,262 +52,206 @@
     </columns>
   </object>
   <template class="PidginAboutDialog" parent="GtkDialog">
-    <property name="can-focus">False</property>
-    <property name="border-width">5</property>
-    <property name="resizable">False</property>
-    <property name="window-position">center</property>
-    <property name="type-hint">dialog</property>
+    <property name="resizable">0</property>
     <signal name="response" handler="pidgin_about_dialog_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">spread</property>
-            <child>
-              <object class="GtkStackSwitcher" id="switcher">
-                <property name="visible">True</property>
-                <property name="can-focus">False</property>
-                <property name="stack">stack</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="close_button">
-                <property name="label" translatable="yes">Close</property>
-                <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">True</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">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="border-width">12</property>
+            <property name="vexpand">1</property>
+            <property name="valign">fill</property>
             <property name="orientation">vertical</property>
             <property name="spacing">5</property>
             <child>
-              <object class="GtkEventBox" id="event-box">
-                <property name="visible">True</property>
-                <property name="can-focus">False</property>
-                <property name="above-child">True</property>
-                <child>
-                  <object class="GtkImage" id="logo">
-                    <property name="visible">True</property>
-                    <property name="can-focus">False</property>
-                    <property name="resource">/im/pidgin/Pidgin3/logo.png</property>
-                    <property name="icon_size">6</property>
-                  </object>
-                </child>
+              <object class="GtkPicture" id="logo">
+                <property name="file">resource:///im/pidgin/Pidgin3/logo.png</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLabel" id="application_name">
-                <property name="visible">True</property>
-                <property name="can-focus">False</property>
-                <property name="label" translatable="yes">Pidgin</property>
+                <property name="label" translatable="1">Pidgin</property>
                 <property name="justify">center</property>
-                <property name="selectable">True</property>
+                <property name="selectable">1</property>
                 <attributes>
-                  <attribute name="weight" value="bold"/>
+                  <attribute name="weight" value="bold"></attribute>
                 </attributes>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
             </child>
             <child>
               <object class="GtkStack" id="stack">
+                <property name="vexpand">1</property>
+                <property name="valign">fill</property>
                 <property name="width-request">400</property>
                 <property name="height-request">150</property>
-                <property name="visible">True</property>
-                <property name="can-focus">False</property>
                 <property name="margin-bottom">2</property>
                 <property name="transition-type">slide-up</property>
                 <child>
-                  <object class="GtkScrolledWindow" id="main_scrolled_window">
-                    <property name="visible">True</property>
-                    <property name="can-focus">True</property>
-                    <property name="hscrollbar-policy">never</property>
-                    <property name="shadow-type">in</property>
-                    <child>
-                      <object class="TalkatuView" id="main_page">
-                        <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="editable">False</property>
-                        <property name="wrap-mode">word</property>
-                        <property name="buffer">main_buffer</property>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
+                  <object class="GtkStackPage">
                     <property name="name">main</property>
-                    <property name="title" translatable="yes">General</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkScrolledWindow" id="developers_page">
-                    <property name="visible">True</property>
-                    <property name="can-focus">True</property>
-                    <property name="hscrollbar-policy">never</property>
-                    <property name="shadow-type">in</property>
-                    <child>
-                      <object class="GtkTreeView" id="developers_treeview">
-                        <property name="visible">True</property>
-                        <property name="can-focus">True</property>
-                        <property name="model">developers_store</property>
-                        <property name="headers-visible">False</property>
-                        <property name="show-expanders">False</property>
-                        <child internal-child="selection">
-                          <object class="GtkTreeSelection"/>
-                        </child>
+                    <property name="title" translatable="1">General</property>
+                    <property name="child">
+                      <object class="GtkScrolledWindow" id="main_scrolled_window">
+                        <property name="focusable">1</property>
+                        <property name="hscrollbar-policy">never</property>
                         <child>
-                          <object class="GtkTreeViewColumn" id="developers_column">
-                            <property name="resizable">True</property>
-                            <property name="sizing">autosize</property>
-                            <child>
-                              <object class="GtkCellRendererText" id="developers_cell_renderer"/>
-                              <attributes>
-                                <attribute name="xalign">1</attribute>
-                                <attribute name="markup">0</attribute>
-                              </attributes>
-                            </child>
+                          <object class="TalkatuView" id="main_page">
+                            <property name="focusable">1</property>
+                            <property name="editable">0</property>
+                            <property name="margin-start">12</property>
+                            <property name="margin-end">12</property>
+                            <property name="wrap-mode">word</property>
+                            <property name="buffer">main_buffer</property>
                           </object>
                         </child>
                       </object>
-                    </child>
+                    </property>
                   </object>
-                  <packing>
-                    <property name="name">developers</property>
-                    <property name="title" translatable="yes">Developers</property>
-                    <property name="position">1</property>
-                  </packing>
                 </child>
                 <child>
-                  <object class="GtkScrolledWindow" id="translators_page">
-                    <property name="visible">True</property>
-                    <property name="can-focus">True</property>
-                    <property name="shadow-type">in</property>
-                    <child>
-                      <object class="GtkTreeView" id="translators_treeview">
-                        <property name="visible">True</property>
-                        <property name="can-focus">True</property>
-                        <property name="model">translators_store</property>
-                        <property name="headers-visible">False</property>
-                        <property name="show-expanders">False</property>
-                        <child internal-child="selection">
-                          <object class="GtkTreeSelection"/>
-                        </child>
-                        <child>
-                          <object class="GtkTreeViewColumn" id="translators_column">
+                  <object class="GtkStackPage">
+                    <property name="name">developers</property>
+                    <property name="title" translatable="1">Developers</property>
+                    <property name="child">
+                      <object class="GtkScrolledWindow" id="developers_page">
+                        <property name="focusable">1</property>
+                        <property name="hscrollbar-policy">never</property>
+                        <property name="child">
+                          <object class="GtkTreeView" id="developers_treeview">
+                            <property name="focusable">1</property>
+                            <property name="model">developers_store</property>
+                            <property name="headers-visible">0</property>
+                            <property name="show-expanders">0</property>
+                            <child internal-child="selection">
+                              <object class="GtkTreeSelection"/>
+                            </child>
                             <child>
-                              <object class="GtkCellRendererText" id="translators_cell_renderer"/>
-                              <attributes>
-                                <attribute name="xalign">1</attribute>
-                                <attribute name="markup">0</attribute>
-                              </attributes>
+                              <object class="GtkTreeViewColumn" id="developers_column">
+                                <property name="resizable">1</property>
+                                <property name="sizing">autosize</property>
+                                <child>
+                                  <object class="GtkCellRendererText" id="developers_cell_renderer"/>
+                                  <attributes>
+                                    <attribute name="xalign">1</attribute>
+                                    <attribute name="markup">0</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
                             </child>
                           </object>
-                        </child>
+                        </property>
                       </object>
-                    </child>
+                    </property>
                   </object>
-                  <packing>
-                    <property name="name">translators</property>
-                    <property name="title" translatable="yes">Translators</property>
-                    <property name="position">2</property>
-                  </packing>
                 </child>
                 <child>
-                  <object class="GtkScrolledWindow" id="build_info_page">
-                    <property name="visible">True</property>
-                    <property name="can-focus">True</property>
-                    <property name="hscrollbar-policy">never</property>
-                    <property name="shadow-type">in</property>
-                    <child>
-                      <object class="GtkTreeView" id="build_info_treeview">
-                        <property name="visible">True</property>
-                        <property name="can-focus">True</property>
-                        <property name="model">build_info_store</property>
-                        <property name="headers-visible">False</property>
-                        <property name="show-expanders">False</property>
-                        <child internal-child="selection">
-                          <object class="GtkTreeSelection"/>
-                        </child>
-                        <child>
-                          <object class="GtkTreeViewColumn">
+                  <object class="GtkStackPage">
+                    <property name="name">translators</property>
+                    <property name="title" translatable="1">Translators</property>
+                    <property name="child">
+                      <object class="GtkScrolledWindow" id="translators_page">
+                        <property name="focusable">1</property>
+                        <property name="child">
+                          <object class="GtkTreeView" id="translators_treeview">
+                            <property name="focusable">1</property>
+                            <property name="model">translators_store</property>
+                            <property name="headers-visible">0</property>
+                            <property name="show-expanders">0</property>
+                            <child internal-child="selection">
+                              <object class="GtkTreeSelection"/>
+                            </child>
                             <child>
-                              <object class="GtkCellRendererText"/>
-                              <attributes>
-                                <attribute name="markup">0</attribute>
-                              </attributes>
+                              <object class="GtkTreeViewColumn" id="translators_column">
+                                <child>
+                                  <object class="GtkCellRendererText" id="translators_cell_renderer"/>
+                                  <attributes>
+                                    <attribute name="xalign">1</attribute>
+                                    <attribute name="markup">0</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
                             </child>
                           </object>
-                        </child>
-                        <child>
-                          <object class="GtkTreeViewColumn">
+                        </property>
+                      </object>
+                    </property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkStackPage">
+                    <property name="name">build-info</property>
+                    <property name="title" translatable="1">Build Information</property>
+                    <property name="child">
+                      <object class="GtkScrolledWindow" id="build_info_page">
+                        <property name="focusable">1</property>
+                        <property name="hscrollbar-policy">never</property>
+                        <property name="child">
+                          <object class="GtkTreeView" id="build_info_treeview">
+                            <property name="focusable">1</property>
+                            <property name="model">build_info_store</property>
+                            <property name="headers-visible">0</property>
+                            <property name="show-expanders">0</property>
+                            <child internal-child="selection">
+                              <object class="GtkTreeSelection"/>
+                            </child>
                             <child>
-                              <object class="GtkCellRendererText"/>
-                              <attributes>
-                                <attribute name="markup">1</attribute>
-                              </attributes>
+                              <object class="GtkTreeViewColumn">
+                                <child>
+                                  <object class="GtkCellRendererText"/>
+                                  <attributes>
+                                    <attribute name="markup">0</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkTreeViewColumn">
+                                <child>
+                                  <object class="GtkCellRendererText"/>
+                                  <attributes>
+                                    <attribute name="markup">1</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
                             </child>
                           </object>
-                        </child>
+                        </property>
                       </object>
-                    </child>
+                    </property>
                   </object>
-                  <packing>
-                    <property name="name">build-info</property>
-                    <property name="title" translatable="yes">Build Information</property>
-                    <property name="position">3</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>
     <action-widgets>
       <action-widget response="-7">close_button</action-widget>
     </action-widgets>
+    <child internal-child="action_area">
+      <object class="GtkBox">
+        <property name="valign">center</property>
+        <child>
+          <object class="GtkStackSwitcher" id="switcher">
+            <property name="stack">stack</property>
+            <property name="hexpand">1</property>
+            <property name="halign">fill</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkButton" id="close_button">
+            <property name="label" translatable="1">Close</property>
+            <property name="focusable">1</property>
+            <property name="receives-default">1</property>
+            <property name="hexpand">1</property>
+            <property name="halign">fill</property>
+          </object>
+        </child>
+      </object>
+    </child>
   </template>
 </interface>

mercurial