To: vim-dev@vim.org Subject: Patch 6.2.240 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.240 Problem: GTK 2: Searching for bitmaps for the toolbar doesn't work as with other systems. Need to explicitly use "icon=name". (Ned Konz, Christian J. Robinson) Solution: Search for icons like done for Motif. Files: src/gui_gtk.c *** ../vim-6.2.239/src/gui_gtk.c Fri Feb 6 19:19:20 2004 --- src/gui_gtk.c Fri Feb 6 15:22:50 2004 *************** *** 266,301 **** } static GtkWidget * ! create_menu_icon(vimmenu_T *menu, GtkIconSize icon_size) { ! GtkWidget *image = NULL; ! if (menu->iconfile != NULL) ! { ! char_u buf[MAXPATHL]; ! if (lookup_menu_iconfile(menu->iconfile, buf)) ! { ! GtkIconSet *icon_set; ! GtkIconSource *icon_source; ! /* ! * Rather than loading the icon directly into a GtkImage, create ! * a new GtkIconSet and put it in there. This way we can easily ! * scale the toolbar icons on the fly when needed. ! */ ! icon_set = gtk_icon_set_new(); ! icon_source = gtk_icon_source_new(); ! gtk_icon_source_set_filename(icon_source, (const char *)buf); ! gtk_icon_set_add_source(icon_set, icon_source); ! image = gtk_image_new_from_icon_set(icon_set, icon_size); ! gtk_icon_source_free(icon_source); ! gtk_icon_set_unref(icon_set); ! } ! } if (image == NULL) { const char *stock_id; --- 260,306 ---- } static GtkWidget * ! load_menu_iconfile(char_u *name, GtkIconSize icon_size) { ! GtkWidget *image = NULL; ! GtkIconSet *icon_set; ! GtkIconSource *icon_source; ! /* ! * Rather than loading the icon directly into a GtkImage, create ! * a new GtkIconSet and put it in there. This way we can easily ! * scale the toolbar icons on the fly when needed. ! */ ! icon_set = gtk_icon_set_new(); ! icon_source = gtk_icon_source_new(); ! gtk_icon_source_set_filename(icon_source, (const char *)name); ! gtk_icon_set_add_source(icon_set, icon_source); ! image = gtk_image_new_from_icon_set(icon_set, icon_size); ! gtk_icon_source_free(icon_source); ! gtk_icon_set_unref(icon_set); ! return image; ! } ! ! static GtkWidget * ! create_menu_icon(vimmenu_T *menu, GtkIconSize icon_size) ! { ! GtkWidget *image = NULL; ! char_u buf[MAXPATHL]; + /* First use a specified "icon=" argument. */ + if (menu->iconfile != NULL && lookup_menu_iconfile(menu->iconfile, buf)) + image = load_menu_iconfile(buf, icon_size); + + /* If not found and not builtin specified try using the menu name. */ + if (image == NULL && !menu->icon_builtin + && lookup_menu_iconfile(menu->name, buf)) + image = load_menu_iconfile(buf, icon_size); + + /* Still not found? Then use a builtin icon, a blank one as fallback. */ if (image == NULL) { const char *stock_id; *** ../vim-6.2.239/src/version.c Fri Feb 6 19:19:20 2004 --- src/version.c Fri Feb 6 19:21:30 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 240, /**/ -- hundred-and-one symptoms of being an internet addict: 64. The remote to the T.V. is missing...and you don't even care. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///