Move conversation preferences to Adwaita preference widgets

Mon, 29 Aug 2022 22:07:24 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Mon, 29 Aug 2022 22:07:24 -0500
changeset 41624
673856331454
parent 41623
78cf94d0f8c8
child 41625
67180a134533

Move conversation preferences to Adwaita preference widgets

Testing Done:
Toggled all the options and checked that stuff happened in the Debug Window.

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

pidgin/prefs/pidginconversationprefs.c file | annotate | diff | comparison | revisions
pidgin/resources/Prefs/conversation.ui file | annotate | diff | comparison | revisions
--- a/pidgin/prefs/pidginconversationprefs.c	Mon Aug 29 22:06:07 2022 -0500
+++ b/pidgin/prefs/pidginconversationprefs.c	Mon Aug 29 22:07:24 2022 -0500
@@ -40,11 +40,11 @@
 	} im;
 	GtkWidget *use_smooth_scrolling;
 	struct {
+		GtkWidget *blink_im_row;
 		GtkWidget *blink_im;
 	} win32;
 	GtkWidget *minimum_entry_lines;
 	GtkTextBuffer *format_buffer;
-	GtkWidget *format_view;
 };
 
 G_DEFINE_TYPE(PidginConversationPrefs, pidgin_conversation_prefs,
@@ -96,6 +96,9 @@
 			use_smooth_scrolling);
 	gtk_widget_class_bind_template_child(
 			widget_class, PidginConversationPrefs,
+			win32.blink_im_row);
+	gtk_widget_class_bind_template_child(
+			widget_class, PidginConversationPrefs,
 			win32.blink_im);
 	gtk_widget_class_bind_template_child(
 			widget_class, PidginConversationPrefs,
@@ -103,9 +106,6 @@
 	gtk_widget_class_bind_template_child(
 			widget_class, PidginConversationPrefs,
 			format_buffer);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginConversationPrefs,
-			format_view);
 }
 
 static void
@@ -115,20 +115,20 @@
 
 	gtk_widget_init_template(GTK_WIDGET(prefs));
 
-	pidgin_prefs_bind_checkbox(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting",
-			prefs->show_incoming_formatting);
+	pidgin_prefs_bind_switch(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting",
+	                         prefs->show_incoming_formatting);
 
-	pidgin_prefs_bind_checkbox("/purple/conversations/im/send_typing",
-			prefs->im.send_typing);
+	pidgin_prefs_bind_switch("/purple/conversations/im/send_typing",
+	                         prefs->im.send_typing);
 
-	pidgin_prefs_bind_checkbox(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling",
-			prefs->use_smooth_scrolling);
+	pidgin_prefs_bind_switch(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling",
+	                         prefs->use_smooth_scrolling);
 
 #ifdef _WIN32
-	pidgin_prefs_bind_checkbox(PIDGIN_PREFS_ROOT "/win32/blink_im",
-			prefs->win32.blink_im);
+	pidgin_prefs_bind_switch(PIDGIN_PREFS_ROOT "/win32/blink_im",
+	                         prefs->win32.blink_im);
 #else
-	gtk_widget_hide(prefs->win32.blink_im);
+	gtk_widget_hide(prefs->win32.blink_im_row);
 #endif
 
 	pidgin_prefs_bind_spin_button(
--- a/pidgin/resources/Prefs/conversation.ui	Mon Aug 29 22:06:07 2022 -0500
+++ b/pidgin/resources/Prefs/conversation.ui	Mon Aug 29 22:07:24 2022 -0500
@@ -41,52 +41,68 @@
       <object class="AdwPreferencesGroup">
         <property name="title" translatable="1">Conversations</property>
         <child>
-          <object class="GtkBox">
-            <property name="margin-start">12</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">6</property>
+          <object class="AdwActionRow">
+            <property name="activatable-widget">show_incoming_formatting</property>
+            <property name="title" translatable="1">Show _formatting on incoming messages</property>
+            <property name="use-underline">1</property>
             <child>
-              <object class="GtkCheckButton" id="show_incoming_formatting">
-                <property name="label" translatable="1">Show _formatting on incoming messages</property>
+              <object class="GtkSwitch" id="show_incoming_formatting">
                 <property name="focusable">1</property>
-                <property name="use-underline">1</property>
+                <property name="valign">center</property>
               </object>
             </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwActionRow">
+            <property name="activatable-widget">im.send_typing</property>
+            <property name="title" translatable="1">_Notify buddies that you are typing to them</property>
+            <property name="use-underline">1</property>
             <child>
-              <object class="GtkCheckButton" id="im.send_typing">
-                <property name="label" translatable="1">_Notify buddies that you are typing to them</property>
+              <object class="GtkSwitch" id="im.send_typing">
                 <property name="focusable">1</property>
-                <property name="use-underline">1</property>
+                <property name="valign">center</property>
               </object>
             </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwActionRow">
+            <property name="activatable-widget">use_smooth_scrolling</property>
+            <property name="title" translatable="1">Use smooth-scrolling</property>
+            <property name="use-underline">1</property>
             <child>
-              <object class="GtkCheckButton" id="use_smooth_scrolling">
-                <property name="label" translatable="1">Use smooth-scrolling</property>
+              <object class="GtkSwitch" id="use_smooth_scrolling">
                 <property name="focusable">1</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="win32.blink_im">
-                <property name="label" translatable="1">F_lash window when IMs are received</property>
-                <property name="focusable">1</property>
-                <property name="use-underline">1</property>
+                <property name="valign">center</property>
               </object>
             </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwActionRow" id="win32.blink_im_row">
+            <property name="activatable-widget">win32.blink_im</property>
+            <property name="title" translatable="1">F_lash window when IMs are received</property>
+            <property name="use-underline">1</property>
             <child>
-              <object class="GtkBox">
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkLabel">
-                    <property name="label" translatable="1">Minimum input area height in lines:</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkSpinButton" id="minimum_entry_lines">
-                    <property name="focusable">1</property>
-                    <property name="adjustment">minimum_entry_lines.adjustment</property>
-                    <property name="numeric">1</property>
-                  </object>
-                </child>
+              <object class="GtkSwitch" id="win32.blink_im">
+                <property name="focusable">1</property>
+                <property name="valign">center</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwActionRow">
+            <property name="activatable-widget">minimum_entry_lines</property>
+            <property name="title" translatable="1">Minimum input area height in lines</property>
+            <property name="use-underline">1</property>
+            <child>
+              <object class="GtkSpinButton" id="minimum_entry_lines">
+                <property name="focusable">1</property>
+                <property name="adjustment">minimum_entry_lines.adjustment</property>
+                <property name="numeric">1</property>
+                <property name="valign">center</property>
               </object>
             </child>
           </object>
@@ -97,28 +113,14 @@
       <object class="AdwPreferencesGroup">
         <property name="title" translatable="1">Default Formatting</property>
         <child>
-          <object class="GtkBox" id="sample_box">
-            <property name="margin-start">12</property>
-            <property name="orientation">vertical</property>
+          <object class="AdwPreferencesRow">
             <child>
               <object class="TalkatuEditor">
-                <property name="orientation">vertical</property>
-                <child internal-child="send_button">
-                  <object class="GtkButton">
-                    <property name="visible">0</property>
-                  </object>
-                </child>
-                <child internal-child="toolbar">
-                  <object class="TalkatuToolbar"/>
-                </child>
-                <child internal-child="input">
-                  <object class="TalkatuInput" id="format_view">
-                    <property name="buffer">format_buffer</property>
-                    <property name="focusable">1</property>
-                    <property name="width-request">450</property>
-                    <property name="wrap-mode">word</property>
-                  </object>
-                </child>
+                <property name="buffer">format_buffer</property>
+                <property name="focusable">1</property>
+                <property name="show-send-button">0</property>
+                <property name="show-toolbar">1</property>
+                <property name="width-request">450</property>
               </object>
             </child>
           </object>

mercurial