unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Icon update
@ 2006-03-26 22:57 Bill Wohler
  2006-03-26 22:59 ` Bill Wohler
  2006-03-28 19:22 ` Bill Wohler
  0 siblings, 2 replies; 35+ messages in thread
From: Bill Wohler @ 2006-03-26 22:57 UTC (permalink / raw)


Using the GNOME icons from Reiner's recent check-in in MH-E, I am now
able to delete the following hand-made icons:

* mail (use mail/inbox)

* mail/alias (use contact)

* mail/refile (use mail/move)

* fld_open (use open)

MH-E had a few more hand-made icons that weren't accommodated by the
recent check-in. I therefore propose we delete the following hand-made
icons and replace them with the suggested GNOME icons minus the "stock_"
prefix:

* widen (use stock_zoom-out and stock_zoom-in)

* highlight (use stock_mail-flag-for-followup)

* execute (use stock_data-save)

* page-down (use stock_next-page)

It does not appear that any packages (besides MH-E) are using these
icons, but please let me know if this is not the case.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-26 22:57 Icon update Bill Wohler
@ 2006-03-26 22:59 ` Bill Wohler
  2006-03-27 19:55   ` David Kastrup
  2006-03-28 19:22 ` Bill Wohler
  1 sibling, 1 reply; 35+ messages in thread
From: Bill Wohler @ 2006-03-26 22:59 UTC (permalink / raw)


Note that the arrows will remain green, the GTK color, rather than blue,
the current GNOME color. The reason is that there is a bug in GNOME
which prevents the current theme from overriding the default GTK icons.
I have been told this has been fixed in GNOME 2.15 (which I assume will
appear to users in GNOME 2.16), but this is probably outside the date
that Emacs will be available.

By the way, if anyone has GTK experience, the Emacs code should be using
the GTK libraries to render the icons and only using our built-in icons
as a fall-back. That way, Emacs icons will pick up theme changes.

These things I learned during a short discussion with the GNOME
usability folks. They were also shocked that we were using XPMs instead
of PNGs which offer 8 bits of transparency instead of 1. Can anyone
speak to that?

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-26 22:59 ` Bill Wohler
@ 2006-03-27 19:55   ` David Kastrup
  2006-03-28  6:33     ` Jan D.
  0 siblings, 1 reply; 35+ messages in thread
From: David Kastrup @ 2006-03-27 19:55 UTC (permalink / raw)


Bill Wohler <wohler@newt.com> writes:

> Note that the arrows will remain green, the GTK color, rather than blue,
> the current GNOME color. The reason is that there is a bug in GNOME
> which prevents the current theme from overriding the default GTK icons.
> I have been told this has been fixed in GNOME 2.15 (which I assume will
> appear to users in GNOME 2.16), but this is probably outside the date
> that Emacs will be available.
>
> By the way, if anyone has GTK experience, the Emacs code should be using
> the GTK libraries to render the icons and only using our built-in icons
> as a fall-back. That way, Emacs icons will pick up theme changes.
>
> These things I learned during a short discussion with the GNOME
> usability folks. They were also shocked that we were using XPMs instead
> of PNGs which offer 8 bits of transparency instead of 1. Can anyone
> speak to that?

IIRC, XPM support is always compiled in, whereas PNG support depends
on the availability of external libraries.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-27 19:55   ` David Kastrup
@ 2006-03-28  6:33     ` Jan D.
  2006-03-29  0:42       ` Leon
  0 siblings, 1 reply; 35+ messages in thread
From: Jan D. @ 2006-03-28  6:33 UTC (permalink / raw)
  Cc: emacs-devel



David Kastrup wrote:
> Bill Wohler <wohler@newt.com> writes:
> 
>>
>> By the way, if anyone has GTK experience, the Emacs code should be using
>> the GTK libraries to render the icons and only using our built-in icons
>> as a fall-back. That way, Emacs icons will pick up theme changes.

I have a patch that does just that, but I decided to wait with it until after 
the release.  It will only work for Emacs compiled with GTK, but I guess that 
is obvious.

	Jan D.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-26 22:57 Icon update Bill Wohler
  2006-03-26 22:59 ` Bill Wohler
@ 2006-03-28 19:22 ` Bill Wohler
  1 sibling, 0 replies; 35+ messages in thread
From: Bill Wohler @ 2006-03-28 19:22 UTC (permalink / raw)


Bill Wohler <wohler@newt.com> writes:

> Using the GNOME icons from Reiner's recent check-in in MH-E, I am now
> able to delete the following hand-made icons:
>
> * mail (use mail/inbox)
>
> * mail/alias (use contact)
>
> * mail/refile (use mail/move)
>
> * fld_open (use open)
>
> MH-E had a few more hand-made icons that weren't accommodated by the
> recent check-in. I therefore propose we delete the following hand-made
> icons and replace them with the suggested GNOME icons minus the "stock_"
> prefix:
>
> * widen (use stock_zoom-out and stock_zoom-in)
>
> * highlight (use stock_mail-flag-for-followup)
>
> * execute (use stock_data-save)
>
> * page-down (use stock_next-page)

Done.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-28  6:33     ` Jan D.
@ 2006-03-29  0:42       ` Leon
  2006-03-29  4:17         ` Bill Wohler
  2006-03-29 10:11         ` Jan D.
  0 siblings, 2 replies; 35+ messages in thread
From: Leon @ 2006-03-29  0:42 UTC (permalink / raw)


"Jan D." <jan.h.d@swipnet.se> writes:

> David Kastrup wrote:
>> Bill Wohler <wohler@newt.com> writes:
>> 
>>>
>>> By the way, if anyone has GTK experience, the Emacs code should be using
>>> the GTK libraries to render the icons and only using our built-in icons
>>> as a fall-back. That way, Emacs icons will pick up theme changes.
>
> I have a patch that does just that, but I decided to wait with it
> until after the release.  It will only work for Emacs compiled with
> GTK, but I guess that is obvious.
>
> 	Jan D.
Sounds interesting. May I have a copy of the patch? Thanks.

-- 
Leon

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-29  0:42       ` Leon
@ 2006-03-29  4:17         ` Bill Wohler
  2006-03-29 10:11         ` Jan D.
  1 sibling, 0 replies; 35+ messages in thread
From: Bill Wohler @ 2006-03-29  4:17 UTC (permalink / raw)


"Jan D." <jan.h.d@swipnet.se> writes:

> Bill Wohler <wohler@newt.com> writes:
> 
>
> By the way, if anyone has GTK experience, the Emacs code should be using
> the GTK libraries to render the icons and only using our built-in icons
> as a fall-back. That way, Emacs icons will pick up theme changes.

I have a patch that does just that, but I decided to wait with it
until after the release.  It will only work for Emacs compiled with
GTK, but I guess that is obvious.

Excellent! Thanks.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-29  0:42       ` Leon
  2006-03-29  4:17         ` Bill Wohler
@ 2006-03-29 10:11         ` Jan D.
  2006-03-29 19:03           ` Leon
  1 sibling, 1 reply; 35+ messages in thread
From: Jan D. @ 2006-03-29 10:11 UTC (permalink / raw)
  Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 713 bytes --]



Leon wrote:
> "Jan D." <jan.h.d@swipnet.se> writes:
> 
>> David Kastrup wrote:
>>> Bill Wohler <wohler@newt.com> writes:
>>>
>>>> By the way, if anyone has GTK experience, the Emacs code should be using
>>>> the GTK libraries to render the icons and only using our built-in icons
>>>> as a fall-back. That way, Emacs icons will pick up theme changes.
>> I have a patch that does just that, but I decided to wait with it
>> until after the release.  It will only work for Emacs compiled with
>> GTK, but I guess that is obvious.
>>
>> 	Jan D.
> Sounds interesting. May I have a copy of the patch? Thanks.

Attached.  But some icons don't have stock items, so the effect may be strange 
for some themes.

	Jan D.

[-- Attachment #2: emacs-stock.diff --]
[-- Type: text/x-patch, Size: 18463 bytes --]

Index: lisp/info.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/info.el,v
retrieving revision 1.481
diff -u -c -r1.481 info.el
*** lisp/info.el	11 Mar 2006 22:35:18 -0000	1.481
--- lisp/info.el	29 Mar 2006 10:05:16 -0000
***************
*** 3209,3224 ****
  (defvar info-tool-bar-map
    (if (display-graphic-p)
        (let ((map (make-sparse-keymap)))
! 	(tool-bar-local-item-from-menu 'Info-exit "close" map Info-mode-map)
! 	(tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map)
! 	(tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map)
  	(tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map)
  	(tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map)
  	(tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map)
! 	(tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map)
! 	(tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map)
! 	(tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map)
! 	(tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map)
  	map)))
  
  (defvar Info-menu-last-node nil)
--- 3209,3231 ----
  (defvar info-tool-bar-map
    (if (display-graphic-p)
        (let ((map (make-sparse-keymap)))
! 	(tool-bar-local-item-from-menu 'Info-exit "close" map Info-mode-map
! 				       :stock "gtk-close")
! 	(tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map
! 				       :stock "gtk-go-back")
! 	(tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map
! 				       :stock "gtk-go-forward")
  	(tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map)
  	(tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map)
  	(tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map)
! 	(tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map
! 				       :stock "gtk-home")
! 	(tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map
! 				       :stock "gtk-jump-to")
! 	(tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map
! 				       :stock "gtk-index")
! 	(tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map
! 				       :stock "gtk-find")
  	map)))
  
  (defvar Info-menu-last-node nil)
Index: lisp/tool-bar.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/tool-bar.el,v
retrieving revision 1.5
diff -u -c -r1.5 tool-bar.el
*** lisp/tool-bar.el	6 Feb 2006 14:33:35 -0000	1.5
--- lisp/tool-bar.el	29 Mar 2006 10:05:16 -0000
***************
*** 232,279 ****
    ;; People say it's bad to have EXIT on the tool bar, since users
    ;; might inadvertently click that button.
    ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
!   (tool-bar-add-item-from-menu 'find-file "new")
!   (tool-bar-add-item-from-menu 'menu-find-file-existing "open")
!   (tool-bar-add-item-from-menu 'dired "diropen")
!   (tool-bar-add-item-from-menu 'kill-this-buffer "close")
    (tool-bar-add-item-from-menu 'save-buffer "save" nil
  			       :visible '(or buffer-file-name
  					     (not (eq 'special
  						      (get major-mode
  							   'mode-class)))))
    (tool-bar-add-item-from-menu 'write-file "saveas" nil
  			       :visible '(or buffer-file-name
  					     (not (eq 'special
  						      (get major-mode
  							   'mode-class)))))
    (tool-bar-add-item-from-menu 'undo "undo" nil
  			       :visible '(not (eq 'special (get major-mode
  								'mode-class))))
    (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [cut])
  			       "cut" nil
  			       :visible '(not (eq 'special (get major-mode
  								'mode-class))))
    (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [copy])
! 			       "copy")
    (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [paste])
  			       "paste" nil
  			       :visible '(not (eq 'special (get major-mode
  								'mode-class))))
!   (tool-bar-add-item-from-menu 'nonincremental-search-forward "search")
    ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell")
  
    ;; There's no icon appropriate for News and we need a command rather
    ;; than a lambda for Read Mail.
    ;;(tool-bar-add-item-from-menu 'compose-mail "mail/compose")
  
!   (tool-bar-add-item-from-menu 'print-buffer "print")
    (tool-bar-add-item "preferences" 'customize 'customize
  		     :help "Edit preferences (customize)")
  
    (tool-bar-add-item "help" (lambda ()
  			      (interactive)
  			      (popup-menu menu-bar-help-menu))
  		     'help
  		     :help "Pop up the Help menu")
    )
  
--- 232,291 ----
    ;; People say it's bad to have EXIT on the tool bar, since users
    ;; might inadvertently click that button.
    ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
!   (tool-bar-add-item-from-menu 'find-file "new" nil :stock "gtk-new")
!   (tool-bar-add-item-from-menu 'menu-find-file-existing "open"
! 			       nil :stock "gtk-open")
!   (tool-bar-add-item-from-menu 'dired "diropen"
! 			       nil :stock "gtk-directory")
!   (tool-bar-add-item-from-menu 'kill-this-buffer "close"
! 			       nil :stock "gtk-close")
    (tool-bar-add-item-from-menu 'save-buffer "save" nil
+ 			       :stock "gtk-save"
  			       :visible '(or buffer-file-name
  					     (not (eq 'special
  						      (get major-mode
  							   'mode-class)))))
    (tool-bar-add-item-from-menu 'write-file "saveas" nil
+ 			       :stock "gtk-save-as"
  			       :visible '(or buffer-file-name
  					     (not (eq 'special
  						      (get major-mode
  							   'mode-class)))))
    (tool-bar-add-item-from-menu 'undo "undo" nil
+ 			       :stock "gtk-undo"
  			       :visible '(not (eq 'special (get major-mode
  								'mode-class))))
    (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [cut])
  			       "cut" nil
+ 			       :stock "gtk-cut"
  			       :visible '(not (eq 'special (get major-mode
  								'mode-class))))
    (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [copy])
! 			       "copy" nil :stock "gtk-copy")
    (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [paste])
  			       "paste" nil
+ 			       :stock "gtk-paste"
  			       :visible '(not (eq 'special (get major-mode
  								'mode-class))))
!   (tool-bar-add-item-from-menu 'nonincremental-search-forward "search"
! 			       nil :stock "gtk-find")
    ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell")
  
    ;; There's no icon appropriate for News and we need a command rather
    ;; than a lambda for Read Mail.
    ;;(tool-bar-add-item-from-menu 'compose-mail "mail/compose")
  
!   (tool-bar-add-item-from-menu 'print-buffer "print"
! 			       nil :stock "gtk-print")
    (tool-bar-add-item "preferences" 'customize 'customize
+ 		     :stock "gtk-preferences"
  		     :help "Edit preferences (customize)")
  
    (tool-bar-add-item "help" (lambda ()
  			      (interactive)
  			      (popup-menu menu-bar-help-menu))
  		     'help
+ 		     :stock "gtk-help"
  		     :help "Pop up the Help menu")
    )
  
Index: src/dispextern.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/dispextern.h,v
retrieving revision 1.215
diff -u -c -r1.215 dispextern.h
*** src/dispextern.h	15 Mar 2006 07:55:36 -0000	1.215
--- src/dispextern.h	29 Mar 2006 10:05:17 -0000
***************
*** 2539,2544 ****
--- 2539,2547 ----
    /* Help string.  */
    TOOL_BAR_ITEM_HELP,
  
+   /* Stock image.  */
+   TOOL_BAR_ITEM_STOCK_IMAGE,
+ 
    /* Sentinel = number of slots in tool_bar_items occupied by one
       tool-bar item.  */
    TOOL_BAR_ITEM_NSLOTS
Index: src/gtkutil.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/gtkutil.c,v
retrieving revision 1.84
diff -u -c -r1.84 gtkutil.c
*** src/gtkutil.c	24 Feb 2006 15:36:39 -0000	1.84
--- src/gtkutil.c	29 Mar 2006 10:05:17 -0000
***************
*** 3243,3248 ****
--- 3243,3253 ----
  #define XG_TOOL_BAR_LAST_MODIFIER "emacs-tool-bar-modifier"
  
  
+ /* The key for the data we put in the GtkImage widgets.  The data is
+    the stock name used by Emacs.  We use this to see if we need to update
+    the GtkImage with a new image.  */
+ #define XG_TOOL_BAR_STOCK_NAME "emacs-tool-bar-stock-name"
+ 
  /* Callback function invoked when a tool bar item is pressed.
     W is the button widget in the tool bar that got pressed,
     CLIENT_DATA is an integer that is the index of the button in the
***************
*** 3525,3530 ****
--- 3530,3536 ----
    GList *iter;
    struct x_output *x = f->output_data.x;
    int hmargin, vmargin;
+   GtkToolbar *wtoolbar;
  
    if (! FRAME_GTK_WIDGET (f))
      return;
***************
*** 3558,3566 ****
    if (! x->toolbar_widget)
      xg_create_tool_bar (f);
  
!   gtk_widget_size_request (x->toolbar_widget, &old_req);
! 
!   icon_list = gtk_container_get_children (GTK_CONTAINER (x->toolbar_widget));
    iter = icon_list;
  
    for (i = 0; i < f->n_tool_bar_items; ++i)
--- 3564,3573 ----
    if (! x->toolbar_widget)
      xg_create_tool_bar (f);
  
!   wtoolbar = GTK_TOOLBAR (x->toolbar_widget);
!   gtk_widget_size_request (GTK_WIDGET (wtoolbar), &old_req);
!   
!   icon_list = gtk_container_get_children (GTK_CONTAINER (wtoolbar));
    iter = icon_list;
  
    for (i = 0; i < f->n_tool_bar_items; ++i)
***************
*** 3571,3622 ****
        int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
        int idx;
        int img_id;
!       struct image *img;
        Lisp_Object image;
        GtkWidget *wicon = iter ? GTK_WIDGET (iter->data) : 0;
  
        if (iter) iter = g_list_next (iter);
  
!       /* If image is a vector, choose the image according to the
! 	 button state.  */
!       image = PROP (TOOL_BAR_ITEM_IMAGES);
!       if (VECTORP (image))
! 	{
! 	  if (enabled_p)
! 	    idx = (selected_p
! 		   ? TOOL_BAR_IMAGE_ENABLED_SELECTED
! 		   : TOOL_BAR_IMAGE_ENABLED_DESELECTED);
! 	  else
! 	    idx = (selected_p
! 		   ? TOOL_BAR_IMAGE_DISABLED_SELECTED
! 		   : TOOL_BAR_IMAGE_DISABLED_DESELECTED);
! 
! 	  xassert (ASIZE (image) >= idx);
! 	  image = AREF (image, idx);
! 	}
!       else
! 	idx = -1;
  
!       /* Ignore invalid image specifications.  */
!       if (!valid_image_p (image))
          {
!           if (wicon) gtk_widget_hide (wicon);
!           continue;
          }
  
!       img_id = lookup_image (f, image);
!       img = IMAGE_FROM_ID (f, img_id);
!       prepare_image_for_display (f, img);
  
-       if (img->load_failed_p || img->pixmap == None)
-         {
-           if (wicon) gtk_widget_hide (wicon);
-           continue;
          }
  
        if (! wicon)
          {
!           GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
            GtkToolItem *ti = gtk_tool_button_new (w, "");
  
            gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
--- 3578,3663 ----
        int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
        int idx;
        int img_id;
!       int icon_size = 0;
!       struct image *img = NULL;
        Lisp_Object image;
+       Lisp_Object stock;
        GtkWidget *wicon = iter ? GTK_WIDGET (iter->data) : 0;
+       GtkStockItem stock_item;
+       char *stock_name = NULL;
  
        if (iter) iter = g_list_next (iter);
  
!       stock = PROP (TOOL_BAR_ITEM_STOCK_IMAGE);
  
!       if (! NILP (stock) && STRINGP (stock)
!           && gtk_stock_lookup (SSDATA (stock), &stock_item))
          {
!           stock_name = SSDATA (stock);
!           icon_size = gtk_toolbar_get_icon_size (wtoolbar);
          }
+       else
+         {
+           /* No stock image, or stock item not known.  Try regular image.  */
  
!           /* If image is a vector, choose the image according to the
! 	     button state.  */
!           image = PROP (TOOL_BAR_ITEM_IMAGES);
!           if (VECTORP (image))
! 	    {
! 	      if (enabled_p)
! 	        idx = (selected_p
! 		       ? TOOL_BAR_IMAGE_ENABLED_SELECTED
! 		       : TOOL_BAR_IMAGE_ENABLED_DESELECTED);
! 	      else
! 	        idx = (selected_p
! 		       ? TOOL_BAR_IMAGE_DISABLED_SELECTED
! 		       : TOOL_BAR_IMAGE_DISABLED_DESELECTED);
!     
! 	      xassert (ASIZE (image) >= idx);
! 	      image = AREF (image, idx);
! 	    }
!           else
! 	    idx = -1;
! 
!           /* Ignore invalid image specifications.  */
!           if (!valid_image_p (image))
!             {
!               if (wicon) gtk_widget_hide (wicon);
!               continue;
!             }
! 
!           img_id = lookup_image (f, image);
!           img = IMAGE_FROM_ID (f, img_id);
!           prepare_image_for_display (f, img);
! 
!           if (img->load_failed_p || img->pixmap == None)
!             {
!               if (wicon) gtk_widget_hide (wicon);
!               continue;
!             }
  
          }
  
        if (! wicon)
          {
!           GtkWidget *w;
!           if (stock_name)
!             {
!               w = gtk_image_new_from_stock (stock_name, icon_size);
!               g_object_set_data_full (G_OBJECT (w), XG_TOOL_BAR_STOCK_NAME,
!                                       (gpointer) xstrdup (stock_name),
!                                       (GDestroyNotify) xfree);
!             }
!           else
! 	    {
! 	      w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
! 	      /* Save the image so we can see if an update is needed when
! 		 this function is called again.  */
! 	      g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
! 				 (gpointer)img->pixmap);
! 	    }
! 
            GtkToolItem *ti = gtk_tool_button_new (w, "");
  
            gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
***************
*** 3632,3641 ****
            gtk_widget_show (GTK_WIDGET (ti));
            gtk_widget_show (GTK_WIDGET (w));
  
-           /* Save the image so we can see if an update is needed when
-              this function is called again.  */
-           g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
-                              (gpointer)img->pixmap);
  
            g_object_set_data (G_OBJECT (ti), XG_FRAME_DATA, (gpointer)f);
  
--- 3673,3678 ----
***************
*** 3684,3698 ****
            GtkImage *wimage = GTK_IMAGE (chlist->data);
            Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage),
                                                        XG_TOOL_BAR_IMAGE_DATA);
            g_list_free (chlist);
  
!           gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin);
  
!           if (old_img != img->pixmap)
!             (void) xg_get_image_for_pixmap (f, img, x->widget, wimage);
! 
!           g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
!                              (gpointer)img->pixmap);
  
            gtk_widget_set_sensitive (wicon, enabled_p);
            gtk_widget_show (wicon);
--- 3721,3751 ----
            GtkImage *wimage = GTK_IMAGE (chlist->data);
            Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage),
                                                        XG_TOOL_BAR_IMAGE_DATA);
+           gpointer old_stock_name = g_object_get_data (G_OBJECT (wimage),
+                                                        XG_TOOL_BAR_STOCK_NAME);
            g_list_free (chlist);
  
!           if (stock_name &&
!               (! old_stock_name || strcmp (old_stock_name, stock_name) != 0))
!             {
!               gtk_image_set_from_stock (wimage, stock_name, icon_size);
!               g_object_set_data_full (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME,
!                                       (gpointer) xstrdup (stock_name),
!                                       (GDestroyNotify) xfree);
!               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
!                                  NULL);
!             }
!           else if (img && old_img != img->pixmap)
!             {
!               (void) xg_get_image_for_pixmap (f, img, x->widget, wimage);
!               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
!                                  (gpointer)img->pixmap);
! 
!               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME,
!                                  NULL);
!             }
  
!           gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin);
  
            gtk_widget_set_sensitive (wicon, enabled_p);
            gtk_widget_show (wicon);
***************
*** 3710,3716 ****
        iter = g_list_next (iter);
      }
  
!   gtk_widget_size_request (x->toolbar_widget, &new_req);
    if (old_req.height != new_req.height
        && ! FRAME_X_OUTPUT (f)->toolbar_detached)
      {
--- 3763,3769 ----
        iter = g_list_next (iter);
      }
  
!   gtk_widget_size_request (GTK_WIDGET (wtoolbar), &new_req);
    if (old_req.height != new_req.height
        && ! FRAME_X_OUTPUT (f)->toolbar_detached)
      {
Index: src/keyboard.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/keyboard.c,v
retrieving revision 1.851
diff -u -c -r1.851 keyboard.c
*** src/keyboard.c	29 Mar 2006 08:00:23 -0000	1.851
--- src/keyboard.c	29 Mar 2006 10:05:18 -0000
***************
*** 7573,7582 ****
  
  static int ntool_bar_items;
  
! /* The symbols `tool-bar', and `:image'.  */
  
  extern Lisp_Object Qtool_bar;
  Lisp_Object QCimage;
  
  /* Function prototypes.  */
  
--- 7573,7583 ----
  
  static int ntool_bar_items;
  
! /* The symbols `tool-bar', `:image' and `:stock'.  */
  
  extern Lisp_Object Qtool_bar;
  Lisp_Object QCimage;
+ Lisp_Object Qstock;
  
  /* Function prototypes.  */
  
***************
*** 7862,7867 ****
--- 7863,7871 ----
  	/* Value is either a single image specification or a vector
  	   of 4 such specifications for the different button states.  */
  	PROP (TOOL_BAR_ITEM_IMAGES) = value;
+       else if (EQ (key, Qstock))
+         /* ':stock STRING' */
+ 	PROP (TOOL_BAR_ITEM_STOCK_IMAGE) = value;
      }
  
    /* If got a filter apply it on binding.  */
***************
*** 10846,10851 ****
--- 10850,10858 ----
    staticpro (&Qhelp_echo);
    Qhelp_echo = intern ("help-echo");
  
+   staticpro (&Qstock);
+   Qstock = intern (":stock");
+ 
    staticpro (&item_properties);
    item_properties = Qnil;
  

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-29 10:11         ` Jan D.
@ 2006-03-29 19:03           ` Leon
  2006-03-29 20:06             ` Leon
  2006-03-30  6:43             ` Jan D.
  0 siblings, 2 replies; 35+ messages in thread
From: Leon @ 2006-03-29 19:03 UTC (permalink / raw)


Can someone show me how to use this patch? I did a patch -p4 <
emacs-stokc.diff in emacs CVS dir, and it asked me for `file to
patch'. Thank you.

"Jan D." <jan.h.d@swipnet.se> writes:

> Leon wrote:
>> "Jan D." <jan.h.d@swipnet.se> writes:
>> 
>>> David Kastrup wrote:
>>>> Bill Wohler <wohler@newt.com> writes:
>>>>
>>>>> By the way, if anyone has GTK experience, the Emacs code should be using
>>>>> the GTK libraries to render the icons and only using our built-in icons
>>>>> as a fall-back. That way, Emacs icons will pick up theme changes.
>>> I have a patch that does just that, but I decided to wait with it
>>> until after the release.  It will only work for Emacs compiled with
>>> GTK, but I guess that is obvious.
>>>
>>> 	Jan D.
>> Sounds interesting. May I have a copy of the patch? Thanks.
>
> Attached.  But some icons don't have stock items, so the effect may be
> strange for some themes.
>
> 	Jan D.
> Index: lisp/info.el
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/lisp/info.el,v
> retrieving revision 1.481
> diff -u -c -r1.481 info.el
> *** lisp/info.el	11 Mar 2006 22:35:18 -0000	1.481
> --- lisp/info.el	29 Mar 2006 10:05:16 -0000
> ***************
> *** 3209,3224 ****
>   (defvar info-tool-bar-map
>     (if (display-graphic-p)
>         (let ((map (make-sparse-keymap)))
> ! 	(tool-bar-local-item-from-menu 'Info-exit "close" map Info-mode-map)
> ! 	(tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map)
> ! 	(tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map)
>   	(tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map)
>   	(tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map)
>   	(tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map)
> ! 	(tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map)
> ! 	(tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map)
> ! 	(tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map)
> ! 	(tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map)
>   	map)))
>   
>   (defvar Info-menu-last-node nil)
> --- 3209,3231 ----
>   (defvar info-tool-bar-map
>     (if (display-graphic-p)
>         (let ((map (make-sparse-keymap)))
> ! 	(tool-bar-local-item-from-menu 'Info-exit "close" map Info-mode-map
> ! 				       :stock "gtk-close")
> ! 	(tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map
> ! 				       :stock "gtk-go-back")
> ! 	(tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map
> ! 				       :stock "gtk-go-forward")
>   	(tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map)
>   	(tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map)
>   	(tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map)
> ! 	(tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map
> ! 				       :stock "gtk-home")
> ! 	(tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map
> ! 				       :stock "gtk-jump-to")
> ! 	(tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map
> ! 				       :stock "gtk-index")
> ! 	(tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map
> ! 				       :stock "gtk-find")
>   	map)))
>   
>   (defvar Info-menu-last-node nil)
> Index: lisp/tool-bar.el
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/lisp/tool-bar.el,v
> retrieving revision 1.5
> diff -u -c -r1.5 tool-bar.el
> *** lisp/tool-bar.el	6 Feb 2006 14:33:35 -0000	1.5
> --- lisp/tool-bar.el	29 Mar 2006 10:05:16 -0000
> ***************
> *** 232,279 ****
>     ;; People say it's bad to have EXIT on the tool bar, since users
>     ;; might inadvertently click that button.
>     ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
> !   (tool-bar-add-item-from-menu 'find-file "new")
> !   (tool-bar-add-item-from-menu 'menu-find-file-existing "open")
> !   (tool-bar-add-item-from-menu 'dired "diropen")
> !   (tool-bar-add-item-from-menu 'kill-this-buffer "close")
>     (tool-bar-add-item-from-menu 'save-buffer "save" nil
>   			       :visible '(or buffer-file-name
>   					     (not (eq 'special
>   						      (get major-mode
>   							   'mode-class)))))
>     (tool-bar-add-item-from-menu 'write-file "saveas" nil
>   			       :visible '(or buffer-file-name
>   					     (not (eq 'special
>   						      (get major-mode
>   							   'mode-class)))))
>     (tool-bar-add-item-from-menu 'undo "undo" nil
>   			       :visible '(not (eq 'special (get major-mode
>   								'mode-class))))
>     (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [cut])
>   			       "cut" nil
>   			       :visible '(not (eq 'special (get major-mode
>   								'mode-class))))
>     (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [copy])
> ! 			       "copy")
>     (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [paste])
>   			       "paste" nil
>   			       :visible '(not (eq 'special (get major-mode
>   								'mode-class))))
> !   (tool-bar-add-item-from-menu 'nonincremental-search-forward "search")
>     ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell")
>   
>     ;; There's no icon appropriate for News and we need a command rather
>     ;; than a lambda for Read Mail.
>     ;;(tool-bar-add-item-from-menu 'compose-mail "mail/compose")
>   
> !   (tool-bar-add-item-from-menu 'print-buffer "print")
>     (tool-bar-add-item "preferences" 'customize 'customize
>   		     :help "Edit preferences (customize)")
>   
>     (tool-bar-add-item "help" (lambda ()
>   			      (interactive)
>   			      (popup-menu menu-bar-help-menu))
>   		     'help
>   		     :help "Pop up the Help menu")
>     )
>   
> --- 232,291 ----
>     ;; People say it's bad to have EXIT on the tool bar, since users
>     ;; might inadvertently click that button.
>     ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
> !   (tool-bar-add-item-from-menu 'find-file "new" nil :stock "gtk-new")
> !   (tool-bar-add-item-from-menu 'menu-find-file-existing "open"
> ! 			       nil :stock "gtk-open")
> !   (tool-bar-add-item-from-menu 'dired "diropen"
> ! 			       nil :stock "gtk-directory")
> !   (tool-bar-add-item-from-menu 'kill-this-buffer "close"
> ! 			       nil :stock "gtk-close")
>     (tool-bar-add-item-from-menu 'save-buffer "save" nil
> + 			       :stock "gtk-save"
>   			       :visible '(or buffer-file-name
>   					     (not (eq 'special
>   						      (get major-mode
>   							   'mode-class)))))
>     (tool-bar-add-item-from-menu 'write-file "saveas" nil
> + 			       :stock "gtk-save-as"
>   			       :visible '(or buffer-file-name
>   					     (not (eq 'special
>   						      (get major-mode
>   							   'mode-class)))))
>     (tool-bar-add-item-from-menu 'undo "undo" nil
> + 			       :stock "gtk-undo"
>   			       :visible '(not (eq 'special (get major-mode
>   								'mode-class))))
>     (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [cut])
>   			       "cut" nil
> + 			       :stock "gtk-cut"
>   			       :visible '(not (eq 'special (get major-mode
>   								'mode-class))))
>     (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [copy])
> ! 			       "copy" nil :stock "gtk-copy")
>     (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [paste])
>   			       "paste" nil
> + 			       :stock "gtk-paste"
>   			       :visible '(not (eq 'special (get major-mode
>   								'mode-class))))
> !   (tool-bar-add-item-from-menu 'nonincremental-search-forward "search"
> ! 			       nil :stock "gtk-find")
>     ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell")
>   
>     ;; There's no icon appropriate for News and we need a command rather
>     ;; than a lambda for Read Mail.
>     ;;(tool-bar-add-item-from-menu 'compose-mail "mail/compose")
>   
> !   (tool-bar-add-item-from-menu 'print-buffer "print"
> ! 			       nil :stock "gtk-print")
>     (tool-bar-add-item "preferences" 'customize 'customize
> + 		     :stock "gtk-preferences"
>   		     :help "Edit preferences (customize)")
>   
>     (tool-bar-add-item "help" (lambda ()
>   			      (interactive)
>   			      (popup-menu menu-bar-help-menu))
>   		     'help
> + 		     :stock "gtk-help"
>   		     :help "Pop up the Help menu")
>     )
>   
> Index: src/dispextern.h
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/src/dispextern.h,v
> retrieving revision 1.215
> diff -u -c -r1.215 dispextern.h
> *** src/dispextern.h	15 Mar 2006 07:55:36 -0000	1.215
> --- src/dispextern.h	29 Mar 2006 10:05:17 -0000
> ***************
> *** 2539,2544 ****
> --- 2539,2547 ----
>     /* Help string.  */
>     TOOL_BAR_ITEM_HELP,
>   
> +   /* Stock image.  */
> +   TOOL_BAR_ITEM_STOCK_IMAGE,
> + 
>     /* Sentinel = number of slots in tool_bar_items occupied by one
>        tool-bar item.  */
>     TOOL_BAR_ITEM_NSLOTS
> Index: src/gtkutil.c
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/src/gtkutil.c,v
> retrieving revision 1.84
> diff -u -c -r1.84 gtkutil.c
> *** src/gtkutil.c	24 Feb 2006 15:36:39 -0000	1.84
> --- src/gtkutil.c	29 Mar 2006 10:05:17 -0000
> ***************
> *** 3243,3248 ****
> --- 3243,3253 ----
>   #define XG_TOOL_BAR_LAST_MODIFIER "emacs-tool-bar-modifier"
>   
>   
> + /* The key for the data we put in the GtkImage widgets.  The data is
> +    the stock name used by Emacs.  We use this to see if we need to update
> +    the GtkImage with a new image.  */
> + #define XG_TOOL_BAR_STOCK_NAME "emacs-tool-bar-stock-name"
> + 
>   /* Callback function invoked when a tool bar item is pressed.
>      W is the button widget in the tool bar that got pressed,
>      CLIENT_DATA is an integer that is the index of the button in the
> ***************
> *** 3525,3530 ****
> --- 3530,3536 ----
>     GList *iter;
>     struct x_output *x = f->output_data.x;
>     int hmargin, vmargin;
> +   GtkToolbar *wtoolbar;
>   
>     if (! FRAME_GTK_WIDGET (f))
>       return;
> ***************
> *** 3558,3566 ****
>     if (! x->toolbar_widget)
>       xg_create_tool_bar (f);
>   
> !   gtk_widget_size_request (x->toolbar_widget, &old_req);
> ! 
> !   icon_list = gtk_container_get_children (GTK_CONTAINER (x->toolbar_widget));
>     iter = icon_list;
>   
>     for (i = 0; i < f->n_tool_bar_items; ++i)
> --- 3564,3573 ----
>     if (! x->toolbar_widget)
>       xg_create_tool_bar (f);
>   
> !   wtoolbar = GTK_TOOLBAR (x->toolbar_widget);
> !   gtk_widget_size_request (GTK_WIDGET (wtoolbar), &old_req);
> !   
> !   icon_list = gtk_container_get_children (GTK_CONTAINER (wtoolbar));
>     iter = icon_list;
>   
>     for (i = 0; i < f->n_tool_bar_items; ++i)
> ***************
> *** 3571,3622 ****
>         int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
>         int idx;
>         int img_id;
> !       struct image *img;
>         Lisp_Object image;
>         GtkWidget *wicon = iter ? GTK_WIDGET (iter->data) : 0;
>   
>         if (iter) iter = g_list_next (iter);
>   
> !       /* If image is a vector, choose the image according to the
> ! 	 button state.  */
> !       image = PROP (TOOL_BAR_ITEM_IMAGES);
> !       if (VECTORP (image))
> ! 	{
> ! 	  if (enabled_p)
> ! 	    idx = (selected_p
> ! 		   ? TOOL_BAR_IMAGE_ENABLED_SELECTED
> ! 		   : TOOL_BAR_IMAGE_ENABLED_DESELECTED);
> ! 	  else
> ! 	    idx = (selected_p
> ! 		   ? TOOL_BAR_IMAGE_DISABLED_SELECTED
> ! 		   : TOOL_BAR_IMAGE_DISABLED_DESELECTED);
> ! 
> ! 	  xassert (ASIZE (image) >= idx);
> ! 	  image = AREF (image, idx);
> ! 	}
> !       else
> ! 	idx = -1;
>   
> !       /* Ignore invalid image specifications.  */
> !       if (!valid_image_p (image))
>           {
> !           if (wicon) gtk_widget_hide (wicon);
> !           continue;
>           }
>   
> !       img_id = lookup_image (f, image);
> !       img = IMAGE_FROM_ID (f, img_id);
> !       prepare_image_for_display (f, img);
>   
> -       if (img->load_failed_p || img->pixmap == None)
> -         {
> -           if (wicon) gtk_widget_hide (wicon);
> -           continue;
>           }
>   
>         if (! wicon)
>           {
> !           GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
>             GtkToolItem *ti = gtk_tool_button_new (w, "");
>   
>             gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
> --- 3578,3663 ----
>         int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
>         int idx;
>         int img_id;
> !       int icon_size = 0;
> !       struct image *img = NULL;
>         Lisp_Object image;
> +       Lisp_Object stock;
>         GtkWidget *wicon = iter ? GTK_WIDGET (iter->data) : 0;
> +       GtkStockItem stock_item;
> +       char *stock_name = NULL;
>   
>         if (iter) iter = g_list_next (iter);
>   
> !       stock = PROP (TOOL_BAR_ITEM_STOCK_IMAGE);
>   
> !       if (! NILP (stock) && STRINGP (stock)
> !           && gtk_stock_lookup (SSDATA (stock), &stock_item))
>           {
> !           stock_name = SSDATA (stock);
> !           icon_size = gtk_toolbar_get_icon_size (wtoolbar);
>           }
> +       else
> +         {
> +           /* No stock image, or stock item not known.  Try regular image.  */
>   
> !           /* If image is a vector, choose the image according to the
> ! 	     button state.  */
> !           image = PROP (TOOL_BAR_ITEM_IMAGES);
> !           if (VECTORP (image))
> ! 	    {
> ! 	      if (enabled_p)
> ! 	        idx = (selected_p
> ! 		       ? TOOL_BAR_IMAGE_ENABLED_SELECTED
> ! 		       : TOOL_BAR_IMAGE_ENABLED_DESELECTED);
> ! 	      else
> ! 	        idx = (selected_p
> ! 		       ? TOOL_BAR_IMAGE_DISABLED_SELECTED
> ! 		       : TOOL_BAR_IMAGE_DISABLED_DESELECTED);
> !     
> ! 	      xassert (ASIZE (image) >= idx);
> ! 	      image = AREF (image, idx);
> ! 	    }
> !           else
> ! 	    idx = -1;
> ! 
> !           /* Ignore invalid image specifications.  */
> !           if (!valid_image_p (image))
> !             {
> !               if (wicon) gtk_widget_hide (wicon);
> !               continue;
> !             }
> ! 
> !           img_id = lookup_image (f, image);
> !           img = IMAGE_FROM_ID (f, img_id);
> !           prepare_image_for_display (f, img);
> ! 
> !           if (img->load_failed_p || img->pixmap == None)
> !             {
> !               if (wicon) gtk_widget_hide (wicon);
> !               continue;
> !             }
>   
>           }
>   
>         if (! wicon)
>           {
> !           GtkWidget *w;
> !           if (stock_name)
> !             {
> !               w = gtk_image_new_from_stock (stock_name, icon_size);
> !               g_object_set_data_full (G_OBJECT (w), XG_TOOL_BAR_STOCK_NAME,
> !                                       (gpointer) xstrdup (stock_name),
> !                                       (GDestroyNotify) xfree);
> !             }
> !           else
> ! 	    {
> ! 	      w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
> ! 	      /* Save the image so we can see if an update is needed when
> ! 		 this function is called again.  */
> ! 	      g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
> ! 				 (gpointer)img->pixmap);
> ! 	    }
> ! 
>             GtkToolItem *ti = gtk_tool_button_new (w, "");
>   
>             gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
> ***************
> *** 3632,3641 ****
>             gtk_widget_show (GTK_WIDGET (ti));
>             gtk_widget_show (GTK_WIDGET (w));
>   
> -           /* Save the image so we can see if an update is needed when
> -              this function is called again.  */
> -           g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
> -                              (gpointer)img->pixmap);
>   
>             g_object_set_data (G_OBJECT (ti), XG_FRAME_DATA, (gpointer)f);
>   
> --- 3673,3678 ----
> ***************
> *** 3684,3698 ****
>             GtkImage *wimage = GTK_IMAGE (chlist->data);
>             Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage),
>                                                         XG_TOOL_BAR_IMAGE_DATA);
>             g_list_free (chlist);
>   
> !           gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin);
>   
> !           if (old_img != img->pixmap)
> !             (void) xg_get_image_for_pixmap (f, img, x->widget, wimage);
> ! 
> !           g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
> !                              (gpointer)img->pixmap);
>   
>             gtk_widget_set_sensitive (wicon, enabled_p);
>             gtk_widget_show (wicon);
> --- 3721,3751 ----
>             GtkImage *wimage = GTK_IMAGE (chlist->data);
>             Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage),
>                                                         XG_TOOL_BAR_IMAGE_DATA);
> +           gpointer old_stock_name = g_object_get_data (G_OBJECT (wimage),
> +                                                        XG_TOOL_BAR_STOCK_NAME);
>             g_list_free (chlist);
>   
> !           if (stock_name &&
> !               (! old_stock_name || strcmp (old_stock_name, stock_name) != 0))
> !             {
> !               gtk_image_set_from_stock (wimage, stock_name, icon_size);
> !               g_object_set_data_full (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME,
> !                                       (gpointer) xstrdup (stock_name),
> !                                       (GDestroyNotify) xfree);
> !               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
> !                                  NULL);
> !             }
> !           else if (img && old_img != img->pixmap)
> !             {
> !               (void) xg_get_image_for_pixmap (f, img, x->widget, wimage);
> !               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
> !                                  (gpointer)img->pixmap);
> ! 
> !               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME,
> !                                  NULL);
> !             }
>   
> !           gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin);
>   
>             gtk_widget_set_sensitive (wicon, enabled_p);
>             gtk_widget_show (wicon);
> ***************
> *** 3710,3716 ****
>         iter = g_list_next (iter);
>       }
>   
> !   gtk_widget_size_request (x->toolbar_widget, &new_req);
>     if (old_req.height != new_req.height
>         && ! FRAME_X_OUTPUT (f)->toolbar_detached)
>       {
> --- 3763,3769 ----
>         iter = g_list_next (iter);
>       }
>   
> !   gtk_widget_size_request (GTK_WIDGET (wtoolbar), &new_req);
>     if (old_req.height != new_req.height
>         && ! FRAME_X_OUTPUT (f)->toolbar_detached)
>       {
> Index: src/keyboard.c
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/src/keyboard.c,v
> retrieving revision 1.851
> diff -u -c -r1.851 keyboard.c
> *** src/keyboard.c	29 Mar 2006 08:00:23 -0000	1.851
> --- src/keyboard.c	29 Mar 2006 10:05:18 -0000
> ***************
> *** 7573,7582 ****
>   
>   static int ntool_bar_items;
>   
> ! /* The symbols `tool-bar', and `:image'.  */
>   
>   extern Lisp_Object Qtool_bar;
>   Lisp_Object QCimage;
>   
>   /* Function prototypes.  */
>   
> --- 7573,7583 ----
>   
>   static int ntool_bar_items;
>   
> ! /* The symbols `tool-bar', `:image' and `:stock'.  */
>   
>   extern Lisp_Object Qtool_bar;
>   Lisp_Object QCimage;
> + Lisp_Object Qstock;
>   
>   /* Function prototypes.  */
>   
> ***************
> *** 7862,7867 ****
> --- 7863,7871 ----
>   	/* Value is either a single image specification or a vector
>   	   of 4 such specifications for the different button states.  */
>   	PROP (TOOL_BAR_ITEM_IMAGES) = value;
> +       else if (EQ (key, Qstock))
> +         /* ':stock STRING' */
> + 	PROP (TOOL_BAR_ITEM_STOCK_IMAGE) = value;
>       }
>   
>     /* If got a filter apply it on binding.  */
> ***************
> *** 10846,10851 ****
> --- 10850,10858 ----
>     staticpro (&Qhelp_echo);
>     Qhelp_echo = intern ("help-echo");
>   
> +   staticpro (&Qstock);
> +   Qstock = intern (":stock");
> + 
>     staticpro (&item_properties);
>     item_properties = Qnil;
>   
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel

-- 
Leon

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-29 19:03           ` Leon
@ 2006-03-29 20:06             ` Leon
  2006-03-29 20:34               ` Stefan Monnier
  2006-03-30  6:56               ` Jan D.
  2006-03-30  6:43             ` Jan D.
  1 sibling, 2 replies; 35+ messages in thread
From: Leon @ 2006-03-29 20:06 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

This patch works great.

However one of the icon (diropen.xpm) should use the gnome file
manager's icon which is named file-manager.png in the sense that dired
is the file manger in emacs. Otherwise emacs tool-bar looks really
odd. Have a look at this.


[-- Attachment #2: tool-bar --]
[-- Type: image/png, Size: 11981 bytes --]

[-- Attachment #3: Type: text/plain, Size: 21155 bytes --]


Leon <sdl.web@gmail.com> writes:

> Can someone show me how to use this patch? I did a patch -p4 <
> emacs-stokc.diff in emacs CVS dir, and it asked me for `file to
> patch'. Thank you.
>
> "Jan D." <jan.h.d@swipnet.se> writes:
>
>> Leon wrote:
>>> "Jan D." <jan.h.d@swipnet.se> writes:
>>> 
>>>> David Kastrup wrote:
>>>>> Bill Wohler <wohler@newt.com> writes:
>>>>>
>>>>>> By the way, if anyone has GTK experience, the Emacs code should be using
>>>>>> the GTK libraries to render the icons and only using our built-in icons
>>>>>> as a fall-back. That way, Emacs icons will pick up theme changes.
>>>> I have a patch that does just that, but I decided to wait with it
>>>> until after the release.  It will only work for Emacs compiled with
>>>> GTK, but I guess that is obvious.
>>>>
>>>> 	Jan D.
>>> Sounds interesting. May I have a copy of the patch? Thanks.
>>
>> Attached.  But some icons don't have stock items, so the effect may be
>> strange for some themes.
>>
>> 	Jan D.
>> Index: lisp/info.el
>> ===================================================================
>> RCS file: /cvsroot/emacs/emacs/lisp/info.el,v
>> retrieving revision 1.481
>> diff -u -c -r1.481 info.el
>> *** lisp/info.el	11 Mar 2006 22:35:18 -0000	1.481
>> --- lisp/info.el	29 Mar 2006 10:05:16 -0000
>> ***************
>> *** 3209,3224 ****
>>   (defvar info-tool-bar-map
>>     (if (display-graphic-p)
>>         (let ((map (make-sparse-keymap)))
>> ! 	(tool-bar-local-item-from-menu 'Info-exit "close" map Info-mode-map)
>> ! 	(tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map)
>> ! 	(tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map)
>>   	(tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map)
>>   	(tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map)
>>   	(tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map)
>> ! 	(tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map)
>> ! 	(tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map)
>> ! 	(tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map)
>> ! 	(tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map)
>>   	map)))
>>   
>>   (defvar Info-menu-last-node nil)
>> --- 3209,3231 ----
>>   (defvar info-tool-bar-map
>>     (if (display-graphic-p)
>>         (let ((map (make-sparse-keymap)))
>> ! 	(tool-bar-local-item-from-menu 'Info-exit "close" map Info-mode-map
>> ! 				       :stock "gtk-close")
>> ! 	(tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map
>> ! 				       :stock "gtk-go-back")
>> ! 	(tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map
>> ! 				       :stock "gtk-go-forward")
>>   	(tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map)
>>   	(tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map)
>>   	(tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map)
>> ! 	(tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map
>> ! 				       :stock "gtk-home")
>> ! 	(tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map
>> ! 				       :stock "gtk-jump-to")
>> ! 	(tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map
>> ! 				       :stock "gtk-index")
>> ! 	(tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map
>> ! 				       :stock "gtk-find")
>>   	map)))
>>   
>>   (defvar Info-menu-last-node nil)
>> Index: lisp/tool-bar.el
>> ===================================================================
>> RCS file: /cvsroot/emacs/emacs/lisp/tool-bar.el,v
>> retrieving revision 1.5
>> diff -u -c -r1.5 tool-bar.el
>> *** lisp/tool-bar.el	6 Feb 2006 14:33:35 -0000	1.5
>> --- lisp/tool-bar.el	29 Mar 2006 10:05:16 -0000
>> ***************
>> *** 232,279 ****
>>     ;; People say it's bad to have EXIT on the tool bar, since users
>>     ;; might inadvertently click that button.
>>     ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
>> !   (tool-bar-add-item-from-menu 'find-file "new")
>> !   (tool-bar-add-item-from-menu 'menu-find-file-existing "open")
>> !   (tool-bar-add-item-from-menu 'dired "diropen")
>> !   (tool-bar-add-item-from-menu 'kill-this-buffer "close")
>>     (tool-bar-add-item-from-menu 'save-buffer "save" nil
>>   			       :visible '(or buffer-file-name
>>   					     (not (eq 'special
>>   						      (get major-mode
>>   							   'mode-class)))))
>>     (tool-bar-add-item-from-menu 'write-file "saveas" nil
>>   			       :visible '(or buffer-file-name
>>   					     (not (eq 'special
>>   						      (get major-mode
>>   							   'mode-class)))))
>>     (tool-bar-add-item-from-menu 'undo "undo" nil
>>   			       :visible '(not (eq 'special (get major-mode
>>   								'mode-class))))
>>     (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [cut])
>>   			       "cut" nil
>>   			       :visible '(not (eq 'special (get major-mode
>>   								'mode-class))))
>>     (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [copy])
>> ! 			       "copy")
>>     (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [paste])
>>   			       "paste" nil
>>   			       :visible '(not (eq 'special (get major-mode
>>   								'mode-class))))
>> !   (tool-bar-add-item-from-menu 'nonincremental-search-forward "search")
>>     ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell")
>>   
>>     ;; There's no icon appropriate for News and we need a command rather
>>     ;; than a lambda for Read Mail.
>>     ;;(tool-bar-add-item-from-menu 'compose-mail "mail/compose")
>>   
>> !   (tool-bar-add-item-from-menu 'print-buffer "print")
>>     (tool-bar-add-item "preferences" 'customize 'customize
>>   		     :help "Edit preferences (customize)")
>>   
>>     (tool-bar-add-item "help" (lambda ()
>>   			      (interactive)
>>   			      (popup-menu menu-bar-help-menu))
>>   		     'help
>>   		     :help "Pop up the Help menu")
>>     )
>>   
>> --- 232,291 ----
>>     ;; People say it's bad to have EXIT on the tool bar, since users
>>     ;; might inadvertently click that button.
>>     ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
>> !   (tool-bar-add-item-from-menu 'find-file "new" nil :stock "gtk-new")
>> !   (tool-bar-add-item-from-menu 'menu-find-file-existing "open"
>> ! 			       nil :stock "gtk-open")
>> !   (tool-bar-add-item-from-menu 'dired "diropen"
>> ! 			       nil :stock "gtk-directory")
>> !   (tool-bar-add-item-from-menu 'kill-this-buffer "close"
>> ! 			       nil :stock "gtk-close")
>>     (tool-bar-add-item-from-menu 'save-buffer "save" nil
>> + 			       :stock "gtk-save"
>>   			       :visible '(or buffer-file-name
>>   					     (not (eq 'special
>>   						      (get major-mode
>>   							   'mode-class)))))
>>     (tool-bar-add-item-from-menu 'write-file "saveas" nil
>> + 			       :stock "gtk-save-as"
>>   			       :visible '(or buffer-file-name
>>   					     (not (eq 'special
>>   						      (get major-mode
>>   							   'mode-class)))))
>>     (tool-bar-add-item-from-menu 'undo "undo" nil
>> + 			       :stock "gtk-undo"
>>   			       :visible '(not (eq 'special (get major-mode
>>   								'mode-class))))
>>     (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [cut])
>>   			       "cut" nil
>> + 			       :stock "gtk-cut"
>>   			       :visible '(not (eq 'special (get major-mode
>>   								'mode-class))))
>>     (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [copy])
>> ! 			       "copy" nil :stock "gtk-copy")
>>     (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [paste])
>>   			       "paste" nil
>> + 			       :stock "gtk-paste"
>>   			       :visible '(not (eq 'special (get major-mode
>>   								'mode-class))))
>> !   (tool-bar-add-item-from-menu 'nonincremental-search-forward "search"
>> ! 			       nil :stock "gtk-find")
>>     ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell")
>>   
>>     ;; There's no icon appropriate for News and we need a command rather
>>     ;; than a lambda for Read Mail.
>>     ;;(tool-bar-add-item-from-menu 'compose-mail "mail/compose")
>>   
>> !   (tool-bar-add-item-from-menu 'print-buffer "print"
>> ! 			       nil :stock "gtk-print")
>>     (tool-bar-add-item "preferences" 'customize 'customize
>> + 		     :stock "gtk-preferences"
>>   		     :help "Edit preferences (customize)")
>>   
>>     (tool-bar-add-item "help" (lambda ()
>>   			      (interactive)
>>   			      (popup-menu menu-bar-help-menu))
>>   		     'help
>> + 		     :stock "gtk-help"
>>   		     :help "Pop up the Help menu")
>>     )
>>   
>> Index: src/dispextern.h
>> ===================================================================
>> RCS file: /cvsroot/emacs/emacs/src/dispextern.h,v
>> retrieving revision 1.215
>> diff -u -c -r1.215 dispextern.h
>> *** src/dispextern.h	15 Mar 2006 07:55:36 -0000	1.215
>> --- src/dispextern.h	29 Mar 2006 10:05:17 -0000
>> ***************
>> *** 2539,2544 ****
>> --- 2539,2547 ----
>>     /* Help string.  */
>>     TOOL_BAR_ITEM_HELP,
>>   
>> +   /* Stock image.  */
>> +   TOOL_BAR_ITEM_STOCK_IMAGE,
>> + 
>>     /* Sentinel = number of slots in tool_bar_items occupied by one
>>        tool-bar item.  */
>>     TOOL_BAR_ITEM_NSLOTS
>> Index: src/gtkutil.c
>> ===================================================================
>> RCS file: /cvsroot/emacs/emacs/src/gtkutil.c,v
>> retrieving revision 1.84
>> diff -u -c -r1.84 gtkutil.c
>> *** src/gtkutil.c	24 Feb 2006 15:36:39 -0000	1.84
>> --- src/gtkutil.c	29 Mar 2006 10:05:17 -0000
>> ***************
>> *** 3243,3248 ****
>> --- 3243,3253 ----
>>   #define XG_TOOL_BAR_LAST_MODIFIER "emacs-tool-bar-modifier"
>>   
>>   
>> + /* The key for the data we put in the GtkImage widgets.  The data is
>> +    the stock name used by Emacs.  We use this to see if we need to update
>> +    the GtkImage with a new image.  */
>> + #define XG_TOOL_BAR_STOCK_NAME "emacs-tool-bar-stock-name"
>> + 
>>   /* Callback function invoked when a tool bar item is pressed.
>>      W is the button widget in the tool bar that got pressed,
>>      CLIENT_DATA is an integer that is the index of the button in the
>> ***************
>> *** 3525,3530 ****
>> --- 3530,3536 ----
>>     GList *iter;
>>     struct x_output *x = f->output_data.x;
>>     int hmargin, vmargin;
>> +   GtkToolbar *wtoolbar;
>>   
>>     if (! FRAME_GTK_WIDGET (f))
>>       return;
>> ***************
>> *** 3558,3566 ****
>>     if (! x->toolbar_widget)
>>       xg_create_tool_bar (f);
>>   
>> !   gtk_widget_size_request (x->toolbar_widget, &old_req);
>> ! 
>> !   icon_list = gtk_container_get_children (GTK_CONTAINER (x->toolbar_widget));
>>     iter = icon_list;
>>   
>>     for (i = 0; i < f->n_tool_bar_items; ++i)
>> --- 3564,3573 ----
>>     if (! x->toolbar_widget)
>>       xg_create_tool_bar (f);
>>   
>> !   wtoolbar = GTK_TOOLBAR (x->toolbar_widget);
>> !   gtk_widget_size_request (GTK_WIDGET (wtoolbar), &old_req);
>> !   
>> !   icon_list = gtk_container_get_children (GTK_CONTAINER (wtoolbar));
>>     iter = icon_list;
>>   
>>     for (i = 0; i < f->n_tool_bar_items; ++i)
>> ***************
>> *** 3571,3622 ****
>>         int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
>>         int idx;
>>         int img_id;
>> !       struct image *img;
>>         Lisp_Object image;
>>         GtkWidget *wicon = iter ? GTK_WIDGET (iter->data) : 0;
>>   
>>         if (iter) iter = g_list_next (iter);
>>   
>> !       /* If image is a vector, choose the image according to the
>> ! 	 button state.  */
>> !       image = PROP (TOOL_BAR_ITEM_IMAGES);
>> !       if (VECTORP (image))
>> ! 	{
>> ! 	  if (enabled_p)
>> ! 	    idx = (selected_p
>> ! 		   ? TOOL_BAR_IMAGE_ENABLED_SELECTED
>> ! 		   : TOOL_BAR_IMAGE_ENABLED_DESELECTED);
>> ! 	  else
>> ! 	    idx = (selected_p
>> ! 		   ? TOOL_BAR_IMAGE_DISABLED_SELECTED
>> ! 		   : TOOL_BAR_IMAGE_DISABLED_DESELECTED);
>> ! 
>> ! 	  xassert (ASIZE (image) >= idx);
>> ! 	  image = AREF (image, idx);
>> ! 	}
>> !       else
>> ! 	idx = -1;
>>   
>> !       /* Ignore invalid image specifications.  */
>> !       if (!valid_image_p (image))
>>           {
>> !           if (wicon) gtk_widget_hide (wicon);
>> !           continue;
>>           }
>>   
>> !       img_id = lookup_image (f, image);
>> !       img = IMAGE_FROM_ID (f, img_id);
>> !       prepare_image_for_display (f, img);
>>   
>> -       if (img->load_failed_p || img->pixmap == None)
>> -         {
>> -           if (wicon) gtk_widget_hide (wicon);
>> -           continue;
>>           }
>>   
>>         if (! wicon)
>>           {
>> !           GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
>>             GtkToolItem *ti = gtk_tool_button_new (w, "");
>>   
>>             gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
>> --- 3578,3663 ----
>>         int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
>>         int idx;
>>         int img_id;
>> !       int icon_size = 0;
>> !       struct image *img = NULL;
>>         Lisp_Object image;
>> +       Lisp_Object stock;
>>         GtkWidget *wicon = iter ? GTK_WIDGET (iter->data) : 0;
>> +       GtkStockItem stock_item;
>> +       char *stock_name = NULL;
>>   
>>         if (iter) iter = g_list_next (iter);
>>   
>> !       stock = PROP (TOOL_BAR_ITEM_STOCK_IMAGE);
>>   
>> !       if (! NILP (stock) && STRINGP (stock)
>> !           && gtk_stock_lookup (SSDATA (stock), &stock_item))
>>           {
>> !           stock_name = SSDATA (stock);
>> !           icon_size = gtk_toolbar_get_icon_size (wtoolbar);
>>           }
>> +       else
>> +         {
>> +           /* No stock image, or stock item not known.  Try regular image.  */
>>   
>> !           /* If image is a vector, choose the image according to the
>> ! 	     button state.  */
>> !           image = PROP (TOOL_BAR_ITEM_IMAGES);
>> !           if (VECTORP (image))
>> ! 	    {
>> ! 	      if (enabled_p)
>> ! 	        idx = (selected_p
>> ! 		       ? TOOL_BAR_IMAGE_ENABLED_SELECTED
>> ! 		       : TOOL_BAR_IMAGE_ENABLED_DESELECTED);
>> ! 	      else
>> ! 	        idx = (selected_p
>> ! 		       ? TOOL_BAR_IMAGE_DISABLED_SELECTED
>> ! 		       : TOOL_BAR_IMAGE_DISABLED_DESELECTED);
>> !     
>> ! 	      xassert (ASIZE (image) >= idx);
>> ! 	      image = AREF (image, idx);
>> ! 	    }
>> !           else
>> ! 	    idx = -1;
>> ! 
>> !           /* Ignore invalid image specifications.  */
>> !           if (!valid_image_p (image))
>> !             {
>> !               if (wicon) gtk_widget_hide (wicon);
>> !               continue;
>> !             }
>> ! 
>> !           img_id = lookup_image (f, image);
>> !           img = IMAGE_FROM_ID (f, img_id);
>> !           prepare_image_for_display (f, img);
>> ! 
>> !           if (img->load_failed_p || img->pixmap == None)
>> !             {
>> !               if (wicon) gtk_widget_hide (wicon);
>> !               continue;
>> !             }
>>   
>>           }
>>   
>>         if (! wicon)
>>           {
>> !           GtkWidget *w;
>> !           if (stock_name)
>> !             {
>> !               w = gtk_image_new_from_stock (stock_name, icon_size);
>> !               g_object_set_data_full (G_OBJECT (w), XG_TOOL_BAR_STOCK_NAME,
>> !                                       (gpointer) xstrdup (stock_name),
>> !                                       (GDestroyNotify) xfree);
>> !             }
>> !           else
>> ! 	    {
>> ! 	      w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
>> ! 	      /* Save the image so we can see if an update is needed when
>> ! 		 this function is called again.  */
>> ! 	      g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
>> ! 				 (gpointer)img->pixmap);
>> ! 	    }
>> ! 
>>             GtkToolItem *ti = gtk_tool_button_new (w, "");
>>   
>>             gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
>> ***************
>> *** 3632,3641 ****
>>             gtk_widget_show (GTK_WIDGET (ti));
>>             gtk_widget_show (GTK_WIDGET (w));
>>   
>> -           /* Save the image so we can see if an update is needed when
>> -              this function is called again.  */
>> -           g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
>> -                              (gpointer)img->pixmap);
>>   
>>             g_object_set_data (G_OBJECT (ti), XG_FRAME_DATA, (gpointer)f);
>>   
>> --- 3673,3678 ----
>> ***************
>> *** 3684,3698 ****
>>             GtkImage *wimage = GTK_IMAGE (chlist->data);
>>             Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage),
>>                                                         XG_TOOL_BAR_IMAGE_DATA);
>>             g_list_free (chlist);
>>   
>> !           gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin);
>>   
>> !           if (old_img != img->pixmap)
>> !             (void) xg_get_image_for_pixmap (f, img, x->widget, wimage);
>> ! 
>> !           g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
>> !                              (gpointer)img->pixmap);
>>   
>>             gtk_widget_set_sensitive (wicon, enabled_p);
>>             gtk_widget_show (wicon);
>> --- 3721,3751 ----
>>             GtkImage *wimage = GTK_IMAGE (chlist->data);
>>             Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage),
>>                                                         XG_TOOL_BAR_IMAGE_DATA);
>> +           gpointer old_stock_name = g_object_get_data (G_OBJECT (wimage),
>> +                                                        XG_TOOL_BAR_STOCK_NAME);
>>             g_list_free (chlist);
>>   
>> !           if (stock_name &&
>> !               (! old_stock_name || strcmp (old_stock_name, stock_name) != 0))
>> !             {
>> !               gtk_image_set_from_stock (wimage, stock_name, icon_size);
>> !               g_object_set_data_full (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME,
>> !                                       (gpointer) xstrdup (stock_name),
>> !                                       (GDestroyNotify) xfree);
>> !               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
>> !                                  NULL);
>> !             }
>> !           else if (img && old_img != img->pixmap)
>> !             {
>> !               (void) xg_get_image_for_pixmap (f, img, x->widget, wimage);
>> !               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
>> !                                  (gpointer)img->pixmap);
>> ! 
>> !               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME,
>> !                                  NULL);
>> !             }
>>   
>> !           gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin);
>>   
>>             gtk_widget_set_sensitive (wicon, enabled_p);
>>             gtk_widget_show (wicon);
>> ***************
>> *** 3710,3716 ****
>>         iter = g_list_next (iter);
>>       }
>>   
>> !   gtk_widget_size_request (x->toolbar_widget, &new_req);
>>     if (old_req.height != new_req.height
>>         && ! FRAME_X_OUTPUT (f)->toolbar_detached)
>>       {
>> --- 3763,3769 ----
>>         iter = g_list_next (iter);
>>       }
>>   
>> !   gtk_widget_size_request (GTK_WIDGET (wtoolbar), &new_req);
>>     if (old_req.height != new_req.height
>>         && ! FRAME_X_OUTPUT (f)->toolbar_detached)
>>       {
>> Index: src/keyboard.c
>> ===================================================================
>> RCS file: /cvsroot/emacs/emacs/src/keyboard.c,v
>> retrieving revision 1.851
>> diff -u -c -r1.851 keyboard.c
>> *** src/keyboard.c	29 Mar 2006 08:00:23 -0000	1.851
>> --- src/keyboard.c	29 Mar 2006 10:05:18 -0000
>> ***************
>> *** 7573,7582 ****
>>   
>>   static int ntool_bar_items;
>>   
>> ! /* The symbols `tool-bar', and `:image'.  */
>>   
>>   extern Lisp_Object Qtool_bar;
>>   Lisp_Object QCimage;
>>   
>>   /* Function prototypes.  */
>>   
>> --- 7573,7583 ----
>>   
>>   static int ntool_bar_items;
>>   
>> ! /* The symbols `tool-bar', `:image' and `:stock'.  */
>>   
>>   extern Lisp_Object Qtool_bar;
>>   Lisp_Object QCimage;
>> + Lisp_Object Qstock;
>>   
>>   /* Function prototypes.  */
>>   
>> ***************
>> *** 7862,7867 ****
>> --- 7863,7871 ----
>>   	/* Value is either a single image specification or a vector
>>   	   of 4 such specifications for the different button states.  */
>>   	PROP (TOOL_BAR_ITEM_IMAGES) = value;
>> +       else if (EQ (key, Qstock))
>> +         /* ':stock STRING' */
>> + 	PROP (TOOL_BAR_ITEM_STOCK_IMAGE) = value;
>>       }
>>   
>>     /* If got a filter apply it on binding.  */
>> ***************
>> *** 10846,10851 ****
>> --- 10850,10858 ----
>>     staticpro (&Qhelp_echo);
>>     Qhelp_echo = intern ("help-echo");
>>   
>> +   staticpro (&Qstock);
>> +   Qstock = intern (":stock");
>> + 
>>     staticpro (&item_properties);
>>     item_properties = Qnil;
>>   
>> _______________________________________________
>> Emacs-devel mailing list
>> Emacs-devel@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-devel

-- 
Leon

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-29 20:06             ` Leon
@ 2006-03-29 20:34               ` Stefan Monnier
  2006-03-29 20:42                 ` Leon
  2006-03-29 21:47                 ` Bill Wohler
  2006-03-30  6:56               ` Jan D.
  1 sibling, 2 replies; 35+ messages in thread
From: Stefan Monnier @ 2006-03-29 20:34 UTC (permalink / raw)
  Cc: emacs-devel

> However one of the icon (diropen.xpm) should use the gnome file
> manager's icon which is named file-manager.png in the sense that dired
> is the file manger in emacs.  Otherwise emacs tool-bar looks really
> odd.  Have a look at this.

I'm not trained in the use of toolbars, so could you explain what's odd
about it?


        Stefan

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-29 20:34               ` Stefan Monnier
@ 2006-03-29 20:42                 ` Leon
  2006-03-30  7:05                   ` Jan D.
  2006-03-29 21:47                 ` Bill Wohler
  1 sibling, 1 reply; 35+ messages in thread
From: Leon @ 2006-03-29 20:42 UTC (permalink / raw)


Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> However one of the icon (diropen.xpm) should use the gnome file
>> manager's icon which is named file-manager.png in the sense that dired
>> is the file manger in emacs.  Otherwise emacs tool-bar looks really
>> odd.  Have a look at this.
>
> I'm not trained in the use of toolbars, so could you explain what's odd
> about it?
>
>
>         Stefan
Hi Stefan,

The diropen icon won't change at all for any gnome-icon-theme since
there is no counterpart. This gives the tool-bar an inconsistent
look. 

-- 
Leon

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-29 20:34               ` Stefan Monnier
  2006-03-29 20:42                 ` Leon
@ 2006-03-29 21:47                 ` Bill Wohler
  2006-03-29 22:50                   ` Stefan Monnier
  1 sibling, 1 reply; 35+ messages in thread
From: Bill Wohler @ 2006-03-29 21:47 UTC (permalink / raw)


Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> However one of the icon (diropen.xpm) should use the gnome file
>> manager's icon which is named file-manager.png in the sense that dired
>> is the file manger in emacs.  Otherwise emacs tool-bar looks really
>> odd.  Have a look at this.
>
> I'm not trained in the use of toolbars, so could you explain what's odd
> about it?

Hi Stefan, icon sets are designed to look good as a set. Take a quick
look at http://art.gnome.org/themes/icon/ to see the vast landscape of
icon sets. It's not visually pleasing to mix and match icons, and
worse, the metaphor can differ between sets as well. Leon is using a
soft and pastelly theme which clashes with the default
gnome-icon-theme from which the diropen/file-manager icon comes.

Jan's patch will ensure that the Emacs icons matches the icon theme
that the user has chosen. I agree with Leon that dired and the file
manager application are equivalent. Unfortunately, I don't see a GTK
file-manager icon so perhaps Jan can speak to how it can be picked up
by the current theme. If it's as easy as renaming diropen to
file-manager, I'm all for it.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-29 21:47                 ` Bill Wohler
@ 2006-03-29 22:50                   ` Stefan Monnier
  0 siblings, 0 replies; 35+ messages in thread
From: Stefan Monnier @ 2006-03-29 22:50 UTC (permalink / raw)
  Cc: emacs-devel

>>> However one of the icon (diropen.xpm) should use the gnome file
>>> manager's icon which is named file-manager.png in the sense that dired
>>> is the file manger in emacs.  Otherwise emacs tool-bar looks really
>>> odd.  Have a look at this.
>> 
>> I'm not trained in the use of toolbars, so could you explain what's odd
>> about it?

> Hi Stefan, icon sets are designed to look good as a set. Take a quick
> look at http://art.gnome.org/themes/icon/ to see the vast landscape of
> icon sets. It's not visually pleasing to mix and match icons, and
> worse, the metaphor can differ between sets as well.

Thanks, that much I understand.

> Leon is using a soft and pastelly theme which clashes with the default
> gnome-icon-theme from which the diropen/file-manager icon comes.

Oh, that's the part that I didn't notice.  I must say, even with your
explanation, I'm still unable to tell which icon comes from which set in
his snapshot.  Anyway, sorry for wasting your time, my artistic sense is
clearly too limited for this ;-)


        Stefan

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-29 19:03           ` Leon
  2006-03-29 20:06             ` Leon
@ 2006-03-30  6:43             ` Jan D.
  1 sibling, 0 replies; 35+ messages in thread
From: Jan D. @ 2006-03-30  6:43 UTC (permalink / raw)
  Cc: emacs-devel



Leon wrote:
> Can someone show me how to use this patch? I did a patch -p4 <
> emacs-stokc.diff in emacs CVS dir, and it asked me for `file to
> patch'. Thank you.

Why -p4?  Use -p0.

	Jan D.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-29 20:06             ` Leon
  2006-03-29 20:34               ` Stefan Monnier
@ 2006-03-30  6:56               ` Jan D.
  2006-03-30 20:26                 ` Leon
  1 sibling, 1 reply; 35+ messages in thread
From: Jan D. @ 2006-03-30  6:56 UTC (permalink / raw)
  Cc: emacs-devel



Leon wrote:
> This patch works great.
> 
> However one of the icon (diropen.xpm) should use the gnome file
> manager's icon which is named file-manager.png in the sense that dired
> is the file manger in emacs. Otherwise emacs tool-bar looks really
> odd. Have a look at this.

There is no stock name for file-manager.png that I can find.  Besides, having 
Gtk+ does not imply having Gnome, so I've restricted stock icons to those 
defined by Gtk+.  gtk-directory is the one used, but I suspect it is only 
present in later Gtk+ versions (i.e. 2.8 and later).  You can change the 
:stock attribute for that item in tool-bar.el if you really need something 
else (and then you need to recompile tool-bar.el and Emacs unfortunately).

	Jan D.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-29 20:42                 ` Leon
@ 2006-03-30  7:05                   ` Jan D.
  2006-03-30 19:39                     ` Bill Wohler
  2006-03-30 20:41                     ` Leon
  0 siblings, 2 replies; 35+ messages in thread
From: Jan D. @ 2006-03-30  7:05 UTC (permalink / raw)
  Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]



Leon wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
> 
>>> However one of the icon (diropen.xpm) should use the gnome file
>>> manager's icon which is named file-manager.png in the sense that dired
>>> is the file manger in emacs.  Otherwise emacs tool-bar looks really
>>> odd.  Have a look at this.
>> I'm not trained in the use of toolbars, so could you explain what's odd
>> about it?
>>
>>
>>         Stefan
> Hi Stefan,
> 
> The diropen icon won't change at all for any gnome-icon-theme since
> there is no counterpart. This gives the tool-bar an inconsistent
> look. 
> 

For example, some themes use bigger icons.  But since the stock item 
gtk-directory isn't available, the standard icon distributed with emacs is 
used, so it looks odd.  Also, if some theme has some visual property (like 
high contrast), the diropen icon will not follow this theme.

I've attached some screenshots of these situations.  I think before we
release this we need to find stock items for everything.  In Info mode there 
are also icons that don't have any stock definition, so arrows may look 
differently.

	Jan D.

[-- Attachment #2: high-contr.jpg --]
[-- Type: image/jpeg, Size: 3402 bytes --]

[-- Attachment #3: big.jpg --]
[-- Type: image/jpeg, Size: 5606 bytes --]

[-- Attachment #4: info.jpg --]
[-- Type: image/jpeg, Size: 3435 bytes --]

[-- Attachment #5: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-30  7:05                   ` Jan D.
@ 2006-03-30 19:39                     ` Bill Wohler
  2006-03-31 12:22                       ` Jan D.
  2006-03-30 20:41                     ` Leon
  1 sibling, 1 reply; 35+ messages in thread
From: Bill Wohler @ 2006-03-30 19:39 UTC (permalink / raw)


"Jan D." <jan.h.d@swipnet.se> writes:

> I've attached some screenshots of these situations.  I think before we
> release this we need to find stock items for everything.  In Info mode
> there are also icons that don't have any stock definition, so arrows
> may look differently.

Since you're more familiar with GTK, can you please suggest a specific
proposal?

While updating the icons I was thinking of stock_previous, stock_next,
and stock_up (from GNOME) to replace prev_node, next_node, and up_node
respectively but wasn't sure how folks would respond to that.

What else did you have in mind? Install your patch and use GTK names
for *all* icons?

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-30  6:56               ` Jan D.
@ 2006-03-30 20:26                 ` Leon
  0 siblings, 0 replies; 35+ messages in thread
From: Leon @ 2006-03-30 20:26 UTC (permalink / raw)


"Jan D." <jan.h.d@swipnet.se> writes:

> Leon wrote:
>> This patch works great.
>> However one of the icon (diropen.xpm) should use the gnome file
>> manager's icon which is named file-manager.png in the sense that dired
>> is the file manger in emacs. Otherwise emacs tool-bar looks really
>> odd. Have a look at this.
>
> There is no stock name for file-manager.png that I can find.  Besides,
> having Gtk+ does not imply having Gnome, so I've restricted stock
> icons to those defined by Gtk+.  gtk-directory is the one used, but I
> suspect it is only present in later Gtk+ versions (i.e. 2.8 and
> later).  You can change the :stock attribute for that item in
> tool-bar.el if you really need something else (and then you need to
> recompile tool-bar.el and Emacs unfortunately).
>
> 	Jan D.

Thank you Jan. I have figured out this and applied the patch.

-- 
Leon

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-30  7:05                   ` Jan D.
  2006-03-30 19:39                     ` Bill Wohler
@ 2006-03-30 20:41                     ` Leon
  2006-03-31  1:52                       ` Bill Wohler
  1 sibling, 1 reply; 35+ messages in thread
From: Leon @ 2006-03-30 20:41 UTC (permalink / raw)


"Jan D." <jan.h.d@swipnet.se> writes:

> Leon wrote:
>> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 
>>>> However one of the icon (diropen.xpm) should use the gnome file
>>>> manager's icon which is named file-manager.png in the sense that dired
>>>> is the file manger in emacs.  Otherwise emacs tool-bar looks really
>>>> odd.  Have a look at this.
>>> I'm not trained in the use of toolbars, so could you explain what's odd
>>> about it?
>>>
>>>
>>>         Stefan
>> Hi Stefan,
>> The diropen icon won't change at all for any gnome-icon-theme since
>> there is no counterpart. This gives the tool-bar an inconsistent
>> look. 
>
> For example, some themes use bigger icons.  But since the stock item
> gtk-directory isn't available, the standard icon distributed with
> emacs is used, so it looks odd.  Also, if some theme has some visual
> property (like high contrast), the diropen icon will not follow this
> theme.
>
> I've attached some screenshots of these situations.  I think before we
> release this we need to find stock items for everything.  In Info mode
> there are also icons that don't have any stock definition, so arrows
> may look differently.
>
> 	Jan D.
>
>

Thank you for explaining this.

Handling icons is more complicated in emacs than in anything
else. Maybe some gtk programmers can point out a solution or maybe we
can create a set of universal icons like nvu and openoffice. We can
also publish a guideline of creating icons for emacs so that package
writers can follow. And in the end emacs will have a consistent look!

-- 
Leon

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-30 20:41                     ` Leon
@ 2006-03-31  1:52                       ` Bill Wohler
  2006-03-31 12:29                         ` Jan D.
  0 siblings, 1 reply; 35+ messages in thread
From: Bill Wohler @ 2006-03-31  1:52 UTC (permalink / raw)


Leon <sdl.web@gmail.com> writes:

> Handling icons is more complicated in emacs than in anything
> else. Maybe some gtk programmers can point out a solution or maybe we
> can create a set of universal icons like nvu and openoffice. We can
> also publish a guideline of creating icons for emacs so that package
> writers can follow. And in the end emacs will have a consistent look!

I think Emacs doesn't have any special icon needs so that might not be
necessary. Using the icons from the current theme is the best choice.
Remember that Emacs also has to provide icons where GTK does not
exist. Or GNOME. But it's fair to say that most Emacs users have it as
an environment which is why the fallback, built-in icons, come from
those icon sets.

But you did remind me of something we should think about.

I noticed that Jan's patch calls for the addition of properties to
calls of tool-bar-add-item-from-menu such as

  (tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map
 				 :stock "gtk-find")

This means that all calls to tool-bar-* in all modes to need to be
updated. It would be good to avoid this. Plus, this approach doesn't
scale to other systems.

I think it would be preferable to keep the tool-bar-* calls the way
they are and provide a table of Emacs icon names to the icon name for
the system being used. That way, Emacs will honor the user's theme
whether it is being run under GNOME, KDE, or Windows, without
requiring code changes from all Emacs package developers.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-30 19:39                     ` Bill Wohler
@ 2006-03-31 12:22                       ` Jan D.
  2006-03-31 17:37                         ` Bill Wohler
  0 siblings, 1 reply; 35+ messages in thread
From: Jan D. @ 2006-03-31 12:22 UTC (permalink / raw)
  Cc: emacs-devel



Bill Wohler wrote:
> "Jan D." <jan.h.d@swipnet.se> writes:
> 
> 
>>I've attached some screenshots of these situations.  I think before we
>>release this we need to find stock items for everything.  In Info mode
>>there are also icons that don't have any stock definition, so arrows
>>may look differently.
> 
> 
> Since you're more familiar with GTK, can you please suggest a specific
> proposal?
> 
> While updating the icons I was thinking of stock_previous, stock_next,
> and stock_up (from GNOME) to replace prev_node, next_node, and up_node
> respectively but wasn't sure how folks would respond to that.

Can you link to them?

	Jan D.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-31  1:52                       ` Bill Wohler
@ 2006-03-31 12:29                         ` Jan D.
  0 siblings, 0 replies; 35+ messages in thread
From: Jan D. @ 2006-03-31 12:29 UTC (permalink / raw)
  Cc: emacs-devel



Bill Wohler wrote:

> This means that all calls to tool-bar-* in all modes to need to be
> updated. It would be good to avoid this. Plus, this approach doesn't
> scale to other systems.
> 
> I think it would be preferable to keep the tool-bar-* calls the way
> they are and provide a table of Emacs icon names to the icon name for
> the system being used. That way, Emacs will honor the user's theme
> whether it is being run under GNOME, KDE, or Windows, without
> requiring code changes from all Emacs package developers.
> 

But that means that the old way of changing icons (copying a new file to 
where Emacs looks for icons) does not work.

	Jan D.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-31 12:22                       ` Jan D.
@ 2006-03-31 17:37                         ` Bill Wohler
  2006-04-01 12:19                           ` Jan D.
  0 siblings, 1 reply; 35+ messages in thread
From: Bill Wohler @ 2006-03-31 17:37 UTC (permalink / raw)
  Cc: emacs-devel

Jan D. <jan.h.d@swipnet.se> wrote:

> Bill Wohler wrote:
> > "Jan D." <jan.h.d@swipnet.se> writes:
> > 
> >>I've attached some screenshots of these situations.  I think before we
> >>release this we need to find stock items for everything.  In Info mode
> >>there are also icons that don't have any stock definition, so arrows
> >>may look differently.
> > Since you're more familiar with GTK, can you please suggest a
> > specific
> > proposal?
> > While updating the icons I was thinking of stock_previous,
> > stock_next,
> > and stock_up (from GNOME) to replace prev_node, next_node, and up_node
> > respectively but wasn't sure how folks would respond to that.
> 
> Can you link to them?

I'm not sure I know what you mean by that.

> > This means that all calls to tool-bar-* in all modes to need to be
> > updated. It would be good to avoid this. Plus, this approach doesn't
> > scale to other systems.
> > I think it would be preferable to keep the tool-bar-* calls the way
> > they are and provide a table of Emacs icon names to the icon name for
> > the system being used. That way, Emacs will honor the user's theme
> > whether it is being run under GNOME, KDE, or Windows, without
> > requiring code changes from all Emacs package developers.
> > 
> 
> But that means that the old way of changing icons (copying a new file
> to where Emacs looks for icons) does not work.

Hmmm, you're right. I see two approaches.

1. Devise a scheme that provides the following icon priorities:

a. Personal icons
b. Theme icons
c. Emacs built-in icons

2. Use the theme as I had proposed. The user personalizes the icon not
   by adding their icons to image-load-path, but rather by adding their
   icons to the GNOME theme. We document this.

I suspect that the latter is more germane to a GNOME user.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-03-31 17:37                         ` Bill Wohler
@ 2006-04-01 12:19                           ` Jan D.
  2006-04-01 16:22                             ` Bill Wohler
  0 siblings, 1 reply; 35+ messages in thread
From: Jan D. @ 2006-04-01 12:19 UTC (permalink / raw)
  Cc: emacs-devel

Bill Wohler wrote:

>Jan D. <jan.h.d@swipnet.se> wrote:
>
>  
>
>>Bill Wohler wrote:
>>    
>>
>>>"Jan D." <jan.h.d@swipnet.se> writes:
>>>
>>>      
>>>
>>>>I've attached some screenshots of these situations.  I think before we
>>>>release this we need to find stock items for everything.  In Info mode
>>>>there are also icons that don't have any stock definition, so arrows
>>>>may look differently.
>>>>        
>>>>
>>>Since you're more familiar with GTK, can you please suggest a
>>>specific
>>>proposal?
>>>While updating the icons I was thinking of stock_previous,
>>>stock_next,
>>>and stock_up (from GNOME) to replace prev_node, next_node, and up_node
>>>respectively but wasn't sure how folks would respond to that.
>>>      
>>>
>>Can you link to them?
>>    
>>
>
>I'm not sure I know what you mean by that.
>  
>

I meant give an URL where these icons can be seen.



>Hmmm, you're right. I see two approaches.
>
>1. Devise a scheme that provides the following icon priorities:
>
>a. Personal icons
>b. Theme icons
>c. Emacs built-in icons
>
>2. Use the theme as I had proposed. The user personalizes the icon not
>   by adding their icons to image-load-path, but rather by adding their
>   icons to the GNOME theme. We document this.
>
>I suspect that the latter is more germane to a GNOME user.
>  
>

Yes.  But it would mean having different strategies fro GTK Emacs and 
Emacs compiled without GTK.  Maybe that isn't such a big deal.  I 
suspect users of GTK Emacs would want it to change as the theme 
changes.  If we can agree on Gnome icons, I'm all for it, we can always 
fall back to builtin icons if those aren't available.

    Jan D.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-04-01 12:19                           ` Jan D.
@ 2006-04-01 16:22                             ` Bill Wohler
  2006-04-01 20:06                               ` Bill Wohler
  2006-04-03  6:28                               ` Jan D.
  0 siblings, 2 replies; 35+ messages in thread
From: Bill Wohler @ 2006-04-01 16:22 UTC (permalink / raw)
  Cc: emacs-devel

Jan D. <jan.h.d@swipnet.se> wrote:

> Bill Wohler wrote:
> 
> >Jan D. <jan.h.d@swipnet.se> wrote:
> >
> >  
> >
> >>Bill Wohler wrote:
> >>    
> >>
> >>>"Jan D." <jan.h.d@swipnet.se> writes:
> >>>
> >>>      
> >>>
> >>>>I've attached some screenshots of these situations.  I think before we
> >>>>release this we need to find stock items for everything.  In Info mode
> >>>>there are also icons that don't have any stock definition, so arrows
> >>>>may look differently.
> >>>>        
> >>>>
> >>>Since you're more familiar with GTK, can you please suggest a
> >>>specific
> >>>proposal?
> >>>While updating the icons I was thinking of stock_previous,
> >>>stock_next,
> >>>and stock_up (from GNOME) to replace prev_node, next_node, and up_node
> >>>respectively but wasn't sure how folks would respond to that.
> >>>      
> >>>
> >>Can you link to them?
> >>    
> >>
> >
> >I'm not sure I know what you mean by that.
> >  
> >
> 
> I meant give an URL where these icons can be seen.

file:/usr/share/icons/hicolor/24x24/stock :-(

I recently asked this very same question on the GNOME usability list:

Rodney Dawes <dobey@novell.com> wrote:

> On Wed, 2006-03-22 at 08:46 -0800, Bill Wohler wrote:
> > Also, there are a dazzling number of icon and desktop themes on the
> > GNOME site, but none are branded "Default" so I could check for
> > myself. What is the URL to the current default set of icons?
> 
> And, as Calum stated, gnome-icon-theme is in GNOME CVS, and not
> available as a simple tarball theme download on a theme site.

> >Hmmm, you're right. I see two approaches.
> >
> >1. Devise a scheme that provides the following icon priorities:
> >
> >a. Personal icons
> >b. Theme icons
> >c. Emacs built-in icons
> >
> >2. Use the theme as I had proposed. The user personalizes the icon not
> >   by adding their icons to image-load-path, but rather by adding their
> >   icons to the GNOME theme. We document this.
> >
> >I suspect that the latter is more germane to a GNOME user.
> 
> Yes.  But it would mean having different strategies fro GTK Emacs and
> Emacs compiled without GTK.  Maybe that isn't such a big deal.  I
> suspect users of GTK Emacs would want it to change as the theme
> changes.  If we can agree on Gnome icons, I'm all for it, we can
> always fall back to builtin icons if those aren't available.

Falling back to those icons will also be the thing to do in non-GTK
situations too, so we should be OK. Right?

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-04-01 16:22                             ` Bill Wohler
@ 2006-04-01 20:06                               ` Bill Wohler
  2006-04-03  6:28                               ` Jan D.
  1 sibling, 0 replies; 35+ messages in thread
From: Bill Wohler @ 2006-04-01 20:06 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 92 bytes --]

Whoops, I meant to at least include those icons so that you could see
them. Here they are:


[-- Attachment #2: stock_previous --]
[-- Type: image/png, Size: 849 bytes --]

[-- Attachment #3: stock_next --]
[-- Type: image/png, Size: 841 bytes --]

[-- Attachment #4: stock_up --]
[-- Type: image/png, Size: 555 bytes --]

[-- Attachment #5: Type: text/plain, Size: 346 bytes --]


You might also be interested in checking out gnome-icon-theme with:

  cvs -d :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome co gnome-icon-theme

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

[-- Attachment #6: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-04-01 16:22                             ` Bill Wohler
  2006-04-01 20:06                               ` Bill Wohler
@ 2006-04-03  6:28                               ` Jan D.
  2006-04-03 22:09                                 ` Bill Wohler
  1 sibling, 1 reply; 35+ messages in thread
From: Jan D. @ 2006-04-03  6:28 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1572 bytes --]


>>>>> While updating the icons I was thinking of stock_previous,
>>>>> stock_next,
>>>>> and stock_up (from GNOME) to replace prev_node, next_node, and up_node
>>>>> respectively but wasn't sure how folks would respond to that.


I think the recent changes to the tool bar icons was so that next_node, 
prev_node and up_node would clearly indicate that we are moving in the node 
(i.e. document) and not in the history of previous moves (see previous 
discussion on emacs-devel).  I think the ones you suggest are more of the 
history kind of icons.  There are icons called next-page and previous-page 
though (attached, no up-page seems to exist).  But these seems to be poorly 
supported by the themes I have (no theme has customized those icons).

>>>>>      
>>>>>
>>>> Can you link to them?
>>>>    
>>>>
>>> I'm not sure I know what you mean by that.
>>>  
>>>
>> I meant give an URL where these icons can be seen.
> 
> file:/usr/share/icons/hicolor/24x24/stock :-(
> 

Ok, too bad these aren't browsable online somewhere.


>>> I suspect that the latter is more germane to a GNOME user.
>> Yes.  But it would mean having different strategies fro GTK Emacs and
>> Emacs compiled without GTK.  Maybe that isn't such a big deal.  I
>> suspect users of GTK Emacs would want it to change as the theme
>> changes.  If we can agree on Gnome icons, I'm all for it, we can
>> always fall back to builtin icons if those aren't available.
> 
> Falling back to those icons will also be the thing to do in non-GTK
> situations too, so we should be OK. Right?

Right.

	Jan D.


[-- Attachment #2: stock_next-page.png --]
[-- Type: image/png, Size: 452 bytes --]

[-- Attachment #3: stock_previous-page.png --]
[-- Type: image/png, Size: 452 bytes --]

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-04-03  6:28                               ` Jan D.
@ 2006-04-03 22:09                                 ` Bill Wohler
  2006-04-04  6:48                                   ` Jan D.
  2006-04-04 19:04                                   ` Bill Wohler
  0 siblings, 2 replies; 35+ messages in thread
From: Bill Wohler @ 2006-04-03 22:09 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1847 bytes --]

"Jan D." <jan.h.d@swipnet.se> writes:

>>>>>> While updating the icons I was thinking of stock_previous,
>>>>>> stock_next,
>>>>>> and stock_up (from GNOME) to replace prev_node, next_node, and up_node
>>>>>> respectively but wasn't sure how folks would respond to that.
>
>
> I think the recent changes to the tool bar icons was so that
> next_node, prev_node and up_node would clearly indicate that we are
> moving in the node (i.e. document) and not in the history of previous
> moves (see previous discussion on emacs-devel).  I think the ones you
> suggest are more of the history kind of icons.

Really? It seems that stock_left and stock_right are usually used for
history, not stock_next and stock_previous.

>                                                There are icons called
> next-page and previous-page though (attached, no up-page seems to
> exist).  But these seems to be poorly supported by the themes I have
> (no theme has customized those icons).

Gnus and MH-E use the next-page icon to indicate paging down within
the current article/mail message, *not* to the next article/mail
message. I *think* that's the intent of this icon. 

In other words, stock_next-page is used to page within the current
article/message/file/node while stock_next is used to go to the next
article/message/file/node.

You do point out that the arrows are used for history, but in MH-E,
I'm using them to go to the next and previous message. Whoops.

Now, I would suggest that we take stock_previous and stock_next icons
from GNOME and use those in info and MH-E. Since the custom next-node
and prev-node Emacs icons aren't supported by GTK at all, we're no
worse off and buy consistency between Info, MH-E, and GNOME.

However, the metaphor between the next and previous icons isn't the
same as the up and top icons, as shown in the following:


[-- Attachment #2: info.png --]
[-- Type: image/png, Size: 5748 bytes --]

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]


I don't think we'd want to do this. I'll ask what the GNOME usability
folks what they recommend we use for these functions and report back
here.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-04-03 22:09                                 ` Bill Wohler
@ 2006-04-04  6:48                                   ` Jan D.
  2006-04-04 19:04                                   ` Bill Wohler
  1 sibling, 0 replies; 35+ messages in thread
From: Jan D. @ 2006-04-04  6:48 UTC (permalink / raw)
  Cc: emacs-devel



Bill Wohler wrote:
> "Jan D." <jan.h.d@swipnet.se> writes:
> 
>> I think the recent changes to the tool bar icons was so that
>> next_node, prev_node and up_node would clearly indicate that we are
>> moving in the node (i.e. document) and not in the history of previous
>> moves (see previous discussion on emacs-devel).  I think the ones you
>> suggest are more of the history kind of icons.
> 
> Really? It seems that stock_left and stock_right are usually used for
> history, not stock_next and stock_previous.

You may be right, it was just my first impression, not a well reasearched fact 
:-).

> 
>>                                                There are icons called
>> next-page and previous-page though (attached, no up-page seems to
>> exist).  But these seems to be poorly supported by the themes I have
>> (no theme has customized those icons).
> 
> Gnus and MH-E use the next-page icon to indicate paging down within
> the current article/mail message, *not* to the next article/mail
> message. I *think* that's the intent of this icon. 
> 
> In other words, stock_next-page is used to page within the current
> article/message/file/node while stock_next is used to go to the next
> article/message/file/node.

I think the distiction is a bit blurred in info.  While you may go to the next 
node (for example, Emacs/Basic/Inserting text to Emacs/Basic/Moving Point), 
you are still within the same topic/article (Emacs and indeed Emacs/Basic).


> 
> You do point out that the arrows are used for history, but in MH-E,
> I'm using them to go to the next and previous message. Whoops.
> 
> Now, I would suggest that we take stock_previous and stock_next icons
> from GNOME and use those in info and MH-E. Since the custom next-node
> and prev-node Emacs icons aren't supported by GTK at all, we're no
> worse off and buy consistency between Info, MH-E, and GNOME.

If that OK with those who took part in the previous discussion, it is fine by me.

> 
> However, the metaphor between the next and previous icons isn't the
> same as the up and top icons, as shown in the following:

Yes, I think the previous discussion pointed to a lack of icons in the 
Gtk/Gnome set, and I think, but am not sure, that a bug report on that was 
filed as well.

> I don't think we'd want to do this. I'll ask what the GNOME usability
> folks what they recommend we use for these functions and report back
> here.

Ok.

	Jan D.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-04-03 22:09                                 ` Bill Wohler
  2006-04-04  6:48                                   ` Jan D.
@ 2006-04-04 19:04                                   ` Bill Wohler
  2006-04-04 19:09                                     ` Lennart Borgman
  1 sibling, 1 reply; 35+ messages in thread
From: Bill Wohler @ 2006-04-04 19:04 UTC (permalink / raw)


Bill Wohler <wohler@newt.com> writes:

> I don't think we'd want to do this. I'll ask what the GNOME usability
> folks what they recommend we use for these functions and report back
> here.

Indeed. Here's a summary:

1. There was a mention that there might be too many icons and that an
   overhaul of the icons might happen someday.

2. Yelp (the GNOME equivalent of the info reader) used the next and
   previous icons as I had suggested, but later removed them as they
   weren't helpful. Note that these were used at the bottom of the
   page with the other navigation icons rather than on the tool bar.

Until a consistent nomenclature and metaphor for structural and
temporal navigation appears from the GTK/GNOME teams, I think it might
be best just to leave these *_node icons as they are for now.

Here are a couple of other thoughts that are worth sharing. The former
seems reasonable, while the second might not be too popular ;-).

1. It would be nice if "M-x info" launched Yelp on GNOME systems.

2. It would be nice if we used Docbook instead of Texinfo.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-04-04 19:04                                   ` Bill Wohler
@ 2006-04-04 19:09                                     ` Lennart Borgman
  2006-04-04 19:30                                       ` Bill Wohler
  0 siblings, 1 reply; 35+ messages in thread
From: Lennart Borgman @ 2006-04-04 19:09 UTC (permalink / raw)
  Cc: emacs-devel

Bill Wohler wrote:
> 1. It would be nice if "M-x info" launched Yelp on GNOME systems.
>   
It wouild make it harder to read the elisp manual since you can not use 
`describe-function' etc.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-04-04 19:09                                     ` Lennart Borgman
@ 2006-04-04 19:30                                       ` Bill Wohler
  2006-04-05  7:08                                         ` Jan D.
  0 siblings, 1 reply; 35+ messages in thread
From: Bill Wohler @ 2006-04-04 19:30 UTC (permalink / raw)
  Cc: emacs-devel

Lennart Borgman <lennart.borgman.073@student.lu.se> wrote:

> Bill Wohler wrote:
> > 1. It would be nice if "M-x info" launched Yelp on GNOME systems.
> >   
> It wouild make it harder to read the elisp manual since you can not
> use `describe-function' etc.

...yet. I expect that this is one of many issues that would have to be
resolved in both Emacs and Yelp before this comes to pass.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-04-04 19:30                                       ` Bill Wohler
@ 2006-04-05  7:08                                         ` Jan D.
  2006-04-05  7:13                                           ` Miles Bader
  0 siblings, 1 reply; 35+ messages in thread
From: Jan D. @ 2006-04-05  7:08 UTC (permalink / raw)




Bill Wohler wrote:
> Lennart Borgman <lennart.borgman.073@student.lu.se> wrote:
> 
>> Bill Wohler wrote:
>>> 1. It would be nice if "M-x info" launched Yelp on GNOME systems.
>>>   
>> It wouild make it harder to read the elisp manual since you can not
>> use `describe-function' etc.
> 
> ...yet. I expect that this is one of many issues that would have to be
> resolved in both Emacs and Yelp before this comes to pass.

AFAIK, yelp does not have any Emacs keybindings like the ones in info-mode.
The yelp I have (Gnome 2.8) have no keybindings at all...

	Jan D.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Icon update
  2006-04-05  7:08                                         ` Jan D.
@ 2006-04-05  7:13                                           ` Miles Bader
  0 siblings, 0 replies; 35+ messages in thread
From: Miles Bader @ 2006-04-05  7:13 UTC (permalink / raw)
  Cc: emacs-devel

"Jan D." <jan.h.d@swipnet.se> writes:
>>>> 1. It would be nice if "M-x info" launched Yelp on GNOME systems.
>>>>   
>>> It wouild make it harder to read the elisp manual since you can not
>>> use `describe-function' etc.
>> 
>> ...yet. I expect that this is one of many issues that would have to be
>> resolved in both Emacs and Yelp before this comes to pass.
>
> AFAIK, yelp does not have any Emacs keybindings like the ones in info-mode.
> The yelp I have (Gnome 2.8) have no keybindings at all...

Yeah.  Non-Emacs info readers are often _seriously_ deficient in
functionality compared to Emacs' reader.  It would be a cruel joke to
invoke yelp automatically without the user having to explicitly enable
such an action.

-Miles
-- 
`To alcohol!  The cause of, and solution to,
 all of life's problems' --Homer J. Simpson

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2006-04-05  7:13 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-26 22:57 Icon update Bill Wohler
2006-03-26 22:59 ` Bill Wohler
2006-03-27 19:55   ` David Kastrup
2006-03-28  6:33     ` Jan D.
2006-03-29  0:42       ` Leon
2006-03-29  4:17         ` Bill Wohler
2006-03-29 10:11         ` Jan D.
2006-03-29 19:03           ` Leon
2006-03-29 20:06             ` Leon
2006-03-29 20:34               ` Stefan Monnier
2006-03-29 20:42                 ` Leon
2006-03-30  7:05                   ` Jan D.
2006-03-30 19:39                     ` Bill Wohler
2006-03-31 12:22                       ` Jan D.
2006-03-31 17:37                         ` Bill Wohler
2006-04-01 12:19                           ` Jan D.
2006-04-01 16:22                             ` Bill Wohler
2006-04-01 20:06                               ` Bill Wohler
2006-04-03  6:28                               ` Jan D.
2006-04-03 22:09                                 ` Bill Wohler
2006-04-04  6:48                                   ` Jan D.
2006-04-04 19:04                                   ` Bill Wohler
2006-04-04 19:09                                     ` Lennart Borgman
2006-04-04 19:30                                       ` Bill Wohler
2006-04-05  7:08                                         ` Jan D.
2006-04-05  7:13                                           ` Miles Bader
2006-03-30 20:41                     ` Leon
2006-03-31  1:52                       ` Bill Wohler
2006-03-31 12:29                         ` Jan D.
2006-03-29 21:47                 ` Bill Wohler
2006-03-29 22:50                   ` Stefan Monnier
2006-03-30  6:56               ` Jan D.
2006-03-30 20:26                 ` Leon
2006-03-30  6:43             ` Jan D.
2006-03-28 19:22 ` Bill Wohler

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).