From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?SmFuIERqw6Rydg==?= Newsgroups: gmane.emacs.devel Subject: Re: Should we relax requirement from gtk 2.6 to gtk 2.4. Date: Fri, 07 Sep 2007 09:19:59 +0200 Message-ID: <46E0FB9F.5020607@swipnet.se> References: <46DF97DD.6040607@swipnet.se> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1189149623 17412 80.91.229.12 (7 Sep 2007 07:20:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 7 Sep 2007 07:20:23 +0000 (UTC) Cc: emacs-devel@gnu.org To: David Koppelman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 07 09:20:20 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1ITY8S-0004b6-GE for ged-emacs-devel@m.gmane.org; Fri, 07 Sep 2007 09:20:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ITY8Q-0008Bl-DI for ged-emacs-devel@m.gmane.org; Fri, 07 Sep 2007 03:20:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ITY8M-000882-RS for emacs-devel@gnu.org; Fri, 07 Sep 2007 03:20:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ITY8L-000841-5A for emacs-devel@gnu.org; Fri, 07 Sep 2007 03:20:06 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ITY8K-00083h-Ru for emacs-devel@gnu.org; Fri, 07 Sep 2007 03:20:04 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ITY8K-0000Ag-AY for emacs-devel@gnu.org; Fri, 07 Sep 2007 03:20:04 -0400 Original-Received: from av9-2-sn2.hy.skanova.net ([81.228.8.180]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1ITY8J-0006oe-Hg for emacs-devel@gnu.org; Fri, 07 Sep 2007 03:20:03 -0400 Original-Received: by av9-2-sn2.hy.skanova.net (Postfix, from userid 502) id BE153381DC; Fri, 7 Sep 2007 09:20:02 +0200 (CEST) Original-Received: from smtp4-2-sn2.hy.skanova.net (smtp4-2-sn2.hy.skanova.net [81.228.8.93]) by av9-2-sn2.hy.skanova.net (Postfix) with ESMTP id 9B4D437ED8; Fri, 7 Sep 2007 09:20:02 +0200 (CEST) Original-Received: from husetbladh.homeip.net (90-231-102-24-no59.tbcn.telia.com [90.231.102.24]) by smtp4-2-sn2.hy.skanova.net (Postfix) with ESMTP id EF22237E42; Fri, 7 Sep 2007 09:20:01 +0200 (CEST) User-Agent: Thunderbird 2.0.0.6 (X11/20070728) In-Reply-To: X-detected-kernel: Linux 2.4-2.6 X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:78105 Archived-At: David Koppelman skrev: >> AFAIK, there are no 2.4-compatible functions to do just that. Do you = know any? >=20 > gtk_icon_theme_load_icon and gtk_image_new_from_pixbuf. >=20 Not quite. Your patch below does not produce a broken image if the icon = is=20 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 curr= ent 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). >=20 > --- gtkutil.c 05 Sep 2007 09:17:48 -0500 1.115 > +++ gtkutil.c 06 Sep 2007 10:46:25 -0500=09 > @@ -3814,6 +3814,8 @@ update_frame_tool_bar (f) > GtkStockItem stock_item; > char *stock_name =3D NULL; > char *icon_name =3D NULL; > + GdkScreen* const screen =3D gtk_widget_get_screen(GTK_WIDGET(wto= olbar)); > + GtkIconTheme* const icon_theme =3D gtk_icon_theme_get_for_screen= (screen); > Lisp_Object rtl; > GtkWidget *wbutton =3D NULL; > GtkWidget *weventbox; > @@ -3844,9 +3846,6 @@ update_frame_tool_bar (f) > stock_name =3D SSDATA (stock); > if (stock_name[0] =3D=3D 'n' && stock_name[1] =3D=3D ':') > { > - GdkScreen *screen =3D gtk_widget_get_screen (GTK_WIDGET = (wtoolbar)); > - GtkIconTheme *icon_theme =3D gtk_icon_theme_get_for_scre= en (screen); > - > icon_name =3D stock_name + 2; > stock_name =3D NULL; > stock =3D Qnil; > @@ -3932,7 +3931,10 @@ update_frame_tool_bar (f) > } > else if (icon_name)=20 > { > - w =3D gtk_image_new_from_icon_name (icon_name, icon_size= ); > + GdkPixbuf* const pixbuf =3D > + gtk_icon_theme_load_icon(icon_theme,icon_name,icon_siz= e,0,NULL); > + > + w =3D gtk_image_new_from_pixbuf(pixbuf); > g_object_set_data_full (G_OBJECT (w), XG_TOOL_BAR_ICON_N= AME, > (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_nam= e) !=3D 0)) > { > - gtk_image_set_from_icon_name (GTK_IMAGE (wimage), > - icon_name, icon_size); > + GdkPixbuf* const pixbuf =3D > + gtk_icon_theme_load_icon(icon_theme,icon_name,icon_siz= e,0,NULL); > + gtk_image_set_from_pixbuf(GTK_IMAGE (wimage), pixbuf ); > g_object_set_data_full (G_OBJECT (wimage), XG_TOOL_BAR_I= CON_NAME, > (gpointer) xstrdup (icon_name), > (GDestroyNotify) xfree); >=20 >=20 >=20 > Jan Dj=C3=A4rv writes: >=20 >> 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 >=20 >=20 > _______________________________________________ > Emacs-devel mailing list > Emacs-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-devel >=20