Mercurial > emacs
view lisp/gnus/gnus-ml.el @ 109067:b5f73bf59a4f
Use non-deprecated Gtk+ functions, add changes for Gtk+3 with GSEAL_ENABLE.
* configure.in: Add --with-x-toolkit=gtk3. Remove HAVE_GTK_MULTIDISPLAY,
check for gtk_file_chooser_dialog_new, and HAVE_GTK_FILE_BOTH (implied
by minimum required Gtk+ 2.6). Add checks for functions introduced
in Gtk+ 2.14 or newer.
* xterm.h (gtk_widget_get_window, gtk_widget_get_mapped)
(gtk_adjustment_get_page_size, gtk_adjustment_get_upper): New
defines based on what configure finds.
* xterm.c (XTflash): Use gtk_widget_get_window.
(xg_scroll_callback): Use gtk_adjustment_get_upper and
gtk_adjustment_get_page_size.
(handle_one_xevent): Use gtk_widget_get_mapped.
(x_term_init): Remove HAVE_GTK_MULTIDISPLAY and associated error
messages.
* xmenu.c (create_and_show_popup_menu): Call gtk_widget_get_mapped.
* gtkutil.h: Replace HAVE_GTK_FILE_BOTH with
HAVE_GTK_FILE_SELECTION_NEW.
* gtkutil.c (xg_display_open, xg_display_close): Remove
HAVE_GTK_MULTIDISPLAY, it is always defined.
(xg_display_open): Return type is void.
(gtk_widget_set_has_window)
(gtk_dialog_get_action_area, gtk_dialog_get_content_area)
(gtk_widget_get_sensitive, gtk_adjustment_set_page_size)
(gtk_adjustment_set_page_increment)
(gtk_adjustment_get_step_increment): #define these if not found
by configure.
(remove_submenu): New define based on Gtk+ version.
(xg_set_cursor, xg_frame_resized, xg_event_is_for_scrollbar): Use
gtk_widget_get_window.
(xg_frame_resized, xg_update_frame_menubar): Use gtk_widget_get_mapped.
(xg_create_frame_widgets): Use gtk_widget_set_has_window.
(create_dialog): Use gtk_dialog_get_action_area and
gtk_dialog_get_content_area.
(xg_uses_old_file_dialog, xg_get_file_name): Remove HAVE_GTK_FILE_BOTH
and HAVE_GTK_FILE_CHOOSER_DIALOG_NEW. File chooser is always
available, so checking for HAVE_GTK_FILE_SELECTION_NEW is enough.
(xg_update_menubar, xg_update_submenu, xg_show_toolbar_item): Use
g_object_ref and g_object_unref.
(xg_update_menu_item, xg_tool_bar_menu_proxy): Use
gtk_widget_get_sensitive.
(xg_update_submenu): Use remove_submenu.
(xg_update_scrollbar_pos): Don't use GtkFixedChild, use child
properties instead to get old x and y position.
(xg_set_toolkit_scroll_bar_thumb): Use gtk_adjustment_get_page_size,
gtk_adjustment_get_step_increment, gtk_adjustment_set_page_size,
gtk_adjustment_set_step_increment and gtk_adjustment_set_page_increment.
(xg_get_tool_bar_widgets): New function.
(xg_tool_bar_menu_proxy, xg_show_toolbar_item)
(update_frame_tool_bar): Call xg_get_tool_bar_widgets.
(toolbar_set_orientation): New #define based on if configure
finds gtk_orientable_set_orientation.
(xg_create_tool_bar): Call toolbar_set_orientation.
(xg_make_tool_item, xg_show_toolbar_item): Call gtk_box_pack_start
instead of gtk_box_pack_start_defaults.
author | Jan D <jan.h.d@swipnet.se> |
---|---|
date | Mon, 28 Jun 2010 12:11:26 +0200 |
parents | c0d13767677a |
children | 8d09094063d0 |
line wrap: on
line source
;;; gnus-ml.el --- Mailing list minor mode for Gnus ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; Author: Julien Gilles <jgilles@free.fr> ;; Keywords: news, mail ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. ;;; Commentary: ;; implement (small subset of) RFC 2369 ;;; Code: (require 'gnus) (require 'gnus-msg) (eval-when-compile (require 'cl)) (eval-when-compile (when (featurep 'xemacs) (require 'easy-mmode))) ; for `define-minor-mode' ;;; Mailing list minor mode (defvar gnus-mailing-list-mode-map (let ((map (make-sparse-keymap))) (gnus-define-keys map "\C-c\C-nh" gnus-mailing-list-help "\C-c\C-ns" gnus-mailing-list-subscribe "\C-c\C-nu" gnus-mailing-list-unsubscribe "\C-c\C-np" gnus-mailing-list-post "\C-c\C-no" gnus-mailing-list-owner "\C-c\C-na" gnus-mailing-list-archive) map)) (defvar gnus-mailing-list-menu) (defun gnus-mailing-list-make-menu-bar () (unless (boundp 'gnus-mailing-list-menu) (easy-menu-define gnus-mailing-list-menu gnus-mailing-list-mode-map "" '("Mailing-Lists" ["Get help" gnus-mailing-list-help t] ["Subscribe" gnus-mailing-list-subscribe t] ["Unsubscribe" gnus-mailing-list-unsubscribe t] ["Post a message" gnus-mailing-list-post t] ["Mail to owner" gnus-mailing-list-owner t] ["Browse archive" gnus-mailing-list-archive t])))) ;;;###autoload (defun turn-on-gnus-mailing-list-mode () (when (gnus-group-find-parameter gnus-newsgroup-name 'to-list) (gnus-mailing-list-mode 1))) ;;;###autoload (defun gnus-mailing-list-insinuate (&optional force) "Setup group parameters from List-Post header. If FORCE is non-nil, replace the old ones." (interactive "P") (let ((list-post (with-current-buffer gnus-original-article-buffer (gnus-fetch-field "list-post")))) (if list-post (if (and (not force) (gnus-group-get-parameter gnus-newsgroup-name 'to-list)) (gnus-message 1 "to-list is non-nil.") (if (string-match "<mailto:\\([^>]*\\)>" list-post) (setq list-post (match-string 1 list-post))) (gnus-group-add-parameter gnus-newsgroup-name (cons 'to-list list-post)) (gnus-mailing-list-mode 1)) (gnus-message 1 "no list-post in this message.")))) (eval-when-compile (when (featurep 'xemacs) (defvar gnus-mailing-list-mode-hook) (defvar gnus-mailing-list-mode-on-hook) (defvar gnus-mailing-list-mode-off-hook))) ;;;###autoload (define-minor-mode gnus-mailing-list-mode "Minor mode for providing mailing-list commands. \\{gnus-mailing-list-mode-map}" :lighter " Mailing-List" :keymap gnus-mailing-list-mode-map (cond ((not (derived-mode-p 'gnus-summary-mode)) (setq gnus-mailing-list-mode nil)) (gnus-mailing-list-mode ;; Set up the menu. (when (gnus-visual-p 'mailing-list-menu 'menu) (gnus-mailing-list-make-menu-bar))))) ;;; Commands (defun gnus-mailing-list-help () "Get help from mailing list server." (interactive) (let ((list-help (with-current-buffer gnus-original-article-buffer (gnus-fetch-field "list-help")))) (cond (list-help (gnus-mailing-list-message list-help)) (t (gnus-message 1 "no list-help in this group"))))) (defun gnus-mailing-list-subscribe () "Subscribe to mailing list." (interactive) (let ((list-subscribe (with-current-buffer gnus-original-article-buffer (gnus-fetch-field "list-subscribe")))) (cond (list-subscribe (gnus-mailing-list-message list-subscribe)) (t (gnus-message 1 "no list-subscribe in this group"))))) (defun gnus-mailing-list-unsubscribe () "Unsubscribe from mailing list." (interactive) (let ((list-unsubscribe (with-current-buffer gnus-original-article-buffer (gnus-fetch-field "list-unsubscribe")))) (cond (list-unsubscribe (gnus-mailing-list-message list-unsubscribe)) (t (gnus-message 1 "no list-unsubscribe in this group"))))) (defun gnus-mailing-list-post () "Post message (really useful ?)" (interactive) (let ((list-post (with-current-buffer gnus-original-article-buffer (gnus-fetch-field "list-post")))) (cond (list-post (gnus-mailing-list-message list-post)) (t (gnus-message 1 "no list-post in this group"))))) (defun gnus-mailing-list-owner () "Mail to the mailing list owner." (interactive) (let ((list-owner (with-current-buffer gnus-original-article-buffer (gnus-fetch-field "list-owner")))) (cond (list-owner (gnus-mailing-list-message list-owner)) (t (gnus-message 1 "no list-owner in this group"))))) (defun gnus-mailing-list-archive () "Browse archive." (interactive) (require 'browse-url) (let ((list-archive (with-current-buffer gnus-original-article-buffer (gnus-fetch-field "list-archive")))) (cond (list-archive (if (string-match "<\\(http:[^>]*\\)>" list-archive) (browse-url (match-string 1 list-archive)) (browse-url list-archive))) (t (gnus-message 1 "no list-archive in this group"))))) ;;; Utility functions (defun gnus-mailing-list-message (address) "Send message to ADDRESS. ADDRESS is specified by a \"mailto:\" URL." (cond ((string-match "<\\(mailto:[^>]*\\)>" address) (require 'gnus-art) (gnus-url-mailto (match-string 1 address))) ;; other case <http://...> to be done. (t nil))) (provide 'gnus-ml) ;; arch-tag: 936c0fe6-acce-4c16-87d0-eded88078896 ;;; gnus-ml.el ends here