]> git.0d.be Git - empathy.git/commitdiff
preferences: add options removed from View into preferences
authorDanielle Madeley <danielle.madeley@collabora.co.uk>
Fri, 11 May 2012 02:50:13 +0000 (12:50 +1000)
committerDanielle Madeley <danielle.madeley@collabora.co.uk>
Tue, 15 May 2012 10:40:27 +0000 (20:40 +1000)
src/empathy-preferences.c
src/empathy-preferences.ui

index a120e641de9797b877220d573988a7c094fe3453..e022221910b5794da456f479891ab3e7c066dc11 100644 (file)
@@ -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 ();
index 6e95c69da574cb7cd4faca211caa9b4995ad451f..db72baec077f2d8f46823471a973962d8fa0d3dd 100644 (file)
         <property name="border_width">12</property>
         <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>
               <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>
           <packing>
             <property name="expand">False</property>
             <property name="fill">False</property>
-            <property name="position">0</property>
+            <property name="position">1</property>
           </packing>
         </child>
         <child>
                       <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>
                             <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>
                             <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>
           <packing>
             <property name="expand">False</property>
             <property name="fill">False</property>
-            <property name="position">1</property>
+            <property name="position">2</property>
           </packing>
         </child>
       </object>
                         <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>