#include <stdlib.h>
#include <gtk/gtk.h>
-#include <glade/glade.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <libmissioncontrol/mission-control.h>
#include <libempathy/empathy-contact-manager.h>
+#include <libempathy/empathy-account-manager.h>
#include <libempathy/empathy-contact-list.h>
#include <libempathy/empathy-utils.h>
EmpathyContactManager *manager;
EmpathyContact *contact;
- manager = empathy_contact_manager_new ();
+ manager = empathy_contact_manager_dup_singleton ();
contact = empathy_contact_widget_get_contact (contact_widget);
if (response == GTK_RESPONSE_YES) {
empathy_subscription_dialog_show (EmpathyContact *contact,
GtkWindow *parent)
{
+ GtkBuilder *gui;
GtkWidget *dialog;
GtkWidget *hbox_subscription;
GtkWidget *contact_widget;
return;
}
- filename = empathy_file_lookup ("empathy-contact-dialogs.glade",
+ filename = empathy_file_lookup ("empathy-contact-dialogs.ui",
"libempathy-gtk");
- empathy_glade_get_file_simple (filename,
- "subscription_request_dialog",
- NULL,
+ gui = empathy_builder_get_file (filename,
"subscription_request_dialog", &dialog,
"hbox_subscription", &hbox_subscription,
NULL);
g_free (filename);
+ g_object_unref (gui);
contact_widget = empathy_contact_widget_new (contact,
EMPATHY_CONTACT_WIDGET_EDIT_ALIAS |
contact_widget,
TRUE, TRUE,
0);
+ gtk_widget_show (contact_widget);
+
g_object_set_data (G_OBJECT (dialog), "contact_widget", contact_widget);
subscription_dialogs = g_list_prepend (subscription_dialogs, dialog);
flags |= EMPATHY_CONTACT_WIDGET_EDIT_GROUPS;
}
contact_widget = empathy_contact_widget_new (contact, flags);
+ gtk_container_set_border_width (GTK_CONTAINER (contact_widget), 8);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
contact_widget,
TRUE, TRUE, 0);
empathy_account_chooser_filter_is_connected,
NULL);
}
+ gtk_widget_show (contact_widget);
g_object_set_data (G_OBJECT (dialog), "contact_widget", contact_widget);
information_dialogs = g_list_prepend (information_dialogs, dialog);
can_add_contact_to_account (McAccount *account,
gpointer user_data)
{
- MissionControl *mc;
- TpConnectionStatus status;
- McProfile *profile;
- const gchar *protocol_name;
-
- mc = empathy_mission_control_new ();
- status = mission_control_get_connection_status (mc, account, NULL);
- g_object_unref (mc);
- if (status != TP_CONNECTION_STATUS_CONNECTED) {
- /* Account is disconnected */
+ EmpathyAccountManager *account_manager;
+ EmpathyContactManager *contact_manager;
+ TpConnection *connection;
+ gboolean result;
+
+ account_manager = empathy_account_manager_dup_singleton ();
+ connection = empathy_account_manager_get_connection (account_manager,
+ account);
+ if (!connection) {
+ g_object_unref (account_manager);
return FALSE;
}
- profile = mc_account_get_profile (account);
- protocol_name = mc_profile_get_protocol_name (profile);
- if (strcmp (protocol_name, "local-xmpp") == 0) {
- /* We can't add accounts to a XMPP LL connection
- * FIXME: We should inspect the flags of the contact list group interface
- */
- g_object_unref (profile);
- return FALSE;
- }
+ contact_manager = empathy_contact_manager_dup_singleton ();
+ result = empathy_contact_manager_can_add (contact_manager, connection);
+ g_object_unref (contact_manager);
+ g_object_unref (account_manager);
- g_object_unref (profile);
- return TRUE;
+ return result;
}
static void
EmpathyContactManager *manager;
EmpathyContact *contact;
- manager = empathy_contact_manager_new ();
+ manager = empathy_contact_manager_dup_singleton ();
contact = empathy_contact_widget_get_contact (contact_widget);
if (contact && response == GTK_RESPONSE_OK) {
empathy_contact_widget_set_account_filter (contact_widget,
can_add_contact_to_account,
NULL);
+ gtk_widget_show (contact_widget);
new_contact_dialog = dialog;