[empathy] add account widget for Ovi



commit 7fa0c3b106c5d5d35cb86a75da047b8c7c5e2685
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Wed Sep 22 16:51:05 2010 +0200

    add account widget for Ovi

 libempathy-gtk/empathy-account-widget-jabber.ui |  105 +++++++++++++++++++++++
 libempathy-gtk/empathy-account-widget.c         |   47 ++++++++++-
 2 files changed, 149 insertions(+), 3 deletions(-)
---
diff --git a/libempathy-gtk/empathy-account-widget-jabber.ui b/libempathy-gtk/empathy-account-widget-jabber.ui
index 6820eab..f7579bb 100644
--- a/libempathy-gtk/empathy-account-widget-jabber.ui
+++ b/libempathy-gtk/empathy-account-widget-jabber.ui
@@ -133,6 +133,20 @@ Use &lt;a href="http://www.facebook.com/username/"&gt;this page&lt;/a&gt; to cho
                 <property name="position">2</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkLabel" id="label_username_ovi_example">
+                <property name="xalign">0</property>
+                <property name="xpad">3</property>
+                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; alice</property>
+                <property name="use_markup">True</property>
+                <attributes>
+                  <attribute name="scale" value="0.800000"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="left_attach">1</property>
@@ -692,4 +706,95 @@ Use &lt;a href="http://www.facebook.com/username/"&gt;this page&lt;/a&gt; to cho
       </packing>
     </child>
   </object>
+  <object class="GtkVBox" id="vbox_ovi_simple">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkLabel" id="label_id_ovi_simple">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your Ovi username?</property>
+      </object>
+      <packing>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment_simple_ovi_id">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="top_padding">6</property>
+        <property name="bottom_padding">3</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkVBox" id="vbox3">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">4</property>
+            <child>
+              <object class="GtkEntry" id="entry_id_ovi_simple">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_ovi_example">
+                <property name="visible">True</property>
+                <property name="xalign">0.10000000149011612</property>
+                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; alice</property>
+                <property name="use_markup">True</property>
+                <attributes>
+                  <attribute name="scale" value="0.800000"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_password_ovi_simple">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="ypad">6</property>
+        <property name="label" translatable="yes">What is your Ovi password?</property>
+      </object>
+      <packing>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment4">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.5</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkEntry" id="entry_password_ovi_simple">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="visibility">False</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">3</property>
+      </packing>
+    </child>
+  </object>
+
 </interface>
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index 9a2b2c8..c14ca59 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -1260,6 +1260,15 @@ account_widget_is_facebook (EmpathyAccountWidget *self)
       "im-facebook");
 }
 
+static gboolean
+account_widget_is_ovi (EmpathyAccountWidget *self)
+{
+  EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+  return !tp_strdiff (empathy_account_settings_get_service (priv->settings),
+      "ovi-chat");
+}
+
 static void
 suffix_id_widget_changed_cb (GtkWidget *entry,
     EmpathyAccountWidget *self)
@@ -1342,17 +1351,19 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
   GtkWidget *label_id, *label_password;
   GtkWidget *label_id_create, *label_password_create;
   GtkWidget *label_example_gtalk, *label_example_jabber, *label_example_fb;
-  gboolean is_gtalk, is_facebook;
+  GtkWidget *label_example_ovi;
+  gboolean is_gtalk, is_facebook, is_ovi;
   GtkWidget *expander_advanced;
   GtkWidget *entry_id;
 
   is_gtalk = account_widget_is_gtalk (self);
   is_facebook = account_widget_is_facebook (self);
+  is_ovi = account_widget_is_ovi (self);
 
   empathy_account_settings_set_regex (priv->settings, "account",
       ACCOUNT_REGEX_JABBER);
 
-  if (priv->simple && !is_gtalk && !is_facebook)
+  if (priv->simple && !is_gtalk && !is_facebook && !is_ovi)
     {
       /* Simple widget for XMPP */
       self->ui_details->gui = empathy_builder_get_file (filename,
@@ -1408,6 +1419,22 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
 
       self->ui_details->default_focus = g_strdup ("entry_id_fb_simple");
     }
+  else if (priv->simple && is_ovi)
+    {
+      /* Simple widget for Ovi */
+      self->ui_details->gui = empathy_builder_get_file (filename,
+          "vbox_ovi_simple", &self->ui_details->widget,
+          "entry_id_ovi_simple", &entry_id,
+          NULL);
+
+      empathy_account_widget_handle_params (self,
+          "entry_password_ovi_simple", "password",
+          NULL);
+
+      setup_id_widget_with_suffix (self, entry_id, "@ovi.com");
+
+      self->ui_details->default_focus = g_strdup ("entry_id_ovi_simple");
+    }
   else
     {
       /* Full widget for XMPP, Google Talk and Facebook*/
@@ -1419,6 +1446,7 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
           "label_username_example", &label_example_jabber,
           "label_username_g_example", &label_example_gtalk,
           "label_username_f_example", &label_example_fb,
+          "label_username_ovi_example", &label_example_ovi,
           "expander_advanced", &expander_advanced,
           "entry_id", &entry_id,
           "label_id", &label_id,
@@ -1443,6 +1471,12 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
            * "@chat.facebook.com" part */
           setup_id_widget_with_suffix (self, entry_id, "@chat.facebook.com");
         }
+      else if (is_ovi)
+        {
+          gtk_label_set_label (GTK_LABEL (label_id), _("Username:"));
+
+          setup_id_widget_with_suffix (self, entry_id, "@ovi.com");
+        }
       else
         {
           empathy_account_widget_setup_widget (self, entry_id, "account");
@@ -1477,6 +1511,12 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
           gtk_widget_show (label_example_fb);
           gtk_widget_hide (expander_advanced);
         }
+      else if (is_ovi)
+        {
+          gtk_widget_hide (label_example_jabber);
+          gtk_widget_show (label_example_ovi);
+          gtk_widget_hide (expander_advanced);
+        }
     }
 }
 
@@ -1948,7 +1988,8 @@ add_register_buttons (EmpathyAccountWidget *self,
   if (!tp_connection_manager_protocol_can_register (protocol))
     return;
 
-  if (account_widget_is_gtalk (self) || account_widget_is_facebook (self))
+  if (account_widget_is_gtalk (self) || account_widget_is_facebook (self) ||
+      account_widget_is_ovi (self))
     return;
 
   if (priv->simple)



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