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_generic_new (McAccount *account) { GladeXML *glade; 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.glade", "libempathy-gtk"); glade = empathy_glade_get_file (filename, "vbox_generic_settings", NULL, "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); g_object_unref (glade); gtk_widget_show_all (widget); return 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); }
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_groupwise_new (McAccount *account) { GladeXML *glade; GtkWidget *widget; gchar *filename; filename = empathy_file_lookup ("empathy-account-widget-groupwise.glade", "libempathy-gtk"); glade = empathy_glade_get_file (filename, "vbox_groupwise_settings", NULL, "vbox_groupwise_settings", &widget, NULL); g_free (filename); empathy_account_widget_handle_params (account, glade, "entry_id", "account", "entry_password", "password", "entry_server", "server", "spinbutton_port", "port", NULL); empathy_account_widget_add_forget_button (account, glade, "button_forget", "entry_password"); g_object_unref (glade); gtk_widget_show (widget); return widget; }
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); }
GtkWidget * empathy_account_widget_salut_new (McAccount *account) { GladeXML *glade; GtkWidget *widget; gchar *filename; filename = empathy_file_lookup ("empathy-account-widget-salut.glade", "libempathy-gtk"); glade = empathy_glade_get_file (filename, "vbox_salut_settings", NULL, "vbox_salut_settings", &widget, NULL); g_free (filename); empathy_account_widget_handle_params (account, glade, "entry_published", "published-name", "entry_nickname", "nickname", "entry_first_name", "first-name", "entry_last_name", "last-name", "entry_email", "email", "entry_jid", "jid", NULL); g_object_unref (glade); gtk_widget_show (widget); return widget; }
void empathy_set_css_provider (GtkWidget *widget) { GtkCssProvider *provider; gchar *filename; GError *error = NULL; GdkScreen *screen; filename = empathy_file_lookup ("empathy.css", "data"); provider = gtk_css_provider_new (); if (!gtk_css_provider_load_from_path (provider, filename, &error)) { g_warning ("Failed to load css file '%s': %s", filename, error->message); g_error_free (error); goto out; } if (widget != NULL) screen = gtk_widget_get_screen (widget); else screen = gdk_screen_get_default (); gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); out: g_free (filename); g_object_unref (provider); }
static void status_icon_create_menu (EmpathyStatusIcon *icon) { EmpathyStatusIconPriv *priv = GET_PRIV (icon); GladeXML *glade; gchar *filename; filename = empathy_file_lookup ("empathy-status-icon.glade", "src"); glade = empathy_glade_get_file (filename, "tray_menu", NULL, "tray_menu", &priv->popup_menu, "tray_show_list", &priv->show_window_item, "tray_new_message", &priv->message_item, "tray_status", &priv->status_item, NULL); g_free (filename); empathy_glade_connect (glade, icon, "tray_show_list", "toggled", status_icon_show_hide_window_cb, "tray_new_message", "activate", status_icon_new_message_cb, "tray_quit", "activate", status_icon_quit_cb, NULL); g_object_unref (glade); }
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 presence_chooser_dialog_show (void) { GladeXML *glade; gchar *filename; if (message_dialog) { gtk_window_present (GTK_WINDOW (message_dialog->dialog)); return; } message_dialog = g_new0 (CustomMessageDialog, 1); filename = empathy_file_lookup ("empathy-presence-chooser.glade", "libempathy-gtk"); glade = empathy_glade_get_file (filename, "custom_message_dialog", NULL, "custom_message_dialog", &message_dialog->dialog, "checkbutton_save", &message_dialog->checkbutton_save, "comboboxentry_message", &message_dialog->comboboxentry_message, "combobox_status", &message_dialog->combobox_status, NULL); g_free (filename); empathy_glade_connect (glade, message_dialog, "custom_message_dialog", "destroy", presence_chooser_dialog_destroy_cb, "custom_message_dialog", "response", presence_chooser_dialog_response_cb, "combobox_status", "changed", presence_chooser_dialog_status_changed_cb, "checkbutton_save", "toggled", presence_chooser_dialog_save_toggled_cb, NULL); g_object_unref (glade); /* Setup the message combobox */ message_dialog->entry_message = GTK_BIN (message_dialog->comboboxentry_message)->child; gtk_entry_set_activates_default (GTK_ENTRY (message_dialog->entry_message), TRUE); gtk_entry_set_width_chars (GTK_ENTRY (message_dialog->entry_message), 25); g_signal_connect (message_dialog->entry_message, "changed", G_CALLBACK (presence_chooser_dialog_message_changed_cb), message_dialog); presence_chooser_dialog_setup (message_dialog); gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (message_dialog->comboboxentry_message), 0); /* FIXME: Set transian for a window ? */ gtk_widget_show_all (message_dialog->dialog); }
GtkWidget * empathy_account_widget_jabber_new (McAccount *account) { GladeXML *glade; GtkWidget *widget; GtkWidget *spinbutton_port; GtkWidget *checkbutton_ssl; gchar *filename; filename = empathy_file_lookup ("empathy-account-widget-jabber.glade", "libempathy-gtk"); glade = empathy_glade_get_file (filename, "vbox_jabber_settings", NULL, "vbox_jabber_settings", &widget, "spinbutton_port", &spinbutton_port, "checkbutton_ssl", &checkbutton_ssl, NULL); g_free (filename); empathy_account_widget_handle_params (account, glade, "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, glade, "button_forget", "entry_password"); g_signal_connect (checkbutton_ssl, "toggled", G_CALLBACK (account_widget_jabber_ssl_toggled_cb), spinbutton_port); g_object_unref (glade); gtk_widget_show (widget); return widget; }
/** * 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; GladeXML *glade; gchar *filename; settings = g_slice_new0 (EmpathyAccountWidgetSip); settings->account = g_object_ref (account); filename = empathy_file_lookup ("empathy-account-widget-sip.glade", "libempathy-gtk"); glade = empathy_glade_get_file (filename, "vbox_sip_settings", NULL, "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, glade, "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, glade, "button_forget", "entry_password"); account_widget_sip_discover_stun_toggled_cb (settings->checkbutton_discover_stun, settings); empathy_glade_connect (glade, settings, "vbox_sip_settings", "destroy", account_widget_sip_destroy_cb, "checkbutton_discover-stun", "toggled", account_widget_sip_discover_stun_toggled_cb, NULL); g_object_unref (glade); return 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); }
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); }
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 = tpaw_builder_get_file (filename, "widget_vbox", &priv->vbox, "treeview", &priv->treeview, "scrolledwindow", &priv->scrolledwindow, NULL); g_free (filename); tpaw_builder_unref_and_keep_widget (gui, priv->vbox); g_signal_connect (priv->vbox, "destroy", G_CALLBACK (import_widget_destroy_cb), self); import_widget_set_up_account_list (self); }
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); }
GtkWidget * empathy_account_widget_yahoo_new (McAccount *account) { GladeXML *glade; GtkWidget *widget; gchar *filename; filename = empathy_file_lookup ("empathy-account-widget-yahoo.glade", "libempathy-gtk"); glade = empathy_glade_get_file (filename, "vbox_yahoo_settings", NULL, "vbox_yahoo_settings", &widget, NULL); g_free (filename); empathy_account_widget_handle_params (account, glade, "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, glade, "button_forget", "entry_password"); g_object_unref (glade); gtk_widget_show (widget); return widget; }
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); }
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_new_chatroom_dialog_show (GtkWindow *parent) { EmpathyNewChatroomDialog *dialog; GladeXML *glade; 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.glade", "src"); glade = empathy_glade_get_file (filename, "new_chatroom_dialog", NULL, "new_chatroom_dialog", &dialog->window, "table_info", &dialog->table_info, "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, "togglebutton_refresh", &dialog->togglebutton_refresh, "vbox_browse", &dialog->vbox_browse, "image_status", &dialog->image_status, "label_status", &dialog->label_status, "hbox_status", &dialog->hbox_status, "treeview", &dialog->treeview, "button_join", &dialog->button_join, NULL); g_free (filename); empathy_glade_connect (glade, 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_room", "changed", new_chatroom_dialog_entry_changed_cb, "togglebutton_refresh", "toggled", new_chatroom_dialog_togglebutton_refresh_toggled_cb, NULL); g_object_unref (glade); 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 = ephy_spinner_new (); ephy_spinner_set_size (EPHY_SPINNER (dialog->throbber), GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_widget_show (dialog->throbber); gtk_box_pack_start (GTK_BOX (dialog->hbox_status), dialog->throbber, FALSE, FALSE, 0); /* 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_is_connected, NULL); gtk_table_attach_defaults (GTK_TABLE (dialog->table_info), dialog->account_chooser, 1, 3, 0, 1); gtk_widget_show (dialog->account_chooser); 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_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); }
void empathy_import_dialog_show (GtkWindow *parent, gboolean warning) { static EmpathyImportDialog *dialog = NULL; GladeXML *glade; gchar *filename; GList *accounts = NULL; /* This window is a singleton. If it already exist, present it */ if (dialog) { gtk_window_present (GTK_WINDOW (dialog->window)); return; } /* Load all accounts from all supported applications */ accounts = g_list_concat (accounts, empathy_import_pidgin_load ()); accounts = g_list_concat (accounts, empathy_import_gajim_load ()); /* Check if we have accounts to import before creating the window */ if (!accounts) { GtkWidget *message; if (warning) { message = gtk_message_dialog_new (parent, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, _("There are no accounts to import.")); gtk_dialog_run (GTK_DIALOG (message)); gtk_widget_destroy (message); } else DEBUG ("No accounts to import; closing dialog silently."); return; } /* We have accounts, let's display the window with them */ dialog = g_slice_new0 (EmpathyImportDialog); dialog->accounts = accounts; filename = empathy_file_lookup ("empathy-import-dialog.glade", "src"); glade = empathy_glade_get_file (filename, "import_dialog", NULL, "import_dialog", &dialog->window, "treeview", &dialog->treeview, NULL); empathy_glade_connect (glade, dialog, "import_dialog", "destroy", import_dialog_destroy_cb, "import_dialog", "response", import_dialog_response_cb, NULL); g_object_add_weak_pointer (G_OBJECT (dialog->window), (gpointer) &dialog); g_free (filename); g_object_unref (glade); if (parent) gtk_window_set_transient_for (GTK_WINDOW (dialog->window), parent); import_dialog_set_up_account_list (dialog); gtk_widget_show (dialog->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 }
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); }
static void ft_manager_build_ui (EmpathyFTManager *manager) { GtkBuilder *gui; 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 = tpaw_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); tpaw_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", "key-press-event", ft_manager_key_press_event_cb, NULL); tpaw_builder_unref_and_keep_widget (gui, priv->window); /* Window geometry. */ empathy_geometry_bind (GTK_WINDOW (priv->window), "ft-manager"); /* 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); g_signal_connect (view, "button-press-event", G_CALLBACK (ft_view_button_press_event_cb), 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); }
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); }
static void empathy_chat_window_init (EmpathyChatWindow *window) { GladeXML *glade; GtkAccelGroup *accel_group; GClosure *closure; GtkWidget *menu_conv; GtkWidget *menu; gint i; GtkWidget *chat_vbox; gchar *filename; EmpathyChatWindowPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (window, EMPATHY_TYPE_CHAT_WINDOW, EmpathyChatWindowPriv); window->priv = priv; filename = empathy_file_lookup ("empathy-chat-window.glade", "src"); glade = empathy_glade_get_file (filename, "chat_window", NULL, "chat_window", &priv->dialog, "chat_vbox", &chat_vbox, "menu_conv", &menu_conv, "menu_conv_clear", &priv->menu_conv_clear, "menu_conv_insert_smiley", &priv->menu_conv_insert_smiley, "menu_conv_contact", &priv->menu_conv_contact, "menu_conv_close", &priv->menu_conv_close, "menu_edit_cut", &priv->menu_edit_cut, "menu_edit_copy", &priv->menu_edit_copy, "menu_edit_paste", &priv->menu_edit_paste, "menu_tabs_next", &priv->menu_tabs_next, "menu_tabs_prev", &priv->menu_tabs_prev, "menu_tabs_left", &priv->menu_tabs_left, "menu_tabs_right", &priv->menu_tabs_right, "menu_tabs_detach", &priv->menu_tabs_detach, "menu_help_contents", &priv->menu_help_contents, "menu_help_about", &priv->menu_help_about, NULL); g_free (filename); empathy_glade_connect (glade, window, "chat_window", "configure-event", chat_window_configure_event_cb, "menu_conv", "activate", chat_window_conv_activate_cb, "menu_conv_clear", "activate", chat_window_clear_activate_cb, "menu_conv_close", "activate", chat_window_close_activate_cb, "menu_edit", "activate", chat_window_edit_activate_cb, "menu_edit_cut", "activate", chat_window_cut_activate_cb, "menu_edit_copy", "activate", chat_window_copy_activate_cb, "menu_edit_paste", "activate", chat_window_paste_activate_cb, "menu_tabs_left", "activate", chat_window_tabs_left_activate_cb, "menu_tabs_right", "activate", chat_window_tabs_right_activate_cb, "menu_tabs_detach", "activate", chat_window_detach_activate_cb, "menu_help_contents", "activate", chat_window_help_contents_cb, "menu_help_about", "activate", chat_window_help_about_cb, NULL); g_object_unref (glade); priv->notebook = gtk_notebook_new (); gtk_notebook_set_group (GTK_NOTEBOOK (priv->notebook), "EmpathyChatWindow"); gtk_box_pack_start (GTK_BOX (chat_vbox), priv->notebook, TRUE, TRUE, 0); gtk_widget_show (priv->notebook); /* Set up accels */ accel_group = gtk_accel_group_new (); gtk_window_add_accel_group (GTK_WINDOW (priv->dialog), accel_group); for (i = 0; i < G_N_ELEMENTS (tab_accel_keys); i++) { closure = g_cclosure_new (G_CALLBACK (chat_window_accel_cb), window, NULL); gtk_accel_group_connect (accel_group, tab_accel_keys[i], GDK_MOD1_MASK, 0, closure); } g_object_unref (accel_group); /* Set up smiley menu */ menu = empathy_chat_view_get_smiley_menu ( G_CALLBACK (chat_window_insert_smiley_activate_cb), window); gtk_menu_item_set_submenu (GTK_MENU_ITEM (priv->menu_conv_insert_smiley), menu); /* Set up signals we can't do with glade since we may need to * block/unblock them at some later stage. */ g_signal_connect (priv->dialog, "delete_event", G_CALLBACK (chat_window_delete_event_cb), window); g_signal_connect_swapped (priv->menu_tabs_prev, "activate", G_CALLBACK (gtk_notebook_prev_page), priv->notebook); g_signal_connect_swapped (priv->menu_tabs_next, "activate", G_CALLBACK (gtk_notebook_next_page), priv->notebook); g_signal_connect (priv->dialog, "focus_in_event", G_CALLBACK (chat_window_focus_in_event_cb), window); g_signal_connect_after (priv->notebook, "switch_page", G_CALLBACK (chat_window_page_switched_cb), window); g_signal_connect (priv->notebook, "page_added", G_CALLBACK (chat_window_page_added_cb), window); g_signal_connect (priv->notebook, "page_removed", G_CALLBACK (chat_window_page_removed_cb), window); /* Set up drag and drop */ gtk_drag_dest_set (GTK_WIDGET (priv->notebook), GTK_DEST_DEFAULT_ALL, drag_types_dest, G_N_ELEMENTS (drag_types_dest), GDK_ACTION_MOVE); g_signal_connect (priv->notebook, "drag-data-received", G_CALLBACK (chat_window_drag_data_received), window); chat_windows = g_list_prepend (chat_windows, window); /* Set up private details */ priv->chats = NULL; priv->chats_new_msg = NULL; priv->chats_composing = NULL; priv->current_chat = NULL; }
/** * 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); }
static void do_constructed (GObject *obj) { EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj); EmpathyAccountWidgetPriv *priv = GET_PRIV (self); TpAccount *account; const gchar *protocol, *cm_name; guint i = 0; struct { const gchar *cm_name; const gchar *protocol; const char *file; void (*func)(EmpathyAccountWidget *self, const gchar *filename); } widgets [] = { { "salut", "local-xmpp", "empathy-account-widget-local-xmpp.ui", account_widget_build_salut }, WIDGET (gabble, jabber), WIDGET (butterfly, msn), WIDGET (haze, icq), WIDGET (haze, aim), WIDGET (haze, yahoo), WIDGET (haze, groupwise), WIDGET (idle, irc), WIDGET (sofiasip, sip), }; cm_name = empathy_account_settings_get_cm (priv->settings); protocol = empathy_account_settings_get_protocol (priv->settings); for (i = 0 ; i < G_N_ELEMENTS (widgets); i++) { if (!tp_strdiff (widgets[i].cm_name, cm_name) && !tp_strdiff (widgets[i].protocol, protocol)) { gchar *filename; filename = empathy_file_lookup (widgets[i].file, "libempathy-gtk"); widgets[i].func (self, filename); g_free (filename); break; } } if (i == G_N_ELEMENTS (widgets)) { gchar *filename = empathy_file_lookup ( "empathy-account-widget-generic.ui", "libempathy-gtk"); account_widget_build_generic (self, filename); g_free (filename); } /* handle default focus */ if (self->ui_details->default_focus != NULL) { GObject *default_focus_entry; default_focus_entry = gtk_builder_get_object (self->ui_details->gui, self->ui_details->default_focus); g_signal_connect (default_focus_entry, "realize", G_CALLBACK (gtk_widget_grab_focus), NULL); } /* handle forget button */ if (self->ui_details->add_forget) { const gchar *password = NULL; priv->button_forget = GTK_WIDGET (gtk_builder_get_object (self->ui_details->gui, "button_forget")); priv->entry_password = GTK_WIDGET (gtk_builder_get_object (self->ui_details->gui, "entry_password")); password = empathy_account_settings_get_string (priv->settings, "password"); gtk_widget_set_sensitive (priv->button_forget, !EMP_STR_EMPTY (password)); g_signal_connect (priv->button_forget, "clicked", G_CALLBACK (account_widget_forget_clicked_cb), self); g_signal_connect (priv->entry_password, "changed", G_CALLBACK (account_widget_password_changed_cb), self); } /* handle apply and cancel button */ if (!priv->simple) { GtkWidget *hbox = gtk_hbox_new (TRUE, 3); priv->cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); if (priv->creating_account) { TpConnectionPresenceType state; priv->idle = empathy_idle_dup_singleton (); empathy_signal_connect_weak (priv->idle, "notify::state", G_CALLBACK (idle_state_change_cb), obj); state = empathy_idle_get_state (priv->idle); if (state > TP_CONNECTION_PRESENCE_TYPE_OFFLINE) { /* We are online, display a Login button */ GtkWidget *image; priv->apply_button = gtk_button_new_with_mnemonic (_("L_og in")); image = gtk_image_new_from_stock (GTK_STOCK_CONNECT, GTK_ICON_SIZE_BUTTON); gtk_button_set_image (GTK_BUTTON (priv->apply_button), image); } else { /* We are offline, display a Save button */ priv->apply_button = gtk_button_new_from_stock (GTK_STOCK_SAVE); } } else { /* We are editing an existing account, display an Apply button */ priv->apply_button = gtk_button_new_from_stock (GTK_STOCK_APPLY); } gtk_box_pack_end (GTK_BOX (hbox), priv->apply_button, TRUE, TRUE, 3); gtk_box_pack_end (GTK_BOX (hbox), priv->cancel_button, TRUE, TRUE, 3); gtk_box_pack_end (GTK_BOX (self->ui_details->widget), hbox, FALSE, FALSE, 3); g_signal_connect (priv->cancel_button, "clicked", G_CALLBACK (account_widget_cancel_clicked_cb), self); g_signal_connect (priv->apply_button, "clicked", G_CALLBACK (account_widget_apply_clicked_cb), self); gtk_widget_show_all (hbox); if (priv->creating_account) /* When creating an account, the user might have nothing to enter. * That means that no control interaction might occur, * so we update the control button sensitivity manually. */ account_widget_handle_control_buttons_sensitivity (self); else account_widget_set_control_buttons_sensitivity (self, FALSE); } account = empathy_account_settings_get_account (priv->settings); if (account != NULL) { g_signal_connect (account, "notify::enabled", G_CALLBACK (empathy_account_widget_enabled_cb), self); } /* handle the "Enabled" checkbox. We only add it when modifying an account */ if (!priv->creating_account && priv->table_common_settings != NULL) { #ifdef HAVE_MOBLIN GtkWidget *w; #endif guint nb_rows, nb_columns; gboolean is_enabled; is_enabled = tp_account_is_enabled (account); #ifndef HAVE_MOBLIN priv->enabled_checkbox = gtk_check_button_new_with_label (_("Enabled")); gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON (priv->enabled_checkbox), is_enabled); #else /* Translators: this is used only when built on a moblin platform */ w = gtk_label_new (_("Account:")); gtk_misc_set_alignment (GTK_MISC (w), 0, 0.5); priv->enabled_checkbox = nbtk_gtk_light_switch_new (); nbtk_gtk_light_switch_set_active ( NBTK_GTK_LIGHT_SWITCH (priv->enabled_checkbox), is_enabled); gtk_widget_show (w); #endif /* HAVE_MOBLIN */ g_object_get (priv->table_common_settings, "n-rows", &nb_rows, "n-columns", &nb_columns, NULL); gtk_table_resize (GTK_TABLE (priv->table_common_settings), ++nb_rows, nb_columns); #ifndef HAVE_MOBLIN gtk_table_attach (GTK_TABLE (priv->table_common_settings), priv->enabled_checkbox, 0, nb_columns, nb_rows - 1, nb_rows, GTK_EXPAND | GTK_FILL, 0, 0, 0); #else gtk_table_attach (GTK_TABLE (priv->table_common_settings), w, 0, 1, nb_rows - 1, nb_rows, GTK_FILL, 0, 0, 0); gtk_table_attach (GTK_TABLE (priv->table_common_settings), priv->enabled_checkbox, 1, nb_columns, nb_rows - 1, nb_rows, GTK_EXPAND | GTK_FILL, 0, 0, 0); #endif /* HAVE_MOBLIN */ gtk_widget_show (priv->enabled_checkbox); #ifndef HAVE_MOBLIN g_signal_connect (G_OBJECT (priv->enabled_checkbox), "released", G_CALLBACK (account_widget_enabled_released_cb), self); #else g_signal_connect (G_OBJECT (priv->enabled_checkbox), "switch-flipped", G_CALLBACK (account_widget_switch_flipped_cb), self); #endif /* HAVE_MOBLIN */ } /* hook up to widget destruction to unref ourselves */ g_signal_connect (self->ui_details->widget, "destroy", G_CALLBACK (account_widget_destroy_cb), self); empathy_builder_unref_and_keep_widget (self->ui_details->gui, self->ui_details->widget); self->ui_details->gui = NULL; }