[empathy] preferences: add options removed from View into preferences



commit 230d722d4ec8b4bc5e59819a1a6799cc52ec8414
Author: Danielle Madeley <danielle madeley collabora co uk>
Date:   Fri May 11 12:50:13 2012 +1000

    preferences: add options removed from View into preferences

 src/empathy-preferences.c  |   50 +++++++++
 src/empathy-preferences.ui |  239 +++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 284 insertions(+), 5 deletions(-)
---
diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c
index a120e64..e022221 100644
--- a/src/empathy-preferences.c
+++ b/src/empathy-preferences.c
@@ -86,6 +86,7 @@ struct _EmpathyPreferencesPriv {
 	GSettings *gsettings_sound;
 	GSettings *gsettings_ui;
 	GSettings *gsettings_logger;
+	GSettings *gsettings_contacts;
 };
 
 static void     preferences_setup_widgets                (EmpathyPreferences      *preferences,
@@ -151,6 +152,36 @@ static SoundEventEntry sound_entries [] = {
 	{ N_("Account disconnected"), EMPATHY_PREFS_SOUNDS_SERVICE_LOGOUT }
 };
 
+static gboolean
+sort_criterium_get_mapping (GValue *value,
+			    GVariant *variant,
+			    gpointer user_data)
+{
+	const char *s = g_variant_get_string (variant, NULL);
+
+	if (!tp_strdiff (s, "state"))
+		g_value_set_boolean (value, TRUE);
+	else if (!tp_strdiff (s, "name"))
+		g_value_set_boolean (value, FALSE);
+	else
+		return FALSE;
+
+	return TRUE;
+}
+
+static GVariant *
+sort_criterium_set_mapping (const GValue *value,
+			    const GVariantType *expected_type,
+			    gpointer user_data)
+{
+	gboolean b = g_value_get_boolean (value);
+
+	if (b)
+		return g_variant_new_string ("state");
+	else
+		return g_variant_new_string ("name");
+}
+
 static void
 preferences_setup_widgets (EmpathyPreferences *preferences,
 			   GtkBuilder *gui)
@@ -177,10 +208,18 @@ preferences_setup_widgets (EmpathyPreferences *preferences,
 	BIND_ACTIVE (sound, SOUNDS_DISABLED_AWAY,
 		     "checkbutton_sounds_disabled_away");
 
+	BIND_ACTIVE (ui, UI_SHOW_OFFLINE,
+		     "checkbutton_show_offline");
+	BIND_ACTIVE (ui, UI_SHOW_PROTOCOLS,
+		     "checkbutton_show_protocols");
 	BIND_ACTIVE (ui, UI_SEPARATE_CHAT_WINDOWS,
 		     "radiobutton_chats_new_windows");
 	BIND_ACTIVE (ui, UI_EVENTS_NOTIFY_AREA,
 		     "checkbutton_events_notif_area");
+	BIND_ACTIVE (ui, UI_SHOW_AVATARS,
+		     "radiobutton_normal_size_avatars");
+	BIND_ACTIVE (ui, UI_COMPACT_CONTACT_LIST,
+		     "radiobutton_compact_size");
 
 	BIND_ACTIVE (chat, CHAT_SHOW_SMILEYS,
 		     "checkbutton_show_smileys");
@@ -244,6 +283,15 @@ preferences_setup_widgets (EmpathyPreferences *preferences,
 			 "active",
 			 G_SETTINGS_BIND_DEFAULT);
 
+	g_settings_bind_with_mapping (priv->gsettings_contacts,
+			 EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
+			 gtk_builder_get_object (gui,
+				 		 "radiobutton_sort_by_status"),
+			 "active",
+			 G_SETTINGS_BIND_DEFAULT,
+			 sort_criterium_get_mapping,
+			 sort_criterium_set_mapping,
+			 NULL, NULL);
 }
 
 static void
@@ -1029,6 +1077,7 @@ empathy_preferences_finalize (GObject *self)
 	g_object_unref (priv->gsettings_sound);
 	g_object_unref (priv->gsettings_ui);
 	g_object_unref (priv->gsettings_logger);
+	g_object_unref (priv->gsettings_contacts);
 
 	G_OBJECT_CLASS (empathy_preferences_parent_class)->finalize (self);
 }
@@ -1093,6 +1142,7 @@ empathy_preferences_init (EmpathyPreferences *preferences)
 	priv->gsettings_sound = g_settings_new (EMPATHY_PREFS_SOUNDS_SCHEMA);
 	priv->gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
 	priv->gsettings_logger = g_settings_new (EMPATHY_PREFS_LOGGER_SCHEMA);
+	priv->gsettings_contacts = g_settings_new (EMPATHY_PREFS_CONTACTS_SCHEMA);
 
 	/* Create chat theme preview, and track changes */
 	priv->theme_manager = empathy_theme_manager_dup_singleton ();
diff --git a/src/empathy-preferences.ui b/src/empathy-preferences.ui
index 6e95c69..db72bae 100644
--- a/src/empathy-preferences.ui
+++ b/src/empathy-preferences.ui
@@ -13,6 +13,224 @@
         <property name="orientation">vertical</property>
         <property name="spacing">18</property>
         <child>
+          <object class="GtkFrame" id="frame6">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkAlignment" id="alignment5">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <object class="GtkBox" id="box2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkCheckButton" id="checkbutton_show_offline">
+                        <property name="label" translatable="yes">Show offline contacts</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="checkbutton_show_protocols">
+                        <property name="label" translatable="yes">Show protocol in avatar</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="box3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">3</property>
+                        <child>
+                          <object class="GtkLabel" id="label9">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Sort contacts by:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkRadioButton" id="radiobutton_sort_by_status">
+                            <property name="label" translatable="yes">status</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="xalign">0</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkRadioButton" id="radiobutton_sort_by_name">
+                            <property name="label" translatable="yes">name</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="xalign">0</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                            <property name="group">radiobutton_sort_by_status</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkGrid" id="grid1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="column_spacing">3</property>
+                        <property name="n_columns">2</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label11">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="halign">start</property>
+                            <property name="label" translatable="yes">Contact size:</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">0</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkRadioButton" id="radiobutton_normal_size_avatars">
+                            <property name="label" translatable="yes">normal size with avatars</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="xalign">0</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">0</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkRadioButton" id="radiobutton_normal_size">
+                            <property name="label" translatable="yes">normal size</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="xalign">0</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                            <property name="group">radiobutton_normal_size_avatars</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">1</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkRadioButton" id="radiobutton_compact_size">
+                            <property name="label" translatable="yes">compact size	</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="xalign">0</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                            <property name="group">radiobutton_normal_size_avatars</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">2</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label8">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Contact List</property>
+                <property name="use_markup">True</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
           <object class="GtkFrame" id="frame3">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
@@ -71,7 +289,7 @@
               <object class="GtkLabel" id="label611">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Appearance</property>
+                <property name="label" translatable="yes">Chat</property>
                 <attributes>
                   <attribute name="weight" value="bold"/>
                 </attributes>
@@ -81,7 +299,7 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">False</property>
-            <property name="position">0</property>
+            <property name="position">1</property>
           </packing>
         </child>
         <child>
@@ -105,14 +323,16 @@
                       <object class="GtkBox" id="vbox2180">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="orientation">horizontal</property>
                         <property name="spacing">3</property>
                         <child>
                           <object class="GtkLabel" id="label1000">
-                            <property name="label" translatable="yes">Start chats in:</property>
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Start chats in:</property>
                           </object>
                           <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
@@ -122,10 +342,13 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
@@ -135,11 +358,14 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
                             <property name="draw_indicator">True</property>
                             <property name="group">radiobutton_chats_new_tabs</property>
                           </object>
                           <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
                             <property name="position">2</property>
                           </packing>
                         </child>
@@ -218,7 +444,7 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">False</property>
-            <property name="position">1</property>
+            <property name="position">2</property>
           </packing>
         </child>
       </object>
@@ -518,7 +744,10 @@
                         <property name="label" translatable="yes">Use _echo cancellation to improve call quality</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
                         <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]