emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should we relax requirement from gtk 2.6 to gtk 2.4.


From: David Koppelman
Subject: Re: Should we relax requirement from gtk 2.6 to gtk 2.4.
Date: Thu, 06 Sep 2007 10:52:45 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

> 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 <address@hidden> 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
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]