GtkWidget *
empathy_account_widget_groupwise_new (McAccount *account)
{
	GtkBuilder *gui;
	GtkWidget *widget;
	gchar     *filename;

	filename = empathy_file_lookup ("empathy-account-widget-groupwise.ui",
					"libempathy-gtk");
	gui = empathy_builder_get_file (filename,
					"vbox_groupwise_settings", &widget,
					NULL);
	g_free (filename);

	empathy_account_widget_handle_params (account, gui,
			"entry_id", "account",
			"entry_password", "password",
			"entry_server", "server",
			"spinbutton_port", "port",
			NULL);

	empathy_account_widget_add_forget_button (account, gui,
						  "button_forget",
						  "entry_password");

	empathy_account_widget_set_default_focus (gui,
						  "entry_id");

	return empathy_builder_unref_and_keep_widget (gui, widget);
}
GtkWidget *
empathy_account_widget_salut_new (McAccount *account)
{
	GtkBuilder *gui;
	GtkWidget *widget;
	gchar     *filename;

	filename = empathy_file_lookup ("empathy-account-widget-salut.ui",
					"libempathy-gtk");
	gui = empathy_builder_get_file (filename,
					"vbox_salut_settings", &widget,
					NULL);
	g_free (filename);

	empathy_account_widget_handle_params (account, gui,
			"entry_published", "published-name",
			"entry_nickname", "nickname",
			"entry_first_name", "first-name",
			"entry_last_name", "last-name",
			"entry_email", "email",
			"entry_jid", "jid",
			NULL);

	empathy_account_widget_set_default_focus (gui,
						  "entry_nickname");

	return empathy_builder_unref_and_keep_widget (gui, widget);
}
GtkWidget *
empathy_account_widget_yahoo_new (McAccount *account)
{
	GtkBuilder *gui;
	GtkWidget *widget;
	gchar     *filename;

	filename = empathy_file_lookup ("empathy-account-widget-yahoo.ui",
					"libempathy-gtk");
	gui = empathy_builder_get_file (filename,
					"vbox_yahoo_settings", &widget,
					NULL);
	g_free (filename);

	empathy_account_widget_handle_params (account, gui,
			"entry_id", "account",
			"entry_password", "password",
			"entry_server", "server",
			"entry_locale", "room-list-locale",
			"entry_charset", "charset",
			"spinbutton_port", "port",
			"checkbutton_yahoojp", "yahoojp",
			"checkbutton_ignore_invites", "ignore-invites",
			NULL);

	empathy_account_widget_add_forget_button (account, gui,
						  "button_forget",
						  "entry_password");

	empathy_account_widget_set_default_focus (gui,
						  "entry_id");

	return empathy_builder_unref_and_keep_widget (gui, widget);
}
Beispiel #4
0
static void
status_icon_create_menu (EmpathyStatusIcon *icon)
{
	EmpathyStatusIconPriv *priv = GET_PRIV (icon);
	GtkBuilder            *gui;
	gchar                 *filename;

	filename = empathy_file_lookup ("empathy-status-icon.ui", "src");
	gui = empathy_builder_get_file (filename,
					"ui_manager", &priv->ui_manager,
					"menu", &priv->popup_menu,
					"show_list", &priv->show_window_item,
					"new_message", &priv->new_message_item,
					"status", &priv->status_item,
				       NULL);
	g_free (filename);

	empathy_builder_connect (gui, icon,
			      "show_list", "toggled", status_icon_show_hide_window_cb,
			      "new_message", "activate", status_icon_new_message_cb,
			      "new_call", "activate", status_icon_new_call_cb,
			      "quit", "activate", status_icon_quit_cb,
			      NULL);

	g_object_ref (priv->ui_manager);
	g_object_unref (gui);
}
static void
account_widget_build_yahoo (EmpathyAccountWidget *self,
    const char *filename)
{
  EmpathyAccountWidgetPriv *priv = GET_PRIV (self);

  if (priv->simple)
    {
      self->ui_details->gui = empathy_builder_get_file (filename,
          "vbox_yahoo_simple", &self->ui_details->widget,
          NULL);

      empathy_account_widget_handle_params (self,
          "entry_id_simple", "account",
          "entry_password_simple", "password",
          NULL);

      self->ui_details->default_focus = g_strdup ("entry_id_simple");
    }
  else
    {
      self->ui_details->gui = empathy_builder_get_file (filename,
          "table_common_settings", &priv->table_common_settings,
          "vbox_yahoo_settings", &self->ui_details->widget,
          NULL);

      empathy_account_widget_handle_params (self,
          "entry_id", "account",
          "entry_password", "password",
          "entry_server", "server",
          "entry_locale", "room-list-locale",
          "entry_charset", "charset",
          "spinbutton_port", "port",
          "checkbutton_yahoojp", "yahoojp",
          "checkbutton_ignore_invites", "ignore-invites",
          NULL);

      self->ui_details->default_focus = g_strdup ("entry_id");
      self->ui_details->add_forget = TRUE;
    }
}
void
empathy_subscription_dialog_show (EmpathyContact *contact,
				  GtkWindow     *parent)
{
	GtkBuilder *gui;
	GtkWidget *dialog;
	GtkWidget *hbox_subscription;
	GtkWidget *contact_widget;
	GList     *l;
	gchar     *filename;

	g_return_if_fail (EMPATHY_IS_CONTACT (contact));

	l = g_list_find_custom (subscription_dialogs,
				contact,
				(GCompareFunc) contact_dialogs_find);
	if (l) {
		gtk_window_present (GTK_WINDOW (l->data));
		return;
	}

	filename = empathy_file_lookup ("empathy-contact-dialogs.ui",
					"libempathy-gtk");
	gui = empathy_builder_get_file (filename,
				      "subscription_request_dialog", &dialog,
				      "hbox_subscription", &hbox_subscription,
				      NULL);
	g_free (filename);
	g_object_unref (gui);

	/* Contact info widget */
	contact_widget = empathy_contact_widget_new (contact,
						     EMPATHY_CONTACT_WIDGET_EDIT_ALIAS |
						     EMPATHY_CONTACT_WIDGET_EDIT_GROUPS);
	gtk_box_pack_end (GTK_BOX (hbox_subscription),
			  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);

	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);
}
static void
account_widget_build_icq (EmpathyAccountWidget *self,
    const char *filename)
{
  EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
  GtkWidget *spinbutton_port;

  if (priv->simple)
    {
      self->ui_details->gui = empathy_builder_get_file (filename,
          "vbox_icq_simple", &self->ui_details->widget,
          NULL);

      empathy_account_widget_handle_params (self,
          "entry_uin_simple", "account",
          "entry_password_simple", "password",
          NULL);

      self->ui_details->default_focus = g_strdup ("entry_uin_simple");
    }
  else
    {
      self->ui_details->gui = empathy_builder_get_file (filename,
          "table_common_settings", &priv->table_common_settings,
          "vbox_icq_settings", &self->ui_details->widget,
          "spinbutton_port", &spinbutton_port,
          NULL);

      empathy_account_widget_handle_params (self,
          "entry_uin", "account",
          "entry_password", "password",
          "entry_server", "server",
          "spinbutton_port", "port",
          "entry_charset", "charset",
          NULL);

      self->ui_details->default_focus = g_strdup ("entry_uin");
      self->ui_details->add_forget = TRUE;
    }
}
/**
 * empathy_account_widget_sip_new:
 * @account: the #McAccount to configure
 *
 * Creates a new SIP account widget to configure a given #McAccount
 *
 * Returns: The toplevel container of the configuration widget
 */
GtkWidget *
empathy_account_widget_sip_new (McAccount *account)
{
  EmpathyAccountWidgetSip *settings;
  GtkBuilder *gui;
  gchar *filename;

  settings = g_slice_new0 (EmpathyAccountWidgetSip);
  settings->account = g_object_ref (account);

  filename = empathy_file_lookup ("empathy-account-widget-sip.ui",
      "libempathy-gtk");
  gui = empathy_builder_get_file (filename,
      "vbox_sip_settings", &settings->vbox_settings,
      "entry_stun-server", &settings->entry_stun_server,
      "spinbutton_stun-port", &settings->spinbutton_stun_part,
      "checkbutton_discover-stun", &settings->checkbutton_discover_stun,
      NULL);
  g_free (filename);

  empathy_account_widget_handle_params (account, gui,
      "entry_userid", "account",
      "entry_password", "password",
      "checkbutton_discover-stun", "discover-stun",
      "entry_stun-server", "stun-server",
      "spinbutton_stun-port", "stun-port",
      NULL);

  empathy_account_widget_add_forget_button (account, gui,
                                            "button_forget",
                                            "entry_password");

  account_widget_sip_discover_stun_toggled_cb (settings->checkbutton_discover_stun,
                                               settings);

  empathy_builder_connect (gui, settings,
      "vbox_sip_settings", "destroy", account_widget_sip_destroy_cb,
      "checkbutton_discover-stun", "toggled", account_widget_sip_discover_stun_toggled_cb,
      NULL);

  empathy_account_widget_set_default_focus (gui, "entry_userid");

  return empathy_builder_unref_and_keep_widget (gui, settings->vbox_settings);
}
GtkWidget *
empathy_account_widget_jabber_new (McAccount *account)
{
	GtkBuilder *gui;
	GtkWidget *widget;
	GtkWidget *spinbutton_port;
	GtkWidget *checkbutton_ssl;
	gchar     *filename;

	filename = empathy_file_lookup ("empathy-account-widget-jabber.ui",
					"libempathy-gtk");
	gui = empathy_builder_get_file (filename,
				        "vbox_jabber_settings", &widget,
				        "spinbutton_port", &spinbutton_port,
				        "checkbutton_ssl", &checkbutton_ssl,
				        NULL);
	g_free (filename);

	empathy_account_widget_handle_params (account, gui,
			"entry_id", "account",
			"entry_password", "password",
			"entry_resource", "resource",
			"entry_server", "server",
			"spinbutton_port", "port",
			"spinbutton_priority", "priority",
			"checkbutton_ssl", "old-ssl",
			"checkbutton_ignore_ssl_errors", "ignore-ssl-errors",
			"checkbutton_encryption", "require-encryption",
			NULL);

	empathy_account_widget_add_forget_button (account, gui,
						  "button_forget",
						  "entry_password");

	empathy_account_widget_set_default_focus (gui,
						  "entry_id");

	g_signal_connect (checkbutton_ssl, "toggled",
			  G_CALLBACK (account_widget_jabber_ssl_toggled_cb),
			  spinbutton_port);

	return empathy_builder_unref_and_keep_widget (gui, widget);
}
Beispiel #10
0
static void
empathy_search_bar_init (EmpathySearchBar * self)
{
  gchar *filename;
  GtkBuilder *gui;
  GtkWidget *internal;
  EmpathySearchBarPriv *priv;

  priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EMPATHY_TYPE_SEARCH_BAR,
      EmpathySearchBarPriv);

  self->priv = priv;

  filename = empathy_file_lookup ("empathy-search-bar.ui", "libempathy-gtk");
  gui = empathy_builder_get_file (filename,
      "search_widget", &internal,
      "search_close", &priv->search_close,
      "search_entry", &priv->search_entry,
      "search_previous", &priv->search_previous,
      "search_next", &priv->search_next,
      "search_not_found", &priv->search_not_found,
      "search_match_case", &priv->search_match_case,
      NULL);
  g_free (filename);

  /* Add the signals */
  empathy_builder_connect (gui, self,
      "search_close", "clicked", empathy_search_bar_close_cb,
      "search_entry", "changed", empathy_search_bar_entry_changed,
      "search_previous", "clicked", empathy_search_bar_previous_cb,
      "search_next", "clicked", empathy_search_bar_next_cb,
      "search_match_case", "toggled", empathy_search_bar_match_case_toggled,
      NULL);

  g_signal_connect (G_OBJECT (self), "key-press-event",
      G_CALLBACK (empathy_search_bar_key_pressed), NULL);

  gtk_container_add (GTK_CONTAINER (self), internal);
  gtk_widget_show_all (internal);
  gtk_widget_hide (priv->search_not_found);
  g_object_unref (gui);
}
EmpathyIrcNetworkChooser *
empathy_account_widget_irc_build_simple (EmpathyAccountWidget *self,
    const char *filename)
{
  EmpathyAccountWidgetIrc *settings;
  EmpathyAccountSettings *ac_settings;
  GtkAlignment *alignment;

  settings = g_slice_new0 (EmpathyAccountWidgetIrc);
  settings->self = self;

  self->ui_details->gui = empathy_builder_get_file (filename,
      "vbox_irc_simple", &self->ui_details->widget,
      "alignment_network_simple", &alignment,
      NULL);

  /* Add network chooser button */
  g_object_get (settings->self, "settings", &ac_settings, NULL);

  settings->network_chooser = empathy_irc_network_chooser_new (ac_settings);

  g_signal_connect (settings->network_chooser, "changed",
      G_CALLBACK (network_changed_cb), settings);

  gtk_container_add (GTK_CONTAINER (alignment), settings->network_chooser);

  gtk_widget_show (settings->network_chooser);

  empathy_account_widget_handle_params (self,
      "entry_nick_simple", "account",
      NULL);

  empathy_builder_connect (self->ui_details->gui, settings,
      "vbox_irc_simple", "destroy", account_widget_irc_destroy_cb,
      NULL);

  self->ui_details->default_focus = g_strdup ("entry_nick_simple");

  g_object_unref (ac_settings);

  return EMPATHY_IRC_NETWORK_CHOOSER (settings->network_chooser);
}
static void
account_widget_build_salut (EmpathyAccountWidget *self,
    const char *filename)
{
  EmpathyAccountWidgetPriv *priv = GET_PRIV (self);

  self->ui_details->gui = empathy_builder_get_file (filename,
      "table_common_settings", &priv->table_common_settings,
      "vbox_salut_settings", &self->ui_details->widget,
      NULL);

  empathy_account_widget_handle_params (self,
      "entry_published", "published-name",
      "entry_nickname", "nickname",
      "entry_first_name", "first-name",
      "entry_last_name", "last-name",
      "entry_email", "email",
      "entry_jid", "jid",
      NULL);

  self->ui_details->default_focus = g_strdup ("entry_nickname");
}
static void
do_constructed (GObject *obj)
{
  EmpathyImportWidget *self = EMPATHY_IMPORT_WIDGET (obj);
  EmpathyImportWidgetPriv *priv = GET_PRIV (self);
  GtkBuilder *gui;
  gchar *filename;

  filename = empathy_file_lookup ("empathy-import-dialog.ui", "src");
  gui = empathy_builder_get_file (filename,
      "widget_vbox", &priv->vbox,
      "treeview", &priv->treeview,
      NULL);

  g_free (filename);
  empathy_builder_unref_and_keep_widget (gui, priv->vbox);

  g_signal_connect (priv->vbox, "destroy",
      G_CALLBACK (import_widget_destroy_cb), self);

  empathy_connection_managers_prepare_async (priv->cms,
      import_widget_cms_prepare_cb, self);
}
static void
account_widget_build_generic (EmpathyAccountWidget *self,
    const char *filename)
{
  EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
  GtkWidget *expander_advanced;

  self->ui_details->gui = empathy_builder_get_file (filename,
      "table_common_settings", &priv->table_common_settings,
      "vbox_generic_settings", &self->ui_details->widget,
      "expander_advanced_settings", &expander_advanced,
      NULL);

  if (priv->simple)
    gtk_widget_hide (expander_advanced);

  g_object_ref (self->ui_details->gui);

  if (empathy_account_settings_is_ready (priv->settings))
    account_widget_setup_generic (self);
  else
    g_signal_connect (priv->settings, "notify::ready",
        G_CALLBACK (account_widget_settings_ready_cb), self);
}
GtkWidget *
empathy_account_widget_generic_new (McAccount *account)
{
	GtkBuilder *gui;
	GtkWidget *widget;
	GtkWidget *table_common_settings;
	GtkWidget *table_advanced_settings;
	gchar     *filename;

	g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);

	filename = empathy_file_lookup ("empathy-account-widget-generic.ui",
					"libempathy-gtk");
	gui = empathy_builder_get_file (filename,
					"vbox_generic_settings", &widget,
					"table_common_settings", &table_common_settings,
					"table_advanced_settings", &table_advanced_settings,
					NULL);
	g_free (filename);

	accounts_widget_generic_setup (account, table_common_settings, table_advanced_settings);

	return empathy_builder_unref_and_keep_widget (gui, widget);
}
/**
 * empathy_contact_widget_new:
 * @contact: an #EmpathyContact
 * @flags: #EmpathyContactWidgetFlags for the new contact widget
 *
 * Creates a new #EmpathyContactWidget.
 *
 * Return value: a new #EmpathyContactWidget
 */
GtkWidget *
empathy_contact_widget_new (EmpathyContact *contact,
                            EmpathyContactWidgetFlags flags)
{
  EmpathyContactWidget *information;
  GtkBuilder *gui;
  gchar *filename;

  g_return_val_if_fail (contact == NULL || EMPATHY_IS_CONTACT (contact), NULL);

  information = g_slice_new0 (EmpathyContactWidget);
  information->flags = flags;

  filename = empathy_file_lookup ("empathy-contact-widget.ui",
      "libempathy-gtk");
  gui = empathy_builder_get_file (filename,
       "vbox_contact_widget", &information->vbox_contact_widget,
       "vbox_contact", &information->vbox_contact,
       "hbox_presence", &information->hbox_presence,
       "label_alias", &information->label_alias,
       "image_state", &information->image_state,
       "label_status", &information->label_status,
       "table_contact", &information->table_contact,
       "vbox_avatar", &information->vbox_avatar,
       "vbox_location", &information->vbox_location,
       "subvbox_location", &information->subvbox_location,
       "label_location", &information->label_location,
#if HAVE_LIBCHAMPLAIN
       "viewport_map", &information->viewport_map,
#endif
       "vbox_groups", &information->vbox_groups,
       "entry_group", &information->entry_group,
       "button_group", &information->button_group,
       "treeview_groups", &information->treeview_groups,
       "vbox_details", &information->vbox_details,
       "table_details", &information->table_details,
       "hbox_details_requested", &information->hbox_details_requested,
       "vbox_client", &information->vbox_client,
       "table_client", &information->table_client,
       "hbox_client_requested", &information->hbox_client_requested,
       NULL);
  g_free (filename);

  empathy_builder_connect (gui, information,
      "vbox_contact_widget", "destroy", contact_widget_destroy_cb,
      "entry_group", "changed", contact_widget_entry_group_changed_cb,
      "entry_group", "activate", contact_widget_entry_group_activate_cb,
      "button_group", "clicked", contact_widget_button_group_clicked_cb,
      NULL);
  information->table_location = NULL;

  g_object_set_data (G_OBJECT (information->vbox_contact_widget),
      "EmpathyContactWidget",
      information);

  /* Create widgets */
  contact_widget_contact_setup (information);
  contact_widget_groups_setup (information);
  contact_widget_details_setup (information);
  contact_widget_client_setup (information);

  if (contact != NULL)
    contact_widget_set_contact (information, contact);

  else if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT ||
      information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID)
    contact_widget_change_contact (information);

  return empathy_builder_unref_and_keep_widget (gui,
    information->vbox_contact_widget);
}
Beispiel #17
0
GtkWidget *
empathy_log_window_show (EmpathyAccount   *account,
			const gchar *chat_id,
			gboolean     is_chatroom,
			GtkWindow   *parent)
{
	static EmpathyLogWindow *window = NULL;
	EmpathyAccountChooser   *account_chooser;
	EmpathyAccountManager  *account_manager;
	gint                    account_num;
	GtkBuilder             *gui;
	gchar                  *filename;

	if (window) {
		gtk_window_present (GTK_WINDOW (window->window));

		if (account && chat_id) {
			gtk_notebook_set_current_page (GTK_NOTEBOOK (window->notebook), 1);
			log_window_chats_set_selected (window, account,
						       chat_id, is_chatroom);
		}

		return window->window;
	}

	window = g_new0 (EmpathyLogWindow, 1);
	window->log_manager = empathy_log_manager_dup_singleton ();

	filename = empathy_file_lookup ("empathy-log-window.ui",
					"libempathy-gtk");
	gui = empathy_builder_get_file (filename,
				       "log_window", &window->window,
				       "notebook", &window->notebook,
				       "entry_find", &window->entry_find,
				       "button_find", &window->button_find,
				       "treeview_find", &window->treeview_find,
				       "scrolledwindow_find", &window->scrolledwindow_find,
				       "button_previous", &window->button_previous,
				       "button_next", &window->button_next,
				       "entry_chats", &window->entry_chats,
				       "calendar_chats", &window->calendar_chats,
				       "vbox_chats", &window->vbox_chats,
				       "treeview_chats", &window->treeview_chats,
				       "scrolledwindow_chats", &window->scrolledwindow_chats,
				       NULL);
	g_free (filename);

	empathy_builder_connect (gui, window,
			      "log_window", "destroy", log_window_destroy_cb,
			      "entry_find", "changed", log_window_entry_find_changed_cb,
			      "button_previous", "clicked", log_window_button_previous_clicked_cb,
			      "button_next", "clicked", log_window_button_next_clicked_cb,
			      "button_find", "clicked", log_window_button_find_clicked_cb,
			      "entry_chats", "changed", log_window_entry_chats_changed_cb,
			      "entry_chats", "activate", log_window_entry_chats_activate_cb,
			      NULL);

	g_object_unref (gui);

	g_object_add_weak_pointer (G_OBJECT (window->window),
				   (gpointer) &window);

	/* We set this up here so we can block it when needed. */
	g_signal_connect (window->calendar_chats, "day-selected",
			  G_CALLBACK (log_window_calendar_chats_day_selected_cb),
			  window);
	g_signal_connect (window->calendar_chats, "month-changed",
			  G_CALLBACK (log_window_calendar_chats_month_changed_cb),
			  window);

	/* Configure Search EmpathyChatView */
	window->chatview_find = empathy_theme_manager_create_view (empathy_theme_manager_get ());
	gtk_container_add (GTK_CONTAINER (window->scrolledwindow_find),
			   GTK_WIDGET (window->chatview_find));
	gtk_widget_show (GTK_WIDGET (window->chatview_find));

	/* Configure Contacts EmpathyChatView */
	window->chatview_chats = empathy_theme_manager_create_view (empathy_theme_manager_get ());
	gtk_container_add (GTK_CONTAINER (window->scrolledwindow_chats),
			   GTK_WIDGET (window->chatview_chats));
	gtk_widget_show (GTK_WIDGET (window->chatview_chats));

	/* Account chooser for chats */
	window->account_chooser_chats = empathy_account_chooser_new ();
	account_chooser = EMPATHY_ACCOUNT_CHOOSER (window->account_chooser_chats);

	gtk_box_pack_start (GTK_BOX (window->vbox_chats),
			    window->account_chooser_chats,
			    FALSE, TRUE, 0);

	g_signal_connect (window->account_chooser_chats, "changed",
			  G_CALLBACK (log_window_chats_accounts_changed_cb),
			  window);

	/* Populate */
	account_manager = empathy_account_manager_dup_singleton ();
	account_num = empathy_account_manager_get_count (account_manager);
	g_object_unref (account_manager);

	if (account_num > 1) {
		gtk_widget_show (window->vbox_chats);
		gtk_widget_show (window->account_chooser_chats);
	} else {
		gtk_widget_hide (window->vbox_chats);
		gtk_widget_hide (window->account_chooser_chats);
	}

	/* Search List */
	log_window_find_setup (window);

	/* Contacts */
	log_window_chats_setup (window);
	log_window_chats_populate (window);

	/* Select chat */
	if (account && chat_id) {
		gtk_notebook_set_current_page (GTK_NOTEBOOK (window->notebook), 1);
		log_window_chats_set_selected (window, account,
					       chat_id, is_chatroom);
	}

	if (parent) {
		gtk_window_set_transient_for (GTK_WINDOW (window->window),
					      GTK_WINDOW (parent));
	}

	gtk_widget_show (window->window);

	return window->window;
}
void
empathy_account_widget_irc_build (EmpathyAccountWidget *self,
    const char *filename,
    GtkWidget **table_common_settings)
{
  EmpathyAccountWidgetIrc *settings;
  gchar *dir, *user_file_with_path, *global_file_with_path;
  GtkListStore *store;
  GtkCellRenderer *renderer;

  settings = g_slice_new0 (EmpathyAccountWidgetIrc);
  settings->self = self;

  dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
  g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
  user_file_with_path = g_build_filename (dir, IRC_NETWORKS_FILENAME, NULL);
  g_free (dir);

  global_file_with_path = g_build_filename (g_getenv ("EMPATHY_SRCDIR"),
      "libempathy-gtk", IRC_NETWORKS_FILENAME, NULL);
  if (!g_file_test (global_file_with_path, G_FILE_TEST_EXISTS))
    {
      g_free (global_file_with_path);
      global_file_with_path = g_build_filename (DATADIR, "empathy",
          IRC_NETWORKS_FILENAME, NULL);
    }

  settings->network_manager = empathy_irc_network_manager_new (
      global_file_with_path,
      user_file_with_path);

  g_free (global_file_with_path);
  g_free (user_file_with_path);

  self->ui_details->gui = empathy_builder_get_file (filename,
      "table_irc_settings", table_common_settings,
      "vbox_irc", &self->ui_details->widget,
      "table_irc_settings", &settings->vbox_settings,
      "combobox_network", &settings->combobox_network,
      NULL);

  /* Fill the networks combobox */
  store = gtk_list_store_new (2, G_TYPE_OBJECT, G_TYPE_STRING);

  gtk_cell_layout_clear (GTK_CELL_LAYOUT (settings->combobox_network));
  renderer = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (settings->combobox_network),
      renderer, TRUE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (settings->combobox_network),
      renderer,
      "text", COL_NETWORK_NAME,
      NULL);

  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
      COL_NETWORK_NAME,
      GTK_SORT_ASCENDING);

  gtk_combo_box_set_model (GTK_COMBO_BOX (settings->combobox_network),
      GTK_TREE_MODEL (store));
  g_object_unref (store);

  account_widget_irc_setup (settings);

  empathy_account_widget_handle_params (self,
      "entry_nick", "account",
      "entry_fullname", "fullname",
      "entry_password", "password",
      "entry_quit_message", "quit-message",
      NULL);

  empathy_builder_connect (self->ui_details->gui, settings,
      "table_irc_settings", "destroy", account_widget_irc_destroy_cb,
      "button_network", "clicked",
          account_widget_irc_button_edit_network_clicked_cb,
      "button_add_network", "clicked",
          account_widget_irc_button_add_network_clicked_cb,
      "button_remove_network", "clicked",
          account_widget_irc_button_remove_clicked_cb,
      "combobox_network", "changed",
          account_widget_irc_combobox_network_changed_cb,
      NULL);

  self->ui_details->default_focus = g_strdup ("entry_nick");
}
Beispiel #19
0
void
empathy_chatrooms_window_show (GtkWindow *parent)
{
    static EmpathyChatroomsWindow *window = NULL;
    GtkBuilder                    *gui;
    gchar                         *filename;

    if (window) {
        gtk_window_present (GTK_WINDOW (window->window));
        return;
    }

    window = g_new0 (EmpathyChatroomsWindow, 1);

    filename = empathy_file_lookup ("empathy-chatrooms-window.ui", "src");
    gui = empathy_builder_get_file (filename,
                                    "chatrooms_window", &window->window,
                                    "hbox_account", &window->hbox_account,
                                    "label_account", &window->label_account,
                                    "treeview", &window->treeview,
                                    "button_remove", &window->button_remove,
                                    "button_close", &window->button_close,
                                    NULL);
    g_free (filename);

    empathy_builder_connect (gui, window,
                             "chatrooms_window", "destroy", chatrooms_window_destroy_cb,
                             "button_remove", "clicked", chatrooms_window_button_remove_clicked_cb,
                             "button_close", "clicked", chatrooms_window_button_close_clicked_cb,
                             NULL);

    g_object_unref (gui);

    g_object_add_weak_pointer (G_OBJECT (window->window), (gpointer) &window);

    /* Get the session and chat room manager */
    window->manager = empathy_chatroom_manager_dup_singleton (NULL);

    g_signal_connect (window->manager, "chatroom-added",
                      G_CALLBACK (chatrooms_window_chatroom_added_cb),
                      window);
    g_signal_connect (window->manager, "chatroom-removed",
                      G_CALLBACK (chatrooms_window_chatroom_removed_cb),
                      window);

    /* Account chooser for chat rooms */
    window->account_chooser = empathy_account_chooser_new ();
    empathy_account_chooser_set_filter (EMPATHY_ACCOUNT_CHOOSER (window->account_chooser),
                                        empathy_account_chooser_filter_is_connected,
                                        NULL);
    g_object_set (window->account_chooser,
                  "has-all-option", TRUE,
                  NULL);
    empathy_account_chooser_set_account (EMPATHY_ACCOUNT_CHOOSER (window->account_chooser), NULL);

    gtk_box_pack_start (GTK_BOX (window->hbox_account),
                        window->account_chooser,
                        TRUE, TRUE, 0);

    g_signal_connect (window->account_chooser, "changed",
                      G_CALLBACK (chatrooms_window_account_changed_cb),
                      window);

    gtk_widget_show (window->account_chooser);

    /* Set up chatrooms */
    chatrooms_window_model_setup (window);

    /* Set focus */
    gtk_widget_grab_focus (window->treeview);

    /* Last touches */
    if (parent) {
        gtk_window_set_transient_for (GTK_WINDOW (window->window),
                                      GTK_WINDOW (parent));
    }

    gtk_widget_show (window->window);
}
static void
empathy_preferences_init (EmpathyPreferences *preferences)
{
	EmpathyPreferencesPriv    *priv;
	GtkBuilder                *gui;
	gchar                     *filename;
	GtkWidget                 *page;

	priv = preferences->priv = G_TYPE_INSTANCE_GET_PRIVATE (preferences,
			EMPATHY_TYPE_PREFERENCES, EmpathyPreferencesPriv);

	gtk_dialog_add_button (GTK_DIALOG (preferences),
			       GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);

	gtk_container_set_border_width (GTK_CONTAINER (preferences), 5);
	gtk_window_set_title (GTK_WINDOW (preferences), _("Preferences"));
	gtk_window_set_role (GTK_WINDOW (preferences), "preferences");
	gtk_window_set_position (GTK_WINDOW (preferences),
				 GTK_WIN_POS_CENTER_ON_PARENT);
	gtk_window_set_icon_name (GTK_WINDOW (preferences), "gtk-preferences");

	filename = empathy_file_lookup ("empathy-preferences.ui", "src");
	gui = empathy_builder_get_file (filename,
		"notebook", &priv->notebook,
		"checkbutton_show_smileys", &priv->checkbutton_show_smileys,
		"checkbutton_show_contacts_in_rooms", &priv->checkbutton_show_contacts_in_rooms,
		"vbox_chat_theme", &priv->vbox_chat_theme,
		"combobox_chat_theme", &priv->combobox_chat_theme,
		"combobox_chat_theme_variant", &priv->combobox_chat_theme_variant,
		"hbox_chat_theme_variant", &priv->hbox_chat_theme_variant,
		"sw_chat_theme_preview", &priv->sw_chat_theme_preview,
		"radiobutton_chats_new_windows", &priv->radiobutton_chats_new_windows,
		"checkbutton_events_notif_area", &priv->checkbutton_events_notif_area,
		"checkbutton_autoconnect", &priv->checkbutton_autoconnect,
		"checkbutton_logging", &priv->checkbutton_logging,
		"checkbutton_notifications_enabled", &priv->checkbutton_notifications_enabled,
		"checkbutton_notifications_disabled_away", &priv->checkbutton_notifications_disabled_away,
		"checkbutton_notifications_focus", &priv->checkbutton_notifications_focus,
		"checkbutton_notifications_contact_signin", &priv->checkbutton_notifications_contact_signin,
		"checkbutton_notifications_contact_signout", &priv->checkbutton_notifications_contact_signout,
		"checkbutton_sounds_enabled", &priv->checkbutton_sounds_enabled,
		"checkbutton_sounds_disabled_away", &priv->checkbutton_sounds_disabled_away,
		"treeview_sounds", &priv->treeview_sounds,
		"treeview_spell_checker", &priv->treeview_spell_checker,
		"checkbutton_location_publish", &priv->checkbutton_location_publish,
		"checkbutton_location_reduce_accuracy", &priv->checkbutton_location_reduce_accuracy,
		"checkbutton_location_resource_network", &priv->checkbutton_location_resource_network,
		"checkbutton_location_resource_cell", &priv->checkbutton_location_resource_cell,
		"checkbutton_location_resource_gps", &priv->checkbutton_location_resource_gps,
		"call_echo_cancellation", &priv->echo_cancellation,
		NULL);
	g_free (filename);

	gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (preferences))), priv->notebook);
	gtk_widget_show (priv->notebook);

	g_object_unref (gui);

	priv->gsettings = g_settings_new (EMPATHY_PREFS_SCHEMA);
	priv->gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);
	priv->gsettings_call = g_settings_new (EMPATHY_PREFS_CALL_SCHEMA);
	priv->gsettings_loc = g_settings_new (EMPATHY_PREFS_LOCATION_SCHEMA);
	priv->gsettings_notify = g_settings_new (EMPATHY_PREFS_NOTIFICATIONS_SCHEMA);
	priv->gsettings_sound = g_settings_new (EMPATHY_PREFS_SOUNDS_SCHEMA);
	priv->gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
	priv->gsettings_logger = g_settings_new (EMPATHY_PREFS_LOGGER_SCHEMA);

	/* Create chat theme preview, and track changes */
	priv->theme_manager = empathy_theme_manager_dup_singleton ();
	tp_g_signal_connect_object (priv->theme_manager, "theme-changed",
			  G_CALLBACK (preferences_preview_theme_changed_cb),
			  preferences, 0);
	preferences_preview_theme_changed_cb (priv->theme_manager, preferences);

	preferences_themes_setup (preferences);

	preferences_setup_widgets (preferences);

	preferences_languages_setup (preferences);
	preferences_languages_add (preferences);
	preferences_languages_load (preferences);

	preferences_sound_setup (preferences);
	preferences_sound_load (preferences);

	if (empathy_spell_supported ()) {
		page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (priv->notebook), EMPATHY_PREFERENCES_TAB_SPELL);
		gtk_widget_show (page);
	}

	page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (priv->notebook), EMPATHY_PREFERENCES_TAB_LOCATION);
#ifdef HAVE_GEOCLUE
	gtk_widget_show (page);
#else
	gtk_widget_hide (page);
#endif
}
Beispiel #21
0
static void
ft_manager_build_ui (EmpathyFTManager *manager)
{
  GtkBuilder *gui;
  gint x, y, w, h;
  GtkTreeView *view;
  GtkListStore *liststore;
  GtkTreeViewColumn *column;
  GtkCellRenderer *renderer;
  GtkTreeSelection *selection;
  gchar *filename;
  EmpathyFTManagerPriv *priv = GET_PRIV (manager);

  filename = empathy_file_lookup ("empathy-ft-manager.ui", "src");
  gui = empathy_builder_get_file (filename,
      "ft_manager_dialog", &priv->window,
      "ft_list", &priv->treeview,
      "clear_button", &priv->clear_button,
      "open_button", &priv->open_button,
      "abort_button", &priv->abort_button,
      NULL);
  g_free (filename);

  empathy_builder_connect (gui, manager,
      "ft_manager_dialog", "destroy", ft_manager_destroy_cb,
      "ft_manager_dialog", "response", ft_manager_response_cb,
      "ft_manager_dialog", "delete-event", ft_manager_delete_event_cb,
      "ft_manager_dialog", "configure-event", ft_manager_configure_event_cb,
      NULL);

  empathy_builder_unref_and_keep_widget (gui, priv->window);

  /* Window geometry. */
  empathy_geometry_load ("ft-manager", &x, &y, &w, &h);

  if (x >= 0 && y >= 0)
    {
      /* Let the window manager position it if we don't have
       * good x, y coordinates. */
      gtk_window_move (GTK_WINDOW (priv->window), x, y);
    }

  if (w > 0 && h > 0)
    {
      /* Use the defaults from the ui file if we don't have
       * good w, h geometry. */
      gtk_window_resize (GTK_WINDOW (priv->window), w, h);
    }

  /* Setup the tree view */
  view = GTK_TREE_VIEW (priv->treeview);
  selection = gtk_tree_view_get_selection (view);
  gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
  g_signal_connect (selection, "changed",
      G_CALLBACK (ft_manager_selection_changed), manager);
  gtk_tree_view_set_headers_visible (view, TRUE);
  gtk_tree_view_set_enable_search (view, FALSE);

  /* Setup the model */
  liststore = gtk_list_store_new (5,
      G_TYPE_INT,     /* percent */
      G_TYPE_ICON,    /* icon */
      G_TYPE_STRING,  /* message */
      G_TYPE_STRING,  /* remaining */
      G_TYPE_OBJECT); /* ft_handler */
  gtk_tree_view_set_model (view, GTK_TREE_MODEL (liststore));
  priv->model = GTK_TREE_MODEL (liststore);
  g_object_unref (liststore);

  /* Progress column */
  column = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (column, _("%"));
  gtk_tree_view_column_set_sort_column_id (column, COL_PERCENT);
  gtk_tree_view_insert_column (view, column, -1);

  renderer = gtk_cell_renderer_progress_new ();
  g_object_set (renderer, "xalign", 0.5, NULL);
  gtk_tree_view_column_pack_start (column, renderer, FALSE);
  gtk_tree_view_column_set_cell_data_func (column, renderer,
      ft_manager_progress_cell_data_func, NULL, NULL);

  /* Icon and filename column*/
  column = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (column, _("File"));
  gtk_tree_view_column_set_expand (column, TRUE);
  gtk_tree_view_column_set_resizable (column, TRUE);
  gtk_tree_view_column_set_sort_column_id (column, COL_MESSAGE);
  gtk_tree_view_column_set_spacing (column, 3);
  gtk_tree_view_insert_column (view, column, -1);

  renderer = gtk_cell_renderer_pixbuf_new ();
  g_object_set (renderer, "xpad", 3,
      "stock-size", GTK_ICON_SIZE_DND, NULL);
  gtk_tree_view_column_pack_start (column, renderer, FALSE);
  gtk_tree_view_column_set_attributes (column, renderer,
      "gicon", COL_ICON, NULL);

  renderer = gtk_cell_renderer_text_new ();
  g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
  gtk_tree_view_column_pack_start (column, renderer, TRUE);
  gtk_tree_view_column_set_attributes (column, renderer,
      "text", COL_MESSAGE, NULL);

  /* Remaining time column */
  column = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (column, _("Remaining"));
  gtk_tree_view_column_set_sort_column_id (column, COL_REMAINING);
  gtk_tree_view_insert_column (view, column, -1);

  renderer = gtk_cell_renderer_text_new ();
  g_object_set (renderer, "xalign", 0.5, NULL);
  gtk_tree_view_column_pack_start (column, renderer, FALSE);
  gtk_tree_view_column_set_attributes (column, renderer,
      "text", COL_REMAINING, NULL);

  /* clear button should be sensitive only if there are completed/cancelled
   * handlers in the store.
   */
  gtk_widget_set_sensitive (priv->clear_button, FALSE);
}
Beispiel #22
0
GtkWidget *
empathy_main_window_show (void)
{
	EmpathyMainWindow        *window;
	EmpathyContactList       *list_iface;
	EmpathyContactMonitor    *monitor;
	GtkBuilder               *gui;
	EmpathyConf              *conf;
	GtkWidget                *sw;
	GtkToggleAction          *show_offline_widget;
	GtkWidget                *ebox;
	GtkAction                *show_map_widget;
	GtkToolItem              *item;
	gboolean                  show_offline;
	gchar                    *filename;
	GSList                   *l;

	if (main_window) {
		empathy_window_present (GTK_WINDOW (main_window->window));
		return main_window->window;
	}

	main_window = g_new0 (EmpathyMainWindow, 1);
	window = main_window;

	/* Set up interface */
	filename = empathy_file_lookup ("empathy-main-window.ui", "src");
	gui = empathy_builder_get_file (filename,
				       "main_window", &window->window,
				       "main_vbox", &window->main_vbox,
				       "errors_vbox", &window->errors_vbox,
				       "ui_manager", &window->ui_manager,
				       "view_show_offline", &show_offline_widget,
				       "view_show_protocols", &window->show_protocols,
				       "view_sort_by_name", &window->sort_by_name,
				       "view_sort_by_status", &window->sort_by_status,
				       "view_normal_size_with_avatars", &window->normal_with_avatars,
				       "view_normal_size", &window->normal_size,
				       "view_compact_size", &window->compact_size,
				       "view_history", &window->view_history,
				       "view_show_map", &show_map_widget,
				       "room_join_favorites", &window->room_join_favorites,
				       "presence_toolbar", &window->presence_toolbar,
				       "roster_scrolledwindow", &sw,
				       NULL);
	g_free (filename);

	empathy_builder_connect (gui, window,
			      "main_window", "destroy", main_window_destroy_cb,
			      "main_window", "key-press-event", main_window_key_press_event_cb,
			      "chat_quit", "activate", main_window_chat_quit_cb,
			      "chat_new_message", "activate", main_window_chat_new_message_cb,
			      "chat_new_call", "activate", main_window_chat_new_call_cb,
			      "view_history", "activate", main_window_view_history_cb,
			      "room_join_new", "activate", main_window_room_join_new_cb,
			      "room_join_favorites", "activate", main_window_room_join_favorites_cb,
			      "room_manage_favorites", "activate", main_window_room_manage_favorites_cb,
			      "chat_add_contact", "activate", main_window_chat_add_contact_cb,
			      "view_show_ft_manager", "activate", main_window_view_show_ft_manager,
			      "view_show_offline", "toggled", main_window_view_show_offline_cb,
			      "view_show_protocols", "toggled", main_window_view_show_protocols_cb,
			      "view_sort_by_name", "changed", main_window_view_sort_contacts_cb,
			      "view_normal_size_with_avatars", "changed", main_window_view_contacts_list_size_cb,
			      "view_show_map", "activate", main_window_view_show_map_cb,
			      "edit", "activate", main_window_edit_cb,
			      "edit_accounts", "activate", main_window_edit_accounts_cb,
			      "edit_personal_information", "activate", main_window_edit_personal_information_cb,
			      "edit_preferences", "activate", main_window_edit_preferences_cb,
			      "help_about", "activate", main_window_help_about_cb,
			      "help_debug", "activate", main_window_help_debug_cb,
			      "help_contents", "activate", main_window_help_contents_cb,
			      NULL);

	/* Set up connection related widgets. */
	main_window_connection_items_setup (window, gui);

	g_object_ref (window->ui_manager);
	g_object_unref (gui);

#if !HAVE_LIBCHAMPLAIN
	gtk_action_set_visible (show_map_widget, FALSE);
#endif

	window->account_manager = tp_account_manager_dup ();

	tp_account_manager_prepare_async (window->account_manager, NULL,
					  account_manager_prepared_cb, window);

	window->errors = g_hash_table_new_full (g_direct_hash,
						g_direct_equal,
						g_object_unref,
						NULL);

	window->status_changed_handlers = g_hash_table_new_full (g_direct_hash,
								 g_direct_equal,
								 NULL,
								 NULL);

	/* Set up menu */
	main_window_favorite_chatroom_menu_setup (window);

	window->edit_context = gtk_ui_manager_get_widget (window->ui_manager,
		"/menubar/edit/edit_context");
	window->edit_context_separator = gtk_ui_manager_get_widget (window->ui_manager,
		"/menubar/edit/edit_context_separator");
	gtk_widget_hide (window->edit_context);
	gtk_widget_hide (window->edit_context_separator);

	/* Set up contact list. */
	empathy_status_presets_get_all ();

	/* Set up presence chooser */
	window->presence_chooser = empathy_presence_chooser_new ();
	gtk_widget_show (window->presence_chooser);
	item = gtk_tool_item_new ();
	gtk_widget_show (GTK_WIDGET (item));
	gtk_container_add (GTK_CONTAINER (item), window->presence_chooser);
	gtk_tool_item_set_is_important (item, TRUE);
	gtk_tool_item_set_expand (item, TRUE);
	gtk_toolbar_insert (GTK_TOOLBAR (window->presence_toolbar), item, -1);

	/* Set up the throbber */
	ebox = gtk_event_box_new ();
	gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
	gtk_widget_set_tooltip_text (ebox, _("Show and edit accounts"));
	g_signal_connect (ebox,
			  "button-press-event",
			  G_CALLBACK (main_window_throbber_button_press_event_cb),
			  window);
	gtk_widget_show (ebox);

	window->throbber = ephy_spinner_new ();
	ephy_spinner_set_size (EPHY_SPINNER (window->throbber), GTK_ICON_SIZE_LARGE_TOOLBAR);
	gtk_container_add (GTK_CONTAINER (ebox), window->throbber);
	gtk_widget_show (window->throbber);

	item = gtk_tool_item_new ();
	gtk_container_add (GTK_CONTAINER (item), ebox);
	gtk_toolbar_insert (GTK_TOOLBAR (window->presence_toolbar), item, -1);
	gtk_widget_show (GTK_WIDGET (item));

	list_iface = EMPATHY_CONTACT_LIST (empathy_contact_manager_dup_singleton ());
	monitor = empathy_contact_list_get_monitor (list_iface);
	window->list_store = empathy_contact_list_store_new (list_iface);
	window->list_view = empathy_contact_list_view_new (window->list_store,
							   EMPATHY_CONTACT_LIST_FEATURE_ALL,
							   EMPATHY_CONTACT_FEATURE_ALL);
	g_signal_connect (monitor, "contact-presence-changed",
			  G_CALLBACK (main_window_contact_presence_changed_cb), window);
	window->butterfly_log_migration_contact_added_id =  g_signal_connect (monitor, "contact-added",
			  G_CALLBACK (main_window_contact_added_cb), window);
	g_object_unref (list_iface);

	gtk_widget_show (GTK_WIDGET (window->list_view));
	gtk_container_add (GTK_CONTAINER (sw),
			   GTK_WIDGET (window->list_view));
	g_signal_connect (window->list_view, "row-activated",
			  G_CALLBACK (main_window_row_activated_cb),
			  window);

	/* Load user-defined accelerators. */
	main_window_accels_load ();

	/* Set window size. */
	empathy_geometry_bind (GTK_WINDOW (window->window), GEOMETRY_NAME);

	/* Enable event handling */
	window->event_manager = empathy_event_manager_dup_singleton ();
	g_signal_connect (window->event_manager, "event-added",
			  G_CALLBACK (main_window_event_added_cb),
			  window);
	g_signal_connect (window->event_manager, "event-removed",
			  G_CALLBACK (main_window_event_removed_cb),
			  window);

	g_signal_connect (window->account_manager, "account-validity-changed",
			  G_CALLBACK (main_window_account_validity_changed_cb),
			  window);
	g_signal_connect (window->account_manager, "account-removed",
			  G_CALLBACK (main_window_account_removed_cb),
			  window);
	g_signal_connect (window->account_manager, "account-disabled",
			  G_CALLBACK (main_window_account_disabled_cb),
			  window);

	l = empathy_event_manager_get_events (window->event_manager);
	while (l) {
		main_window_event_added_cb (window->event_manager,
					    l->data, window);
		l = l->next;
	}

	conf = empathy_conf_get ();

	/* Show offline ? */
	empathy_conf_get_bool (conf,
			      EMPATHY_PREFS_CONTACTS_SHOW_OFFLINE,
			      &show_offline);
	empathy_conf_notify_add (conf,
				EMPATHY_PREFS_CONTACTS_SHOW_OFFLINE,
				main_window_notify_show_offline_cb,
				show_offline_widget);

	gtk_toggle_action_set_active (show_offline_widget, show_offline);

	/* Show protocol ? */
	empathy_conf_notify_add (conf,
				 EMPATHY_PREFS_UI_SHOW_PROTOCOLS,
				 (EmpathyConfNotifyFunc) main_window_notify_show_protocols_cb,
				 window);

	main_window_notify_show_protocols_cb (conf,
					    EMPATHY_PREFS_UI_SHOW_PROTOCOLS,
					    window);

	/* Sort by name / by status ? */
	empathy_conf_notify_add (conf,
				 EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
				 (EmpathyConfNotifyFunc) main_window_notify_sort_contact_cb,
				 window);

	main_window_notify_sort_contact_cb (conf,
					    EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
					    window);

	/* Contacts list size */
	empathy_conf_notify_add (conf,
				 EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
				 (EmpathyConfNotifyFunc) main_window_notify_contact_list_size_cb,
				 window);
	empathy_conf_notify_add (conf,
				 EMPATHY_PREFS_UI_SHOW_AVATARS,
				 (EmpathyConfNotifyFunc) main_window_notify_contact_list_size_cb,
				 window);

	main_window_notify_contact_list_size_cb (conf,
						 EMPATHY_PREFS_UI_SHOW_AVATARS,
						 window);

	return window->window;
}
static void
account_widget_build_jabber (EmpathyAccountWidget *self,
    const char *filename)
{
  EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
  GtkWidget *spinbutton_port;
  GtkWidget *checkbutton_ssl;
  GtkWidget *label_id, *label_password;
  GtkWidget *label_id_create, *label_password_create;
  GtkWidget *label_example_gtalk, *label_example_jabber;
  gboolean is_gtalk;

  is_gtalk = !tp_strdiff (
      empathy_account_settings_get_icon_name (priv->settings),
      "im-google-talk");

  if (priv->simple && !is_gtalk)
    {
      self->ui_details->gui = empathy_builder_get_file (filename,
          "vbox_jabber_simple", &self->ui_details->widget,
          "label_id_simple", &label_id,
          "label_id_create", &label_id_create,
          "label_password_simple", &label_password,
          "label_password_create", &label_password_create,
          NULL);

      if (empathy_account_settings_get_boolean (priv->settings, "register"))
        {
          gtk_widget_hide (label_id);
          gtk_widget_hide (label_password);
          gtk_widget_show (label_id_create);
          gtk_widget_show (label_password_create);
        }

      empathy_account_widget_handle_params (self,
          "entry_id_simple", "account",
          "entry_password_simple", "password",
          NULL);

      self->ui_details->default_focus = g_strdup ("entry_id_simple");
    }
  else if (priv->simple && is_gtalk)
    {
      self->ui_details->gui = empathy_builder_get_file (filename,
          "vbox_gtalk_simple", &self->ui_details->widget,
          NULL);

      empathy_account_widget_handle_params (self,
          "entry_id_g_simple", "account",
          "entry_password_g_simple", "password",
          NULL);

      self->ui_details->default_focus = g_strdup ("entry_id_g_simple");
    }
  else
    {
      self->ui_details->gui = empathy_builder_get_file (filename,
          "table_common_settings", &priv->table_common_settings,
          "vbox_jabber_settings", &self->ui_details->widget,
          "spinbutton_port", &spinbutton_port,
          "checkbutton_ssl", &checkbutton_ssl,
          "label_username_example", &label_example_jabber,
          "label_username_g_example", &label_example_gtalk,
          NULL);

      empathy_account_widget_handle_params (self,
          "entry_id", "account",
          "entry_password", "password",
          "entry_resource", "resource",
          "entry_server", "server",
          "spinbutton_port", "port",
          "spinbutton_priority", "priority",
          "checkbutton_ssl", "old-ssl",
          "checkbutton_ignore_ssl_errors", "ignore-ssl-errors",
          "checkbutton_encryption", "require-encryption",
          NULL);

      self->ui_details->default_focus = g_strdup ("entry_id");
      self->ui_details->add_forget = TRUE;
      priv->spinbutton_port = spinbutton_port;

      g_signal_connect (checkbutton_ssl, "toggled",
          G_CALLBACK (account_widget_jabber_ssl_toggled_cb),
          self);

      if (is_gtalk)
        {
          gtk_widget_hide (label_example_jabber);
          gtk_widget_show (label_example_gtalk);
        }
    }
}
void
empathy_new_chatroom_dialog_show (GtkWindow *parent)
{
	EmpathyNewChatroomDialog *dialog;
	GtkBuilder               *gui;
	GtkSizeGroup             *size_group;
	gchar                    *filename;

	if (dialog_p) {
		gtk_window_present (GTK_WINDOW (dialog_p->window));
		return;
	}

	dialog_p = dialog = g_new0 (EmpathyNewChatroomDialog, 1);

	filename = empathy_file_lookup ("empathy-new-chatroom-dialog.ui", "src");
	gui = empathy_builder_get_file (filename,
				       "new_chatroom_dialog", &dialog->window,
				       "table_grid", &dialog->table_grid,
				       "label_account", &dialog->label_account,
				       "label_server", &dialog->label_server,
				       "label_room", &dialog->label_room,
				       "entry_server", &dialog->entry_server,
				       "entry_room", &dialog->entry_room,
				       "treeview", &dialog->treeview,
				       "button_join", &dialog->button_join,
				       "expander_browse", &dialog->expander_browse,
				       "hbox_expander", &dialog->hbox_expander,
				       "label_error_message", &dialog->label_error_message,
				       "viewport_error", &dialog->viewport_error,
				       NULL);
	g_free (filename);

	empathy_builder_connect (gui, dialog,
			      "new_chatroom_dialog", "response", new_chatroom_dialog_response_cb,
			      "new_chatroom_dialog", "destroy", new_chatroom_dialog_destroy_cb,
			      "entry_server", "changed", new_chatroom_dialog_entry_changed_cb,
			      "entry_server", "activate", new_chatroom_dialog_entry_server_activate_cb,
			      "entry_server", "focus-out-event", new_chatroom_dialog_entry_server_focus_out_cb,
			      "entry_room", "changed", new_chatroom_dialog_entry_changed_cb,
			      "expander_browse", "activate", new_chatroom_dialog_expander_browse_activate_cb,
			      "button_close_error", "clicked", new_chatroom_dialog_button_close_error_clicked_cb,
			      NULL);

	g_object_unref (gui);

	g_object_add_weak_pointer (G_OBJECT (dialog->window), (gpointer) &dialog_p);

	/* Label alignment */
	size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);

	gtk_size_group_add_widget (size_group, dialog->label_account);
	gtk_size_group_add_widget (size_group, dialog->label_server);
	gtk_size_group_add_widget (size_group, dialog->label_room);

	g_object_unref (size_group);

	/* Set up chatrooms treeview */
	new_chatroom_dialog_model_setup (dialog);

	/* Add throbber */
	dialog->throbber = gtk_spinner_new ();
	gtk_box_pack_start (GTK_BOX (dialog->hbox_expander), dialog->throbber,
		TRUE, TRUE, 0);

	dialog->gsettings = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);

	/* Account chooser for custom */
	dialog->account_chooser = empathy_account_chooser_new ();
	empathy_account_chooser_set_filter (EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser),
					    empathy_account_chooser_filter_supports_chatrooms,
					    NULL);
	gtk_grid_attach (GTK_GRID (dialog->table_grid),
				   dialog->account_chooser,
				   1, 0, 1, 1);
	gtk_widget_show (dialog->account_chooser);

	g_signal_connect (EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser), "ready",
			  G_CALLBACK (new_chatroom_dialog_account_ready_cb),
			  dialog);
	g_signal_connect (GTK_COMBO_BOX (dialog->account_chooser), "changed",
			  G_CALLBACK (new_chatroom_dialog_account_changed_cb),
			  dialog);
	new_chatroom_dialog_account_changed_cb (GTK_COMBO_BOX (dialog->account_chooser),
						dialog);

	if (parent) {
		gtk_window_set_transient_for (GTK_WINDOW (dialog->window),
					      GTK_WINDOW (parent));
	}

	gtk_widget_show (dialog->window);
}
void
empathy_account_widget_sip_build (EmpathyAccountWidget *self,
    const char *filename,
    GtkWidget **table_common_settings)
{
  EmpathyAccountWidgetSip *settings;
  GtkWidget *vbox_settings;
  gboolean is_simple;
  GtkWidget *table_advanced;

  g_object_get (self, "simple", &is_simple, NULL);

  if (is_simple)
    {
      self->ui_details->gui = empathy_builder_get_file (filename,
          "vbox_sip_simple", &vbox_settings,
          NULL);

      empathy_account_widget_handle_params (self,
          "entry_userid_simple", "account",
          "entry_password_simple", "password",
          NULL);

      self->ui_details->default_focus = g_strdup ("entry_userid_simple");
    }
  else
    {
      GtkListStore *store;
      GtkTreeIter iter;
      GtkCellRenderer *renderer;
      GtkToggleButton *checkbutton_tel;

      settings = g_slice_new0 (EmpathyAccountWidgetSip);
      settings->self = self;

      self->ui_details->gui = empathy_builder_get_file (filename,
          "table_common_settings", table_common_settings,
          "table_advanced_sip_settings", &table_advanced,
          "vbox_sip_settings", &vbox_settings,
          "label_stun-server", &settings->label_stun_server,
          "entry_stun-server", &settings->entry_stun_server,
          "label_stun-port", &settings->label_stun_port,
          "spinbutton_stun-port", &settings->spinbutton_stun_port,
          "checkbutton_discover-stun", &settings->checkbutton_discover_stun,
          "spinbutton_keepalive-interval",
            &settings->spinbutton_keepalive_interval,
          "checkbutton_tel", &checkbutton_tel,
          NULL);
      settings->vbox_settings = vbox_settings;

      gtk_toggle_button_set_active (checkbutton_tel,
          empathy_account_settings_has_uri_scheme_tel (
            empathy_account_widget_get_settings (self)));

      empathy_account_widget_handle_params (self,
          "entry_userid", "account",
          "entry_password", "password",
          "checkbutton_discover-stun", "discover-stun",
          "entry_stun-server", "stun-server",
          "spinbutton_stun-port", "stun-port",
          "entry_auth-user", "auth-user",
          "entry_proxy-host", "proxy-host",
          "spinbutton_port", "port",
          "checkbutton_loose-routing", "loose-routing",
          "checkbutton_discover-binding", "discover-binding",
          "spinbutton_keepalive-interval", "keepalive-interval",
          "checkbutton_ignore-tls-errors", "ignore-tls-errors",
          NULL);

      account_widget_sip_discover_stun_toggled_cb (
          settings->checkbutton_discover_stun,
          settings);

      empathy_builder_connect (self->ui_details->gui, settings,
          "vbox_sip_settings", "destroy", account_widget_sip_destroy_cb,
          "checkbutton_discover-stun", "toggled",
          account_widget_sip_discover_stun_toggled_cb,
          "checkbutton_tel", "toggled", checkbutton_tel_toggled,
          NULL);

      self->ui_details->default_focus = g_strdup ("entry_userid");

      /* Create the 'transport' combo box. The first column has to contain the
       * value of the param. */
      store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
      settings->combobox_transport = gtk_combo_box_new_with_model (
          GTK_TREE_MODEL (store));

      renderer = gtk_cell_renderer_text_new ();
      gtk_cell_layout_pack_start (
          GTK_CELL_LAYOUT (settings->combobox_transport), renderer, TRUE);
      gtk_cell_layout_add_attribute (
          GTK_CELL_LAYOUT (settings->combobox_transport), renderer, "text", 1);

      gtk_list_store_append (store, &iter);
      gtk_list_store_set (store, &iter, 0, "auto", 1, _("Auto"), -1);

      gtk_list_store_append (store, &iter);
      gtk_list_store_set (store, &iter, 0, "udp", 1, _("UDP"), -1);

      gtk_list_store_append (store, &iter);
      gtk_list_store_set (store, &iter, 0, "tcp", 1, _("TCP"), -1);

      gtk_list_store_append (store, &iter);
      gtk_list_store_set (store, &iter, 0, "tls", 1, _("TLS"), -1);

      empathy_account_widget_setup_widget (self, settings->combobox_transport,
          "transport");

      gtk_table_attach_defaults (GTK_TABLE (table_advanced),
          settings->combobox_transport, 1, 4, 11, 12);

      gtk_widget_show (settings->combobox_transport);

      /* Create the 'keep-alive mechanism' combo box */
      store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
      settings->combobox_keep_alive_mechanism = gtk_combo_box_new_with_model (
          GTK_TREE_MODEL (store));

      renderer = gtk_cell_renderer_text_new ();
      gtk_cell_layout_pack_start (
          GTK_CELL_LAYOUT (settings->combobox_keep_alive_mechanism), renderer,
          TRUE);
      gtk_cell_layout_add_attribute (
          GTK_CELL_LAYOUT (settings->combobox_keep_alive_mechanism), renderer,
          "text", 1);

      gtk_list_store_append (store, &iter);
      gtk_list_store_set (store, &iter, 0, "auto", 1, _("Auto"), -1);

      gtk_list_store_append (store, &iter);
      /* translators: this string is very specific to SIP's internal; maybe
       * best to keep the English version. */
      gtk_list_store_set (store, &iter, 0, "register", 1, _("Register"), -1);

      gtk_list_store_append (store, &iter);
      /* translators: this string is very specific to SIP's internal; maybe
       * best to keep the English version. */
      gtk_list_store_set (store, &iter, 0, "options", 1, _("Options"), -1);

      gtk_list_store_append (store, &iter);
      gtk_list_store_set (store, &iter, 0, "none", 1, _("None"), -1);

      g_signal_connect (settings->combobox_keep_alive_mechanism, "changed",
          G_CALLBACK (keep_alive_mechanism_combobox_change_cb), settings);

      empathy_account_widget_setup_widget (self,
          settings->combobox_keep_alive_mechanism, "keepalive-mechanism");

      gtk_table_attach_defaults (GTK_TABLE (table_advanced),
          settings->combobox_keep_alive_mechanism, 1, 4, 7, 8);

      gtk_widget_show (settings->combobox_keep_alive_mechanism);
    }

  self->ui_details->widget = vbox_settings;
}
static void
empathy_contact_blocking_dialog_init (EmpathyContactBlockingDialog *self)
{
  GtkBuilder *gui;
  char *filename;
  GtkWidget *contents;
  GtkWidget *account_hbox, *blocked_contacts_view, *blocked_contacts_sw,
      *remove_toolbar;
  GtkEntryCompletion *completion;
  TpAccountManager *am;
  GtkStyleContext *context;
  TpSimpleClientFactory *factory;

  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
      EMPATHY_TYPE_CONTACT_BLOCKING_DIALOG,
      EmpathyContactBlockingDialogPrivate);

  gtk_window_set_title (GTK_WINDOW (self), _("Edit Blocked Contacts"));
  gtk_dialog_add_button (GTK_DIALOG (self),
      GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);

  filename = empathy_file_lookup ("empathy-contact-blocking-dialog.ui",
      "libempathy-gtk");

  gui = empathy_builder_get_file (filename,
      "contents", &contents,
      "account-hbox", &account_hbox,
      "add-button", &self->priv->add_button,
      "add-contact-entry", &self->priv->add_contact_entry,
      "blocked-contacts", &self->priv->blocked_contacts,
      "blocked-contacts-sw", &blocked_contacts_sw,
      "blocked-contacts-view", &blocked_contacts_view,
      "remove-button", &self->priv->remove_button,
      "remove-toolbar", &remove_toolbar,
      NULL);

  empathy_builder_connect (gui, self,
      "add-button", "clicked", contact_blocking_dialog_add_contact,
      "add-contact-entry", "activate", contact_blocking_dialog_add_contact,
      "remove-button", "clicked", contact_blocking_dialog_remove_contacts,
      NULL);

  /* join the remove toolbar to the treeview */
  context = gtk_widget_get_style_context (blocked_contacts_sw);
  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
  context = gtk_widget_get_style_context (remove_toolbar);
  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);

  /* add the contents to the dialog */
  gtk_container_add (
      GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (self))),
      contents);
  gtk_widget_show (contents);

  /* set up the tree selection */
  self->priv->selection = gtk_tree_view_get_selection (
      GTK_TREE_VIEW (blocked_contacts_view));
  gtk_tree_selection_set_mode (self->priv->selection, GTK_SELECTION_MULTIPLE);
  g_signal_connect (self->priv->selection, "changed",
      G_CALLBACK (contact_blocking_dialog_view_selection_changed), self);

  /* build the contact entry */
  self->priv->completion_contacts = gtk_list_store_new (N_COMPLETION_COLUMNS,
      G_TYPE_STRING, /* id */
      G_TYPE_STRING, /* text */
      TP_TYPE_CONTACT); /* contact */

  completion = gtk_entry_completion_new ();
  gtk_entry_completion_set_model (completion,
      GTK_TREE_MODEL (self->priv->completion_contacts));
  gtk_entry_completion_set_text_column (completion, COL_COMPLETION_TEXT);
  gtk_entry_completion_set_match_func (completion,
      contact_selector_dialog_match_func,
      NULL, NULL);
  g_signal_connect (completion, "match-selected",
        G_CALLBACK (contact_selector_dialog_match_selected_cb),
        self);
  gtk_entry_set_completion (GTK_ENTRY (self->priv->add_contact_entry),
      completion);
  g_object_unref (completion);
  g_object_unref (self->priv->completion_contacts);

  /* add the account chooser */
  self->priv->account_chooser = empathy_account_chooser_new ();
  contact_blocking_dialog_refilter_account_chooser (self);
  g_signal_connect (self->priv->account_chooser, "changed",
      G_CALLBACK (contact_blocking_dialog_account_changed), self);

  gtk_box_pack_start (GTK_BOX (account_hbox), self->priv->account_chooser,
      TRUE, TRUE, 0);
  gtk_widget_show (self->priv->account_chooser);

  /* add an error warning info bar */
  self->priv->info_bar = gtk_info_bar_new ();
  gtk_box_pack_start (GTK_BOX (contents), self->priv->info_bar, FALSE, TRUE, 0);
  gtk_info_bar_set_message_type (GTK_INFO_BAR (self->priv->info_bar),
      GTK_MESSAGE_ERROR);

  self->priv->info_bar_label = gtk_label_new ("");
  gtk_container_add (GTK_CONTAINER (
        gtk_info_bar_get_content_area (GTK_INFO_BAR (self->priv->info_bar))),
      self->priv->info_bar_label);
  gtk_widget_show (self->priv->info_bar_label);

  /* prepare the account manager */
  am = tp_account_manager_dup ();

  factory = tp_proxy_get_factory (am);
  tp_simple_client_factory_add_connection_features_varargs (factory,
      TP_CONNECTION_FEATURE_CONTACT_BLOCKING, NULL);

  tp_proxy_prepare_async (am, NULL, contact_blocking_dialog_am_prepared, self);
  g_object_unref (am);

  g_free (filename);
  g_object_unref (gui);
}
EmpathyIrcNetworkChooser *
empathy_account_widget_irc_build (EmpathyAccountWidget *self,
    const char *filename,
    GtkWidget **table_common_settings)
{
  EmpathyAccountWidgetIrc *settings;
  EmpathyAccountSettings *ac_settings;
  GtkWidget *entry_password;
  const gchar *password;

  settings = g_slice_new0 (EmpathyAccountWidgetIrc);
  settings->self = self;

  self->ui_details->gui = empathy_builder_get_file (filename,
      "table_irc_settings", table_common_settings,
      "vbox_irc", &self->ui_details->widget,
      "table_irc_settings", &settings->vbox_settings,
      "entry_password", &entry_password,
      NULL);

  /* Add network chooser button */
  g_object_get (settings->self, "settings", &ac_settings, NULL);

  settings->network_chooser = empathy_irc_network_chooser_new (ac_settings);

  g_signal_connect (settings->network_chooser, "changed",
      G_CALLBACK (network_changed_cb), settings);

  gtk_table_attach (GTK_TABLE (*table_common_settings),
      settings->network_chooser, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);

  gtk_widget_show (settings->network_chooser);

  account_widget_irc_setup (settings);

  empathy_account_widget_handle_params (self,
      "entry_nick", "account",
      "entry_fullname", "fullname",
      "entry_password", "password",
      "entry_quit_message", "quit-message",
      NULL);

  empathy_builder_connect (self->ui_details->gui, settings,
      "table_irc_settings", "destroy", account_widget_irc_destroy_cb,
      NULL);

  self->ui_details->default_focus = g_strdup ("entry_nick");

  g_object_unref (ac_settings);

  /* Automatically set password-prompt when needed */
  password = empathy_account_settings_get_string (ac_settings, "password");

  if (set_password_prompt_if_needed (ac_settings, password))
    {
      /* Apply right now to save password-prompt */
      empathy_account_settings_apply_async (ac_settings, NULL, NULL);
    }

  g_signal_connect (entry_password, "changed",
      G_CALLBACK (entry_password_changed_cb), settings);

  return EMPATHY_IRC_NETWORK_CHOOSER (settings->network_chooser);
}
/**
 * empathy_irc_network_dialog_show:
 * @network: the #EmpathyIrcNetwork to configure
 * @parent: the parent of this dialog
 *
 * Display a dialog to configure a given #EmpathyIrcNetwork.
 * This function is a singleton so if a configuration dialog already
 * exists we use this one to edit the network.
 *
 * Returns: The displayed #GtkDialog
 */
GtkWidget *
empathy_irc_network_dialog_show (EmpathyIrcNetwork *network,
                                 GtkWidget *parent)
{
  static EmpathyIrcNetworkDialog *dialog = NULL;
  GtkBuilder *gui;
  GtkListStore *store;
  GtkCellRenderer *renderer;
  GtkAdjustment *adjustment;
  GtkTreeSelection *selection;
  GtkTreeViewColumn *column;
  gchar *filename;
  GtkWidget *sw, *toolbar;
  GtkStyleContext *context;

  g_return_val_if_fail (network != NULL, NULL);

  if (dialog != NULL)
    {
      change_network (dialog, network);
      gtk_window_present (GTK_WINDOW (dialog->dialog));

      return dialog->dialog;
    }

  dialog = g_slice_new0 (EmpathyIrcNetworkDialog);

  dialog->network = network;
  g_object_ref (dialog->network);

  filename = empathy_file_lookup ("empathy-account-widget-irc.ui",
      "libempathy-gtk");
  gui = empathy_builder_get_file (filename,
      "irc_network_dialog", &dialog->dialog,
      "button_close", &dialog->button_close,
      "entry_network", &dialog->entry_network,
      "combobox_charset", &dialog->combobox_charset,
      "treeview_servers", &dialog->treeview_servers,
      "button_add", &dialog->button_add,
      "button_remove", &dialog->button_remove,
      "button_up", &dialog->button_up,
      "button_down", &dialog->button_down,
      "scrolledwindow_network_server", &sw,
      "toolbar_network_server", &toolbar,
      NULL);
  g_free (filename);

  store = gtk_list_store_new (4, G_TYPE_OBJECT, G_TYPE_STRING,
      G_TYPE_UINT, G_TYPE_BOOLEAN);
  gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->treeview_servers),
      GTK_TREE_MODEL (store));
  g_object_unref (store);

  /* address */
  renderer = gtk_cell_renderer_text_new ();
  g_object_set (renderer, "editable", TRUE, NULL);
  g_signal_connect (renderer, "edited",
      G_CALLBACK (irc_network_dialog_address_edited_cb), dialog);
  gtk_tree_view_insert_column_with_attributes (
      GTK_TREE_VIEW (dialog->treeview_servers),
      -1, _("Server"), renderer, "text", COL_ADR,
      NULL);
  column = gtk_tree_view_get_column (GTK_TREE_VIEW (dialog->treeview_servers),
      0);
  gtk_tree_view_column_set_expand (column, TRUE);

  /* port */
  adjustment = (GtkAdjustment *) gtk_adjustment_new (6667, 1, G_MAXUINT16,
      1, 10, 0);
  renderer = gtk_cell_renderer_spin_new ();
  g_object_set (renderer,
      "editable", TRUE,
      "adjustment", adjustment,
      NULL);
  g_signal_connect (renderer, "edited",
      G_CALLBACK (irc_network_dialog_port_edited_cb), dialog);
  gtk_tree_view_insert_column_with_attributes (
      GTK_TREE_VIEW (dialog->treeview_servers),
      -1, _("Port"), renderer, "text", COL_PORT,
      NULL);

  /* SSL */
  renderer = gtk_cell_renderer_toggle_new ();
  g_object_set (renderer, "activatable", TRUE, NULL);
  g_signal_connect (renderer, "toggled",
      G_CALLBACK (irc_network_dialog_ssl_toggled_cb), dialog);
  gtk_tree_view_insert_column_with_attributes (
      GTK_TREE_VIEW (dialog->treeview_servers),
      -1, _("SSL"), renderer, "active", COL_SSL,
      NULL);

  selection = gtk_tree_view_get_selection (
      GTK_TREE_VIEW (dialog->treeview_servers));
  gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);

  /* charset */
  totem_subtitle_encoding_init (GTK_COMBO_BOX (dialog->combobox_charset));

  irc_network_dialog_setup (dialog);

  empathy_builder_connect (gui, dialog,
      "irc_network_dialog", "destroy", irc_network_dialog_destroy_cb,
      "button_close", "clicked", irc_network_dialog_close_clicked_cb,
      "entry_network", "focus-out-event", irc_network_dialog_network_focus_cb,
      "button_add", "clicked", irc_network_dialog_button_add_clicked_cb,
      "button_remove", "clicked", irc_network_dialog_button_remove_clicked_cb,
      "button_up", "clicked", irc_network_dialog_button_up_clicked_cb,
      "button_down", "clicked", irc_network_dialog_button_down_clicked_cb,
      "combobox_charset", "changed", irc_network_dialog_combobox_charset_changed_cb,
      NULL);

  g_object_unref (gui);

  g_object_add_weak_pointer (G_OBJECT (dialog->dialog),
      (gpointer) &dialog);

  g_signal_connect (selection, "changed",
      G_CALLBACK (irc_network_dialog_selection_changed_cb),
      dialog);

  gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog),
      GTK_WINDOW (parent));
  gtk_window_set_modal (GTK_WINDOW (dialog->dialog), TRUE);

  /* join the add/remove toolbar to the treeview */
  context = gtk_widget_get_style_context (sw);
  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);

  context = gtk_widget_get_style_context (toolbar);
  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);

  irc_network_dialog_network_update_buttons (dialog);
  gtk_widget_show_all (dialog->dialog);

  return dialog->dialog;
}