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_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_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, "treeview", &dialog->treeview, "button_join", &dialog->button_join, "expander_browse", &dialog->expander_browse, "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 = ephy_spinner_new (); ephy_spinner_set_size (EPHY_SPINNER (dialog->throbber), GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_widget_show (dialog->throbber); gtk_table_attach (GTK_TABLE (dialog->table_info), dialog->throbber, 2, 3, 0, 1, 0, 0, 0, 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_supports_multichat, NULL); gtk_table_attach_defaults (GTK_TABLE (dialog->table_info), dialog->account_chooser, 1, 2, 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); }
static GtkWidget * build_tab_label (NautilusNotebook *nb, NautilusWindowSlot *slot) { NautilusDragSlotProxyInfo *drag_info; GtkWidget *hbox, *label, *close_button, *image, *spinner, *icon; /* set hbox spacing and label padding (see below) so that there's an * equal amount of space around the label */ hbox = gtk_hbox_new (FALSE, 4); gtk_widget_show (hbox); /* setup load feedback */ spinner = ephy_spinner_new (); ephy_spinner_set_size (EPHY_SPINNER (spinner), GTK_ICON_SIZE_MENU); gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0); /* setup site icon, empty by default */ icon = gtk_image_new (); gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0); /* don't show the icon */ /* setup label */ label = gtk_label_new (NULL); gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END); gtk_label_set_single_line_mode (GTK_LABEL (label), TRUE); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 0, 0); gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); gtk_widget_show (label); /* setup close button */ close_button = gtk_button_new (); gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE); /* don't allow focus on the close button */ gtk_button_set_focus_on_click (GTK_BUTTON (close_button), FALSE); gtk_widget_set_name (close_button, "nautilus-tab-close-button"); image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); gtk_widget_set_tooltip_text (close_button, _("Close tab")); g_signal_connect_object (close_button, "clicked", G_CALLBACK (close_button_clicked_cb), slot, 0); gtk_container_add (GTK_CONTAINER (close_button), image); gtk_widget_show (image); gtk_box_pack_start (GTK_BOX (hbox), close_button, FALSE, FALSE, 0); gtk_widget_show (close_button); /* Set minimal size */ g_signal_connect (hbox, "style-set", G_CALLBACK (tab_label_style_set_cb), NULL); drag_info = g_new0 (NautilusDragSlotProxyInfo, 1); drag_info->target_slot = slot; g_object_set_data_full (G_OBJECT (hbox), "proxy-drag-info", drag_info, (GDestroyNotify) g_free); nautilus_drag_slot_proxy_init (hbox, drag_info); g_object_set_data (G_OBJECT (hbox), "label", label); g_object_set_data (G_OBJECT (hbox), "spinner", spinner); g_object_set_data (G_OBJECT (hbox), "icon", icon); g_object_set_data (G_OBJECT (hbox), "close-button", close_button); return hbox; }
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; }