+2007-06-06 Xavier Claessens <xclaesse@gmail.com>
+
+ * 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 <xclaesse@gmail.com>
* libempathy-gtk/empathy-contact-widget.glade:
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 \
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 \
--- /dev/null
+/* -*- 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 <xclaesse@gmail.com>
+ */
+
+#include <config.h>
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+#include <glib/gi18n.h>
+
+#include <libempathy/empathy-contact-manager.h>
+#include <libempathy/empathy-contact-list.h>
+
+#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);
+}
+
--- /dev/null
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkDialog" id="subscription_request_dialog">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Subscription Request</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="modal">False</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox4">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area4">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="button19">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Decide _Later</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button20">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-9</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox48">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image8">
+ <property name="visible">True</property>
+ <property name="stock">gtk-no</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label218">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Deny</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button21">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox_subscription">
+ <property name="border_width">5</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-question</property>
+ <property name="icon_size">6</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
--- /dev/null
+/* -*- 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 <xclaesse@gmail.com>
+ */
+
+#ifndef __EMPATHY_CONTACT_DIALOGS_H__
+#define __EMPATHY_CONTACT_DIALOGS_H__
+
+#include <gtk/gtk.h>
+
+#include <libempathy/gossip-contact.h>
+
+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__ */
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 */
<child>
<widget class="GtkVBox" id="vbox_contact_widget">
<property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="spacing">6</property>
<child>
<widget class="GtkHBox" id="hbox_contact">
<property name="right_padding">0</property>
<child>
- <widget class="GtkTable" id="table_contact">
+ <widget class="GtkVBox" id="vbox225">
<property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
<property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label655">
+ <widget class="GtkTable" id="table_contact">
<property name="visible">True</property>
- <property name="label" translatable="yes">Identifier:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
- <child>
- <widget class="GtkLabel" id="label658">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Alias:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkLabel" id="label655">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Identifier:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="label_id">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <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>
- <property name="y_options"></property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkLabel" id="label658">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Alias:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="label680">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Presence:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
+ <child>
+ <widget class="GtkLabel" id="label_id">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <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>
+ <property name="y_options"></property>
+ </packing>
+ </child>
</widget>
<packing>
- <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">fill</property>
- <property name="y_options"></property>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label_status">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</property>
- <property name="selectable">False</property>
+ <property name="selectable">True</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
</child>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
</packing>
</child>
</widget>
#include <libempathy/empathy-idle.h>
#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"
+++ /dev/null
-/* -*- 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 <xclaesse@gmail.com>
- */
-
-#include <config.h>
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <gtk/gtk.h>
-#include <glade/glade.h>
-#include <glib/gi18n.h>
-
-#include <libempathy/empathy-contact-manager.h>
-#include <libempathy/empathy-contact-list.h>
-
-#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);
-}
-
+++ /dev/null
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-
-<widget class="GtkDialog" id="subscription_request_dialog">
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Subscription Request</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
- <property name="modal">False</property>
- <property name="resizable">False</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
- <property name="has_separator">False</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox4">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area4">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="button19">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Decide _Later</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button20">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-9</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment3">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox48">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image8">
- <property name="visible">True</property>
- <property name="stock">gtk-no</property>
- <property name="icon_size">4</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label218">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Deny</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button21">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-8</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox46">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image6">
- <property name="visible">True</property>
- <property name="stock">gtk-yes</property>
- <property name="icon_size">4</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label216">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Accept</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox_subscription">
- <property name="border_width">5</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkImage" id="image5">
- <property name="visible">True</property>
- <property name="stock">gtk-dialog-question</property>
- <property name="icon_size">6</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-</glade-interface>
+++ /dev/null
-/* -*- 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 <xclaesse@gmail.com>
- */
-
-#ifndef __EMPATHY_SUBSCRIPTION_DIALOG_H__
-#define __EMPATHY_SUBSCRIPTION_DIALOG_H__
-
-#include <gtk/gtk.h>
-
-#include <libempathy/gossip-contact.h>
-
-G_BEGIN_DECLS
-
-void empathy_subscription_dialog_show (GossipContact *contact,
- GtkWindow *parent);
-
-G_END_DECLS
-
-#endif /* __EMPATHY_SUBSCRIPTION_DIALOG_H__ */
#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"
GossipContact *contact;
const gchar *name;
gchar *group;
+ GtkWindow *parent;
priv = GET_PRIV (view);
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);
}
}
+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
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,