# HG changeset patch
# Node ID f62e08ff5122
# Parent  0cebcadedd4c
diff --git a/pidgin/prefs/pidginawayprefs.c b/pidgin/prefs/pidginawayprefs.c
--- a/pidgin/prefs/pidginawayprefs.c
+++ b/pidgin/prefs/pidginawayprefs.c
@@ -20,6 +20,8 @@
  * along with this program; if not, see <https://www.gnu.org/licenses/>.
  */
 
+#include <glib/gi18n-lib.h>
+
 #include <purple.h>
 
 #include <adwaita.h>
@@ -32,11 +34,11 @@
 struct _PidginAwayPrefs {
 	AdwPreferencesPage parent;
 
-	PidginPrefCombo idle_reporting;
+	GtkWidget *idle_reporting;
 	GtkWidget *mins_before_away;
 	GtkWidget *idle_row;
 	GtkWidget *away_when_idle;
-	PidginPrefCombo auto_reply;
+	GtkWidget *auto_reply;
 	GtkWidget *startup_current_status;
 	GtkWidget *startup_row;
 };
@@ -46,6 +48,24 @@ G_DEFINE_TYPE(PidginAwayPrefs, pidgin_aw
 /******************************************************************************
  * Helpers
  *****************************************************************************/
+static gchar *
+idle_reporting_expression_cb(GObject *self, G_GNUC_UNUSED gpointer data)
+{
+	const gchar *text = "";
+	const gchar *value = NULL;
+
+	value = gtk_string_object_get_string(GTK_STRING_OBJECT(self));
+	if(purple_strequal(value, "none")) {
+		text = _("Never");
+	} else if(purple_strequal(value, "purple")) {
+		text = _("From last sent message");
+	} else if(purple_strequal(value, "system")) {
+		text = _("Based on keyboard or mouse use");
+	}
+
+	return g_strdup(text);
+}
+
 static void
 set_idle_away(PurpleSavedStatus *status)
 {
@@ -53,6 +73,24 @@ set_idle_away(PurpleSavedStatus *status)
 	                     purple_savedstatus_get_creation_time(status));
 }
 
+static gchar *
+auto_reply_expression_cb(GObject *self, G_GNUC_UNUSED gpointer data)
+{
+	const gchar *text = "";
+	const gchar *value = NULL;
+
+	value = gtk_string_object_get_string(GTK_STRING_OBJECT(self));
+	if(purple_strequal(value, "never")) {
+		text = _("Never");
+	} else if(purple_strequal(value, "away")) {
+		text = _("When away");
+	} else if(purple_strequal(value, "awayidle")) {
+		text = _("When both away and idle");
+	}
+
+	return g_strdup(text);
+}
+
 static void
 set_startupstatus(PurpleSavedStatus *status)
 {
@@ -74,7 +112,9 @@ pidgin_away_prefs_class_init(PidginAwayP
 	);
 
 	gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
-	                                     idle_reporting.combo);
+	                                     idle_reporting);
+	gtk_widget_class_bind_template_callback(widget_class,
+	                                        idle_reporting_expression_cb);
 	gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
 	                                     mins_before_away);
 	gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
@@ -82,7 +122,9 @@ pidgin_away_prefs_class_init(PidginAwayP
 	gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
 	                                     idle_row);
 	gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
-	                                     auto_reply.combo);
+	                                     auto_reply);
+	gtk_widget_class_bind_template_callback(widget_class,
+	                                        auto_reply_expression_cb);
 	gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
 	                                     startup_current_status);
 	gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
@@ -96,9 +138,8 @@ pidgin_away_prefs_init(PidginAwayPrefs *
 
 	gtk_widget_init_template(GTK_WIDGET(prefs));
 
-	prefs->idle_reporting.type = PURPLE_PREF_STRING;
-	prefs->idle_reporting.key = "/purple/away/idle_reporting";
-	pidgin_prefs_bind_dropdown(&prefs->idle_reporting);
+	pidgin_prefs_bind_combo_row("/purple/away/idle_reporting",
+	                            prefs->idle_reporting);
 
 	pidgin_prefs_bind_spin_button("/purple/away/mins_before_away",
 			prefs->mins_before_away);
@@ -119,9 +160,7 @@ pidgin_away_prefs_init(PidginAwayPrefs *
 			G_BINDING_SYNC_CREATE);
 
 	/* Away stuff */
-	prefs->auto_reply.type = PURPLE_PREF_STRING;
-	prefs->auto_reply.key = "/purple/away/auto_reply";
-	pidgin_prefs_bind_dropdown(&prefs->auto_reply);
+	pidgin_prefs_bind_combo_row("/purple/away/auto_reply", prefs->auto_reply);
 
 	/* Signon status stuff */
 	pidgin_prefs_bind_switch("/purple/savedstatus/startup_current_status",
diff --git a/pidgin/resources/Prefs/away.ui b/pidgin/resources/Prefs/away.ui
--- a/pidgin/resources/Prefs/away.ui
+++ b/pidgin/resources/Prefs/away.ui
@@ -23,78 +23,27 @@ along with this program; if not, see <ht
   <!-- interface-name Pidgin -->
   <!-- interface-description Internet Messenger -->
   <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
-  <object class="GtkListStore" id="auto_reply.store">
-    <columns>
-      <!-- column-name text -->
-      <column type="gchararray"/>
-      <!-- column-name value -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes">Never</col>
-        <col id="1">never</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">When away</col>
-        <col id="1">away</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">When both away and idle</col>
-        <col id="1">awayidle</col>
-      </row>
-    </data>
-  </object>
-  <object class="GtkListStore" id="idle_reporting.store">
-    <columns>
-      <!-- column-name text -->
-      <column type="gchararray"/>
-      <!-- column-name value -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes">Never</col>
-        <col id="1">none</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">From last sent message</col>
-        <col id="1">purple</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Based on keyboard or mouse use</col>
-        <col id="1">system</col>
-      </row>
-    </data>
-  </object>
-  <object class="GtkAdjustment" id="mins_before_adjustment">
-    <property name="lower">1</property>
-    <property name="upper">1440</property>
-    <property name="value">1</property>
-    <property name="step-increment">1</property>
-    <property name="page-increment">10</property>
-  </object>
   <template class="PidginAwayPrefs" parent="AdwPreferencesPage">
     <child>
       <object class="AdwPreferencesGroup">
         <property name="title" translatable="1">Idle</property>
         <child>
-          <object class="AdwActionRow">
-            <property name="activatable-widget">idle_reporting.combo</property>
+          <object class="AdwComboRow" id="idle_reporting">
             <property name="title" translatable="1">_Report idle time</property>
+            <property name="use-subtitle">1</property>
             <property name="use-underline">1</property>
-            <child>
-              <object class="GtkComboBox" id="idle_reporting.combo">
-                <property name="model">idle_reporting.store</property>
-                <property name="valign">center</property>
-                <child>
-                  <object class="GtkCellRendererText"/>
-                  <attributes>
-                    <attribute name="text">0</attribute>
-                  </attributes>
-                </child>
+            <property name="model">
+              <object class="GtkStringList">
+                <items>
+                  <item>none</item>
+                  <item>purple</item>
+                  <item>system</item>
+                </items>
               </object>
-            </child>
+            </property>
+            <property name="expression">
+              <closure type="gchararray" function="idle_reporting_expression_cb"/>
+            </property>
           </object>
         </child>
         <child>
@@ -105,7 +54,15 @@ along with this program; if not, see <ht
             <child>
               <object class="GtkSpinButton" id="mins_before_away">
                 <property name="focusable">1</property>
-                <property name="adjustment">mins_before_adjustment</property>
+                <property name="adjustment">
+                  <object class="GtkAdjustment">
+                    <property name="lower">1</property>
+                    <property name="upper">1440</property>
+                    <property name="value">1</property>
+                    <property name="step-increment">1</property>
+                    <property name="page-increment">10</property>
+                  </object>
+                </property>
                 <property name="numeric">1</property>
                 <property name="valign">center</property>
               </object>
@@ -131,22 +88,22 @@ along with this program; if not, see <ht
       <object class="AdwPreferencesGroup">
         <property name="title" translatable="1">Away</property>
         <child>
-          <object class="AdwActionRow">
-            <property name="activatable-widget">auto_reply.combo</property>
+          <object class="AdwComboRow" id="auto_reply">
             <property name="title" translatable="1">_Auto-reply</property>
+            <property name="use-subtitle">1</property>
             <property name="use-underline">1</property>
-            <child>
-              <object class="GtkComboBox" id="auto_reply.combo">
-                <property name="model">auto_reply.store</property>
-                <property name="valign">center</property>
-                <child>
-                  <object class="GtkCellRendererText"/>
-                  <attributes>
-                    <attribute name="text">0</attribute>
-                  </attributes>
-                </child>
+            <property name="model">
+              <object class="GtkStringList">
+                <items>
+                  <item>never</item>
+                  <item>away</item>
+                  <item>awayidle</item>
+                </items>
               </object>
-            </child>
+            </property>
+            <property name="expression">
+              <closure type="gchararray" function="auto_reply_expression_cb"/>
+            </property>
           </object>
         </child>
       </object>
diff --git a/pidgin/resources/Prefs/proxy.ui b/pidgin/resources/Prefs/proxy.ui
--- a/pidgin/resources/Prefs/proxy.ui
+++ b/pidgin/resources/Prefs/proxy.ui
@@ -69,6 +69,7 @@ along with this program; if not, see <ht
         <child>
           <object class="AdwComboRow" id="type">
             <property name="title" translatable="1">Proxy t_ype</property>
+            <property name="use-subtitle">1</property>
             <property name="use-underline">1</property>
             <property name="model">
               <object class="GtkStringList">
