[empathy] Add a Location tab in preferences



commit c6d064ad5952f233d583ccd420c502b581d57a8c
Author: Pierre-Luc Beaudoin <pierre-luc beaudoin collabora co uk>
Date:   Fri May 29 13:53:38 2009 -0400

    Add a Location tab in preferences
---
 data/empathy.schemas.in       |   72 ++++++++++++++-
 libempathy-gtk/empathy-conf.h |    5 +
 src/empathy-preferences.c     |   52 ++++++++++
 src/empathy-preferences.ui    |  206 ++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 329 insertions(+), 6 deletions(-)

diff --git a/data/empathy.schemas.in b/data/empathy.schemas.in
index 62b462f..80a1457 100644
--- a/data/empathy.schemas.in
+++ b/data/empathy.schemas.in
@@ -463,5 +463,75 @@
       </locale>
     </schema>
 
-  </schemalist>  
+    <schema>
+      <key>/schemas/apps/empathy/location/publish</key>
+      <applyto>/apps/empathy/location/publish</applyto>
+      <owner>empathy</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Empathy can publish the user's location</short>
+        <long>
+        Whether or not Empathy can publish the user's location to his contacts.
+        </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/empathy/location/resource_network</key>
+      <applyto>/apps/empathy/location/resource_network</applyto>
+      <owner>empathy</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+        <short>Empathy can use the network to guess the location</short>
+        <long>
+        Whether or not Empathy can use the network to guess the location.
+        </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/empathy/location/resource_cell</key>
+      <applyto>/apps/empathy/location/resource_cell</applyto>
+      <owner>empathy</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+        <short>Empathy can use the cellular network to guess the location</short>
+        <long>
+        Whether or not Empathy can use the cellular network to guess the location.
+        </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/empathy/location/resource_gps</key>
+      <applyto>/apps/empathy/location/resource_gps</applyto>
+      <owner>empathy</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Empathy can use the GPS to guess the location</short>
+        <long>
+        Whether or not Empathy can use the GPS to guess the location.
+        </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/empathy/location/reduce_accuracy</key>
+      <applyto>/apps/empathy/location/reduce_accuracy</applyto>
+      <owner>empathy</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Empathy should reduce the location's accuracy</short>
+        <long>
+        Whether or not Empathy should reduce the location's accuracy for privacy reasons.
+        </long>
+      </locale>
+    </schema>
+
+  </schemalist>
 </gconfschemafile>
diff --git a/libempathy-gtk/empathy-conf.h b/libempathy-gtk/empathy-conf.h
index 4a6fdc4..07026df 100644
--- a/libempathy-gtk/empathy-conf.h
+++ b/libempathy-gtk/empathy-conf.h
@@ -77,6 +77,11 @@ struct _EmpathyConfClass {
 #define EMPATHY_PREFS_AUTOCONNECT                  EMPATHY_PREFS_PATH "/autoconnect"
 #define EMPATHY_PREFS_IMPORT_ASKED                 EMPATHY_PREFS_PATH "/import_asked"
 #define EMPATHY_PREFS_FILE_TRANSFER_DEFAULT_FOLDER EMPATHY_PREFS_PATH "/file_transfer/default_folder"
+#define EMPATHY_PREFS_LOCATION_PUBLISH             EMPATHY_PREFS_PATH "/location/publish"
+#define EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK    EMPATHY_PREFS_PATH "/location/resource_network"
+#define EMPATHY_PREFS_LOCATION_RESOURCE_CELL       EMPATHY_PREFS_PATH "/location/resource_cell"
+#define EMPATHY_PREFS_LOCATION_RESOURCE_GPS        EMPATHY_PREFS_PATH "/location/resource_gps"
+#define EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY     EMPATHY_PREFS_PATH "/location/reduce_accuracy"
 
 typedef void (*EmpathyConfNotifyFunc) (EmpathyConf  *conf,
 				      const gchar *key,
diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c
index 628db52..ff74a8c 100644
--- a/src/empathy-preferences.c
+++ b/src/empathy-preferences.c
@@ -64,6 +64,12 @@ typedef struct {
 
 	GtkWidget *treeview_spell_checker;
 
+	GtkWidget *checkbutton_location_publish;
+	GtkWidget *checkbutton_location_reduce_accuracy;
+	GtkWidget *checkbutton_location_resource_network;
+	GtkWidget *checkbutton_location_resource_cell;
+	GtkWidget *checkbutton_location_resource_gps;
+
 	GList     *notify_ids;
 } EmpathyPreferences;
 
@@ -247,6 +253,38 @@ preferences_setup_widgets (EmpathyPreferences *preferences)
 					  EMPATHY_PREFS_AUTOCONNECT,
 					  preferences->checkbutton_autoconnect);
 
+	preferences_hookup_toggle_button (preferences,
+					  EMPATHY_PREFS_LOCATION_PUBLISH,
+					  preferences->checkbutton_location_publish);
+
+	preferences_hookup_toggle_button (preferences,
+					  EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK,
+					  preferences->checkbutton_location_resource_network);
+	preferences_hookup_sensitivity (preferences,
+					EMPATHY_PREFS_LOCATION_PUBLISH,
+					preferences->checkbutton_location_resource_network);
+
+	preferences_hookup_toggle_button (preferences,
+					  EMPATHY_PREFS_LOCATION_RESOURCE_CELL,
+					  preferences->checkbutton_location_resource_cell);
+	preferences_hookup_sensitivity (preferences,
+					EMPATHY_PREFS_LOCATION_PUBLISH,
+					preferences->checkbutton_location_resource_cell);
+
+	preferences_hookup_toggle_button (preferences,
+					  EMPATHY_PREFS_LOCATION_RESOURCE_GPS,
+					  preferences->checkbutton_location_resource_gps);
+	preferences_hookup_sensitivity (preferences,
+					EMPATHY_PREFS_LOCATION_PUBLISH,
+					preferences->checkbutton_location_resource_gps);
+
+	preferences_hookup_toggle_button (preferences,
+					  EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY,
+					  preferences->checkbutton_location_reduce_accuracy);
+	preferences_hookup_sensitivity (preferences,
+					EMPATHY_PREFS_LOCATION_PUBLISH,
+					preferences->checkbutton_location_reduce_accuracy);
+
 	id = empathy_conf_notify_add (empathy_conf_get (),
 				      EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
 				      preferences_compact_contact_list_changed_cb,
@@ -1009,6 +1047,8 @@ preferences_radio_button_toggled_cb (GtkWidget *button,
 		}
 
 		value = enum_value->value_nick;
+	} else if (key && strcmp (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM) == 0) {
+           return;
 	}
 
 	empathy_conf_set_string (empathy_conf_get (), key, value);
@@ -1094,6 +1134,11 @@ empathy_preferences_show (GtkWindow *parent)
 		"checkbutton_sounds_disabled_away", &preferences->checkbutton_sounds_disabled_away,
 		"treeview_sounds", &preferences->treeview_sounds,
 		"treeview_spell_checker", &preferences->treeview_spell_checker,
+		"checkbutton_location_publish", &preferences->checkbutton_location_publish,
+		"checkbutton_location_reduce_accuracy", &preferences->checkbutton_location_reduce_accuracy,
+		"checkbutton_location_resource_network", &preferences->checkbutton_location_resource_network,
+		"checkbutton_location_resource_cell", &preferences->checkbutton_location_resource_cell,
+		"checkbutton_location_resource_gps", &preferences->checkbutton_location_resource_gps,
 		NULL);
 	g_free (filename);
 
@@ -1124,6 +1169,13 @@ empathy_preferences_show (GtkWindow *parent)
 		gtk_widget_show (page);
 	}
 
+	if (TRUE) { /* FIXME */
+		GtkWidget *page;
+
+		page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (preferences->notebook), 4);
+		gtk_widget_show (page);
+	}
+
 	if (parent) {
 		gtk_window_set_transient_for (GTK_WINDOW (preferences->dialog),
 					      GTK_WINDOW (parent));
diff --git a/src/empathy-preferences.ui b/src/empathy-preferences.ui
index c20d271..b953547 100644
--- a/src/empathy-preferences.ui
+++ b/src/empathy-preferences.ui
@@ -308,7 +308,7 @@
                 <property name="label" translatable="yes">Notifications</property>
               </object>
               <packing>
-                <property name="position">4</property>
+                <property name="position">1</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>
@@ -424,6 +424,202 @@
               </packing>
             </child>
             <child>
+              <object class="GtkVBox" id="vbox1">
+                <property name="visible">True</property>
+                <property name="border_width">12</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">18</property>
+                <child>
+                  <object class="GtkCheckButton" id="checkbutton_location_publish">
+                    <property name="label" translatable="yes">_Publish location to my contacts</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkFrame" id="frame1">
+                    <property name="visible">True</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment2">
+                        <property name="visible">True</property>
+                        <property name="top_padding">6</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkVBox" id="vbox4">
+                            <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <object class="GtkHBox" id="hbox1">
+                                <property name="visible">True</property>
+                                <property name="spacing">6</property>
+                                <child>
+                                  <object class="GtkImage" id="image1">
+                                    <property name="visible">True</property>
+                                    <property name="yalign">0</property>
+                                    <property name="stock">gtk-dialog-info</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="label6">
+                                    <property name="visible">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">&lt;small&gt;Reduced location accuracy means that nothing more precise than your city, state and country will be published.  GPS coordinates will have a random value added (&#xB1;0.5&#xB0;).&lt;/small&gt;</property>
+                                    <property name="use_markup">True</property>
+                                    <property name="wrap">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkCheckButton" id="checkbutton_location_reduce_accuracy">
+                                <property name="label" translatable="yes">_Reduce location accuracy</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label3">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">&lt;b&gt;Privacy&lt;/b&gt;</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkFrame" id="frame5">
+                    <property name="visible">True</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment4">
+                        <property name="visible">True</property>
+                        <property name="top_padding">6</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkVBox" id="vbox5">
+                            <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <object class="GtkCheckButton" id="checkbutton_location_resource_gps">
+                                <property name="label" translatable="yes">Allow _GPS usage</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkCheckButton" id="checkbutton_location_resource_cell">
+                                <property name="label" translatable="yes">Allow _cellphone usage</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkCheckButton" id="checkbutton_location_resource_network">
+                                <property name="label" translatable="yes">Allow _network usage</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label5">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">&lt;b&gt;Geoclue Settings&lt;/b&gt;</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="label2">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Location</property>
+              </object>
+              <packing>
+                <property name="position">3</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkVBox" id="vbox168">
                 <property name="visible">True</property>
                 <property name="border_width">12</property>
@@ -532,7 +728,7 @@
                 </child>
               </object>
               <packing>
-                <property name="position">3</property>
+                <property name="position">4</property>
               </packing>
             </child>
             <child type="tab">
@@ -541,7 +737,7 @@
                 <property name="label" translatable="yes">Spell Checking</property>
               </object>
               <packing>
-                <property name="position">3</property>
+                <property name="position">4</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>
@@ -616,7 +812,7 @@
                 </child>
               </object>
               <packing>
-                <property name="position">4</property>
+                <property name="position">5</property>
               </packing>
             </child>
             <child type="tab">
@@ -625,7 +821,7 @@
                 <property name="label" translatable="yes">Themes</property>
               </object>
               <packing>
-                <property name="position">4</property>
+                <property name="position">5</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>



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