unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jan Djärv" <jan.h.d@swipnet.se>
To: David Koppelman <koppel@ece.lsu.edu>
Cc: emacs-devel@gnu.org
Subject: Re: Should we relax requirement from gtk 2.6 to gtk 2.4.
Date: Fri, 07 Sep 2007 09:19:59 +0200	[thread overview]
Message-ID: <46E0FB9F.5020607@swipnet.se> (raw)
In-Reply-To: <yg5fy1rx036.fsf@ece.lsu.edu>



David Koppelman skrev:
>> AFAIK, there are no 2.4-compatible functions to do just that.  Do you know any?
> 
> gtk_icon_theme_load_icon and gtk_image_new_from_pixbuf.
> 

Not quite.  Your patch below does not produce a broken image if the icon is 
not found, nor does it make an icon the reacts to theme changes.

Lets move on to 2.6.  After all, it is two major versions before the current one.

	Jan D.


> The patch below shows how they might be used. The code compiles but I
> don't know if it works because for some reason no icons are being
> found (in code upstream of the changes).
> 
> --- gtkutil.c	05 Sep 2007 09:17:48 -0500	1.115
> +++ gtkutil.c	06 Sep 2007 10:46:25 -0500	
> @@ -3814,6 +3814,8 @@ update_frame_tool_bar (f)
>        GtkStockItem stock_item;
>        char *stock_name = NULL;
>        char *icon_name = NULL;
> +      GdkScreen* const screen = gtk_widget_get_screen(GTK_WIDGET(wtoolbar));
> +      GtkIconTheme* const icon_theme = gtk_icon_theme_get_for_screen(screen);
>        Lisp_Object rtl;
>        GtkWidget *wbutton = NULL;
>        GtkWidget *weventbox;
> @@ -3844,9 +3846,6 @@ update_frame_tool_bar (f)
>            stock_name = SSDATA (stock);
>            if (stock_name[0] == 'n' && stock_name[1] == ':')
>              {
> -              GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (wtoolbar));
> -              GtkIconTheme *icon_theme = gtk_icon_theme_get_for_screen (screen);
> -
>                icon_name = stock_name + 2;
>                stock_name = NULL;
>                stock = Qnil;
> @@ -3932,7 +3931,10 @@ update_frame_tool_bar (f)
>              }
>            else if (icon_name) 
>              {
> -              w = gtk_image_new_from_icon_name (icon_name, icon_size);
> +              GdkPixbuf* const pixbuf =
> +                gtk_icon_theme_load_icon(icon_theme,icon_name,icon_size,0,NULL);
> +
> +              w = gtk_image_new_from_pixbuf(pixbuf);
>                g_object_set_data_full (G_OBJECT (w), XG_TOOL_BAR_ICON_NAME,
>                                        (gpointer) xstrdup (icon_name),
>                                        (GDestroyNotify) xfree);
> @@ -4029,8 +4031,9 @@ update_frame_tool_bar (f)
>            else if (icon_name &&
>                     (! old_icon_name || strcmp (old_icon_name, icon_name) != 0))
>              {
> -              gtk_image_set_from_icon_name (GTK_IMAGE (wimage),
> -                                            icon_name, icon_size);
> +              GdkPixbuf* const pixbuf =
> +                gtk_icon_theme_load_icon(icon_theme,icon_name,icon_size,0,NULL);
> +              gtk_image_set_from_pixbuf(GTK_IMAGE (wimage), pixbuf );
>                g_object_set_data_full (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME,
>                                        (gpointer) xstrdup (icon_name),
>                                        (GDestroyNotify) xfree);
> 
> 
> 
> Jan Djärv <jan.h.d@swipnet.se> writes:
> 
>> David Koppelman skrev:
>>> Recently Emacs changed the gtk version from 2.4? to 2.6, perhaps to
>>> accommodate a use of gtk_image_new_from_icon_name and
>>> gtk_image_set_from_icon_name. If that's all, then perhaps it would be
>>> better to use 2.4-compatible functions to do the same thing.
>> AFAIK, there are no 2.4-compatible functions to do just that.  Do you know any?
>>
>> 	Jan D.
>>
>>
>> _______________________________________________
>> Emacs-devel mailing list
>> Emacs-devel@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-devel
> 
> 
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
> 

      reply	other threads:[~2007-09-07  7:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-05 22:33 Should we relax requirement from gtk 2.6 to gtk 2.4 David Koppelman
2007-09-05 22:59 ` Leo
2007-09-06  8:42   ` David Hansen
2007-09-06  9:04     ` Jan Djärv
2007-09-06  5:33 ` David Kastrup
2007-09-07  6:31   ` Richard Stallman
2007-09-06  6:02 ` Jan Djärv
2007-09-06 15:52   ` David Koppelman
2007-09-07  7:19     ` Jan Djärv [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46E0FB9F.5020607@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=emacs-devel@gnu.org \
    --cc=koppel@ece.lsu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).