From: David Koppelman <koppel@ece.lsu.edu>
To: "Jan Djärv" <jan.h.d@swipnet.se>
Cc: emacs-devel@gnu.org
Subject: Re: Should we relax requirement from gtk 2.6 to gtk 2.4.
Date: Thu, 06 Sep 2007 10:52:45 -0500 [thread overview]
Message-ID: <yg5fy1rx036.fsf@ece.lsu.edu> (raw)
In-Reply-To: <46DF97DD.6040607@swipnet.se> ("Jan Djärv"'s message of "Thu\, 06 Sep 2007 08\:02\:05 +0200")
> 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.
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
next prev parent reply other threads:[~2007-09-06 15:52 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 [this message]
2007-09-07 7:19 ` Jan Djärv
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yg5fy1rx036.fsf@ece.lsu.edu \
--to=koppel@ece.lsu.edu \
--cc=emacs-devel@gnu.org \
--cc=jan.h.d@swipnet.se \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.