From a3a321f7e30e09c0adce157d3894642bad32e42c Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 6 Jun 2007 20:20:50 +0000 Subject: Implement editing and viewing contact information with right click on the 2007-06-06 Xavier Claessens * libempathy-gtk/empathy-contact-dialogs.glade: * libempathy-gtk/empathy-contact-widget.glade: * libempathy-gtk/empathy-status-icon.c: * libempathy-gtk/empathy-contact-dialogs.c: * libempathy-gtk/empathy-contact-dialogs.h: * libempathy-gtk/gossip-ui-utils.c: * libempathy-gtk/empathy-subscription-dialog.glade: * libempathy-gtk/empathy-contact-widget.c: * libempathy-gtk/gossip-ui-utils.h: * libempathy-gtk/gossip-contact-list-view.c: * libempathy-gtk/empathy-subscription-dialog.c: * libempathy-gtk/Makefile.am: * libempathy-gtk/empathy-subscription-dialog.h: Implement editing and viewing contact information with right click on the roster. svn path=/trunk/; revision=128 --- ChangeLog | 17 ++ libempathy-gtk/Makefile.am | 4 +- libempathy-gtk/empathy-contact-dialogs.c | 209 +++++++++++++++++++ libempathy-gtk/empathy-contact-dialogs.glade | 182 +++++++++++++++++ libempathy-gtk/empathy-contact-dialogs.h | 40 ++++ libempathy-gtk/empathy-contact-widget.c | 4 + libempathy-gtk/empathy-contact-widget.glade | 213 +++++++++----------- libempathy-gtk/empathy-status-icon.c | 2 +- libempathy-gtk/empathy-subscription-dialog.c | 116 ----------- libempathy-gtk/empathy-subscription-dialog.glade | 244 ----------------------- libempathy-gtk/empathy-subscription-dialog.h | 37 ---- libempathy-gtk/gossip-contact-list-view.c | 8 +- libempathy-gtk/gossip-ui-utils.c | 15 ++ libempathy-gtk/gossip-ui-utils.h | 1 + 14 files changed, 575 insertions(+), 517 deletions(-) create mode 100644 libempathy-gtk/empathy-contact-dialogs.c create mode 100644 libempathy-gtk/empathy-contact-dialogs.glade create mode 100644 libempathy-gtk/empathy-contact-dialogs.h delete mode 100644 libempathy-gtk/empathy-subscription-dialog.c delete mode 100644 libempathy-gtk/empathy-subscription-dialog.glade delete mode 100644 libempathy-gtk/empathy-subscription-dialog.h diff --git a/ChangeLog b/ChangeLog index da0983dd8..8d91a13d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2007-06-06 Xavier Claessens + + * libempathy-gtk/empathy-contact-dialogs.glade: + * libempathy-gtk/empathy-contact-widget.glade: + * libempathy-gtk/empathy-status-icon.c: + * libempathy-gtk/empathy-contact-dialogs.c: + * libempathy-gtk/empathy-contact-dialogs.h: + * libempathy-gtk/gossip-ui-utils.c: + * libempathy-gtk/empathy-subscription-dialog.glade: + * libempathy-gtk/empathy-contact-widget.c: + * libempathy-gtk/gossip-ui-utils.h: + * libempathy-gtk/gossip-contact-list-view.c: + * libempathy-gtk/empathy-subscription-dialog.c: + * libempathy-gtk/Makefile.am: + * libempathy-gtk/empathy-subscription-dialog.h: Implement editing and + viewing contact information with right click on the roster. + 2007-06-06 Xavier Claessens * libempathy-gtk/empathy-contact-widget.glade: diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am index e2c02eddd..2c87b43f4 100644 --- a/libempathy-gtk/Makefile.am +++ b/libempathy-gtk/Makefile.am @@ -13,7 +13,7 @@ libempathy_gtk_la_SOURCES = \ empathy-main-window.c empathy-main-window.h \ empathy-status-icon.c empathy-status-icon.h \ empathy-contact-widget.c empathy-contact-widget.h \ - empathy-subscription-dialog.c empathy-subscription-dialog.c \ + empathy-contact-dialogs.c empathy-contact-dialogs.c \ gossip-accounts-dialog.c gossip-accounts-dialog.h \ gossip-account-widget-generic.c gossip-account-widget-generic.h \ gossip-account-widget-jabber.c gossip-account-widget-jabber.h \ @@ -51,7 +51,7 @@ glade_DATA = \ empathy-main-window.glade \ empathy-status-icon.glade \ empathy-contact-widget.glade \ - empathy-subscription-dialog.glade \ + empathy-contact-dialogs.glade \ gossip-preferences.glade \ gossip-presence-chooser.glade \ gossip-accounts-dialog.glade \ diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c new file mode 100644 index 000000000..8f377d02d --- /dev/null +++ b/libempathy-gtk/empathy-contact-dialogs.c @@ -0,0 +1,209 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2007 Collabora Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Authors: Xavier Claessens + */ + +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include "empathy-contact-dialogs.h" +#include "empathy-contact-widget.h" +#include "gossip-ui-utils.h" + +static GHashTable *subscription_dialogs = NULL; +static GHashTable *information_dialogs = NULL; + +/* + * Subscription dialog + */ + +static void +subscription_dialog_response_cb (GtkDialog *dialog, + gint response, + GtkWidget *contact_widget) +{ + EmpathyContactManager *manager; + GossipContact *contact; + + manager = empathy_contact_manager_new (); + contact = empathy_contact_widget_get_contact (contact_widget); + empathy_contact_widget_save (contact_widget); + + if (response == GTK_RESPONSE_YES) { + empathy_contact_list_add (EMPATHY_CONTACT_LIST (manager), + contact, + _("I would like to add you to my contact list.")); + } + else if (response == GTK_RESPONSE_NO) { + empathy_contact_list_remove (EMPATHY_CONTACT_LIST (manager), + contact, + _("Sorry, I don't want you in my contact list.")); + } + + g_hash_table_remove (subscription_dialogs, contact); + g_object_unref (manager); +} + +void +empathy_subscription_dialog_show (GossipContact *contact, + GtkWindow *parent) +{ + GtkWidget *dialog; + GtkWidget *hbox_subscription; + GtkWidget *contact_widget; + + g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + + if (!subscription_dialogs) { + subscription_dialogs = g_hash_table_new_full (gossip_contact_hash, + gossip_contact_equal, + (GDestroyNotify) g_object_unref, + (GDestroyNotify) gtk_widget_destroy); + } + + dialog = g_hash_table_lookup (subscription_dialogs, contact); + if (dialog) { + gtk_window_present (GTK_WINDOW (dialog)); + return; + } + + gossip_glade_get_file_simple ("empathy-contact-dialogs.glade", + "subscription_request_dialog", + NULL, + "subscription_request_dialog", &dialog, + "hbox_subscription", &hbox_subscription, + NULL); + + g_hash_table_insert (subscription_dialogs, g_object_ref (contact), dialog); + + contact_widget = empathy_contact_widget_new (contact, TRUE); + gtk_box_pack_end (GTK_BOX (hbox_subscription), + contact_widget, + TRUE, TRUE, + 0); + + g_signal_connect (dialog, "response", + G_CALLBACK (subscription_dialog_response_cb), + contact_widget); + + if (parent) { + gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); + } + + gtk_widget_show (dialog); +} + +/* + * Information dialog + */ + +static void +contact_information_response_cb (GtkDialog *dialog, + gint response, + GtkWidget *contact_widget) +{ + GossipContact *contact; + + contact = empathy_contact_widget_get_contact (contact_widget); + empathy_contact_widget_save (contact_widget); + + g_hash_table_remove (information_dialogs, contact); +} + +void +empathy_contact_information_dialog_show (GossipContact *contact, + GtkWindow *parent, + gboolean edit) +{ + GtkWidget *dialog; + GtkWidget *button; + GtkWidget *contact_widget; + + g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + + if (!information_dialogs) { + information_dialogs = g_hash_table_new_full (gossip_contact_hash, + gossip_contact_equal, + (GDestroyNotify) g_object_unref, + (GDestroyNotify) gtk_widget_destroy); + } + + dialog = g_hash_table_lookup (information_dialogs, contact); + if (dialog) { + gtk_window_present (GTK_WINDOW (dialog)); + return; + } + + dialog = gtk_dialog_new (); + gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); + + if (edit) { + /* Cancel button */ + button = gtk_button_new_with_label (GTK_STOCK_CANCEL); + gtk_button_set_use_stock (GTK_BUTTON (button), TRUE); + gtk_dialog_add_action_widget (GTK_DIALOG (dialog), + button, + GTK_RESPONSE_CANCEL); + gtk_widget_show (button); + + button = gtk_button_new_with_label (GTK_STOCK_SAVE); + gtk_button_set_use_stock (GTK_BUTTON (button), TRUE); + gtk_dialog_add_action_widget (GTK_DIALOG (dialog), + button, + GTK_RESPONSE_OK); + gtk_widget_show (button); + } else { + /* Close button */ + button = gtk_button_new_with_label (GTK_STOCK_CLOSE); + gtk_button_set_use_stock (GTK_BUTTON (button), TRUE); + gtk_dialog_add_action_widget (GTK_DIALOG (dialog), + button, + GTK_RESPONSE_CLOSE); + gtk_widget_show (button); + } + + contact_widget = empathy_contact_widget_new (contact, edit); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), + contact_widget, + TRUE, TRUE, 0); + + g_signal_connect (dialog, "response", + G_CALLBACK (contact_information_response_cb), + contact_widget); + + g_hash_table_insert (information_dialogs, g_object_ref (contact), dialog); + + if (parent) { + gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); + } + + gtk_widget_show (dialog); +} + diff --git a/libempathy-gtk/empathy-contact-dialogs.glade b/libempathy-gtk/empathy-contact-dialogs.glade new file mode 100644 index 000000000..475844267 --- /dev/null +++ b/libempathy-gtk/empathy-contact-dialogs.glade @@ -0,0 +1,182 @@ + + + + + + + 5 + Subscription Request + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + False + False + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + False + + + + True + False + 2 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + Decide _Later + True + GTK_RELIEF_NORMAL + True + -6 + + + + + + True + True + True + GTK_RELIEF_NORMAL + True + -9 + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-no + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Deny + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + -6 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 5 + True + False + 12 + + + + True + gtk-dialog-question + 6 + 0.5 + 0 + 0 + 0 + + + 0 + False + False + + + + + + + + + 0 + True + True + + + + + + + diff --git a/libempathy-gtk/empathy-contact-dialogs.h b/libempathy-gtk/empathy-contact-dialogs.h new file mode 100644 index 000000000..809623d47 --- /dev/null +++ b/libempathy-gtk/empathy-contact-dialogs.h @@ -0,0 +1,40 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2007 Collabora Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Authors: Xavier Claessens + */ + +#ifndef __EMPATHY_CONTACT_DIALOGS_H__ +#define __EMPATHY_CONTACT_DIALOGS_H__ + +#include + +#include + +G_BEGIN_DECLS + +void empathy_subscription_dialog_show (GossipContact *contact, + GtkWindow *parent); +void empathy_contact_information_dialog_show (GossipContact *contact, + GtkWindow *parent, + gboolean edit); + +G_END_DECLS + +#endif /* __EMPATHY_CONTACT_DIALOGS_H__ */ diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index cd50056ce..b8ed7efb0 100644 --- a/libempathy-gtk/empathy-contact-widget.c +++ b/libempathy-gtk/empathy-contact-widget.c @@ -275,7 +275,11 @@ contact_widget_contact_setup (EmpathyContactWidget *information) information); } else { information->widget_alias = gtk_label_new (NULL); + gtk_label_set_selectable (GTK_LABEL (information->widget_alias), TRUE); } + gtk_table_attach_defaults (GTK_TABLE (information->table_contact), + information->widget_alias, + 1, 2, 1, 2); gtk_widget_show (information->widget_alias); /* Setup id label */ diff --git a/libempathy-gtk/empathy-contact-widget.glade b/libempathy-gtk/empathy-contact-widget.glade index 7172a9623..d36971b78 100644 --- a/libempathy-gtk/empathy-contact-widget.glade +++ b/libempathy-gtk/empathy-contact-widget.glade @@ -22,7 +22,7 @@ False - 0 + 6 @@ -74,123 +74,108 @@ 0 - + True - 3 - 2 False - 6 - 12 + 6 - + True - Identifier: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - + 2 + 2 + False + 6 + 12 - - - True - Alias: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - + + + True + Identifier: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + - - - True - True - - False - False - GTK_JUSTIFY_LEFT - False - True - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 0 - 1 - - - + + + True + Alias: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + - - - True - Presence: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 + + + True + True + + False + False + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 0 + 1 + + + - 0 - 1 - 2 - 3 - fill - + 0 + True + True @@ -218,12 +203,13 @@ True + True False True GTK_JUSTIFY_LEFT True - False + True 0 0.5 0 @@ -241,12 +227,9 @@ - 1 - 2 - 2 - 3 - fill - fill + 0 + True + True diff --git a/libempathy-gtk/empathy-status-icon.c b/libempathy-gtk/empathy-status-icon.c index d6e4cbe24..f8753820a 100644 --- a/libempathy-gtk/empathy-status-icon.c +++ b/libempathy-gtk/empathy-status-icon.c @@ -39,7 +39,7 @@ #include #include "empathy-status-icon.h" -#include "empathy-subscription-dialog.h" +#include "empathy-contact-dialogs.h" #include "gossip-presence-chooser.h" #include "gossip-preferences.h" #include "gossip-ui-utils.h" diff --git a/libempathy-gtk/empathy-subscription-dialog.c b/libempathy-gtk/empathy-subscription-dialog.c deleted file mode 100644 index 578118581..000000000 --- a/libempathy-gtk/empathy-subscription-dialog.c +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2007 Collabora Ltd. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: Xavier Claessens - */ - -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include "empathy-subscription-dialog.h" -#include "empathy-contact-widget.h" -#include "gossip-ui-utils.h" - -static GHashTable *dialogs = NULL; - -static void -subscription_dialog_response_cb (GtkDialog *dialog, - gint response, - GtkWidget *contact_widget) -{ - EmpathyContactManager *manager; - GossipContact *contact; - - manager = empathy_contact_manager_new (); - contact = empathy_contact_widget_get_contact (contact_widget); - empathy_contact_widget_save (contact_widget); - - if (response == GTK_RESPONSE_YES) { - empathy_contact_list_add (EMPATHY_CONTACT_LIST (manager), - contact, - _("I would like to add you to my contact list.")); - } - else if (response == GTK_RESPONSE_NO) { - empathy_contact_list_remove (EMPATHY_CONTACT_LIST (manager), - contact, - _("Sorry, I don't want you in my contact list.")); - } - - g_hash_table_remove (dialogs, contact); - g_object_unref (manager); -} - -void -empathy_subscription_dialog_show (GossipContact *contact, - GtkWindow *parent) -{ - GtkWidget *dialog; - GtkWidget *hbox_subscription; - GtkWidget *contact_widget; - - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); - - if (!dialogs) { - dialogs = g_hash_table_new_full (gossip_contact_hash, - gossip_contact_equal, - (GDestroyNotify) g_object_unref, - (GDestroyNotify) gtk_widget_destroy); - } - - dialog = g_hash_table_lookup (dialogs, contact); - if (dialog) { - gtk_window_present (GTK_WINDOW (dialog)); - return; - } - - gossip_glade_get_file_simple ("empathy-subscription-dialog.glade", - "subscription_request_dialog", - NULL, - "subscription_request_dialog", &dialog, - "hbox_subscription", &hbox_subscription, - NULL); - - g_hash_table_insert (dialogs, g_object_ref (contact), dialog); - - contact_widget = empathy_contact_widget_new (contact, TRUE); - gtk_box_pack_end (GTK_BOX (hbox_subscription), - contact_widget, - TRUE, TRUE, - 0); - - g_signal_connect (dialog, "response", - G_CALLBACK (subscription_dialog_response_cb), - contact_widget); - - if (parent) { - gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); - } - - gtk_widget_show (dialog); -} - diff --git a/libempathy-gtk/empathy-subscription-dialog.glade b/libempathy-gtk/empathy-subscription-dialog.glade deleted file mode 100644 index e43b8ea42..000000000 --- a/libempathy-gtk/empathy-subscription-dialog.glade +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - 5 - Subscription Request - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER_ON_PARENT - False - False - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 2 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - Decide _Later - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - True - True - True - GTK_RELIEF_NORMAL - True - -9 - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-no - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Deny - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - - True - True - True - True - GTK_RELIEF_NORMAL - True - -8 - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-yes - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Accept - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - 0 - False - True - GTK_PACK_END - - - - - - 5 - True - False - 12 - - - - True - gtk-dialog-question - 6 - 0.5 - 0 - 0 - 0 - - - 0 - False - False - - - - - - - - - 0 - True - True - - - - - - - diff --git a/libempathy-gtk/empathy-subscription-dialog.h b/libempathy-gtk/empathy-subscription-dialog.h deleted file mode 100644 index 0488722e6..000000000 --- a/libempathy-gtk/empathy-subscription-dialog.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2007 Collabora Ltd. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: Xavier Claessens - */ - -#ifndef __EMPATHY_SUBSCRIPTION_DIALOG_H__ -#define __EMPATHY_SUBSCRIPTION_DIALOG_H__ - -#include - -#include - -G_BEGIN_DECLS - -void empathy_subscription_dialog_show (GossipContact *contact, - GtkWindow *parent); - -G_END_DECLS - -#endif /* __EMPATHY_SUBSCRIPTION_DIALOG_H__ */ diff --git a/libempathy-gtk/gossip-contact-list-view.c b/libempathy-gtk/gossip-contact-list-view.c index b81ccfd40..b3c00a33b 100644 --- a/libempathy-gtk/gossip-contact-list-view.c +++ b/libempathy-gtk/gossip-contact-list-view.c @@ -47,9 +47,8 @@ #include "gossip-cell-renderer-expander.h" #include "gossip-cell-renderer-text.h" #include "gossip-ui-utils.h" +#include "empathy-contact-dialogs.h" //#include "gossip-chat-invite.h" -//#include "gossip-contact-info-dialog.h" -//#include "gossip-edit-contact-dialog.h" //#include "gossip-ft-window.h" //#include "gossip-log-window.h" @@ -1452,6 +1451,7 @@ contact_list_view_action_cb (GtkAction *action, GossipContact *contact; const gchar *name; gchar *group; + GtkWindow *parent; priv = GET_PRIV (view); @@ -1464,15 +1464,19 @@ contact_list_view_action_cb (GtkAction *action, contact = gossip_contact_list_view_get_selected (view); group = gossip_contact_list_view_get_selected_group (view); + parent = gossip_get_toplevel_window (GTK_WIDGET (view)); if (contact && strcmp (name, "Chat") == 0) { contact_list_view_action_activated (view, contact); } else if (contact && strcmp (name, "Information") == 0) { + empathy_contact_information_dialog_show (contact, parent, FALSE); } else if (contact && strcmp (name, "Edit") == 0) { + empathy_contact_information_dialog_show (contact, parent, TRUE); } else if (contact && strcmp (name, "Remove") == 0) { + /* FIXME: Ask for confirmation */ EmpathyContactList *list; list = gossip_contact_list_store_get_list_iface (priv->store); diff --git a/libempathy-gtk/gossip-ui-utils.c b/libempathy-gtk/gossip-ui-utils.c index f9628f014..f834ceb0c 100644 --- a/libempathy-gtk/gossip-ui-utils.c +++ b/libempathy-gtk/gossip-ui-utils.c @@ -1254,6 +1254,21 @@ gossip_window_present (GtkWindow *window, } } +GtkWindow * +gossip_get_toplevel_window (GtkWidget *widget) +{ + GtkWidget *toplevel; + + g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); + + toplevel = gtk_widget_get_toplevel (widget); + if (GTK_IS_WINDOW (toplevel)) { + return GTK_WINDOW (toplevel); + } + + return NULL; +} + /* The URL opening code can't handle schemeless strings, so we try to be * smart and add http if there is no scheme or doesn't look like a mail * address. This should work in most cases, and let us click on strings diff --git a/libempathy-gtk/gossip-ui-utils.h b/libempathy-gtk/gossip-ui-utils.h index 987993798..5a0804a9f 100644 --- a/libempathy-gtk/gossip-ui-utils.h +++ b/libempathy-gtk/gossip-ui-utils.h @@ -98,6 +98,7 @@ gboolean gossip_text_iter_backward_search (const GtkTextIter *iter, gboolean gossip_window_get_is_visible (GtkWindow *window); void gossip_window_present (GtkWindow *window, gboolean steal_focus); +GtkWindow *gossip_get_toplevel_window (GtkWidget *widget); void gossip_url_show (const char *url); void gossip_toggle_button_set_state_quietly (GtkWidget *widget, GCallback callback, -- cgit v1.2.3