aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy-gtk/empathy-individual-edit-dialog.c53
-rw-r--r--libempathy-gtk/empathy-linking-dialog.c40
2 files changed, 41 insertions, 52 deletions
diff --git a/libempathy-gtk/empathy-individual-edit-dialog.c b/libempathy-gtk/empathy-individual-edit-dialog.c
index 677a53401..3f5f35d45 100644
--- a/libempathy-gtk/empathy-individual-edit-dialog.c
+++ b/libempathy-gtk/empathy-individual-edit-dialog.c
@@ -30,7 +30,6 @@
#include <telepathy-glib/util.h>
#include <folks/folks.h>
-#include <folks/folks-telepathy.h>
#include <libempathy/empathy-individual-manager.h>
#include <libempathy/empathy-utils.h>
@@ -61,25 +60,11 @@ static void individual_edit_dialog_set_individual (
G_DEFINE_TYPE (EmpathyIndividualEditDialog, empathy_individual_edit_dialog,
GTK_TYPE_DIALOG);
-/* Fairly arbitrary response ID for the "Unlink" button */
-#define RESPONSE_UNLINK 5
-
static void
individual_dialogs_response_cb (GtkDialog *dialog,
gint response,
GList **dialogs)
{
- if (response == RESPONSE_UNLINK)
- {
- EmpathyIndividualEditDialogPriv *priv = GET_PRIV (dialog);
- EmpathyIndividualManager *manager =
- empathy_individual_manager_dup_singleton ();
-
- empathy_individual_manager_unlink_individual (manager, priv->individual);
-
- g_object_unref (manager);
- }
-
*dialogs = g_list_remove (*dialogs, dialog);
gtk_widget_destroy (GTK_WIDGET (dialog));
}
@@ -122,30 +107,6 @@ empathy_individual_edit_dialog_show (FolksIndividual *individual,
}
static void
-set_unlink_button_sensitivity (EmpathyIndividualEditDialog *self)
-{
- EmpathyIndividualEditDialogPriv *priv = GET_PRIV (self);
- GList *personas, *l;
- guint num_personas = 0;
-
- /* Count how many Telepathy personas we have, to see whether we can
- * unlink */
- if (priv->individual != NULL)
- {
- personas = folks_individual_get_personas (priv->individual);
- for (l = personas; l != NULL; l = l->next)
- {
- if (TPF_IS_PERSONA (l->data))
- num_personas++;
- }
- }
-
- /* Only make the "Unlink" button sensitive if we have enough personas */
- gtk_dialog_set_response_sensitive (GTK_DIALOG (self), RESPONSE_UNLINK,
- (num_personas > 1) ? TRUE : FALSE);
-}
-
-static void
individual_removed_cb (FolksIndividual *individual,
FolksIndividual *replacement_individual,
EmpathyIndividualEditDialog *self)
@@ -195,7 +156,6 @@ individual_edit_dialog_set_individual (
/* Update the UI */
empathy_individual_widget_set_individual (
EMPATHY_INDIVIDUAL_WIDGET (priv->individual_widget), individual);
- set_unlink_button_sensitivity (dialog);
}
}
@@ -275,7 +235,7 @@ static void
empathy_individual_edit_dialog_init (
EmpathyIndividualEditDialog *dialog)
{
- GtkWidget *button, *action_area;
+ GtkWidget *button;
EmpathyIndividualEditDialogPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (
dialog, EMPATHY_TYPE_INDIVIDUAL_EDIT_DIALOG,
EmpathyIndividualEditDialogPriv);
@@ -297,17 +257,6 @@ empathy_individual_edit_dialog_init (
GTK_DIALOG (dialog))), priv->individual_widget, TRUE, TRUE, 0);
gtk_widget_show (priv->individual_widget);
- /* Unlink button */
- button = gtk_button_new_with_mnemonic (
- C_("Unlink individual (button)", "_Unlink"));
- gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, RESPONSE_UNLINK);
-
- action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
- gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area), button,
- TRUE);
-
- gtk_widget_show (button);
-
/* Close button */
button = gtk_button_new_with_label (GTK_STOCK_CLOSE);
gtk_button_set_use_stock (GTK_BUTTON (button), TRUE);
diff --git a/libempathy-gtk/empathy-linking-dialog.c b/libempathy-gtk/empathy-linking-dialog.c
index 4d80b659f..1ab58abb1 100644
--- a/libempathy-gtk/empathy-linking-dialog.c
+++ b/libempathy-gtk/empathy-linking-dialog.c
@@ -26,6 +26,9 @@
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
+#include <folks/folks.h>
+#include <folks/folks-telepathy.h>
+
#include <libempathy/empathy-individual-manager.h>
#include <libempathy/empathy-utils.h>
@@ -56,6 +59,9 @@
static GtkWidget *linking_dialog = NULL;
+/* Fairly arbitrary response ID for the "Unlink" button */
+#define RESPONSE_UNLINK 5
+
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyLinkingDialog)
typedef struct {
@@ -109,6 +115,12 @@ empathy_linking_dialog_init (EmpathyLinkingDialog *self)
gtk_window_set_title (GTK_WINDOW (self), _("Link Contacts"));
gtk_widget_set_size_request (GTK_WIDGET (self), 600, 500);
+ /* Unlink button */
+ button = gtk_button_new_with_mnemonic (
+ C_("Unlink individual (button)", "_Unlink"));
+ gtk_dialog_add_action_widget (dialog, button, RESPONSE_UNLINK);
+ gtk_widget_show (button);
+
/* Cancel button */
button = gtk_button_new_with_label (GTK_STOCK_CANCEL);
gtk_button_set_use_stock (GTK_BUTTON (button), TRUE);
@@ -154,6 +166,19 @@ linking_response_cb (EmpathyLinkingDialog *self,
g_object_unref (manager);
}
+ else if (response == RESPONSE_UNLINK)
+ {
+ EmpathyIndividualManager *manager;
+ FolksIndividual *individual;
+
+ manager = empathy_individual_manager_dup_singleton ();
+ individual =
+ empathy_individual_linker_get_start_individual (priv->linker);
+
+ empathy_individual_manager_unlink_individual (manager, individual);
+
+ g_object_unref (manager);
+ }
linking_dialog = NULL;
gtk_widget_destroy (GTK_WIDGET (self));
@@ -175,6 +200,8 @@ empathy_linking_dialog_show (FolksIndividual *individual,
GtkWindow *parent)
{
EmpathyLinkingDialogPriv *priv;
+ GList *personas, *l;
+ guint num_personas = 0;
/* Create the dialogue if it doesn't exist */
if (linking_dialog == NULL)
@@ -193,6 +220,19 @@ empathy_linking_dialog_show (FolksIndividual *individual,
empathy_individual_linker_set_start_individual (priv->linker, individual);
+ /* Count how many Telepathy personas we have, to see whether we can
+ * unlink */
+ personas = folks_individual_get_personas (individual);
+ for (l = personas; l != NULL; l = l->next)
+ {
+ if (TPF_IS_PERSONA (l->data))
+ num_personas++;
+ }
+
+ /* Only make the "Unlink" button sensitive if we have enough personas */
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (linking_dialog),
+ RESPONSE_UNLINK, (num_personas > 1) ? TRUE : FALSE);
+
gtk_window_present (GTK_WINDOW (linking_dialog));
return linking_dialog;