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; }
static void contact_widget_contact_setup (EmpathyContactWidget *information) { /* Setup account label/chooser */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT) { information->widget_account = empathy_account_chooser_new (); g_signal_connect_swapped (information->widget_account, "changed", G_CALLBACK (contact_widget_change_contact), information); } else { information->widget_account = gtk_label_new (NULL); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) { gtk_label_set_selectable (GTK_LABEL (information->widget_account), TRUE); } gtk_misc_set_alignment (GTK_MISC (information->widget_account), 0, 0.5); } gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->widget_account, 1, 2, 0, 1); gtk_widget_show (information->widget_account); /* Set up avatar chooser/display */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_AVATAR) { information->widget_avatar = empathy_avatar_chooser_new (); g_signal_connect (information->widget_avatar, "changed", G_CALLBACK (contact_widget_avatar_changed_cb), information); if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT) { g_signal_connect (information->widget_account, "changed", G_CALLBACK (update_avatar_chooser_account_cb), information->widget_avatar); update_avatar_chooser_account_cb ( EMPATHY_ACCOUNT_CHOOSER (information->widget_account), EMPATHY_AVATAR_CHOOSER (information->widget_avatar)); } } else { information->widget_avatar = empathy_avatar_image_new (); g_signal_connect (information->widget_avatar, "popup-menu", G_CALLBACK (widget_avatar_popup_menu_cb), information); g_signal_connect (information->widget_avatar, "button-press-event", G_CALLBACK (widget_avatar_button_press_event_cb), information); } gtk_box_pack_start (GTK_BOX (information->vbox_avatar), information->widget_avatar, FALSE, FALSE, 6); gtk_widget_show (information->widget_avatar); /* Setup id label/entry */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID) { information->widget_id = gtk_entry_new (); g_signal_connect (information->widget_id, "focus-out-event", G_CALLBACK (contact_widget_id_focus_out_cb), information); g_signal_connect (information->widget_id, "changed", G_CALLBACK (contact_widget_id_changed_cb), information); } else { information->widget_id = gtk_label_new (NULL); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) { gtk_label_set_selectable (GTK_LABEL (information->widget_id), TRUE); } gtk_misc_set_alignment (GTK_MISC (information->widget_id), 0, 0.5); } gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->widget_id, 1, 2, 1, 2); gtk_widget_show (information->widget_id); /* Setup alias label/entry */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ALIAS) { information->widget_alias = gtk_entry_new (); g_signal_connect (information->widget_alias, "focus-out-event", G_CALLBACK (contact_widget_entry_alias_focus_event_cb), information); /* Make return activate the window default (the Close button) */ gtk_entry_set_activates_default (GTK_ENTRY (information->widget_alias), TRUE); } else { information->widget_alias = gtk_label_new (NULL); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) { gtk_label_set_selectable (GTK_LABEL (information->widget_alias), TRUE); } gtk_misc_set_alignment (GTK_MISC (information->widget_alias), 0, 0.5); } gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->widget_alias, 1, 2, 2, 3); if (information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP) { gtk_label_set_selectable (GTK_LABEL (information->label_status), FALSE); } gtk_widget_show (information->widget_alias); }
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); }
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 contact_widget_contact_setup (EmpathyContactWidget *information) { /* Setup label_status as a KludgeLabel */ information->label_status = empathy_kludge_label_new (""); gtk_label_set_line_wrap_mode (GTK_LABEL (information->label_status), PANGO_WRAP_WORD_CHAR); gtk_label_set_line_wrap (GTK_LABEL (information->label_status), TRUE); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) gtk_label_set_selectable (GTK_LABEL (information->label_status), TRUE); gtk_box_pack_start (GTK_BOX (information->hbox_presence), information->label_status, TRUE, TRUE, 0); gtk_widget_show (information->label_status); /* Setup account label/chooser */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT) { information->widget_account = empathy_account_chooser_new (); g_signal_connect_swapped (information->widget_account, "changed", G_CALLBACK (contact_widget_change_contact), information); } else { /* Pack the protocol icon with the account name in an hbox */ information->widget_account = gtk_hbox_new (FALSE, 6); information->label_account = gtk_label_new (NULL); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) { gtk_label_set_selectable (GTK_LABEL (information->label_account), TRUE); } gtk_misc_set_alignment (GTK_MISC (information->label_account), 0, 0.5); gtk_widget_show (information->label_account); information->image_account = gtk_image_new (); gtk_widget_show (information->image_account); gtk_box_pack_start (GTK_BOX (information->widget_account), information->image_account, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (information->widget_account), information->label_account, FALSE, TRUE, 0); } gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->widget_account, 1, 2, 0, 1); gtk_widget_show (information->widget_account); /* Set up avatar chooser/display */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_AVATAR) { information->widget_avatar = empathy_avatar_chooser_new (); g_signal_connect (information->widget_avatar, "changed", G_CALLBACK (contact_widget_avatar_changed_cb), information); if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT) { g_signal_connect (information->widget_account, "changed", G_CALLBACK (update_avatar_chooser_account_cb), information->widget_avatar); update_avatar_chooser_account_cb ( EMPATHY_ACCOUNT_CHOOSER (information->widget_account), EMPATHY_AVATAR_CHOOSER (information->widget_avatar)); } } else { information->widget_avatar = empathy_avatar_image_new (); g_signal_connect (information->widget_avatar, "popup-menu", G_CALLBACK (widget_avatar_popup_menu_cb), information); g_signal_connect (information->widget_avatar, "button-press-event", G_CALLBACK (widget_avatar_button_press_event_cb), information); } gtk_box_pack_start (GTK_BOX (information->vbox_avatar), information->widget_avatar, FALSE, FALSE, 6); gtk_widget_show (information->widget_avatar); /* Setup id label/entry */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID) { information->widget_id = gtk_entry_new (); g_signal_connect (information->widget_id, "focus-out-event", G_CALLBACK (contact_widget_id_focus_out_cb), information); g_signal_connect (information->widget_id, "changed", G_CALLBACK (contact_widget_id_changed_cb), information); } else { information->widget_id = gtk_label_new (NULL); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) { gtk_label_set_selectable (GTK_LABEL (information->widget_id), TRUE); } gtk_misc_set_alignment (GTK_MISC (information->widget_id), 0, 0.5); } gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->widget_id, 1, 2, 1, 2); gtk_widget_show (information->widget_id); /* Setup alias label/entry */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ALIAS) { information->widget_alias = gtk_entry_new (); if (!(information->flags & EMPATHY_CONTACT_WIDGET_NO_SET_ALIAS)) g_signal_connect (information->widget_alias, "focus-out-event", G_CALLBACK (contact_widget_entry_alias_focus_event_cb), information); /* Make return activate the window default (the Close button) */ gtk_entry_set_activates_default (GTK_ENTRY (information->widget_alias), TRUE); } else { information->widget_alias = gtk_label_new (NULL); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) { gtk_label_set_selectable (GTK_LABEL (information->widget_alias), TRUE); } gtk_misc_set_alignment (GTK_MISC (information->widget_alias), 0, 0.5); } gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->widget_alias, 1, 2, 2, 3); if (information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP) { gtk_label_set_selectable (GTK_LABEL (information->label_status), FALSE); } gtk_widget_show (information->widget_alias); #if HAVE_FAVOURITE_CONTACTS /* Favorite */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_FAVOURITE) { information->favourite_checkbox = gtk_check_button_new_with_label ( _("Favorite")); g_signal_connect (information->favourite_checkbox, "toggled", G_CALLBACK (favourite_toggled_cb), information); gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->favourite_checkbox, 0, 2, 3, 4); information->fav_sig_id = g_signal_connect (information->manager, "favourites-changed", G_CALLBACK (contact_widget_favourites_changed_cb), information); gtk_widget_show (information->favourite_checkbox); } #endif }
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); }