aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2010-03-05 00:56:36 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2010-03-05 00:56:36 +0800
commit6cbff108ac6211bfdc3638f23f3226f6521449fc (patch)
tree1c2f593f18f813cded3192a71cb96b4b107e1d64
parent82d23975943d3d1087c4c23ce88c78ae0dc468a0 (diff)
parentb4d06351f186346bfc65204aa4057641bbde4649 (diff)
downloadgsoc2013-empathy-6cbff108ac6211bfdc3638f23f3226f6521449fc.tar
gsoc2013-empathy-6cbff108ac6211bfdc3638f23f3226f6521449fc.tar.gz
gsoc2013-empathy-6cbff108ac6211bfdc3638f23f3226f6521449fc.tar.bz2
gsoc2013-empathy-6cbff108ac6211bfdc3638f23f3226f6521449fc.tar.lz
gsoc2013-empathy-6cbff108ac6211bfdc3638f23f3226f6521449fc.tar.xz
gsoc2013-empathy-6cbff108ac6211bfdc3638f23f3226f6521449fc.tar.zst
gsoc2013-empathy-6cbff108ac6211bfdc3638f23f3226f6521449fc.zip
Merge branch 'tweaks'
-rw-r--r--libempathy-gtk/empathy-presence-chooser.c12
-rw-r--r--src/cc-empathy-accounts-page.c24
-rw-r--r--src/empathy-account-assistant.c19
-rw-r--r--src/empathy-accounts-dialog.c45
-rw-r--r--src/empathy-accounts-dialog.h4
5 files changed, 78 insertions, 26 deletions
diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c
index 7c4aae9ba..7e2e89fb6 100644
--- a/libempathy-gtk/empathy-presence-chooser.c
+++ b/libempathy-gtk/empathy-presence-chooser.c
@@ -345,7 +345,7 @@ presence_chooser_set_favorite_icon (EmpathyPresenceChooser *self)
GTK_ENTRY_ICON_SECONDARY,
_("Click to remove this status as a favorite"));
}
- else {
+ else if (priv->not_favorite_pixbuf != NULL) {
/* custom entries can be favorited */
gtk_entry_set_icon_from_pixbuf (GTK_ENTRY (entry),
GTK_ENTRY_ICON_SECONDARY,
@@ -818,6 +818,9 @@ create_not_favorite_pixbuf (void)
favorite = empathy_pixbuf_from_icon_name ("emblem-favorite",
GTK_ICON_SIZE_MENU);
+ if (favorite == NULL)
+ return NULL;
+
result = gdk_pixbuf_copy (favorite);
gdk_pixbuf_saturate_and_pixelate (favorite, result, 1.0, TRUE);
@@ -832,7 +835,8 @@ icon_theme_changed_cb (GtkIconTheme *icon_theme,
EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
/* Theme has changed, recreate the not-favorite icon */
- g_object_unref (priv->not_favorite_pixbuf);
+ if (priv->not_favorite_pixbuf != NULL)
+ g_object_unref (priv->not_favorite_pixbuf);
priv->not_favorite_pixbuf = create_not_favorite_pixbuf ();
/* Update the icon */
@@ -851,7 +855,6 @@ empathy_presence_chooser_init (EmpathyPresenceChooser *chooser)
/* Create the not-favorite icon */
priv->not_favorite_pixbuf = create_not_favorite_pixbuf ();
- g_assert (priv->not_favorite_pixbuf != NULL);
empathy_signal_connect_weak (gtk_icon_theme_get_default (), "changed",
G_CALLBACK (icon_theme_changed_cb),
@@ -964,7 +967,8 @@ presence_chooser_finalize (GObject *object)
g_object_unref (priv->idle);
g_object_unref (priv->connectivity);
- g_object_unref (priv->not_favorite_pixbuf);
+ if (priv->not_favorite_pixbuf != NULL)
+ g_object_unref (priv->not_favorite_pixbuf);
G_OBJECT_CLASS (empathy_presence_chooser_parent_class)->finalize (object);
}
diff --git a/src/cc-empathy-accounts-page.c b/src/cc-empathy-accounts-page.c
index ef9b17557..383e20d41 100644
--- a/src/cc-empathy-accounts-page.c
+++ b/src/cc-empathy-accounts-page.c
@@ -28,6 +28,7 @@
#include <glib/gi18n-lib.h>
#include <telepathy-glib/account-manager.h>
+#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-connection-managers.h>
#include <libempathy-gtk/empathy-ui-utils.h>
@@ -75,6 +76,20 @@ page_pack_with_accounts_dialog (CcEmpathyAccountsPage *page)
}
static void
+account_assistant_closed_cb (GtkWidget *widget,
+ gpointer user_data)
+{
+ CcEmpathyAccountsPage *page = CC_EMPATHY_ACCOUNTS_PAGE (user_data);
+
+ if (empathy_accounts_dialog_is_creating (
+ EMPATHY_ACCOUNTS_DIALOG (page->priv->accounts_window)))
+ {
+ empathy_account_dialog_cancel (
+ EMPATHY_ACCOUNTS_DIALOG (page->priv->accounts_window));
+ }
+}
+
+static void
connection_managers_prepare (GObject *source,
GAsyncResult *result,
gpointer user_data)
@@ -96,7 +111,14 @@ connection_managers_prepare (GObject *source,
empathy_accounts_import (account_mgr, cm_mgr);
if (!empathy_accounts_has_non_salut_accounts (account_mgr))
- empathy_account_assistant_show (NULL, cm_mgr);
+ {
+ GtkWidget *w;
+ w = empathy_account_assistant_show (NULL, cm_mgr);
+
+ empathy_signal_connect_weak (w, "hide",
+ G_CALLBACK (account_assistant_closed_cb),
+ G_OBJECT (page));
+ }
out:
/* remove ref from active_changed() */
diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c
index 97b7f9692..c944ccc98 100644
--- a/src/empathy-account-assistant.c
+++ b/src/empathy-account-assistant.c
@@ -348,21 +348,26 @@ account_assistant_apply_account_and_finish (EmpathyAccountAssistant *self,
EmpathyAccountSettings *settings)
{
EmpathyAccountAssistantPriv *priv = GET_PRIV (self);
- gchar *display_name;
if (settings == NULL)
return;
priv->is_creating = TRUE;
- /* set default display name */
- display_name = empathy_account_widget_get_default_display_name (
- priv->current_widget_object);
+ /* set default display name, if there is no current widget then assume the
+ * display name was already set correctly. e.g. salut account creation */
+ if (priv->current_widget_object != NULL)
+ {
+ gchar *display_name;
+
+ display_name = empathy_account_widget_get_default_display_name (
+ priv->current_widget_object);
- empathy_account_settings_set_display_name_async (settings,
- display_name, NULL, NULL);
+ empathy_account_settings_set_display_name_async (settings,
+ display_name, NULL, NULL);
- g_free (display_name);
+ g_free (display_name);
+ }
empathy_account_settings_apply_async (settings,
account_assistant_apply_account_cb, self);
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index d8489ee92..ac0f27b96 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -346,10 +346,8 @@ accounts_dialog_update_status_infobar (EmpathyAccountsDialog *dialog,
g_free (message_markup);
}
-static void
-empathy_account_dialog_widget_cancelled_cb (
- EmpathyAccountWidget *widget_object,
- EmpathyAccountsDialog *dialog)
+void
+empathy_account_dialog_cancel (EmpathyAccountsDialog *dialog)
{
GtkTreeView *view;
GtkTreeModel *model;
@@ -394,6 +392,14 @@ empathy_account_dialog_widget_cancelled_cb (
}
static void
+empathy_account_dialog_widget_cancelled_cb (
+ EmpathyAccountWidget *widget_object,
+ EmpathyAccountsDialog *dialog)
+{
+ empathy_account_dialog_cancel (dialog);
+}
+
+static void
empathy_account_dialog_account_created_cb (EmpathyAccountWidget *widget_object,
TpAccount *account,
EmpathyAccountsDialog *dialog)
@@ -411,11 +417,6 @@ empathy_account_dialog_account_created_cb (EmpathyAccountWidget *widget_object,
gtk_widget_set_sensitive (priv->button_remove, TRUE);
gtk_widget_set_sensitive (priv->button_import, TRUE);
- empathy_signal_connect_weak (account, "status-changed",
- G_CALLBACK (accounts_dialog_connection_changed_cb), G_OBJECT (dialog));
- empathy_signal_connect_weak (account, "presence-changed",
- G_CALLBACK (accounts_dialog_presence_changed_cb), G_OBJECT (dialog));
-
if (settings)
g_object_unref (settings);
}
@@ -1659,6 +1660,11 @@ accounts_dialog_add_account (EmpathyAccountsDialog *dialog,
G_CALLBACK (accounts_dialog_account_display_name_changed_cb),
G_OBJECT (dialog));
+ empathy_signal_connect_weak (account, "status-changed",
+ G_CALLBACK (accounts_dialog_connection_changed_cb), G_OBJECT (dialog));
+ empathy_signal_connect_weak (account, "presence-changed",
+ G_CALLBACK (accounts_dialog_presence_changed_cb), G_OBJECT (dialog));
+
g_object_unref (settings);
}
@@ -1864,11 +1870,6 @@ accounts_dialog_accounts_setup (EmpathyAccountsDialog *dialog)
for (l = accounts; l; l = l->next)
{
accounts_dialog_add_account (dialog, l->data);
-
- empathy_signal_connect_weak (l->data, "status-changed",
- G_CALLBACK (accounts_dialog_connection_changed_cb), G_OBJECT (dialog));
- empathy_signal_connect_weak (l->data, "presence-changed",
- G_CALLBACK (accounts_dialog_presence_changed_cb), G_OBJECT (dialog));
}
g_list_free (accounts);
@@ -2344,3 +2345,19 @@ empathy_accounts_dialog_show_application (GdkScreen *screen,
g_free (account_option);
g_free (path);
}
+
+gboolean
+empathy_account_dialog_is_creating (EmpathyAccountsDialog *dialog)
+{
+ EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
+ gboolean result = FALSE;
+
+ if (priv->setting_widget_object == NULL)
+ goto out;
+
+ g_object_get (priv->setting_widget_object,
+ "creating-account", &result, NULL);
+
+out:
+ return result;
+}
diff --git a/src/empathy-accounts-dialog.h b/src/empathy-accounts-dialog.h
index c171e3d24..8f33add8d 100644
--- a/src/empathy-accounts-dialog.h
+++ b/src/empathy-accounts-dialog.h
@@ -56,6 +56,10 @@ typedef struct {
GType empathy_accounts_dialog_get_type (void);
GtkWidget *empathy_accounts_dialog_show (GtkWindow *parent,
TpAccount *selected_account);
+
+void empathy_account_dialog_cancel (EmpathyAccountsDialog *dialog);
+gboolean empathy_account_dialog_is_creating (EmpathyAccountsDialog *dialog);
+
void empathy_accounts_dialog_show_application (GdkScreen *screen,
GChildWatchFunc application_exit_cb,
gpointer user_data,