aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-linking-dialog.c
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2010-08-30 22:05:42 +0800
committerPhilip Withnall <philip.withnall@collabora.co.uk>2010-08-30 23:04:46 +0800
commit59333ef35fe969e67e3a9da55f2bd5856d878e3a (patch)
treea4ed935f4cc0e23a7aab466c46b38314c104ca7f /libempathy-gtk/empathy-linking-dialog.c
parentdfcab5196d9ba84e4cce84ac31750495e4b36f06 (diff)
downloadgsoc2013-empathy-59333ef35fe969e67e3a9da55f2bd5856d878e3a.tar
gsoc2013-empathy-59333ef35fe969e67e3a9da55f2bd5856d878e3a.tar.gz
gsoc2013-empathy-59333ef35fe969e67e3a9da55f2bd5856d878e3a.tar.bz2
gsoc2013-empathy-59333ef35fe969e67e3a9da55f2bd5856d878e3a.tar.lz
gsoc2013-empathy-59333ef35fe969e67e3a9da55f2bd5856d878e3a.tar.xz
gsoc2013-empathy-59333ef35fe969e67e3a9da55f2bd5856d878e3a.tar.zst
gsoc2013-empathy-59333ef35fe969e67e3a9da55f2bd5856d878e3a.zip
Change the sensitivity of the Link button if changes have been made
Closes: bgo#628320
Diffstat (limited to 'libempathy-gtk/empathy-linking-dialog.c')
-rw-r--r--libempathy-gtk/empathy-linking-dialog.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-linking-dialog.c b/libempathy-gtk/empathy-linking-dialog.c
index d323e84f4..6d76ea1de 100644
--- a/libempathy-gtk/empathy-linking-dialog.c
+++ b/libempathy-gtk/empathy-linking-dialog.c
@@ -60,12 +60,26 @@ static GtkWidget *linking_dialog = NULL;
typedef struct {
EmpathyIndividualLinker *linker; /* child widget */
+ GtkWidget *link_button; /* child widget */
} EmpathyLinkingDialogPriv;
G_DEFINE_TYPE (EmpathyLinkingDialog, empathy_linking_dialog,
GTK_TYPE_DIALOG);
static void
+linker_notify_has_changed_cb (EmpathyIndividualLinker *linker,
+ GParamSpec *pspec,
+ EmpathyLinkingDialog *self)
+{
+ EmpathyLinkingDialogPriv *priv = GET_PRIV (self);
+
+ /* Only make the "Link" button sensitive if the linked Individual has been
+ * changed. */
+ gtk_widget_set_sensitive (priv->link_button,
+ empathy_individual_linker_get_has_changed (linker));
+}
+
+static void
empathy_linking_dialog_class_init (EmpathyLinkingDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -105,13 +119,16 @@ empathy_linking_dialog_init (EmpathyLinkingDialog *self)
/* Translators: this is an action button in the linking dialogue. "Link" is
* used here as a verb meaning "to connect two contacts to form a
* meta-contact". */
- button = gtk_button_new_with_mnemonic (_("_Link"));
- gtk_dialog_add_action_widget (dialog, button, GTK_RESPONSE_OK);
- gtk_widget_show (button);
+ priv->link_button = gtk_button_new_with_mnemonic (_("_Link"));
+ gtk_dialog_add_action_widget (dialog, priv->link_button, GTK_RESPONSE_OK);
+ gtk_widget_show (priv->link_button);
/* Linker widget */
priv->linker =
EMPATHY_INDIVIDUAL_LINKER (empathy_individual_linker_new (NULL));
+ g_signal_connect (priv->linker, "notify::has-changed",
+ (GCallback) linker_notify_has_changed_cb, self);
+
gtk_container_set_border_width (GTK_CONTAINER (priv->linker), 8);
content_area = GTK_BOX (gtk_dialog_get_content_area (dialog));
gtk_box_pack_start (content_area, GTK_WIDGET (priv->linker), TRUE, TRUE, 0);