aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/Makefile.am2
-rw-r--r--libempathy-gtk/empathy-account-widget-aim.ui34
-rw-r--r--libempathy-gtk/empathy-account-widget-groupwise.ui40
-rw-r--r--libempathy-gtk/empathy-account-widget-icq.ui34
-rw-r--r--libempathy-gtk/empathy-account-widget-jabber.ui71
-rw-r--r--libempathy-gtk/empathy-account-widget-msn.ui40
-rw-r--r--libempathy-gtk/empathy-account-widget-sip.ui40
-rw-r--r--libempathy-gtk/empathy-account-widget-yahoo.ui34
-rw-r--r--libempathy-gtk/empathy-account-widget.c358
-rw-r--r--libempathy-gtk/empathy-avatar-image.c3
-rw-r--r--libempathy-gtk/empathy-chat-text-view.c2
-rw-r--r--libempathy-gtk/empathy-chat.c6
-rw-r--r--libempathy-gtk/empathy-contact-dialogs.c3
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c23
-rw-r--r--libempathy-gtk/empathy-contact-widget.c10
-rw-r--r--libempathy-gtk/empathy-individual-menu.c4
-rw-r--r--libempathy-gtk/empathy-individual-store.c27
-rw-r--r--libempathy-gtk/empathy-individual-view.c68
-rw-r--r--libempathy-gtk/empathy-individual-widget.c37
-rw-r--r--libempathy-gtk/empathy-linking-dialog.c10
-rw-r--r--libempathy-gtk/empathy-password-dialog.c336
-rw-r--r--libempathy-gtk/empathy-password-dialog.h66
-rw-r--r--libempathy-gtk/empathy-persona-store.c19
-rw-r--r--libempathy-gtk/empathy-persona-view.c22
-rw-r--r--libempathy-gtk/empathy-status-preset-dialog.c8
-rw-r--r--libempathy-gtk/empathy-ui-utils.c16
-rw-r--r--libempathy-gtk/empathy-ui-utils.h3
-rw-r--r--libempathy-gtk/empathy-video-widget.c10
28 files changed, 1113 insertions, 213 deletions
diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am
index 7e35929b1..72e489c75 100644
--- a/libempathy-gtk/Makefile.am
+++ b/libempathy-gtk/Makefile.am
@@ -68,6 +68,7 @@ libempathy_gtk_handwritten_source = \
empathy-new-message-dialog.c \
empathy-new-call-dialog.c \
empathy-notify-manager.c \
+ empathy-password-dialog.c \
empathy-persona-store.c \
empathy-persona-view.c \
empathy-presence-chooser.c \
@@ -130,6 +131,7 @@ libempathy_gtk_headers = \
empathy-new-message-dialog.h \
empathy-new-call-dialog.h \
empathy-notify-manager.h \
+ empathy-password-dialog.h \
empathy-persona-store.h \
empathy-persona-view.h \
empathy-presence-chooser.h \
diff --git a/libempathy-gtk/empathy-account-widget-aim.ui b/libempathy-gtk/empathy-account-widget-aim.ui
index b590eea99..fb2e5181d 100644
--- a/libempathy-gtk/empathy-account-widget-aim.ui
+++ b/libempathy-gtk/empathy-account-widget-aim.ui
@@ -15,7 +15,7 @@
<child>
<object class="GtkTable" id="table_common_settings">
<property name="visible">True</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -91,6 +91,25 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="remember_password">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<placeholder/>
</child>
</object>
@@ -273,5 +292,18 @@
<property name="position">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="remember_password_simple">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
</object>
</interface>
diff --git a/libempathy-gtk/empathy-account-widget-groupwise.ui b/libempathy-gtk/empathy-account-widget-groupwise.ui
index 1629a0175..1cf2ea790 100644
--- a/libempathy-gtk/empathy-account-widget-groupwise.ui
+++ b/libempathy-gtk/empathy-account-widget-groupwise.ui
@@ -14,7 +14,7 @@
<child>
<object class="GtkTable" id="table_common_groupwise_settings">
<property name="visible">True</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -75,9 +75,6 @@
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
<object class="GtkEntry" id="entry_password">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -90,6 +87,28 @@
<property name="bottom_attach">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="remember_password">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -270,5 +289,18 @@
<property name="position">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="remember_password_simple">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
</object>
</interface>
diff --git a/libempathy-gtk/empathy-account-widget-icq.ui b/libempathy-gtk/empathy-account-widget-icq.ui
index 654174f8e..4d9597886 100644
--- a/libempathy-gtk/empathy-account-widget-icq.ui
+++ b/libempathy-gtk/empathy-account-widget-icq.ui
@@ -15,7 +15,7 @@
<child>
<object class="GtkTable" id="table_common_settings">
<property name="visible">True</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -91,6 +91,25 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="remember_password">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<placeholder/>
</child>
</object>
@@ -301,5 +320,18 @@
<property name="position">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="remember_password_simple">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
</object>
</interface>
diff --git a/libempathy-gtk/empathy-account-widget-jabber.ui b/libempathy-gtk/empathy-account-widget-jabber.ui
index 6820eabd8..ca476e536 100644
--- a/libempathy-gtk/empathy-account-widget-jabber.ui
+++ b/libempathy-gtk/empathy-account-widget-jabber.ui
@@ -21,7 +21,7 @@
<child>
<object class="GtkTable" id="table_common_settings">
<property name="visible">True</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -46,8 +46,6 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
</packing>
</child>
<child>
@@ -60,10 +58,6 @@
</object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
</packing>
</child>
<child>
@@ -76,11 +70,9 @@
<property name="mnemonic_widget">entry_password</property>
</object>
<packing>
- <property name="x_options">GTK_FILL</property>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
@@ -89,7 +81,6 @@
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label_username_example">
- <property name="visible">True</property>
<property name="xalign">0</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@jabber.org</property>
@@ -142,6 +133,25 @@ Use &lt;a href="http://www.facebook.com/username/"&gt;this page&lt;/a&gt; to cho
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="remember_password">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<placeholder/>
</child>
</object>
@@ -509,6 +519,19 @@ Use &lt;a href="http://www.facebook.com/username/"&gt;this page&lt;/a&gt; to cho
<property name="position">5</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="remember_password_simple">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">6</property>
+ </packing>
+ </child>
</object>
<object class="GtkVBox" id="vbox_gtalk_simple">
<property name="visible">True</property>
@@ -599,6 +622,19 @@ Use &lt;a href="http://www.facebook.com/username/"&gt;this page&lt;/a&gt; to cho
<property name="position">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="remember_password_g_simple">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
</object>
<object class="GtkVBox" id="vbox_fb_simple">
<property name="visible">True</property>
@@ -691,5 +727,18 @@ Use &lt;a href="http://www.facebook.com/username/"&gt;this page&lt;/a&gt; to cho
<property name="position">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="remember_password_fb_simple">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
</object>
</interface>
diff --git a/libempathy-gtk/empathy-account-widget-msn.ui b/libempathy-gtk/empathy-account-widget-msn.ui
index 133ce487d..6665133f4 100644
--- a/libempathy-gtk/empathy-account-widget-msn.ui
+++ b/libempathy-gtk/empathy-account-widget-msn.ui
@@ -14,7 +14,7 @@
<child>
<object class="GtkTable" id="table_common_msn_settings">
<property name="visible">True</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -75,9 +75,6 @@
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
<object class="GtkEntry" id="entry_password">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -90,6 +87,28 @@
<property name="bottom_attach">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="remember_password">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -270,5 +289,18 @@
<property name="position">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="remember_password_simple">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
</object>
</interface>
diff --git a/libempathy-gtk/empathy-account-widget-sip.ui b/libempathy-gtk/empathy-account-widget-sip.ui
index b00eda944..98a8f2c17 100644
--- a/libempathy-gtk/empathy-account-widget-sip.ui
+++ b/libempathy-gtk/empathy-account-widget-sip.ui
@@ -13,7 +13,7 @@
<child>
<object class="GtkTable" id="table_common_settings">
<property name="visible">True</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -75,9 +75,6 @@
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
<object class="GtkEntry" id="entry_password">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -89,6 +86,28 @@
<property name="bottom_attach">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="remember_password">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -583,6 +602,19 @@
<property name="position">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="remember_password_simple">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">65535</property>
diff --git a/libempathy-gtk/empathy-account-widget-yahoo.ui b/libempathy-gtk/empathy-account-widget-yahoo.ui
index acc60de74..16044f3c8 100644
--- a/libempathy-gtk/empathy-account-widget-yahoo.ui
+++ b/libempathy-gtk/empathy-account-widget-yahoo.ui
@@ -16,7 +16,7 @@
<child>
<object class="GtkTable" id="table_common_settings">
<property name="visible">True</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -92,6 +92,25 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="remember_password">
+ <property name="label" translatable="yes">Remember Password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<placeholder/>
</child>
</object>
@@ -357,5 +376,18 @@
<property name="position">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="remember_password_simple">
+ <property name="label" translatable="yes">Remember password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
</object>
</interface>
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index b6a308aff..591c964f4 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -54,6 +54,26 @@
G_DEFINE_TYPE (EmpathyAccountWidget, empathy_account_widget, G_TYPE_OBJECT)
+typedef enum
+{
+ NO_SERVICE = 0,
+ GTALK_SERVICE,
+ FACEBOOK_SERVICE,
+ N_SERVICES
+} Service;
+
+typedef struct
+{
+ const gchar *label_username_example;
+ gboolean show_advanced;
+} ServiceInfo;
+
+static ServiceInfo services_infos[N_SERVICES] = {
+ { "label_username_example", TRUE },
+ { "label_username_g_example", TRUE },
+ { "label_username_f_example", FALSE },
+};
+
typedef struct {
EmpathyAccountSettings *settings;
@@ -89,9 +109,16 @@ typedef struct {
GtkWidget *param_account_widget;
GtkWidget *param_password_widget;
+ gboolean automatic_change;
+ GtkWidget *remember_password_widget;
+
/* Used only for IRC accounts */
EmpathyIrcNetworkChooser *irc_network_chooser;
+ /* Used for 'special' XMPP account having a service associated ensuring that
+ * JIDs have a specific suffix; such as Facebook for example */
+ gchar *jid_suffix;
+
gboolean dispose_run;
} EmpathyAccountWidgetPriv;
@@ -199,32 +226,33 @@ account_widget_set_control_buttons_sensitivity (EmpathyAccountWidget *self,
}
static void
-account_widget_set_entry_highlighting (GtkEntry *entry, gboolean highlight)
+account_widget_set_entry_highlighting (GtkEntry *entry,
+ gboolean highlight)
{
- GdkColor color;
- GtkStyle *style;
-
g_return_if_fail (GTK_IS_ENTRY (entry));
- style = gtk_widget_get_style (GTK_WIDGET (entry));
-
if (highlight)
{
- color = style->bg[GTK_STATE_SELECTED];
+ GtkStyleContext *style;
+ GdkRGBA color;
+
+ style = gtk_widget_get_style_context (GTK_WIDGET (entry));
+ gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED,
+ &color);
/* Here we take the current theme colour and add it to
* the colour for white and average the two. This
* gives a colour which is inline with the theme but
* slightly whiter.
*/
- color.red = (color.red + (style->white).red) / 2;
- color.green = (color.green + (style->white).green) / 2;
- color.blue = (color.blue + (style->white).blue) / 2;
+ empathy_make_color_whiter (&color);
- gtk_widget_modify_base (GTK_WIDGET (entry), GTK_STATE_NORMAL, &color);
+ gtk_widget_override_background_color (GTK_WIDGET (entry), 0, &color);
}
else
- gtk_widget_modify_base (GTK_WIDGET (entry), GTK_STATE_NORMAL, NULL);
+ {
+ gtk_widget_override_background_color (GTK_WIDGET (entry), 0, NULL);
+ }
}
static void
@@ -287,6 +315,11 @@ static void
account_widget_entry_changed_cb (GtkEditable *entry,
EmpathyAccountWidget *self)
{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ if (priv->automatic_change)
+ return;
+
account_widget_entry_changed_common (self, GTK_ENTRY (entry), FALSE);
empathy_account_widget_changed (self);
}
@@ -1054,32 +1087,48 @@ account_widget_launch_external_clicked (GtkWidget *button,
"com.meego.libsocialweb"))
{
/* we know how to handle this external provider */
- GDesktopAppInfo *app_info;
- const gchar *args[3] = { NULL, };
+ GDesktopAppInfo *desktop_info;
GError *error = NULL;
+ GdkAppLaunchContext *context = NULL;
+ gchar *cmd;
+ GAppInfo *app_info;
- app_info = g_desktop_app_info_new ("gnome-control-center.desktop");
-
- if (app_info == NULL)
+ desktop_info = g_desktop_app_info_new ("gnome-control-center.desktop");
+ if (desktop_info == NULL)
{
g_critical ("Could not locate 'gnome-control-center.desktop'");
return;
}
- args[0] = g_app_info_get_commandline (G_APP_INFO (app_info));
- args[1] = "bisho.desktop";
- args[2] = NULL;
+ /* glib doesn't have API to start a desktop file with args... (#637875) */
+ cmd = g_strdup_printf ("%s bisho.desktop", g_app_info_get_commandline (
+ (GAppInfo *) desktop_info));
+
+ app_info = g_app_info_create_from_commandline (cmd, NULL, 0, &error);
+ g_free (cmd);
+
+ if (app_info == NULL)
+ {
+ DEBUG ("Failed to create app info: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ context = gdk_app_launch_context_new ();
+ gdk_app_launch_context_set_screen (context,
+ gtk_widget_get_screen (button));
- gdk_spawn_on_screen (gtk_widget_get_screen (button),
- NULL, (gchar **) args, NULL,
- G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error);
- if (error != NULL)
+ if (!g_app_info_launch (app_info, NULL, (GAppLaunchContext *) context,
+ &error))
{
- g_critical ("Failed to launch editor: %s", error->message);
+ g_critical ("Failed to bisho: %s", error->message);
g_clear_error (&error);
}
- g_object_unref (app_info);
+out:
+ g_object_unref (desktop_info);
+ tp_clear_object (&app_info);
+ tp_clear_object (&context);
}
}
@@ -1196,6 +1245,17 @@ account_widget_build_sip (EmpathyAccountWidget *self,
EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
empathy_account_widget_sip_build (self, filename,
&priv->table_common_settings);
+
+ if (priv->simple)
+ {
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password_simple"));
+ }
+ else
+ {
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password"));
+ }
}
static void
@@ -1219,6 +1279,9 @@ account_widget_build_msn (EmpathyAccountWidget *self,
NULL);
self->ui_details->default_focus = g_strdup ("entry_id_simple");
+
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password_simple"));
}
else
{
@@ -1235,45 +1298,30 @@ account_widget_build_msn (EmpathyAccountWidget *self,
NULL);
self->ui_details->default_focus = g_strdup ("entry_id");
- }
-}
-
-static gboolean
-account_widget_is_gtalk (EmpathyAccountWidget *self)
-{
- EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
-
- return !tp_strdiff (empathy_account_settings_get_icon_name (priv->settings),
- "im-google-talk");
-}
-
-static gboolean
-account_widget_is_facebook (EmpathyAccountWidget *self)
-{
- EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
- return !tp_strdiff (empathy_account_settings_get_icon_name (priv->settings),
- "im-facebook");
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password"));
+ }
}
-#define FACEBOOK_SUFFIX "@chat.facebook.com"
-
static void
-facebook_id_widget_changed_cb (GtkWidget *entry,
+suffix_id_widget_changed_cb (GtkWidget *entry,
EmpathyAccountWidget *self)
{
EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
const gchar *account;
+ g_assert (priv->jid_suffix != NULL);
+
account_widget_entry_changed_common (self, GTK_ENTRY (entry), FALSE);
account = empathy_account_settings_get_string (priv->settings, "account");
if (!EMP_STR_EMPTY (account) &&
- !g_str_has_suffix (account, FACEBOOK_SUFFIX))
+ !g_str_has_suffix (account, priv->jid_suffix))
{
gchar *tmp;
- tmp = g_strdup_printf ("%s%s", account, FACEBOOK_SUFFIX);
+ tmp = g_strdup_printf ("%s%s", account, priv->jid_suffix);
DEBUG ("Change account from '%s' to '%s'", account, tmp);
@@ -1285,17 +1333,23 @@ facebook_id_widget_changed_cb (GtkWidget *entry,
}
static gchar *
-remove_facebook_suffix (const gchar *str)
+remove_jid_suffix (EmpathyAccountWidget *self,
+ const gchar *str)
{
- if (!g_str_has_suffix (str, FACEBOOK_SUFFIX))
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ g_assert (priv->jid_suffix != NULL);
+
+ if (!g_str_has_suffix (str, priv->jid_suffix))
return g_strdup (str);
- return g_strndup (str, strlen (str) - strlen (FACEBOOK_SUFFIX));
+ return g_strndup (str, strlen (str) - strlen (priv->jid_suffix));
}
static void
-setup_facebook_id_widget (EmpathyAccountWidget *self,
- GtkWidget *widget)
+setup_id_widget_with_suffix (EmpathyAccountWidget *self,
+ GtkWidget *widget,
+ const gchar *suffix)
{
EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
const gchar *str = NULL;
@@ -1303,12 +1357,15 @@ setup_facebook_id_widget (EmpathyAccountWidget *self,
g_object_set_data_full (G_OBJECT (widget), "param_name",
g_strdup ("account"), g_free);
+ g_assert (priv->jid_suffix == NULL);
+ priv->jid_suffix = g_strdup (suffix);
+
str = empathy_account_settings_get_string (priv->settings, "account");
if (str != NULL)
{
gchar *tmp;
- tmp = remove_facebook_suffix (str);
+ tmp = remove_jid_suffix (self, str);
gtk_entry_set_text (GTK_ENTRY (widget), tmp);
g_free (tmp);
}
@@ -1316,7 +1373,29 @@ setup_facebook_id_widget (EmpathyAccountWidget *self,
priv->param_account_widget = widget;
g_signal_connect (widget, "changed",
- G_CALLBACK (facebook_id_widget_changed_cb), self);
+ G_CALLBACK (suffix_id_widget_changed_cb), self);
+}
+
+static Service
+account_widget_get_service (EmpathyAccountWidget *self)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ const gchar *icon_name, *service;
+
+ icon_name = empathy_account_settings_get_icon_name (priv->settings);
+ service = empathy_account_settings_get_service (priv->settings);
+
+ /* Previous versions of Empathy didn't set the Service property on Facebook
+ * and gtalk accounts, so we check using the icon name as well. */
+ if (!tp_strdiff (icon_name, "im-google-talk") ||
+ !tp_strdiff (service, "google-talk"))
+ return GTALK_SERVICE;
+
+ if (!tp_strdiff (icon_name, "im-facebook") ||
+ !tp_strdiff (service, "facebook"))
+ return FACEBOOK_SERVICE;
+
+ return NO_SERVICE;
}
static void
@@ -1328,18 +1407,18 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
GtkWidget *checkbutton_ssl;
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_fb;
+ GtkWidget *label_example;
GtkWidget *expander_advanced;
GtkWidget *entry_id;
+ Service service;
- is_gtalk = account_widget_is_gtalk (self);
- is_facebook = account_widget_is_facebook (self);
+ service = account_widget_get_service (self);
empathy_account_settings_set_regex (priv->settings, "account",
ACCOUNT_REGEX_JABBER);
- if (priv->simple && !is_gtalk && !is_facebook)
+ if (priv->simple && service == NO_SERVICE)
{
/* Simple widget for XMPP */
self->ui_details->gui = empathy_builder_get_file (filename,
@@ -1364,8 +1443,11 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
NULL);
self->ui_details->default_focus = g_strdup ("entry_id_simple");
+
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password_simple"));
}
- else if (priv->simple && is_gtalk)
+ else if (priv->simple && service == GTALK_SERVICE)
{
/* Simple widget for Google Talk */
self->ui_details->gui = empathy_builder_get_file (filename,
@@ -1378,8 +1460,11 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
NULL);
self->ui_details->default_focus = g_strdup ("entry_id_g_simple");
+
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password_g_simple"));
}
- else if (priv->simple && is_facebook)
+ else if (priv->simple && service == FACEBOOK_SERVICE)
{
/* Simple widget for Facebook */
self->ui_details->gui = empathy_builder_get_file (filename,
@@ -1391,21 +1476,25 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
"entry_password_fb_simple", "password",
NULL);
- setup_facebook_id_widget (self, entry_id);
+ setup_id_widget_with_suffix (self, entry_id, "@chat.facebook.com");
self->ui_details->default_focus = g_strdup ("entry_id_fb_simple");
+
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password_fb_simple"));
}
else
{
+ ServiceInfo info = services_infos[service];
+
/* Full widget for XMPP, Google Talk and Facebook*/
self->ui_details->gui = empathy_builder_get_file (filename,
"table_common_settings", &priv->table_common_settings,
"vbox_jabber_settings", &self->ui_details->widget,
"spinbutton_port", &spinbutton_port,
"checkbutton_ssl", &checkbutton_ssl,
- "label_username_example", &label_example_jabber,
- "label_username_g_example", &label_example_gtalk,
"label_username_f_example", &label_example_fb,
+ info.label_username_example, &label_example,
"expander_advanced", &expander_advanced,
"entry_id", &entry_id,
"label_id", &label_id,
@@ -1422,13 +1511,13 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
"checkbutton_encryption", "require-encryption",
NULL);
- if (is_facebook)
+ if (service == FACEBOOK_SERVICE)
{
gtk_label_set_label (GTK_LABEL (label_id), _("Username:"));
/* Facebook special case the entry ID widget to hide the
* "@chat.facebook.com" part */
- setup_facebook_id_widget (self, entry_id);
+ setup_id_widget_with_suffix (self, entry_id, "@chat.facebook.com");
}
else
{
@@ -1438,32 +1527,30 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
self->ui_details->default_focus = g_strdup ("entry_id");
priv->spinbutton_port = spinbutton_port;
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password"));
+
g_signal_connect (checkbutton_ssl, "toggled",
G_CALLBACK (account_widget_jabber_ssl_toggled_cb),
self);
- if (is_gtalk)
- {
- gtk_widget_hide (label_example_jabber);
- gtk_widget_show (label_example_gtalk);
- }
- else if (is_facebook)
+ if (service == FACEBOOK_SERVICE)
{
GtkContainer *parent;
GList *children;
- gtk_widget_hide (label_example_jabber);
-
/* Removing the label from list of focusable widgets */
parent = GTK_CONTAINER (gtk_widget_get_parent (label_example_fb));
children = gtk_container_get_children (parent);
children = g_list_remove (children, label_example_fb);
gtk_container_set_focus_chain (parent, children);
g_list_free (children);
-
- gtk_widget_show (label_example_fb);
- gtk_widget_hide (expander_advanced);
}
+
+ gtk_widget_show (label_example);
+
+ if (!info.show_advanced)
+ gtk_widget_hide (expander_advanced);
}
}
@@ -1489,6 +1576,9 @@ account_widget_build_icq (EmpathyAccountWidget *self,
NULL);
self->ui_details->default_focus = g_strdup ("entry_uin_simple");
+
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password_simple"));
}
else
{
@@ -1507,6 +1597,9 @@ account_widget_build_icq (EmpathyAccountWidget *self,
NULL);
self->ui_details->default_focus = g_strdup ("entry_uin");
+
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password"));
}
}
@@ -1529,6 +1622,9 @@ account_widget_build_aim (EmpathyAccountWidget *self,
NULL);
self->ui_details->default_focus = g_strdup ("entry_screenname_simple");
+
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password_simple"));
}
else
{
@@ -1546,6 +1642,9 @@ account_widget_build_aim (EmpathyAccountWidget *self,
NULL);
self->ui_details->default_focus = g_strdup ("entry_screenname");
+
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password"));
}
}
@@ -1570,6 +1669,9 @@ account_widget_build_yahoo (EmpathyAccountWidget *self,
NULL);
self->ui_details->default_focus = g_strdup ("entry_id_simple");
+
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password_simple"));
}
else
{
@@ -1589,6 +1691,9 @@ account_widget_build_yahoo (EmpathyAccountWidget *self,
NULL);
self->ui_details->default_focus = g_strdup ("entry_id");
+
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password"));
}
}
@@ -1610,6 +1715,9 @@ account_widget_build_groupwise (EmpathyAccountWidget *self,
NULL);
self->ui_details->default_focus = g_strdup ("entry_id_simple");
+
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password_simple"));
}
else
{
@@ -1626,6 +1734,9 @@ account_widget_build_groupwise (EmpathyAccountWidget *self,
NULL);
self->ui_details->default_focus = g_strdup ("entry_id");
+
+ priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object (
+ self->ui_details->gui, "remember_password"));
}
}
@@ -1935,7 +2046,7 @@ 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_get_service (self) != NO_SERVICE)
return;
if (priv->simple)
@@ -1957,6 +2068,48 @@ add_register_buttons (EmpathyAccountWidget *self,
#endif /* HAVE_MEEGO */
static void
+remember_password_toggled_cb (GtkToggleButton *button,
+ EmpathyAccountWidget *self)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ if (gtk_toggle_button_get_active (button))
+ {
+ gtk_widget_set_sensitive (priv->param_password_widget, TRUE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive (priv->param_password_widget, FALSE);
+ gtk_entry_set_text (GTK_ENTRY (priv->param_password_widget), "");
+ empathy_account_settings_unset (priv->settings, "password");
+ }
+}
+
+static void
+account_settings_password_retrieved_cb (GObject *object,
+ gpointer user_data)
+{
+ EmpathyAccountWidget *self = user_data;
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ const gchar *password = empathy_account_settings_get_string (
+ priv->settings, "password");
+
+ if (password != NULL)
+ {
+ /* We have to do this so that when we call gtk_entry_set_text,
+ * the ::changed callback doesn't think the user made the
+ * change. */
+ priv->automatic_change = TRUE;
+ gtk_entry_set_text (GTK_ENTRY (priv->param_password_widget), password);
+ priv->automatic_change = FALSE;
+ }
+
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (priv->remember_password_widget),
+ !EMP_STR_EMPTY (password));
+}
+
+static void
do_constructed (GObject *obj)
{
EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj);
@@ -2041,6 +2194,42 @@ do_constructed (GObject *obj)
NULL);
}
+ /* remember password */
+ if (priv->param_password_widget != NULL
+ && priv->remember_password_widget != NULL
+ && empathy_account_settings_supports_sasl (priv->settings))
+ {
+ if (priv->simple)
+ {
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (priv->remember_password_widget), TRUE);
+ }
+ else
+ {
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (priv->remember_password_widget),
+ !EMP_STR_EMPTY (empathy_account_settings_get_string (
+ priv->settings, "password")));
+
+ /* The password might not have been retrieved from the
+ * keyring yet. We should update the remember password
+ * toggle button and the password entry when/if it is. */
+ g_signal_connect (priv->settings, "password-retrieved",
+ G_CALLBACK (account_settings_password_retrieved_cb), self);
+ }
+
+ g_signal_connect (priv->remember_password_widget, "toggled",
+ G_CALLBACK (remember_password_toggled_cb), self);
+
+ remember_password_toggled_cb (
+ GTK_TOGGLE_BUTTON (priv->remember_password_widget), self);
+ }
+ else if (priv->remember_password_widget != NULL
+ && !empathy_account_settings_supports_sasl (priv->settings))
+ {
+ gtk_widget_set_visible (priv->remember_password_widget, FALSE);
+ }
+
/* dup and init the account-manager */
priv->account_manager = tp_account_manager_dup ();
@@ -2177,10 +2366,13 @@ static void
do_finalize (GObject *obj)
{
EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj);
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
g_free (self->ui_details->default_focus);
g_slice_free (EmpathyAccountWidgetUIDetails, self->ui_details);
+ g_free (priv->jid_suffix);
+
if (G_OBJECT_CLASS (empathy_account_widget_parent_class)->finalize != NULL)
G_OBJECT_CLASS (empathy_account_widget_parent_class)->finalize (obj);
}
@@ -2331,9 +2523,11 @@ empathy_account_widget_get_default_display_name (EmpathyAccountWidget *self)
const gchar *login_id;
const gchar *protocol, *p;
gchar *default_display_name;
+ Service service;
login_id = empathy_account_settings_get_string (priv->settings, "account");
protocol = empathy_account_settings_get_protocol (priv->settings);
+ service = account_widget_get_service (self);
if (login_id != NULL)
{
@@ -2354,11 +2548,11 @@ empathy_account_widget_get_default_display_name (EmpathyAccountWidget *self)
default_display_name = g_strdup_printf (_("%1$s on %2$s"),
login_id, empathy_irc_network_get_name (network));
}
- else if (account_widget_is_facebook (self))
+ else if (service == FACEBOOK_SERVICE)
{
gchar *tmp;
- tmp = remove_facebook_suffix (login_id);
+ tmp = remove_jid_suffix (self, login_id);
default_display_name = g_strdup_printf ("Facebook (%s)", tmp);
g_free (tmp);
}
diff --git a/libempathy-gtk/empathy-avatar-image.c b/libempathy-gtk/empathy-avatar-image.c
index a8041d2ba..a11627d15 100644
--- a/libempathy-gtk/empathy-avatar-image.c
+++ b/libempathy-gtk/empathy-avatar-image.c
@@ -155,7 +155,8 @@ avatar_image_add_filter (EmpathyAvatarImage *avatar_image)
mask = PropertyChangeMask;
window = GDK_ROOT_WINDOW ();
- gdkwindow = gdk_xid_table_lookup (window);
+ gdkwindow = gdk_x11_window_lookup_for_display (gdk_display_get_default (),
+ window);
gdk_error_trap_push ();
if (gdkwindow) {
diff --git a/libempathy-gtk/empathy-chat-text-view.c b/libempathy-gtk/empathy-chat-text-view.c
index 5d5dcde46..b58fbc239 100644
--- a/libempathy-gtk/empathy-chat-text-view.c
+++ b/libempathy-gtk/empathy-chat-text-view.c
@@ -219,7 +219,7 @@ chat_text_view_system_font_update (EmpathyChatTextView *view)
font_description = NULL;
}
- gtk_widget_modify_font (GTK_WIDGET (view), font_description);
+ gtk_widget_override_font (GTK_WIDGET (view), font_description);
if (font_description) {
pango_font_description_free (font_description);
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index a92298cfa..295615413 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -3250,12 +3250,6 @@ empathy_chat_get_contact_menu (EmpathyChat *chat)
EMPATHY_CONTACT_FEATURE_LOG |
EMPATHY_CONTACT_FEATURE_INFO);
}
- else if (priv->contact_list_view) {
- EmpathyContactListView *view;
-
- view = EMPATHY_CONTACT_LIST_VIEW (priv->contact_list_view);
- menu = empathy_contact_list_view_get_contact_menu (view);
- }
return menu;
}
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index fb57f348b..fb67c41cc 100644
--- a/libempathy-gtk/empathy-contact-dialogs.c
+++ b/libempathy-gtk/empathy-contact-dialogs.c
@@ -130,7 +130,8 @@ empathy_subscription_dialog_show (EmpathyContact *contact,
contact_widget = empathy_contact_widget_new (contact,
EMPATHY_CONTACT_WIDGET_NO_SET_ALIAS |
EMPATHY_CONTACT_WIDGET_EDIT_ALIAS |
- EMPATHY_CONTACT_WIDGET_EDIT_GROUPS);
+ EMPATHY_CONTACT_WIDGET_EDIT_GROUPS |
+ EMPATHY_CONTACT_WIDGET_SHOW_DETAILS);
gtk_box_pack_start (GTK_BOX (vbox),
contact_widget,
TRUE, TRUE,
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index 1b11309f3..cccfebb51 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -387,8 +387,8 @@ contact_list_view_contact_drag_received (GtkWidget *view,
{
EmpathyContactListViewPriv *priv;
TpAccountManager *account_manager;
- TpConnection *connection;
- TpAccount *account;
+ TpConnection *connection = NULL;
+ TpAccount *account = NULL;
DndGetContactData *data;
GtkTreePath *source_path;
const gchar *sel_data;
@@ -951,29 +951,28 @@ contact_list_view_cell_set_background (EmpathyContactListView *view,
gboolean is_group,
gboolean is_active)
{
- GdkColor color;
- GtkStyle *style;
+ if (!is_group && is_active) {
+ GdkRGBA color;
+ GtkStyleContext *style;
- style = gtk_widget_get_style (GTK_WIDGET (view));
+ style = gtk_widget_get_style_context (GTK_WIDGET (view));
- if (!is_group && is_active) {
- color = style->bg[GTK_STATE_SELECTED];
+ gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED,
+ &color);
/* Here we take the current theme colour and add it to
* the colour for white and average the two. This
* gives a colour which is inline with the theme but
* slightly whiter.
*/
- color.red = (color.red + (style->white).red) / 2;
- color.green = (color.green + (style->white).green) / 2;
- color.blue = (color.blue + (style->white).blue) / 2;
+ empathy_make_color_whiter (&color);
g_object_set (cell,
- "cell-background-gdk", &color,
+ "cell-background-rgba", &color,
NULL);
} else {
g_object_set (cell,
- "cell-background-gdk", NULL,
+ "cell-background-rgba", NULL,
NULL);
}
}
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 26713ebe4..3ebaa9dee 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -1345,10 +1345,10 @@ contact_widget_contact_update (EmpathyContactWidget *information)
FolksPersona *persona = empathy_contact_get_persona (
information->contact);
- if (persona != NULL && FOLKS_IS_FAVOURITE (persona))
+ if (persona != NULL && FOLKS_IS_FAVOURITABLE (persona))
{
- gboolean is_favourite = folks_favourite_get_is_favourite (
- FOLKS_FAVOURITE (persona));
+ gboolean is_favourite = folks_favouritable_get_is_favourite (
+ FOLKS_FAVOURITABLE (persona));
contact_widget_favourites_changed_cb (information->manager,
information->contact, is_favourite, information);
}
@@ -1479,10 +1479,10 @@ favourite_toggled_cb (GtkToggleButton *button,
{
FolksPersona *persona = empathy_contact_get_persona (information->contact);
- if (persona != NULL && FOLKS_IS_FAVOURITE (persona))
+ if (persona != NULL && FOLKS_IS_FAVOURITABLE (persona))
{
gboolean active = gtk_toggle_button_get_active (button);
- folks_favourite_set_is_favourite (FOLKS_FAVOURITE (persona), active);
+ folks_favouritable_set_is_favourite (FOLKS_FAVOURITABLE (persona), active);
}
}
diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c
index e3159b401..29ead4fb0 100644
--- a/libempathy-gtk/empathy-individual-menu.c
+++ b/libempathy-gtk/empathy-individual-menu.c
@@ -749,7 +749,7 @@ static void
favourite_menu_item_toggled_cb (GtkCheckMenuItem *item,
FolksIndividual *individual)
{
- folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual),
+ folks_favouritable_set_is_favourite (FOLKS_FAVOURITABLE (individual),
gtk_check_menu_item_get_active (item));
}
@@ -761,7 +761,7 @@ empathy_individual_favourite_menu_item_new (FolksIndividual *individual)
item = gtk_check_menu_item_new_with_label (_("Favorite"));
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item),
- folks_favourite_get_is_favourite (FOLKS_FAVOURITE (individual)));
+ folks_favouritable_get_is_favourite (FOLKS_FAVOURITABLE (individual)));
g_signal_connect (item, "toggled",
G_CALLBACK (favourite_menu_item_toggled_cb), individual);
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c
index 4b07131a6..0add70ce3 100644
--- a/libempathy-gtk/empathy-individual-store.c
+++ b/libempathy-gtk/empathy-individual-store.c
@@ -164,20 +164,21 @@ individual_get_client_types (FolksIndividual *individual)
personas = folks_individual_get_personas (individual);
for (l = personas; l != NULL; l = l->next)
{
- FolksPresence *presence;
+ FolksHasPresence *presence;
- /* We only want personas which implement FolksPresence */
- if (!FOLKS_IS_PRESENCE (l->data))
+ /* We only want personas which implement FolksHasPresence */
+ if (!FOLKS_IS_HAS_PRESENCE (l->data))
continue;
- presence = FOLKS_PRESENCE (l->data);
+ presence = FOLKS_HAS_PRESENCE (l->data);
- if (folks_presence_typecmp (folks_presence_get_presence_type (presence),
+ if (folks_has_presence_typecmp (
+ folks_has_presence_get_presence_type (presence),
presence_type) > 0)
{
TpContact *tp_contact;
- presence_type = folks_presence_get_presence_type (presence);
+ presence_type = folks_has_presence_get_presence_type (presence);
tp_contact = tpf_persona_get_contact (TPF_PERSONA (l->data));
types = tp_contact_get_client_types (tp_contact);
@@ -477,7 +478,7 @@ individual_store_add_individual (EmpathyIndividualStore *self,
g_list_free (groups);
if (priv->show_groups &&
- folks_favourite_get_is_favourite (FOLKS_FAVOURITE (individual)))
+ folks_favouritable_get_is_favourite (FOLKS_FAVOURITABLE (individual)))
{
/* Add contact to the fake 'Favorites' group */
GtkTreeIter iter_group;
@@ -705,7 +706,7 @@ individual_store_contact_update (EmpathyIndividualStore *self,
}
/* Get online state now. */
- now_online = folks_presence_is_online (FOLKS_PRESENCE (individual));
+ now_online = folks_has_presence_is_online (FOLKS_HAS_PRESENCE (individual));
if (!in_list)
{
@@ -795,9 +796,11 @@ individual_store_contact_update (EmpathyIndividualStore *self,
EMPATHY_INDIVIDUAL_STORE_COL_NAME,
folks_aliasable_get_alias (FOLKS_ALIASABLE (individual)),
EMPATHY_INDIVIDUAL_STORE_COL_PRESENCE_TYPE,
- folks_presence_get_presence_type (FOLKS_PRESENCE (individual)),
+ folks_has_presence_get_presence_type (
+ FOLKS_HAS_PRESENCE (individual)),
EMPATHY_INDIVIDUAL_STORE_COL_STATUS,
- folks_presence_get_presence_message (FOLKS_PRESENCE (individual)),
+ folks_has_presence_get_presence_message (
+ FOLKS_HAS_PRESENCE (individual)),
EMPATHY_INDIVIDUAL_STORE_COL_COMPACT, priv->is_compact,
EMPATHY_INDIVIDUAL_STORE_COL_IS_GROUP, FALSE,
EMPATHY_INDIVIDUAL_STORE_COL_IS_ONLINE, now_online,
@@ -1464,9 +1467,9 @@ individual_store_state_sort_func (GtkTreeModel *model,
* the presences.
*/
folks_presence_type_a =
- folks_presence_get_presence_type (FOLKS_PRESENCE (individual_a));
+ folks_has_presence_get_presence_type (FOLKS_HAS_PRESENCE (individual_a));
folks_presence_type_b =
- folks_presence_get_presence_type (FOLKS_PRESENCE (individual_b));
+ folks_has_presence_get_presence_type (FOLKS_HAS_PRESENCE (individual_b));
tp_presence_a = empathy_folks_presence_type_to_tp (folks_presence_type_a);
tp_presence_b = empathy_folks_presence_type_to_tp (folks_presence_type_b);
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 39dc3b34b..38ef61e54 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -377,14 +377,14 @@ real_drag_individual_received_cb (EmpathyIndividualView *self,
if (!tp_strdiff (new_group, EMPATHY_INDIVIDUAL_STORE_FAVORITE))
{
/* Mark contact as favourite */
- folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual), TRUE);
+ folks_favouritable_set_is_favourite (FOLKS_FAVOURITABLE (individual), TRUE);
return;
}
if (!tp_strdiff (old_group, EMPATHY_INDIVIDUAL_STORE_FAVORITE))
{
/* Remove contact as favourite */
- folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual), FALSE);
+ folks_favouritable_set_is_favourite (FOLKS_FAVOURITABLE (individual), FALSE);
/* Don't try to remove it */
old_group = NULL;
@@ -681,7 +681,7 @@ individual_view_drag_motion (GtkWidget *widget,
}
if (individual != NULL &&
- folks_presence_is_online (FOLKS_PRESENCE (individual)) &&
+ folks_has_presence_is_online (FOLKS_HAS_PRESENCE (individual)) &&
(caps & EMPATHY_CAPABILITIES_FT))
{
gdk_drag_status (context, GDK_ACTION_COPY, time_);
@@ -1047,28 +1047,27 @@ individual_view_cell_set_background (EmpathyIndividualView *view,
gboolean is_group,
gboolean is_active)
{
- GdkColor color;
- GtkStyle *style;
-
- style = gtk_widget_get_style (GTK_WIDGET (view));
-
if (!is_group && is_active)
{
- color = style->bg[GTK_STATE_SELECTED];
+ GtkStyleContext *style;
+ GdkRGBA color;
+
+ style = gtk_widget_get_style_context (GTK_WIDGET (view));
+
+ gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED,
+ &color);
/* Here we take the current theme colour and add it to
* the colour for white and average the two. This
* gives a colour which is inline with the theme but
* slightly whiter.
*/
- color.red = (color.red + (style->white).red) / 2;
- color.green = (color.green + (style->white).green) / 2;
- color.blue = (color.blue + (style->white).blue) / 2;
+ empathy_make_color_whiter (&color);
- g_object_set (cell, "cell-background-gdk", &color, NULL);
+ g_object_set (cell, "cell-background-rgba", &color, NULL);
}
else
- g_object_set (cell, "cell-background-gdk", NULL, NULL);
+ g_object_set (cell, "cell-background-rgba", NULL, NULL);
}
static void
@@ -2345,12 +2344,45 @@ individual_view_remove_activate_cb (GtkMenuItem *menuitem,
{
gchar *text;
GtkWindow *parent;
+ GList *l, *personas;
+ guint persona_count = 0;
+
+ personas = folks_individual_get_personas (individual);
+
+ /* If we have more than one TpfPersona, display a different message
+ * ensuring the user knows that *all* of the meta-contacts' personas will
+ * be removed. */
+ for (l = personas; l != NULL; l = l->next)
+ {
+ if (!TPF_IS_PERSONA (l->data))
+ continue;
+
+ persona_count++;
+ if (persona_count >= 2)
+ break;
+ }
+
+ if (persona_count < 2)
+ {
+ /* Not a meta-contact */
+ text =
+ g_strdup_printf (
+ _("Do you really want to remove the contact '%s'?"),
+ folks_aliasable_get_alias (FOLKS_ALIASABLE (individual)));
+ }
+ else
+ {
+ /* Meta-contact */
+ text =
+ g_strdup_printf (
+ _("Do you really want to remove the linked contact '%s'? "
+ "Note that this will remove all the contacts which make up "
+ "this linked contact."),
+ folks_aliasable_get_alias (FOLKS_ALIASABLE (individual)));
+ }
parent = empathy_get_toplevel_window (GTK_WIDGET (view));
- text =
- g_strdup_printf (_
- ("Do you really want to remove the contact '%s'?"),
- folks_aliasable_get_alias (FOLKS_ALIASABLE (individual)));
+
if (individual_view_remove_dialog_show (parent, _("Removing contact"),
text))
{
diff --git a/libempathy-gtk/empathy-individual-widget.c b/libempathy-gtk/empathy-individual-widget.c
index 863ce021e..44e7f9572 100644
--- a/libempathy-gtk/empathy-individual-widget.c
+++ b/libempathy-gtk/empathy-individual-widget.c
@@ -220,19 +220,20 @@ update_weak_contact (EmpathyIndividualWidget *self)
personas = folks_individual_get_personas (priv->individual);
for (l = personas; l != NULL; l = l->next)
{
- FolksPresence *presence;
+ FolksHasPresence *presence;
/* We only want personas which implement FolksPresence */
- if (!FOLKS_IS_PRESENCE (l->data))
+ if (!FOLKS_IS_HAS_PRESENCE (l->data))
continue;
- presence = FOLKS_PRESENCE (l->data);
+ presence = FOLKS_HAS_PRESENCE (l->data);
- if (folks_presence_typecmp (folks_presence_get_presence_type (presence),
+ if (folks_has_presence_typecmp (
+ folks_has_presence_get_presence_type (presence),
presence_type) > 0
&& TPF_IS_PERSONA (presence))
{
- presence_type = folks_presence_get_presence_type (presence);
+ presence_type = folks_has_presence_get_presence_type (presence);
tp_contact = tpf_persona_get_contact (TPF_PERSONA (l->data));
}
}
@@ -896,7 +897,7 @@ individual_dup_avatar (FolksIndividual *individual)
/* FIXME: We just choose the first Persona which has an avatar, and save that.
* The avatar handling in EmpathyContact needs to be moved into libfolks as
- * much as possible, and this code rewritten to use FolksAvatar.
+ * much as possible, and this code rewritten to use FolksHasAvatar.
* (bgo#627401) */
personas = folks_individual_get_personas (individual);
for (l = personas; l != NULL; l = l->next)
@@ -1150,8 +1151,8 @@ favourite_toggled_cb (GtkToggleButton *button,
EmpathyIndividualWidget *self)
{
gboolean active = gtk_toggle_button_get_active (button);
- folks_favourite_set_is_favourite (
- FOLKS_FAVOURITE (GET_PRIV (self)->individual), active);
+ folks_favouritable_set_is_favourite (
+ FOLKS_FAVOURITABLE (GET_PRIV (self)->individual), active);
}
static void
@@ -1247,11 +1248,13 @@ notify_presence_cb (gpointer folks_object,
state_image = g_object_get_data (table, "state-image");
/* FIXME: Default messages should be moved into libfolks (bgo#627403) */
- message = folks_presence_get_presence_message (FOLKS_PRESENCE (folks_object));
+ message = folks_has_presence_get_presence_message (
+ FOLKS_HAS_PRESENCE (folks_object));
if (EMP_STR_EMPTY (message))
{
message = empathy_presence_get_default_message (
- folks_presence_get_presence_type (FOLKS_PRESENCE (folks_object)));
+ folks_has_presence_get_presence_type (
+ FOLKS_HAS_PRESENCE (folks_object)));
}
if (message != NULL)
@@ -1261,7 +1264,8 @@ notify_presence_cb (gpointer folks_object,
gtk_image_set_from_icon_name (GTK_IMAGE (state_image),
empathy_icon_name_for_presence (
- folks_presence_get_presence_type (FOLKS_PRESENCE (folks_object))),
+ folks_has_presence_get_presence_type (
+ FOLKS_HAS_PRESENCE (folks_object))),
GTK_ICON_SIZE_BUTTON);
gtk_widget_show (state_image);
}
@@ -1290,7 +1294,8 @@ notify_is_favourite_cb (gpointer folks_object,
if (GTK_IS_TOGGLE_BUTTON (favourite_widget))
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (favourite_widget),
- folks_favourite_get_is_favourite (FOLKS_FAVOURITE (folks_object)));
+ folks_favouritable_get_is_favourite (
+ FOLKS_FAVOURITABLE (folks_object)));
}
}
@@ -1646,8 +1651,12 @@ individual_table_set_up (EmpathyIndividualWidget *self)
num_personas++;
}
- message = g_strdup_printf (ngettext ("Meta-contact containing %u contact",
- "Meta-contact containing %u contacts", num_personas), num_personas);
+ /* Translators: the plurality applies to both instances of the word
+ * "contact" */
+ message = g_strdup_printf (
+ ngettext ("Linked contact containing %u contact",
+ "Linked contacts containing %u contacts", num_personas),
+ num_personas);
label = gtk_label_new (message);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
g_free (message);
diff --git a/libempathy-gtk/empathy-linking-dialog.c b/libempathy-gtk/empathy-linking-dialog.c
index 323ec4e03..e6d408fb4 100644
--- a/libempathy-gtk/empathy-linking-dialog.c
+++ b/libempathy-gtk/empathy-linking-dialog.c
@@ -119,7 +119,7 @@ empathy_linking_dialog_init (EmpathyLinkingDialog *self)
button = gtk_button_new_with_mnemonic (
C_("Unlink individual (button)", "_Unlinkā€¦"));
gtk_widget_set_tooltip_text (button, _("Completely split the displayed "
- "meta-contact into the contacts it contains."));
+ "linked contacts into the separate contacts."));
gtk_dialog_add_action_widget (dialog, button, RESPONSE_UNLINK);
gtk_widget_show (button);
@@ -179,12 +179,12 @@ linking_response_cb (EmpathyLinkingDialog *self,
/* Show a confirmation dialogue first */
dialog = gtk_message_dialog_new (GTK_WINDOW (self), GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, _("Unlink meta-contact '%s'?"),
+ GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
+ _("Unlink linked contacts '%s'?"),
folks_aliasable_get_alias (FOLKS_ALIASABLE (individual)));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- _("Are you sure you want to unlink this meta-contact? This will "
- "completely split the meta-contact into the contacts it "
- "contains."));
+ _("Are you sure you want to unlink these linked contacts? This will "
+ "completely split the linked contacts into separate contacts."));
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
C_("Unlink individual (button)", "_Unlink"), GTK_RESPONSE_OK,
diff --git a/libempathy-gtk/empathy-password-dialog.c b/libempathy-gtk/empathy-password-dialog.c
new file mode 100644
index 000000000..2b1048c1c
--- /dev/null
+++ b/libempathy-gtk/empathy-password-dialog.c
@@ -0,0 +1,336 @@
+/*
+ * empathy-password-dialog.c - Source for EmpathyPasswordDialog
+ * Copyright (C) 2010 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <config.h>
+
+#include "empathy-password-dialog.h"
+
+#include <glib/gi18n-lib.h>
+
+#define DEBUG_FLAG EMPATHY_DEBUG_SASL
+#include <libempathy/empathy-debug.h>
+#include <libempathy/empathy-utils.h>
+
+G_DEFINE_TYPE (EmpathyPasswordDialog, empathy_password_dialog,
+ GTK_TYPE_MESSAGE_DIALOG)
+
+enum {
+ PROP_HANDLER = 1,
+
+ LAST_PROPERTY,
+};
+
+typedef struct {
+ EmpathyServerSASLHandler *handler;
+
+ GtkWidget *entry;
+ GtkWidget *ticky;
+ GtkWidget *ok_button;
+
+ gboolean grabbing;
+
+ gboolean dispose_run;
+} EmpathyPasswordDialogPriv;
+
+static void
+empathy_password_dialog_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EmpathyPasswordDialogPriv *priv = EMPATHY_PASSWORD_DIALOG (object)->priv;
+
+ switch (property_id)
+ {
+ case PROP_HANDLER:
+ g_value_set_object (value, priv->handler);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+empathy_password_dialog_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EmpathyPasswordDialogPriv *priv = EMPATHY_PASSWORD_DIALOG (object)->priv;
+
+ switch (property_id)
+ {
+ case PROP_HANDLER:
+ g_assert (priv->handler == NULL); /* construct only */
+ priv->handler = g_value_dup_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+empathy_password_dialog_dispose (GObject *object)
+{
+ EmpathyPasswordDialogPriv *priv = EMPATHY_PASSWORD_DIALOG (object)->priv;
+
+ if (priv->dispose_run)
+ return;
+
+ priv->dispose_run = TRUE;
+
+ tp_clear_object (&priv->handler);
+
+ G_OBJECT_CLASS (empathy_password_dialog_parent_class)->dispose (object);
+}
+
+static void
+password_dialog_response_cb (GtkDialog *dialog,
+ gint response,
+ gpointer user_data)
+{
+ EmpathyPasswordDialogPriv *priv = EMPATHY_PASSWORD_DIALOG (user_data)->priv;
+
+ if (response == GTK_RESPONSE_OK)
+ {
+ empathy_server_sasl_handler_provide_password (priv->handler,
+ gtk_entry_get_text (GTK_ENTRY (priv->entry)),
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->ticky)));
+ }
+ else
+ {
+ empathy_server_sasl_handler_cancel (priv->handler);
+ }
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+static void
+clear_icon_released_cb (GtkEntry *entry,
+ GtkEntryIconPosition icon_pos,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ gtk_entry_set_text (entry, "");
+}
+
+static void
+password_entry_changed_cb (GtkEditable *entry,
+ gpointer user_data)
+{
+ EmpathyPasswordDialogPriv *priv = EMPATHY_PASSWORD_DIALOG (user_data)->priv;
+ const gchar *str;
+
+ str = gtk_entry_get_text (GTK_ENTRY (entry));
+
+ gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
+ GTK_ENTRY_ICON_SECONDARY, !EMP_STR_EMPTY (str));
+
+ gtk_widget_set_sensitive (priv->ok_button,
+ !EMP_STR_EMPTY (str));
+}
+
+static gboolean
+password_dialog_grab_keyboard (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ EmpathyPasswordDialogPriv *priv = EMPATHY_PASSWORD_DIALOG (user_data)->priv;
+
+ if (!priv->grabbing)
+ {
+ GdkGrabStatus status = gdk_keyboard_grab (gtk_widget_get_window (widget),
+ FALSE, gdk_event_get_time (event));
+
+ if (status != GDK_GRAB_SUCCESS)
+ DEBUG ("Could not grab keyboard; grab status was %u", status);
+ else
+ priv->grabbing = TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+password_dialog_ungrab_keyboard (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ EmpathyPasswordDialogPriv *priv = EMPATHY_PASSWORD_DIALOG (user_data)->priv;
+
+ if (priv->grabbing)
+ {
+ gdk_keyboard_ungrab (gdk_event_get_time (event));
+ priv->grabbing = FALSE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+password_dialog_window_state_changed (GtkWidget *widget,
+ GdkEventWindowState *event,
+ gpointer data)
+{
+ GdkWindowState state = gdk_window_get_state (gtk_widget_get_window (widget));
+
+ if (state & GDK_WINDOW_STATE_WITHDRAWN
+ || state & GDK_WINDOW_STATE_ICONIFIED
+ || state & GDK_WINDOW_STATE_FULLSCREEN
+ || state & GDK_WINDOW_STATE_MAXIMIZED)
+ {
+ password_dialog_ungrab_keyboard (widget, (GdkEvent *) event, data);
+ }
+ else
+ {
+ password_dialog_grab_keyboard (widget, (GdkEvent *) event, data);
+ }
+
+ return FALSE;
+}
+
+static void
+password_dialog_handler_invalidated_cb (EmpathyServerSASLHandler *handler,
+ EmpathyPasswordDialog *dialog)
+{
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+static void
+empathy_password_dialog_constructed (GObject *object)
+{
+ EmpathyPasswordDialog *dialog;
+ EmpathyPasswordDialogPriv *priv;
+ TpAccount *account;
+ GtkWidget *icon;
+ GtkBox *box;
+ gchar *text;
+
+ dialog = EMPATHY_PASSWORD_DIALOG (object);
+ priv = dialog->priv;
+
+ g_assert (priv->handler != NULL);
+
+ priv->grabbing = FALSE;
+
+ account = empathy_server_sasl_handler_get_account (priv->handler);
+
+ tp_g_signal_connect_object (priv->handler, "invalidated",
+ G_CALLBACK (password_dialog_handler_invalidated_cb),
+ object, 0);
+
+ /* dialog */
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+
+ priv->ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
+ GTK_STOCK_OK, GTK_RESPONSE_OK);
+ gtk_widget_set_sensitive (priv->ok_button, FALSE);
+
+ text = g_strdup_printf (_("Enter your password for account\n<b>%s</b>"),
+ tp_account_get_display_name (account));
+ gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), text);
+ g_free (text);
+
+ gtk_window_set_icon_name (GTK_WINDOW (dialog),
+ GTK_STOCK_DIALOG_AUTHENTICATION);
+
+ box = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
+
+ /* dialog icon */
+ icon = gtk_image_new_from_icon_name (tp_account_get_icon_name (account),
+ GTK_ICON_SIZE_DIALOG);
+ gtk_message_dialog_set_image (GTK_MESSAGE_DIALOG (dialog), icon);
+ gtk_widget_show (icon);
+
+ /* entry */
+ priv->entry = gtk_entry_new ();
+ gtk_entry_set_visibility (GTK_ENTRY (priv->entry), FALSE);
+
+ /* entry clear icon */
+ gtk_entry_set_icon_from_stock (GTK_ENTRY (priv->entry),
+ GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
+ gtk_entry_set_icon_sensitive (GTK_ENTRY (priv->entry),
+ GTK_ENTRY_ICON_SECONDARY, FALSE);
+
+ g_signal_connect (priv->entry, "icon-release",
+ G_CALLBACK (clear_icon_released_cb), NULL);
+ g_signal_connect (priv->entry, "changed",
+ G_CALLBACK (password_entry_changed_cb), dialog);
+
+ gtk_box_pack_start (box, priv->entry, FALSE, FALSE, 0);
+ gtk_widget_show (priv->entry);
+
+ /* remember password ticky box */
+ priv->ticky = gtk_check_button_new_with_label (_("Remember password"));
+
+ gtk_box_pack_start (box, priv->ticky, FALSE, FALSE, 0);
+ gtk_widget_show (priv->ticky);
+
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (password_dialog_response_cb), dialog);
+ g_signal_connect (dialog, "window-state-event",
+ G_CALLBACK (password_dialog_window_state_changed), dialog);
+ g_signal_connect (dialog, "map-event",
+ G_CALLBACK (password_dialog_grab_keyboard), dialog);
+ g_signal_connect (dialog, "unmap-event",
+ G_CALLBACK (password_dialog_ungrab_keyboard), dialog);
+
+ gtk_widget_grab_focus (priv->entry);
+
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
+}
+
+static void
+empathy_password_dialog_init (EmpathyPasswordDialog *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ EMPATHY_TYPE_PASSWORD_DIALOG, EmpathyPasswordDialogPriv);
+}
+
+static void
+empathy_password_dialog_class_init (EmpathyPasswordDialogClass *klass)
+{
+ GParamSpec *pspec;
+ GObjectClass *oclass = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (EmpathyPasswordDialogPriv));
+
+ oclass->set_property = empathy_password_dialog_set_property;
+ oclass->get_property = empathy_password_dialog_get_property;
+ oclass->dispose = empathy_password_dialog_dispose;
+ oclass->constructed = empathy_password_dialog_constructed;
+
+ pspec = g_param_spec_object ("handler", "The EmpathyServerSASLHandler",
+ "The EmpathyServerSASLHandler to be used.",
+ EMPATHY_TYPE_SERVER_SASL_HANDLER,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (oclass, PROP_HANDLER, pspec);
+}
+
+GtkWidget *
+empathy_password_dialog_new (EmpathyServerSASLHandler *handler)
+{
+ g_assert (EMPATHY_IS_SERVER_SASL_HANDLER (handler));
+
+ return g_object_new (EMPATHY_TYPE_PASSWORD_DIALOG,
+ "handler", handler, NULL);
+}
diff --git a/libempathy-gtk/empathy-password-dialog.h b/libempathy-gtk/empathy-password-dialog.h
new file mode 100644
index 000000000..566322de1
--- /dev/null
+++ b/libempathy-gtk/empathy-password-dialog.h
@@ -0,0 +1,66 @@
+/*
+ * empathy-password-dialog.h - Header for EmpathyPasswordDialog
+ * Copyright (C) 2010 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __EMPATHY_PASSWORD_DIALOG_H__
+#define __EMPATHY_PASSWORD_DIALOG_H__
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+#include <libempathy/empathy-server-sasl-handler.h>
+
+#include <extensions/extensions.h>
+
+G_BEGIN_DECLS
+
+typedef struct _EmpathyPasswordDialog EmpathyPasswordDialog;
+typedef struct _EmpathyPasswordDialogClass EmpathyPasswordDialogClass;
+
+struct _EmpathyPasswordDialogClass {
+ GtkMessageDialogClass parent_class;
+};
+
+struct _EmpathyPasswordDialog {
+ GtkMessageDialog parent;
+ gpointer priv;
+};
+
+GType empathy_password_dialog_get_type (void);
+
+#define EMPATHY_TYPE_PASSWORD_DIALOG \
+ (empathy_password_dialog_get_type ())
+#define EMPATHY_PASSWORD_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_PASSWORD_DIALOG, \
+ EmpathyPasswordDialog))
+#define EMPATHY_PASSWORD_DIALOG_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_PASSWORD_DIALOG, \
+ EmpathyPasswordDialogClass))
+#define EMPATHY_IS_PASSWORD_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_PASSWORD_DIALOG))
+#define EMPATHY_IS_PASSWORD_DIALOG_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_PASSWORD_DIALOG))
+#define EMPATHY_PASSWORD_DIALOG_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_PASSWORD_DIALOG, \
+ EmpathyPasswordDialogClass))
+
+GtkWidget * empathy_password_dialog_new (EmpathyServerSASLHandler *handler);
+
+G_END_DECLS
+
+#endif /* #ifndef __EMPATHY_PASSWORD_DIALOG_H__*/
diff --git a/libempathy-gtk/empathy-persona-store.c b/libempathy-gtk/empathy-persona-store.c
index fbeeb6991..b77e34d4b 100644
--- a/libempathy-gtk/empathy-persona-store.c
+++ b/libempathy-gtk/empathy-persona-store.c
@@ -438,7 +438,7 @@ update_persona (EmpathyPersonaStore *self,
gtk_tree_path_free (path);
/* Get online state now. */
- now_online = folks_presence_is_online (FOLKS_PRESENCE (persona));
+ now_online = folks_has_presence_is_online (FOLKS_HAS_PRESENCE (persona));
/* Get online state before. */
gtk_tree_model_get (GTK_TREE_MODEL (self), &iter,
@@ -484,9 +484,11 @@ update_persona (EmpathyPersonaStore *self,
EMPATHY_PERSONA_STORE_COL_DISPLAY_ID,
folks_persona_get_display_id (persona),
EMPATHY_PERSONA_STORE_COL_PRESENCE_TYPE,
- folks_presence_get_presence_type (FOLKS_PRESENCE (persona)),
+ folks_has_presence_get_presence_type (
+ FOLKS_HAS_PRESENCE (persona)),
EMPATHY_PERSONA_STORE_COL_STATUS,
- folks_presence_get_presence_message (FOLKS_PRESENCE (persona)),
+ folks_has_presence_get_presence_message (
+ FOLKS_HAS_PRESENCE (persona)),
EMPATHY_PERSONA_STORE_COL_IS_ONLINE, now_online,
EMPATHY_PERSONA_STORE_COL_CAN_AUDIO_CALL,
empathy_contact_get_capabilities (contact) &
@@ -532,6 +534,11 @@ individual_personas_changed_cb (GObject *object,
{
GList *l;
+ /* One of the personas' row references might hold the last reference to the
+ * PersonaStore, so we need to keep a reference ourselves so we don't get
+ * finalised. */
+ g_object_ref (self);
+
/* Remove the old personas. */
for (l = removed; l != NULL; l = l->next)
remove_persona_and_disconnect (self, FOLKS_PERSONA (l->data));
@@ -539,6 +546,8 @@ individual_personas_changed_cb (GObject *object,
/* Add each of the new personas to the tree model */
for (l = added; l != NULL; l = l->next)
add_persona_and_connect (self, FOLKS_PERSONA (l->data));
+
+ g_object_unref (self);
}
static gint
@@ -619,8 +628,8 @@ state_sort_func (GtkTreeModel *model,
* the presences.
*/
ret_val = -tp_connection_presence_type_cmp_availability (
- folks_presence_get_presence_type (FOLKS_PRESENCE (persona_a)),
- folks_presence_get_presence_type (FOLKS_PRESENCE (persona_b)));
+ folks_has_presence_get_presence_type (FOLKS_HAS_PRESENCE (persona_a)),
+ folks_has_presence_get_presence_type (FOLKS_HAS_PRESENCE (persona_b)));
if (ret_val == 0) {
/* Fallback: compare by name et al. */
diff --git a/libempathy-gtk/empathy-persona-view.c b/libempathy-gtk/empathy-persona-view.c
index adfe6be5c..a03746538 100644
--- a/libempathy-gtk/empathy-persona-view.c
+++ b/libempathy-gtk/empathy-persona-view.c
@@ -47,6 +47,7 @@
#include "empathy-cell-renderer-activatable.h"
#include "empathy-gtk-enum-types.h"
#include "empathy-gtk-marshal.h"
+#include "empathy-ui-utils.h"
#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
#include <libempathy/empathy-debug.h>
@@ -236,29 +237,28 @@ cell_set_background (EmpathyPersonaView *self,
GtkCellRenderer *cell,
gboolean is_active)
{
- GdkColor color;
- GtkStyle *style;
-
- style = gtk_widget_get_style (GTK_WIDGET (self));
-
if (is_active)
{
- color = style->bg[GTK_STATE_SELECTED];
+ GdkRGBA color;
+ GtkStyleContext *style;
+
+ style = gtk_widget_get_style_context (GTK_WIDGET (self));
+
+ gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED,
+ &color);
/* Here we take the current theme colour and add it to
* the colour for white and average the two. This
* gives a colour which is inline with the theme but
* slightly whiter.
*/
- color.red = (color.red + (style->white).red) / 2;
- color.green = (color.green + (style->white).green) / 2;
- color.blue = (color.blue + (style->white).blue) / 2;
+ empathy_make_color_whiter (&color);
- g_object_set (cell, "cell-background-gdk", &color, NULL);
+ g_object_set (cell, "cell-background-rgba", &color, NULL);
}
else
{
- g_object_set (cell, "cell-background-gdk", NULL, NULL);
+ g_object_set (cell, "cell-background-rgba", NULL, NULL);
}
}
diff --git a/libempathy-gtk/empathy-status-preset-dialog.c b/libempathy-gtk/empathy-status-preset-dialog.c
index 957a17d58..2c36cb332 100644
--- a/libempathy-gtk/empathy-status-preset-dialog.c
+++ b/libempathy-gtk/empathy-status-preset-dialog.c
@@ -351,12 +351,12 @@ status_preset_dialog_set_add_combo_changed (EmpathyStatusPresetDialog *self,
gtk_widget_set_sensitive (priv->add_button, state);
if (state) {
- gtk_widget_modify_text (entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_override_color (entry, 0, NULL);
} else {
- GdkColor colour;
+ GdkRGBA color;
- gdk_color_parse ("Gray", &colour); /* FIXME - theme */
- gtk_widget_modify_text (entry, GTK_STATE_NORMAL, &colour);
+ if (gdk_rgba_parse (&color, "Gray")) /* FIXME - theme */
+ gtk_widget_override_color (entry, 0, &color);
if (reset_text) {
priv->block_add_combo_changed++;
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 4c1287424..e2946e513 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -232,7 +232,8 @@ empathy_icon_name_for_individual (FolksIndividual *individual)
TpConnectionPresenceType presence;
folks_presence =
- folks_presence_get_presence_type (FOLKS_PRESENCE (individual));
+ folks_has_presence_get_presence_type (
+ FOLKS_HAS_PRESENCE (individual));
presence = empathy_folks_presence_type_to_tp (folks_presence);
return empathy_icon_name_for_presence (presence);
@@ -632,7 +633,8 @@ empathy_pixbuf_avatar_from_individual_scaled_async (
callback, user_data,
empathy_pixbuf_avatar_from_individual_scaled_async);
- avatar_file = folks_avatar_get_avatar (FOLKS_AVATAR (individual));
+ avatar_file =
+ folks_has_avatar_get_avatar (FOLKS_HAS_AVATAR (individual));
if (avatar_file == NULL)
goto out;
@@ -1896,3 +1898,13 @@ empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler)
gtk_widget_show (widget);
g_free (title);
}
+
+void
+empathy_make_color_whiter (GdkRGBA *color)
+{
+ const GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 };
+
+ color->red = (color->red + white.red) / 2;
+ color->green = (color->green + white.green) / 2;
+ color->blue = (color->blue + white.blue) / 2;
+}
diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h
index 0b76d09a3..0ff637a33 100644
--- a/libempathy-gtk/empathy-ui-utils.h
+++ b/libempathy-gtk/empathy-ui-utils.h
@@ -145,6 +145,9 @@ void empathy_send_file_from_uri_list (EmpathyContact *conta
void empathy_send_file_with_file_chooser (EmpathyContact *contact);
void empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler);
+/* Misc */
+void empathy_make_color_whiter (GdkRGBA *color);
+
G_END_DECLS
#endif /* __EMPATHY_UI_UTILS_H__ */
diff --git a/libempathy-gtk/empathy-video-widget.c b/libempathy-gtk/empathy-video-widget.c
index 26cc878b2..b4b39ffdb 100644
--- a/libempathy-gtk/empathy-video-widget.c
+++ b/libempathy-gtk/empathy-video-widget.c
@@ -83,7 +83,7 @@ static void
empathy_video_widget_init (EmpathyVideoWidget *obj)
{
EmpathyVideoWidgetPriv *priv = GET_PRIV (obj);
- GdkColor black;
+ GdkRGBA black;
priv->lock = g_mutex_new ();
@@ -92,9 +92,8 @@ empathy_video_widget_init (EmpathyVideoWidget *obj)
G_CALLBACK (empathy_video_widget_element_added_cb),
obj);
- if (gdk_color_parse ("Black", &black))
- gtk_widget_modify_bg (GTK_WIDGET (obj), GTK_STATE_NORMAL,
- &black);
+ if (gdk_rgba_parse (&black, "Black"))
+ gtk_widget_override_background_color (GTK_WIDGET (obj), 0, &black);
gtk_widget_set_double_buffered (GTK_WIDGET (obj), FALSE);
}
@@ -434,8 +433,7 @@ empathy_video_widget_draw (GtkWidget *widget,
{
gtk_widget_get_allocation (widget, &allocation);
- gtk_paint_flat_box (gtk_widget_get_style (widget), cr,
- GTK_STATE_NORMAL, GTK_SHADOW_NONE, widget, NULL,
+ gtk_render_frame (gtk_widget_get_style_context (widget), cr,
0, 0,
gtk_widget_get_allocated_width (widget),
gtk_widget_get_allocated_height (widget));