]>
Commit | Line | Data |
---|---|---|
05649561 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.2.240 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 6.2.240 | |
11 | Problem: GTK 2: Searching for bitmaps for the toolbar doesn't work as with | |
12 | other systems. Need to explicitly use "icon=name". (Ned Konz, | |
13 | Christian J. Robinson) | |
14 | Solution: Search for icons like done for Motif. | |
15 | Files: src/gui_gtk.c | |
16 | ||
17 | ||
18 | *** ../vim-6.2.239/src/gui_gtk.c Fri Feb 6 19:19:20 2004 | |
19 | --- src/gui_gtk.c Fri Feb 6 15:22:50 2004 | |
20 | *************** | |
21 | *** 266,301 **** | |
22 | } | |
23 | ||
24 | static GtkWidget * | |
25 | ! create_menu_icon(vimmenu_T *menu, GtkIconSize icon_size) | |
26 | { | |
27 | ! GtkWidget *image = NULL; | |
28 | ||
29 | ! if (menu->iconfile != NULL) | |
30 | ! { | |
31 | ! char_u buf[MAXPATHL]; | |
32 | ||
33 | ! if (lookup_menu_iconfile(menu->iconfile, buf)) | |
34 | ! { | |
35 | ! GtkIconSet *icon_set; | |
36 | ! GtkIconSource *icon_source; | |
37 | ! /* | |
38 | ! * Rather than loading the icon directly into a GtkImage, create | |
39 | ! * a new GtkIconSet and put it in there. This way we can easily | |
40 | ! * scale the toolbar icons on the fly when needed. | |
41 | ! */ | |
42 | ! icon_set = gtk_icon_set_new(); | |
43 | ! icon_source = gtk_icon_source_new(); | |
44 | ||
45 | ! gtk_icon_source_set_filename(icon_source, (const char *)buf); | |
46 | ! gtk_icon_set_add_source(icon_set, icon_source); | |
47 | ||
48 | ! image = gtk_image_new_from_icon_set(icon_set, icon_size); | |
49 | ||
50 | ! gtk_icon_source_free(icon_source); | |
51 | ! gtk_icon_set_unref(icon_set); | |
52 | ! } | |
53 | ! } | |
54 | ||
55 | if (image == NULL) | |
56 | { | |
57 | const char *stock_id; | |
58 | --- 260,306 ---- | |
59 | } | |
60 | ||
61 | static GtkWidget * | |
62 | ! load_menu_iconfile(char_u *name, GtkIconSize icon_size) | |
63 | { | |
64 | ! GtkWidget *image = NULL; | |
65 | ! GtkIconSet *icon_set; | |
66 | ! GtkIconSource *icon_source; | |
67 | ||
68 | ! /* | |
69 | ! * Rather than loading the icon directly into a GtkImage, create | |
70 | ! * a new GtkIconSet and put it in there. This way we can easily | |
71 | ! * scale the toolbar icons on the fly when needed. | |
72 | ! */ | |
73 | ! icon_set = gtk_icon_set_new(); | |
74 | ! icon_source = gtk_icon_source_new(); | |
75 | ||
76 | ! gtk_icon_source_set_filename(icon_source, (const char *)name); | |
77 | ! gtk_icon_set_add_source(icon_set, icon_source); | |
78 | ||
79 | ! image = gtk_image_new_from_icon_set(icon_set, icon_size); | |
80 | ||
81 | ! gtk_icon_source_free(icon_source); | |
82 | ! gtk_icon_set_unref(icon_set); | |
83 | ||
84 | ! return image; | |
85 | ! } | |
86 | ! | |
87 | ! static GtkWidget * | |
88 | ! create_menu_icon(vimmenu_T *menu, GtkIconSize icon_size) | |
89 | ! { | |
90 | ! GtkWidget *image = NULL; | |
91 | ! char_u buf[MAXPATHL]; | |
92 | ||
93 | + /* First use a specified "icon=" argument. */ | |
94 | + if (menu->iconfile != NULL && lookup_menu_iconfile(menu->iconfile, buf)) | |
95 | + image = load_menu_iconfile(buf, icon_size); | |
96 | + | |
97 | + /* If not found and not builtin specified try using the menu name. */ | |
98 | + if (image == NULL && !menu->icon_builtin | |
99 | + && lookup_menu_iconfile(menu->name, buf)) | |
100 | + image = load_menu_iconfile(buf, icon_size); | |
101 | + | |
102 | + /* Still not found? Then use a builtin icon, a blank one as fallback. */ | |
103 | if (image == NULL) | |
104 | { | |
105 | const char *stock_id; | |
106 | *** ../vim-6.2.239/src/version.c Fri Feb 6 19:19:20 2004 | |
107 | --- src/version.c Fri Feb 6 19:21:30 2004 | |
108 | *************** | |
109 | *** 639,640 **** | |
110 | --- 639,642 ---- | |
111 | { /* Add new patch number below this line */ | |
112 | + /**/ | |
113 | + 240, | |
114 | /**/ | |
115 | ||
116 | -- | |
117 | hundred-and-one symptoms of being an internet addict: | |
118 | 64. The remote to the T.V. is missing...and you don't even care. | |
119 | ||
120 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
121 | /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
122 | \\\ Project leader for A-A-P -- http://www.A-A-P.org /// | |
123 | \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html /// |