Mercurial > vim
comparison src/gui_gtk.c @ 18781:79e10adc821d v8.1.2380
patch 8.1.2380: using old C style comments
Commit: https://github.com/vim/vim/commit/306139005c31ea7e6f892dd119beba3c94dcb982
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Dec 1 22:11:18 2019 +0100
patch 8.1.2380: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 01 Dec 2019 22:15:03 +0100 |
parents | ce04ebdf26b8 |
children | 3ff714d765ba |
comparison
equal
deleted
inserted
replaced
18780:04ce3b8a50ed | 18781:79e10adc821d |
---|---|
35 | 35 |
36 #ifdef FEAT_GUI_GTK | 36 #ifdef FEAT_GUI_GTK |
37 # include "gui_gtk_f.h" | 37 # include "gui_gtk_f.h" |
38 #endif | 38 #endif |
39 | 39 |
40 /* GTK defines MAX and MIN, but some system header files as well. Undefine | 40 // GTK defines MAX and MIN, but some system header files as well. Undefine |
41 * them and don't use them. */ | 41 // them and don't use them. |
42 #ifdef MIN | 42 #ifdef MIN |
43 # undef MIN | 43 # undef MIN |
44 #endif | 44 #endif |
45 #ifdef MAX | 45 #ifdef MAX |
46 # undef MAX | 46 # undef MAX |
47 #endif | 47 #endif |
48 | 48 |
49 #ifdef FEAT_GUI_GNOME | 49 #ifdef FEAT_GUI_GNOME |
50 /* Gnome redefines _() and N_(). Grrr... */ | 50 // Gnome redefines _() and N_(). Grrr... |
51 # ifdef _ | 51 # ifdef _ |
52 # undef _ | 52 # undef _ |
53 # endif | 53 # endif |
54 # ifdef N_ | 54 # ifdef N_ |
55 # undef N_ | 55 # undef N_ |
62 # endif | 62 # endif |
63 # ifdef bind_textdomain_codeset | 63 # ifdef bind_textdomain_codeset |
64 # undef bind_textdomain_codeset | 64 # undef bind_textdomain_codeset |
65 # endif | 65 # endif |
66 # if defined(FEAT_GETTEXT) && !defined(ENABLE_NLS) | 66 # if defined(FEAT_GETTEXT) && !defined(ENABLE_NLS) |
67 # define ENABLE_NLS /* so the texts in the dialog boxes are translated */ | 67 # define ENABLE_NLS // so the texts in the dialog boxes are translated |
68 # endif | 68 # endif |
69 # include <gnome.h> | 69 # include <gnome.h> |
70 #endif | 70 #endif |
71 | 71 |
72 #ifdef FEAT_GUI_GTK | 72 #ifdef FEAT_GUI_GTK |
82 # include <gdk/gdkx.h> | 82 # include <gdk/gdkx.h> |
83 # endif | 83 # endif |
84 | 84 |
85 # include <gtk/gtk.h> | 85 # include <gtk/gtk.h> |
86 #else | 86 #else |
87 /* define these items to be able to generate prototypes without GTK */ | 87 // define these items to be able to generate prototypes without GTK |
88 typedef int GtkWidget; | 88 typedef int GtkWidget; |
89 # define gpointer int | 89 # define gpointer int |
90 # define guint8 int | 90 # define guint8 int |
91 # define GdkPixmap int | 91 # define GdkPixmap int |
92 # define GdkBitmap int | 92 # define GdkBitmap int |
116 * ones can be overridden in your gtkrc file. | 116 * ones can be overridden in your gtkrc file. |
117 */ | 117 */ |
118 # if GTK_CHECK_VERSION(3,10,0) | 118 # if GTK_CHECK_VERSION(3,10,0) |
119 static const char * const menu_themed_names[] = | 119 static const char * const menu_themed_names[] = |
120 { | 120 { |
121 /* 00 */ "document-new", /* sub. GTK_STOCK_NEW */ | 121 /* 00 */ "document-new", // sub. GTK_STOCK_NEW |
122 /* 01 */ "document-open", /* sub. GTK_STOCK_OPEN */ | 122 /* 01 */ "document-open", // sub. GTK_STOCK_OPEN |
123 /* 02 */ "document-save", /* sub. GTK_STOCK_SAVE */ | 123 /* 02 */ "document-save", // sub. GTK_STOCK_SAVE |
124 /* 03 */ "edit-undo", /* sub. GTK_STOCK_UNDO */ | 124 /* 03 */ "edit-undo", // sub. GTK_STOCK_UNDO |
125 /* 04 */ "edit-redo", /* sub. GTK_STOCK_REDO */ | 125 /* 04 */ "edit-redo", // sub. GTK_STOCK_REDO |
126 /* 05 */ "edit-cut", /* sub. GTK_STOCK_CUT */ | 126 /* 05 */ "edit-cut", // sub. GTK_STOCK_CUT |
127 /* 06 */ "edit-copy", /* sub. GTK_STOCK_COPY */ | 127 /* 06 */ "edit-copy", // sub. GTK_STOCK_COPY |
128 /* 07 */ "edit-paste", /* sub. GTK_STOCK_PASTE */ | 128 /* 07 */ "edit-paste", // sub. GTK_STOCK_PASTE |
129 /* 08 */ "document-print", /* sub. GTK_STOCK_PRINT */ | 129 /* 08 */ "document-print", // sub. GTK_STOCK_PRINT |
130 /* 09 */ "help-browser", /* sub. GTK_STOCK_HELP */ | 130 /* 09 */ "help-browser", // sub. GTK_STOCK_HELP |
131 /* 10 */ "edit-find", /* sub. GTK_STOCK_FIND */ | 131 /* 10 */ "edit-find", // sub. GTK_STOCK_FIND |
132 # if GTK_CHECK_VERSION(3,14,0) | 132 # if GTK_CHECK_VERSION(3,14,0) |
133 /* Use the file names in gui_gtk_res.xml, cutting off the extension. | 133 // Use the file names in gui_gtk_res.xml, cutting off the extension. |
134 * Similar changes follow. */ | 134 // Similar changes follow. |
135 /* 11 */ "stock_vim_save_all", | 135 /* 11 */ "stock_vim_save_all", |
136 /* 12 */ "stock_vim_session_save", | 136 /* 12 */ "stock_vim_session_save", |
137 /* 13 */ "stock_vim_session_new", | 137 /* 13 */ "stock_vim_session_new", |
138 /* 14 */ "stock_vim_session_load", | 138 /* 14 */ "stock_vim_session_load", |
139 # else | 139 # else |
140 /* 11 */ "vim-save-all", | 140 /* 11 */ "vim-save-all", |
141 /* 12 */ "vim-session-save", | 141 /* 12 */ "vim-session-save", |
142 /* 13 */ "vim-session-new", | 142 /* 13 */ "vim-session-new", |
143 /* 14 */ "vim-session-load", | 143 /* 14 */ "vim-session-load", |
144 # endif | 144 # endif |
145 /* 15 */ "system-run", /* sub. GTK_STOCK_EXECUTE */ | 145 /* 15 */ "system-run", // sub. GTK_STOCK_EXECUTE |
146 /* 16 */ "edit-find-replace", /* sub. GTK_STOCK_FIND_AND_REPLACE */ | 146 /* 16 */ "edit-find-replace", // sub. GTK_STOCK_FIND_AND_REPLACE |
147 /* 17 */ "window-close", /* sub. GTK_STOCK_CLOSE, FIXME: fuzzy */ | 147 /* 17 */ "window-close", // sub. GTK_STOCK_CLOSE, FIXME: fuzzy |
148 # if GTK_CHECK_VERSION(3,14,0) | 148 # if GTK_CHECK_VERSION(3,14,0) |
149 /* 18 */ "stock_vim_window_maximize", | 149 /* 18 */ "stock_vim_window_maximize", |
150 /* 19 */ "stock_vim_window_minimize", | 150 /* 19 */ "stock_vim_window_minimize", |
151 /* 20 */ "stock_vim_window_split", | 151 /* 20 */ "stock_vim_window_split", |
152 /* 21 */ "stock_vim_shell", | 152 /* 21 */ "stock_vim_shell", |
154 /* 18 */ "vim-window-maximize", | 154 /* 18 */ "vim-window-maximize", |
155 /* 19 */ "vim-window-minimize", | 155 /* 19 */ "vim-window-minimize", |
156 /* 20 */ "vim-window-split", | 156 /* 20 */ "vim-window-split", |
157 /* 21 */ "vim-shell", | 157 /* 21 */ "vim-shell", |
158 # endif | 158 # endif |
159 /* 22 */ "go-previous", /* sub. GTK_STOCK_GO_BACK */ | 159 /* 22 */ "go-previous", // sub. GTK_STOCK_GO_BACK |
160 /* 23 */ "go-next", /* sub. GTK_STOCK_GO_FORWARD */ | 160 /* 23 */ "go-next", // sub. GTK_STOCK_GO_FORWARD |
161 # if GTK_CHECK_VERSION(3,14,0) | 161 # if GTK_CHECK_VERSION(3,14,0) |
162 /* 24 */ "stock_vim_find_help", | 162 /* 24 */ "stock_vim_find_help", |
163 # else | 163 # else |
164 /* 24 */ "vim-find-help", | 164 /* 24 */ "vim-find-help", |
165 # endif | 165 # endif |
166 /* 25 */ "gtk-convert", /* sub. GTK_STOCK_CONVERT */ | 166 /* 25 */ "gtk-convert", // sub. GTK_STOCK_CONVERT |
167 /* 26 */ "go-jump", /* sub. GTK_STOCK_JUMP_TO */ | 167 /* 26 */ "go-jump", // sub. GTK_STOCK_JUMP_TO |
168 # if GTK_CHECK_VERSION(3,14,0) | 168 # if GTK_CHECK_VERSION(3,14,0) |
169 /* 27 */ "stock_vim_build_tags", | 169 /* 27 */ "stock_vim_build_tags", |
170 /* 28 */ "stock_vim_window_split_vertical", | 170 /* 28 */ "stock_vim_window_split_vertical", |
171 /* 29 */ "stock_vim_window_maximize_width", | 171 /* 29 */ "stock_vim_window_maximize_width", |
172 /* 30 */ "stock_vim_window_minimize_width", | 172 /* 30 */ "stock_vim_window_minimize_width", |
174 /* 27 */ "vim-build-tags", | 174 /* 27 */ "vim-build-tags", |
175 /* 28 */ "vim-window-split-vertical", | 175 /* 28 */ "vim-window-split-vertical", |
176 /* 29 */ "vim-window-maximize-width", | 176 /* 29 */ "vim-window-maximize-width", |
177 /* 30 */ "vim-window-minimize-width", | 177 /* 30 */ "vim-window-minimize-width", |
178 # endif | 178 # endif |
179 /* 31 */ "application-exit", /* GTK_STOCK_QUIT */ | 179 /* 31 */ "application-exit", // GTK_STOCK_QUIT |
180 }; | 180 }; |
181 # else /* !GTK_CHECK_VERSION(3,10,0) */ | 181 # else // !GTK_CHECK_VERSION(3,10,0) |
182 static const char * const menu_stock_ids[] = | 182 static const char * const menu_stock_ids[] = |
183 { | 183 { |
184 /* 00 */ GTK_STOCK_NEW, | 184 /* 00 */ GTK_STOCK_NEW, |
185 /* 01 */ GTK_STOCK_OPEN, | 185 /* 01 */ GTK_STOCK_OPEN, |
186 /* 02 */ GTK_STOCK_SAVE, | 186 /* 02 */ GTK_STOCK_SAVE, |
196 /* 12 */ "vim-session-save", | 196 /* 12 */ "vim-session-save", |
197 /* 13 */ "vim-session-new", | 197 /* 13 */ "vim-session-new", |
198 /* 14 */ "vim-session-load", | 198 /* 14 */ "vim-session-load", |
199 /* 15 */ GTK_STOCK_EXECUTE, | 199 /* 15 */ GTK_STOCK_EXECUTE, |
200 /* 16 */ GTK_STOCK_FIND_AND_REPLACE, | 200 /* 16 */ GTK_STOCK_FIND_AND_REPLACE, |
201 /* 17 */ GTK_STOCK_CLOSE, /* FIXME: fuzzy */ | 201 /* 17 */ GTK_STOCK_CLOSE, // FIXME: fuzzy |
202 /* 18 */ "vim-window-maximize", | 202 /* 18 */ "vim-window-maximize", |
203 /* 19 */ "vim-window-minimize", | 203 /* 19 */ "vim-window-minimize", |
204 /* 20 */ "vim-window-split", | 204 /* 20 */ "vim-window-split", |
205 /* 21 */ "vim-shell", | 205 /* 21 */ "vim-shell", |
206 /* 22 */ GTK_STOCK_GO_BACK, | 206 /* 22 */ GTK_STOCK_GO_BACK, |
212 /* 28 */ "vim-window-split-vertical", | 212 /* 28 */ "vim-window-split-vertical", |
213 /* 29 */ "vim-window-maximize-width", | 213 /* 29 */ "vim-window-maximize-width", |
214 /* 30 */ "vim-window-minimize-width", | 214 /* 30 */ "vim-window-minimize-width", |
215 /* 31 */ GTK_STOCK_QUIT | 215 /* 31 */ GTK_STOCK_QUIT |
216 }; | 216 }; |
217 # endif /* !GTK_CHECK_VERSION(3,10,0) */ | 217 # endif // !GTK_CHECK_VERSION(3,10,0) |
218 | 218 |
219 # ifdef USE_GRESOURCE | 219 # ifdef USE_GRESOURCE |
220 # if !GTK_CHECK_VERSION(3,10,0) | 220 # if !GTK_CHECK_VERSION(3,10,0) |
221 typedef struct IconNames { | 221 typedef struct IconNames { |
222 const char *icon_name; | 222 const char *icon_name; |
238 { "vim-window-split", "stock_vim_window_split.png" }, | 238 { "vim-window-split", "stock_vim_window_split.png" }, |
239 { "vim-window-split-vertical", "stock_vim_window_split_vertical.png" }, | 239 { "vim-window-split-vertical", "stock_vim_window_split_vertical.png" }, |
240 { NULL, NULL } | 240 { NULL, NULL } |
241 }; | 241 }; |
242 # endif | 242 # endif |
243 # endif /* USE_G_RESOURCE */ | 243 # endif // USE_G_RESOURCE |
244 | 244 |
245 # ifndef USE_GRESOURCE | 245 # ifndef USE_GRESOURCE |
246 static void | 246 static void |
247 add_stock_icon(GtkIconFactory *factory, | 247 add_stock_icon(GtkIconFactory *factory, |
248 const char *stock_id, | 248 const char *stock_id, |
314 break; | 314 break; |
315 case GTK_ICON_SIZE_DIALOG: | 315 case GTK_ICON_SIZE_DIALOG: |
316 pixel_size = 48; | 316 pixel_size = 48; |
317 break; | 317 break; |
318 case GTK_ICON_SIZE_INVALID: | 318 case GTK_ICON_SIZE_INVALID: |
319 /* FALLTHROUGH */ | 319 // FALLTHROUGH |
320 default: | 320 default: |
321 pixel_size = 0; | 321 pixel_size = 0; |
322 break; | 322 break; |
323 } | 323 } |
324 | 324 |
335 } | 335 } |
336 if (image == NULL) | 336 if (image == NULL) |
337 image = gtk_image_new_from_icon_name("image-missing", icon_size); | 337 image = gtk_image_new_from_icon_name("image-missing", icon_size); |
338 | 338 |
339 return image; | 339 return image; |
340 # else /* !GTK_CHECK_VERSION(3,10,0) */ | 340 # else // !GTK_CHECK_VERSION(3,10,0) |
341 GtkIconSet *icon_set; | 341 GtkIconSet *icon_set; |
342 GtkIconSource *icon_source; | 342 GtkIconSource *icon_source; |
343 | 343 |
344 /* | 344 /* |
345 * Rather than loading the icon directly into a GtkImage, create | 345 * Rather than loading the icon directly into a GtkImage, create |
356 | 356 |
357 gtk_icon_source_free(icon_source); | 357 gtk_icon_source_free(icon_source); |
358 gtk_icon_set_unref(icon_set); | 358 gtk_icon_set_unref(icon_set); |
359 | 359 |
360 return image; | 360 return image; |
361 # endif /* !GTK_CHECK_VERSION(3,10,0) */ | 361 # endif // !GTK_CHECK_VERSION(3,10,0) |
362 } | 362 } |
363 | 363 |
364 static GtkWidget * | 364 static GtkWidget * |
365 create_menu_icon(vimmenu_T *menu, GtkIconSize icon_size) | 365 create_menu_icon(vimmenu_T *menu, GtkIconSize icon_size) |
366 { | 366 { |
367 GtkWidget *image = NULL; | 367 GtkWidget *image = NULL; |
368 char_u buf[MAXPATHL]; | 368 char_u buf[MAXPATHL]; |
369 | 369 |
370 /* First use a specified "icon=" argument. */ | 370 // First use a specified "icon=" argument. |
371 if (menu->iconfile != NULL && lookup_menu_iconfile(menu->iconfile, buf)) | 371 if (menu->iconfile != NULL && lookup_menu_iconfile(menu->iconfile, buf)) |
372 image = load_menu_iconfile(buf, icon_size); | 372 image = load_menu_iconfile(buf, icon_size); |
373 | 373 |
374 /* If not found and not builtin specified try using the menu name. */ | 374 // If not found and not builtin specified try using the menu name. |
375 if (image == NULL && !menu->icon_builtin | 375 if (image == NULL && !menu->icon_builtin |
376 && lookup_menu_iconfile(menu->name, buf)) | 376 && lookup_menu_iconfile(menu->name, buf)) |
377 image = load_menu_iconfile(buf, icon_size); | 377 image = load_menu_iconfile(buf, icon_size); |
378 | 378 |
379 /* Still not found? Then use a builtin icon, a blank one as fallback. */ | 379 // Still not found? Then use a builtin icon, a blank one as fallback. |
380 if (image == NULL) | 380 if (image == NULL) |
381 { | 381 { |
382 # if GTK_CHECK_VERSION(3,10,0) | 382 # if GTK_CHECK_VERSION(3,10,0) |
383 const char *icon_name = NULL; | 383 const char *icon_name = NULL; |
384 const int n_names = G_N_ELEMENTS(menu_themed_names); | 384 const int n_names = G_N_ELEMENTS(menu_themed_names); |
408 static gint | 408 static gint |
409 toolbar_button_focus_in_event(GtkWidget *widget UNUSED, | 409 toolbar_button_focus_in_event(GtkWidget *widget UNUSED, |
410 GdkEventFocus *event UNUSED, | 410 GdkEventFocus *event UNUSED, |
411 gpointer data UNUSED) | 411 gpointer data UNUSED) |
412 { | 412 { |
413 /* When we're in a GtkPlug, we don't have window focus events, only widget | 413 // When we're in a GtkPlug, we don't have window focus events, only widget |
414 * focus. To emulate stand-alone gvim, if a button gets focus (e.g., | 414 // focus. To emulate stand-alone gvim, if a button gets focus (e.g., |
415 * <Tab> into GtkPlug) immediately pass it to mainwin. */ | 415 // <Tab> into GtkPlug) immediately pass it to mainwin. |
416 if (gtk_socket_id != 0) | 416 if (gtk_socket_id != 0) |
417 gtk_widget_grab_focus(gui.drawarea); | 417 gtk_widget_grab_focus(gui.drawarea); |
418 | 418 |
419 return TRUE; | 419 return TRUE; |
420 } | 420 } |
421 #endif /* FEAT_TOOLBAR */ | 421 #endif // FEAT_TOOLBAR |
422 | 422 |
423 #if defined(FEAT_TOOLBAR) || defined(PROTO) | 423 #if defined(FEAT_TOOLBAR) || defined(PROTO) |
424 | 424 |
425 void | 425 void |
426 gui_gtk_register_stock_icons(void) | 426 gui_gtk_register_stock_icons(void) |
448 | 448 |
449 # undef ADD_ICON | 449 # undef ADD_ICON |
450 | 450 |
451 gtk_icon_factory_add_default(factory); | 451 gtk_icon_factory_add_default(factory); |
452 g_object_unref(factory); | 452 g_object_unref(factory); |
453 # else /* defined(USE_GRESOURCE) */ | 453 # else // defined(USE_GRESOURCE) |
454 const char * const path_prefix = "/org/vim/gui/icon"; | 454 const char * const path_prefix = "/org/vim/gui/icon"; |
455 # if GTK_CHECK_VERSION(3,14,0) | 455 # if GTK_CHECK_VERSION(3,14,0) |
456 GdkScreen *screen = NULL; | 456 GdkScreen *screen = NULL; |
457 GtkIconTheme *icon_theme = NULL; | 457 GtkIconTheme *icon_theme = NULL; |
458 | 458 |
476 { | 476 { |
477 const gint size = MAX(gdk_pixbuf_get_width(pixbuf), | 477 const gint size = MAX(gdk_pixbuf_get_width(pixbuf), |
478 gdk_pixbuf_get_height(pixbuf)); | 478 gdk_pixbuf_get_height(pixbuf)); |
479 if (size > 16) | 479 if (size > 16) |
480 { | 480 { |
481 /* An icon theme is supposed to provide fixed-size | 481 // An icon theme is supposed to provide fixed-size |
482 * image files for each size, e.g., 16, 22, 24, ... | 482 // image files for each size, e.g., 16, 22, 24, ... |
483 * Naturally, in contrast to GtkIconSet, GtkIconTheme | 483 // Naturally, in contrast to GtkIconSet, GtkIconTheme |
484 * won't prepare size variants for us out of a single | 484 // won't prepare size variants for us out of a single |
485 * fixed-size image. | 485 // fixed-size image. |
486 * | 486 // |
487 * Currently, Vim provides 24x24 images only while the | 487 // Currently, Vim provides 24x24 images only while the |
488 * icon size on the menu and the toolbar is set to 16x16 | 488 // icon size on the menu and the toolbar is set to 16x16 |
489 * by default. | 489 // by default. |
490 * | 490 // |
491 * Resize them by ourselves until we have our own fully | 491 // Resize them by ourselves until we have our own fully |
492 * fledged icon theme. */ | 492 // fledged icon theme. |
493 GdkPixbuf *src = pixbuf; | 493 GdkPixbuf *src = pixbuf; |
494 pixbuf = gdk_pixbuf_scale_simple(src, | 494 pixbuf = gdk_pixbuf_scale_simple(src, |
495 16, 16, | 495 16, 16, |
496 GDK_INTERP_BILINEAR); | 496 GDK_INTERP_BILINEAR); |
497 if (pixbuf == NULL) | 497 if (pixbuf == NULL) |
501 } | 501 } |
502 gtk_icon_theme_add_builtin_icon(names->icon_name, size, pixbuf); | 502 gtk_icon_theme_add_builtin_icon(names->icon_name, size, pixbuf); |
503 g_object_unref(pixbuf); | 503 g_object_unref(pixbuf); |
504 } | 504 } |
505 } | 505 } |
506 # else /* !GTK_CHECK_VERSION(3,0.0) */ | 506 # else // !GTK_CHECK_VERSION(3,0.0) |
507 GtkIconFactory * const factory = gtk_icon_factory_new(); | 507 GtkIconFactory * const factory = gtk_icon_factory_new(); |
508 IconNames *names; | 508 IconNames *names; |
509 | 509 |
510 for (names = stock_vim_icons; names->icon_name != NULL; names++) | 510 for (names = stock_vim_icons; names->icon_name != NULL; names++) |
511 { | 511 { |
523 } | 523 } |
524 } | 524 } |
525 | 525 |
526 gtk_icon_factory_add_default(factory); | 526 gtk_icon_factory_add_default(factory); |
527 g_object_unref(factory); | 527 g_object_unref(factory); |
528 # endif /* !GTK_CHECK_VERSION(3,0,0) */ | 528 # endif // !GTK_CHECK_VERSION(3,0,0) |
529 # endif /* defined(USE_GRESOURCE) */ | 529 # endif // defined(USE_GRESOURCE) |
530 } | 530 } |
531 | 531 |
532 #endif /* FEAT_TOOLBAR */ | 532 #endif // FEAT_TOOLBAR |
533 | 533 |
534 #if defined(FEAT_MENU) || defined(PROTO) | 534 #if defined(FEAT_MENU) || defined(PROTO) |
535 | 535 |
536 /* | 536 /* |
537 * Translate Vim's mnemonic tagging to GTK+ style and convert to UTF-8 | 537 * Translate Vim's mnemonic tagging to GTK+ style and convert to UTF-8 |
595 { | 595 { |
596 GtkWidget *box; | 596 GtkWidget *box; |
597 char_u *text; | 597 char_u *text; |
598 int use_mnemonic; | 598 int use_mnemonic; |
599 | 599 |
600 /* It would be neat to have image menu items, but that would require major | 600 // It would be neat to have image menu items, but that would require major |
601 * changes to Vim's menu system. Not to mention that all the translations | 601 // changes to Vim's menu system. Not to mention that all the translations |
602 * had to be updated. */ | 602 // had to be updated. |
603 menu->id = gtk_menu_item_new(); | 603 menu->id = gtk_menu_item_new(); |
604 # if GTK_CHECK_VERSION(3,2,0) | 604 # if GTK_CHECK_VERSION(3,2,0) |
605 box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 20); | 605 box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 20); |
606 gtk_box_set_homogeneous(GTK_BOX(box), FALSE); | 606 gtk_box_set_homogeneous(GTK_BOX(box), FALSE); |
607 # else | 607 # else |
651 | 651 |
652 parent_widget = (parent != NULL) ? parent->submenu_id : gui.menubar; | 652 parent_widget = (parent != NULL) ? parent->submenu_id : gui.menubar; |
653 menu_item_new(menu, parent_widget); | 653 menu_item_new(menu, parent_widget); |
654 | 654 |
655 # if !GTK_CHECK_VERSION(3,4,0) | 655 # if !GTK_CHECK_VERSION(3,4,0) |
656 /* since the tearoff should always appear first, increment idx */ | 656 // since the tearoff should always appear first, increment idx |
657 if (parent != NULL && !menu_is_popup(parent->name)) | 657 if (parent != NULL && !menu_is_popup(parent->name)) |
658 ++idx; | 658 ++idx; |
659 # endif | 659 # endif |
660 | 660 |
661 gtk_menu_shell_insert(GTK_MENU_SHELL(parent_widget), menu->id, idx); | 661 gtk_menu_shell_insert(GTK_MENU_SHELL(parent_widget), menu->id, idx); |
720 char_u *tooltip; | 720 char_u *tooltip; |
721 | 721 |
722 text = CONVERT_TO_UTF8(menu->dname); | 722 text = CONVERT_TO_UTF8(menu->dname); |
723 tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]); | 723 tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]); |
724 if (tooltip != NULL && !utf_valid_string(tooltip, NULL)) | 724 if (tooltip != NULL && !utf_valid_string(tooltip, NULL)) |
725 /* Invalid text, can happen when 'encoding' is changed. Avoid | 725 // Invalid text, can happen when 'encoding' is changed. Avoid |
726 * a nasty GTK error message, skip the tooltip. */ | 726 // a nasty GTK error message, skip the tooltip. |
727 CONVERT_TO_UTF8_FREE(tooltip); | 727 CONVERT_TO_UTF8_FREE(tooltip); |
728 | 728 |
729 # if GTK_CHECK_VERSION(3,0,0) | 729 # if GTK_CHECK_VERSION(3,0,0) |
730 { | 730 { |
731 GtkWidget *icon; | 731 GtkWidget *icon; |
762 CONVERT_TO_UTF8_FREE(text); | 762 CONVERT_TO_UTF8_FREE(text); |
763 CONVERT_TO_UTF8_FREE(tooltip); | 763 CONVERT_TO_UTF8_FREE(tooltip); |
764 } | 764 } |
765 } | 765 } |
766 else | 766 else |
767 # endif /* FEAT_TOOLBAR */ | 767 # endif // FEAT_TOOLBAR |
768 { | 768 { |
769 /* No parent, must be a non-menubar menu */ | 769 // No parent, must be a non-menubar menu |
770 if (parent == NULL || parent->submenu_id == NULL) | 770 if (parent == NULL || parent->submenu_id == NULL) |
771 return; | 771 return; |
772 | 772 |
773 # if !GTK_CHECK_VERSION(3,4,0) | 773 # if !GTK_CHECK_VERSION(3,4,0) |
774 /* Make place for the possible tearoff handle item. Not in the popup | 774 // Make place for the possible tearoff handle item. Not in the popup |
775 * menu, it doesn't have a tearoff item. */ | 775 // menu, it doesn't have a tearoff item. |
776 if (!menu_is_popup(parent->name)) | 776 if (!menu_is_popup(parent->name)) |
777 ++idx; | 777 ++idx; |
778 # endif | 778 # endif |
779 | 779 |
780 if (menu_is_separator(menu->name)) | 780 if (menu_is_separator(menu->name)) |
781 { | 781 { |
782 /* Separator: Just add it */ | 782 // Separator: Just add it |
783 # if GTK_CHECK_VERSION(3,0,0) | 783 # if GTK_CHECK_VERSION(3,0,0) |
784 menu->id = gtk_separator_menu_item_new(); | 784 menu->id = gtk_separator_menu_item_new(); |
785 # else | 785 # else |
786 menu->id = gtk_menu_item_new(); | 786 menu->id = gtk_menu_item_new(); |
787 gtk_widget_set_sensitive(menu->id, FALSE); | 787 gtk_widget_set_sensitive(menu->id, FALSE); |
791 menu->id, idx); | 791 menu->id, idx); |
792 | 792 |
793 return; | 793 return; |
794 } | 794 } |
795 | 795 |
796 /* Add textual menu item. */ | 796 // Add textual menu item. |
797 menu_item_new(menu, parent->submenu_id); | 797 menu_item_new(menu, parent->submenu_id); |
798 gtk_widget_show(menu->id); | 798 gtk_widget_show(menu->id); |
799 gtk_menu_shell_insert(GTK_MENU_SHELL(parent->submenu_id), | 799 gtk_menu_shell_insert(GTK_MENU_SHELL(parent->submenu_id), |
800 menu->id, idx); | 800 menu->id, idx); |
801 | 801 |
802 if (menu->id != NULL) | 802 if (menu->id != NULL) |
803 g_signal_connect(G_OBJECT(menu->id), "activate", | 803 g_signal_connect(G_OBJECT(menu->id), "activate", |
804 G_CALLBACK(menu_item_activate), menu); | 804 G_CALLBACK(menu_item_activate), menu); |
805 } | 805 } |
806 } | 806 } |
807 #endif /* FEAT_MENU */ | 807 #endif // FEAT_MENU |
808 | 808 |
809 | 809 |
810 void | 810 void |
811 gui_mch_set_text_area_pos(int x, int y, int w, int h) | 811 gui_mch_set_text_area_pos(int x, int y, int w, int h) |
812 { | 812 { |
857 | 857 |
858 # if GTK_CHECK_VERSION(3,4,0) | 858 # if GTK_CHECK_VERSION(3,4,0) |
859 void | 859 void |
860 gui_mch_toggle_tearoffs(int enable UNUSED) | 860 gui_mch_toggle_tearoffs(int enable UNUSED) |
861 { | 861 { |
862 /* Do nothing */ | 862 // Do nothing |
863 } | 863 } |
864 # else | 864 # else |
865 void | 865 void |
866 gui_mch_toggle_tearoffs(int enable) | 866 gui_mch_toggle_tearoffs(int enable) |
867 { | 867 { |
868 recurse_tearoffs(root_menu, enable); | 868 recurse_tearoffs(root_menu, enable); |
869 } | 869 } |
870 # endif | 870 # endif |
871 #endif /* FEAT_MENU */ | 871 #endif // FEAT_MENU |
872 | 872 |
873 #if defined(FEAT_TOOLBAR) | 873 #if defined(FEAT_TOOLBAR) |
874 static int | 874 static int |
875 get_menu_position(vimmenu_T *menu) | 875 get_menu_position(vimmenu_T *menu) |
876 { | 876 { |
883 ++idx; | 883 ++idx; |
884 } | 884 } |
885 | 885 |
886 return idx; | 886 return idx; |
887 } | 887 } |
888 #endif /* FEAT_TOOLBAR */ | 888 #endif // FEAT_TOOLBAR |
889 | 889 |
890 | 890 |
891 #if defined(FEAT_TOOLBAR) || defined(PROTO) | 891 #if defined(FEAT_TOOLBAR) || defined(PROTO) |
892 void | 892 void |
893 gui_mch_menu_set_tip(vimmenu_T *menu) | 893 gui_mch_menu_set_tip(vimmenu_T *menu) |
898 char_u *tooltip; | 898 char_u *tooltip; |
899 | 899 |
900 tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]); | 900 tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]); |
901 if (tooltip != NULL && utf_valid_string(tooltip, NULL)) | 901 if (tooltip != NULL && utf_valid_string(tooltip, NULL)) |
902 # if GTK_CHECK_VERSION(3,0,0) | 902 # if GTK_CHECK_VERSION(3,0,0) |
903 /* Only set the tooltip when it's valid utf-8. */ | 903 // Only set the tooltip when it's valid utf-8. |
904 gtk_widget_set_tooltip_text(menu->id, (const gchar *)tooltip); | 904 gtk_widget_set_tooltip_text(menu->id, (const gchar *)tooltip); |
905 # else | 905 # else |
906 /* Only set the tooltip when it's valid utf-8. */ | 906 // Only set the tooltip when it's valid utf-8. |
907 gtk_tooltips_set_tip(GTK_TOOLBAR(gui.toolbar)->tooltips, | 907 gtk_tooltips_set_tip(GTK_TOOLBAR(gui.toolbar)->tooltips, |
908 menu->id, (const char *)tooltip, NULL); | 908 menu->id, (const char *)tooltip, NULL); |
909 # endif | 909 # endif |
910 CONVERT_TO_UTF8_FREE(tooltip); | 910 CONVERT_TO_UTF8_FREE(tooltip); |
911 } | 911 } |
912 } | 912 } |
913 #endif /* FEAT_TOOLBAR */ | 913 #endif // FEAT_TOOLBAR |
914 | 914 |
915 | 915 |
916 #if defined(FEAT_MENU) || defined(PROTO) | 916 #if defined(FEAT_MENU) || defined(PROTO) |
917 /* | 917 /* |
918 * Destroy the machine specific menu widget. | 918 * Destroy the machine specific menu widget. |
919 */ | 919 */ |
920 void | 920 void |
921 gui_mch_destroy_menu(vimmenu_T *menu) | 921 gui_mch_destroy_menu(vimmenu_T *menu) |
922 { | 922 { |
923 /* Don't let gtk_container_remove automatically destroy menu->id. */ | 923 // Don't let gtk_container_remove automatically destroy menu->id. |
924 if (menu->id != NULL) | 924 if (menu->id != NULL) |
925 g_object_ref(menu->id); | 925 g_object_ref(menu->id); |
926 | 926 |
927 /* Workaround for a spurious gtk warning in Ubuntu: "Trying to remove | 927 // Workaround for a spurious gtk warning in Ubuntu: "Trying to remove |
928 * a child that doesn't believe we're its parent." | 928 // a child that doesn't believe we're its parent." |
929 * Remove widget from gui.menubar before destroying it. */ | 929 // Remove widget from gui.menubar before destroying it. |
930 if (menu->id != NULL && gui.menubar != NULL | 930 if (menu->id != NULL && gui.menubar != NULL |
931 && gtk_widget_get_parent(menu->id) == gui.menubar) | 931 && gtk_widget_get_parent(menu->id) == gui.menubar) |
932 gtk_container_remove(GTK_CONTAINER(gui.menubar), menu->id); | 932 gtk_container_remove(GTK_CONTAINER(gui.menubar), menu->id); |
933 | 933 |
934 # ifdef FEAT_TOOLBAR | 934 # ifdef FEAT_TOOLBAR |
951 # endif | 951 # endif |
952 else if (menu->id != NULL) | 952 else if (menu->id != NULL) |
953 gtk_widget_destroy(menu->id); | 953 gtk_widget_destroy(menu->id); |
954 } | 954 } |
955 else | 955 else |
956 # endif /* FEAT_TOOLBAR */ | 956 # endif // FEAT_TOOLBAR |
957 { | 957 { |
958 if (menu->submenu_id != NULL) | 958 if (menu->submenu_id != NULL) |
959 gtk_widget_destroy(menu->submenu_id); | 959 gtk_widget_destroy(menu->submenu_id); |
960 | 960 |
961 if (menu->id != NULL) | 961 if (menu->id != NULL) |
965 if (menu->id != NULL) | 965 if (menu->id != NULL) |
966 g_object_unref(menu->id); | 966 g_object_unref(menu->id); |
967 menu->submenu_id = NULL; | 967 menu->submenu_id = NULL; |
968 menu->id = NULL; | 968 menu->id = NULL; |
969 } | 969 } |
970 #endif /* FEAT_MENU */ | 970 #endif // FEAT_MENU |
971 | 971 |
972 | 972 |
973 /* | 973 /* |
974 * Scrollbar stuff. | 974 * Scrollbar stuff. |
975 */ | 975 */ |
1017 scrollbar_T *sb; | 1017 scrollbar_T *sb; |
1018 long value; | 1018 long value; |
1019 int dragging = FALSE; | 1019 int dragging = FALSE; |
1020 | 1020 |
1021 #ifdef FEAT_XIM | 1021 #ifdef FEAT_XIM |
1022 /* cancel any preediting */ | 1022 // cancel any preediting |
1023 if (im_is_preediting()) | 1023 if (im_is_preediting()) |
1024 xim_reset(); | 1024 xim_reset(); |
1025 #endif | 1025 #endif |
1026 | 1026 |
1027 sb = gui_find_scrollbar((long)data); | 1027 sb = gui_find_scrollbar((long)data); |
1046 int y; | 1046 int y; |
1047 GdkModifierType state; | 1047 GdkModifierType state; |
1048 int width; | 1048 int width; |
1049 int height; | 1049 int height; |
1050 | 1050 |
1051 /* vertical scrollbar: need to set "dragging" properly in case | 1051 // vertical scrollbar: need to set "dragging" properly in case |
1052 * there are closed folds. */ | 1052 // there are closed folds. |
1053 gdk_window_get_pointer(sb->id->window, &x, &y, &state); | 1053 gdk_window_get_pointer(sb->id->window, &x, &y, &state); |
1054 gdk_window_get_size(sb->id->window, &width, &height); | 1054 gdk_window_get_size(sb->id->window, &width, &height); |
1055 if (x >= 0 && x < width && y >= 0 && y < height) | 1055 if (x >= 0 && x < width && y >= 0 && y < height) |
1056 { | 1056 { |
1057 if (y < width) | 1057 if (y < width) |
1058 { | 1058 { |
1059 /* up arrow: move one (closed fold) line up */ | 1059 // up arrow: move one (closed fold) line up |
1060 dragging = FALSE; | 1060 dragging = FALSE; |
1061 value = sb->wp->w_topline - 2; | 1061 value = sb->wp->w_topline - 2; |
1062 } | 1062 } |
1063 else if (y > height - width) | 1063 else if (y > height - width) |
1064 { | 1064 { |
1065 /* down arrow: move one (closed fold) line down */ | 1065 // down arrow: move one (closed fold) line down |
1066 dragging = FALSE; | 1066 dragging = FALSE; |
1067 value = sb->wp->w_topline; | 1067 value = sb->wp->w_topline; |
1068 } | 1068 } |
1069 } | 1069 } |
1070 } | 1070 } |
1071 } | 1071 } |
1072 #endif /* !GTK_CHECK_VERSION(3,0,0) */ | 1072 #endif // !GTK_CHECK_VERSION(3,0,0) |
1073 gui_drag_scrollbar(sb, value, dragging); | 1073 gui_drag_scrollbar(sb, value, dragging); |
1074 } | 1074 } |
1075 | 1075 |
1076 /* SBAR_VERT or SBAR_HORIZ */ | 1076 // SBAR_VERT or SBAR_HORIZ |
1077 void | 1077 void |
1078 gui_mch_create_scrollbar(scrollbar_T *sb, int orient) | 1078 gui_mch_create_scrollbar(scrollbar_T *sb, int orient) |
1079 { | 1079 { |
1080 if (orient == SBAR_HORIZ) | 1080 if (orient == SBAR_HORIZ) |
1081 #if GTK_CHECK_VERSION(3,2,0) | 1081 #if GTK_CHECK_VERSION(3,2,0) |
1189 guint log_handler; | 1189 guint log_handler; |
1190 const gchar *domain = "Gtk"; | 1190 const gchar *domain = "Gtk"; |
1191 | 1191 |
1192 title = CONVERT_TO_UTF8(title); | 1192 title = CONVERT_TO_UTF8(title); |
1193 | 1193 |
1194 /* GTK has a bug, it only works with an absolute path. */ | 1194 // GTK has a bug, it only works with an absolute path. |
1195 if (initdir == NULL || *initdir == NUL) | 1195 if (initdir == NULL || *initdir == NUL) |
1196 mch_dirname(dirbuf, MAXPATHL); | 1196 mch_dirname(dirbuf, MAXPATHL); |
1197 else if (vim_FullName(initdir, dirbuf, MAXPATHL - 2, FALSE) == FAIL) | 1197 else if (vim_FullName(initdir, dirbuf, MAXPATHL - 2, FALSE) == FAIL) |
1198 dirbuf[0] = NUL; | 1198 dirbuf[0] = NUL; |
1199 /* Always need a trailing slash for a directory. */ | 1199 // Always need a trailing slash for a directory. |
1200 add_pathsep(dirbuf); | 1200 add_pathsep(dirbuf); |
1201 | 1201 |
1202 /* If our pointer is currently hidden, then we should show it. */ | 1202 // If our pointer is currently hidden, then we should show it. |
1203 gui_mch_mousehide(FALSE); | 1203 gui_mch_mousehide(FALSE); |
1204 | 1204 |
1205 /* Hack: The GTK file dialog warns when it can't access a new file, this | 1205 // Hack: The GTK file dialog warns when it can't access a new file, this |
1206 * makes it shut up. http://bugzilla.gnome.org/show_bug.cgi?id=664587 */ | 1206 // makes it shut up. http://bugzilla.gnome.org/show_bug.cgi?id=664587 |
1207 log_handler = g_log_set_handler(domain, G_LOG_LEVEL_WARNING, | 1207 log_handler = g_log_set_handler(domain, G_LOG_LEVEL_WARNING, |
1208 recent_func_log_func, NULL); | 1208 recent_func_log_func, NULL); |
1209 | 1209 |
1210 #ifdef USE_FILE_CHOOSER | 1210 #ifdef USE_FILE_CHOOSER |
1211 /* We create the dialog each time, so that the button text can be "Open" | 1211 // We create the dialog each time, so that the button text can be "Open" |
1212 * or "Save" according to the action. */ | 1212 // or "Save" according to the action. |
1213 fc = gtk_file_chooser_dialog_new((const gchar *)title, | 1213 fc = gtk_file_chooser_dialog_new((const gchar *)title, |
1214 GTK_WINDOW(gui.mainwin), | 1214 GTK_WINDOW(gui.mainwin), |
1215 saving ? GTK_FILE_CHOOSER_ACTION_SAVE | 1215 saving ? GTK_FILE_CHOOSER_ACTION_SAVE |
1216 : GTK_FILE_CHOOSER_ACTION_OPEN, | 1216 : GTK_FILE_CHOOSER_ACTION_OPEN, |
1217 # if GTK_CHECK_VERSION(3,10,0) | 1217 # if GTK_CHECK_VERSION(3,10,0) |
1276 gui.browse_fname = (char_u *)g_strdup(filename); | 1276 gui.browse_fname = (char_u *)g_strdup(filename); |
1277 g_free(filename); | 1277 g_free(filename); |
1278 } | 1278 } |
1279 gtk_widget_destroy(GTK_WIDGET(fc)); | 1279 gtk_widget_destroy(GTK_WIDGET(fc)); |
1280 | 1280 |
1281 #else /* !USE_FILE_CHOOSER */ | 1281 #else // !USE_FILE_CHOOSER |
1282 | 1282 |
1283 if (gui.filedlg == NULL) | 1283 if (gui.filedlg == NULL) |
1284 { | 1284 { |
1285 GtkFileSelection *fs; /* shortcut */ | 1285 GtkFileSelection *fs; // shortcut |
1286 | 1286 |
1287 gui.filedlg = gtk_file_selection_new((const gchar *)title); | 1287 gui.filedlg = gtk_file_selection_new((const gchar *)title); |
1288 gtk_window_set_modal(GTK_WINDOW(gui.filedlg), TRUE); | 1288 gtk_window_set_modal(GTK_WINDOW(gui.filedlg), TRUE); |
1289 gtk_window_set_transient_for(GTK_WINDOW(gui.filedlg), | 1289 gtk_window_set_transient_for(GTK_WINDOW(gui.filedlg), |
1290 GTK_WINDOW(gui.mainwin)); | 1290 GTK_WINDOW(gui.mainwin)); |
1294 | 1294 |
1295 gtk_signal_connect(GTK_OBJECT(fs->ok_button), | 1295 gtk_signal_connect(GTK_OBJECT(fs->ok_button), |
1296 "clicked", GTK_SIGNAL_FUNC(browse_ok_cb), &gui); | 1296 "clicked", GTK_SIGNAL_FUNC(browse_ok_cb), &gui); |
1297 gtk_signal_connect(GTK_OBJECT(fs->cancel_button), | 1297 gtk_signal_connect(GTK_OBJECT(fs->cancel_button), |
1298 "clicked", GTK_SIGNAL_FUNC(browse_cancel_cb), &gui); | 1298 "clicked", GTK_SIGNAL_FUNC(browse_cancel_cb), &gui); |
1299 /* gtk_signal_connect() doesn't work for destroy, it causes a hang */ | 1299 // gtk_signal_connect() doesn't work for destroy, it causes a hang |
1300 gtk_signal_connect_object(GTK_OBJECT(gui.filedlg), | 1300 gtk_signal_connect_object(GTK_OBJECT(gui.filedlg), |
1301 "destroy", GTK_SIGNAL_FUNC(browse_destroy_cb), | 1301 "destroy", GTK_SIGNAL_FUNC(browse_destroy_cb), |
1302 GTK_OBJECT(gui.filedlg)); | 1302 GTK_OBJECT(gui.filedlg)); |
1303 } | 1303 } |
1304 else | 1304 else |
1305 gtk_window_set_title(GTK_WINDOW(gui.filedlg), (const gchar *)title); | 1305 gtk_window_set_title(GTK_WINDOW(gui.filedlg), (const gchar *)title); |
1306 | 1306 |
1307 /* Concatenate "initdir" and "dflt". */ | 1307 // Concatenate "initdir" and "dflt". |
1308 if (dflt != NULL && *dflt != NUL | 1308 if (dflt != NULL && *dflt != NUL |
1309 && STRLEN(dirbuf) + 2 + STRLEN(dflt) < MAXPATHL) | 1309 && STRLEN(dirbuf) + 2 + STRLEN(dflt) < MAXPATHL) |
1310 STRCAT(dirbuf, dflt); | 1310 STRCAT(dirbuf, dflt); |
1311 | 1311 |
1312 gtk_file_selection_set_filename(GTK_FILE_SELECTION(gui.filedlg), | 1312 gtk_file_selection_set_filename(GTK_FILE_SELECTION(gui.filedlg), |
1313 (const gchar *)dirbuf); | 1313 (const gchar *)dirbuf); |
1314 | 1314 |
1315 gtk_widget_show(gui.filedlg); | 1315 gtk_widget_show(gui.filedlg); |
1316 gtk_main(); | 1316 gtk_main(); |
1317 #endif /* !USE_FILE_CHOOSER */ | 1317 #endif // !USE_FILE_CHOOSER |
1318 g_log_remove_handler(domain, log_handler); | 1318 g_log_remove_handler(domain, log_handler); |
1319 | 1319 |
1320 CONVERT_TO_UTF8_FREE(title); | 1320 CONVERT_TO_UTF8_FREE(title); |
1321 if (gui.browse_fname == NULL) | 1321 if (gui.browse_fname == NULL) |
1322 return NULL; | 1322 return NULL; |
1323 | 1323 |
1324 /* shorten the file name if possible */ | 1324 // shorten the file name if possible |
1325 return vim_strsave(shorten_fname1(gui.browse_fname)); | 1325 return vim_strsave(shorten_fname1(gui.browse_fname)); |
1326 } | 1326 } |
1327 | 1327 |
1328 /* | 1328 /* |
1329 * Put up a directory selector | 1329 * Put up a directory selector |
1335 char_u * | 1335 char_u * |
1336 gui_mch_browsedir( | 1336 gui_mch_browsedir( |
1337 char_u *title, | 1337 char_u *title, |
1338 char_u *initdir) | 1338 char_u *initdir) |
1339 { | 1339 { |
1340 # if defined(GTK_FILE_CHOOSER) /* Only in GTK 2.4 and later. */ | 1340 # if defined(GTK_FILE_CHOOSER) // Only in GTK 2.4 and later. |
1341 char_u dirbuf[MAXPATHL]; | 1341 char_u dirbuf[MAXPATHL]; |
1342 char_u *p; | 1342 char_u *p; |
1343 GtkWidget *dirdlg; /* file selection dialog */ | 1343 GtkWidget *dirdlg; // file selection dialog |
1344 char_u *dirname = NULL; | 1344 char_u *dirname = NULL; |
1345 | 1345 |
1346 title = CONVERT_TO_UTF8(title); | 1346 title = CONVERT_TO_UTF8(title); |
1347 | 1347 |
1348 dirdlg = gtk_file_chooser_dialog_new( | 1348 dirdlg = gtk_file_chooser_dialog_new( |
1358 # endif | 1358 # endif |
1359 NULL); | 1359 NULL); |
1360 | 1360 |
1361 CONVERT_TO_UTF8_FREE(title); | 1361 CONVERT_TO_UTF8_FREE(title); |
1362 | 1362 |
1363 /* if our pointer is currently hidden, then we should show it. */ | 1363 // if our pointer is currently hidden, then we should show it. |
1364 gui_mch_mousehide(FALSE); | 1364 gui_mch_mousehide(FALSE); |
1365 | 1365 |
1366 /* GTK appears to insist on an absolute path. */ | 1366 // GTK appears to insist on an absolute path. |
1367 if (initdir == NULL || *initdir == NUL | 1367 if (initdir == NULL || *initdir == NUL |
1368 || vim_FullName(initdir, dirbuf, MAXPATHL - 10, FALSE) == FAIL) | 1368 || vim_FullName(initdir, dirbuf, MAXPATHL - 10, FALSE) == FAIL) |
1369 mch_dirname(dirbuf, MAXPATHL - 10); | 1369 mch_dirname(dirbuf, MAXPATHL - 10); |
1370 | 1370 |
1371 /* Always need a trailing slash for a directory. | 1371 // Always need a trailing slash for a directory. |
1372 * Also add a dummy file name, so that we get to the directory. */ | 1372 // Also add a dummy file name, so that we get to the directory. |
1373 add_pathsep(dirbuf); | 1373 add_pathsep(dirbuf); |
1374 STRCAT(dirbuf, "@zd(*&1|"); | 1374 STRCAT(dirbuf, "@zd(*&1|"); |
1375 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dirdlg), | 1375 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dirdlg), |
1376 (const gchar *)dirbuf); | 1376 (const gchar *)dirbuf); |
1377 | 1377 |
1378 /* Run the dialog. */ | 1378 // Run the dialog. |
1379 if (gtk_dialog_run(GTK_DIALOG(dirdlg)) == GTK_RESPONSE_ACCEPT) | 1379 if (gtk_dialog_run(GTK_DIALOG(dirdlg)) == GTK_RESPONSE_ACCEPT) |
1380 dirname = (char_u *)gtk_file_chooser_get_filename( | 1380 dirname = (char_u *)gtk_file_chooser_get_filename( |
1381 GTK_FILE_CHOOSER(dirdlg)); | 1381 GTK_FILE_CHOOSER(dirdlg)); |
1382 gtk_widget_destroy(dirdlg); | 1382 gtk_widget_destroy(dirdlg); |
1383 if (dirname == NULL) | 1383 if (dirname == NULL) |
1384 return NULL; | 1384 return NULL; |
1385 | 1385 |
1386 /* shorten the file name if possible */ | 1386 // shorten the file name if possible |
1387 p = vim_strsave(shorten_fname1(dirname)); | 1387 p = vim_strsave(shorten_fname1(dirname)); |
1388 g_free(dirname); | 1388 g_free(dirname); |
1389 return p; | 1389 return p; |
1390 | 1390 |
1391 # else /* !defined(GTK_FILE_CHOOSER) */ | 1391 # else // !defined(GTK_FILE_CHOOSER) |
1392 /* For GTK 2.2 and earlier: fall back to ordinary file selector. */ | 1392 // For GTK 2.2 and earlier: fall back to ordinary file selector. |
1393 return gui_mch_browse(0, title, NULL, NULL, initdir, NULL); | 1393 return gui_mch_browse(0, title, NULL, NULL, initdir, NULL); |
1394 # endif /* !defined(GTK_FILE_CHOOSER) */ | 1394 # endif // !defined(GTK_FILE_CHOOSER) |
1395 } | 1395 } |
1396 | 1396 |
1397 | 1397 |
1398 #endif /* FEAT_BROWSE */ | 1398 #endif // FEAT_BROWSE |
1399 | 1399 |
1400 #if defined(FEAT_GUI_DIALOG) || defined(PROTO) | 1400 #if defined(FEAT_GUI_DIALOG) || defined(PROTO) |
1401 | 1401 |
1402 static GtkWidget * | 1402 static GtkWidget * |
1403 create_message_dialog(int type, char_u *title, char_u *message) | 1403 create_message_dialog(int type, char_u *title, char_u *message) |
1468 else if (*p == DLG_HOTKEY_CHAR) | 1468 else if (*p == DLG_HOTKEY_CHAR) |
1469 *p++ = '_'; | 1469 *p++ = '_'; |
1470 else | 1470 else |
1471 MB_PTR_ADV(p); | 1471 MB_PTR_ADV(p); |
1472 } | 1472 } |
1473 array[count] = NULL; /* currently not relied upon, but doesn't hurt */ | 1473 array[count] = NULL; // currently not relied upon, but doesn't hurt |
1474 } | 1474 } |
1475 | 1475 |
1476 *n_buttons = count; | 1476 *n_buttons = count; |
1477 return array; | 1477 return array; |
1478 } | 1478 } |
1544 | 1544 |
1545 static void | 1545 static void |
1546 dialog_add_buttons(GtkDialog *dialog, char_u *button_string) | 1546 dialog_add_buttons(GtkDialog *dialog, char_u *button_string) |
1547 { | 1547 { |
1548 char **ok; | 1548 char **ok; |
1549 char **ync; /* "yes no cancel" */ | 1549 char **ync; // "yes no cancel" |
1550 char **buttons; | 1550 char **buttons; |
1551 int n_buttons = 0; | 1551 int n_buttons = 0; |
1552 int idx; | 1552 int idx; |
1553 | 1553 |
1554 button_string = vim_strsave(button_string); /* must be writable */ | 1554 button_string = vim_strsave(button_string); // must be writable |
1555 if (button_string == NULL) | 1555 if (button_string == NULL) |
1556 return; | 1556 return; |
1557 | 1557 |
1558 /* Check 'v' flag in 'guioptions': vertical button placement. */ | 1558 // Check 'v' flag in 'guioptions': vertical button placement. |
1559 if (vim_strchr(p_go, GO_VERTICAL) != NULL) | 1559 if (vim_strchr(p_go, GO_VERTICAL) != NULL) |
1560 { | 1560 { |
1561 # if GTK_CHECK_VERSION(3,0,0) | 1561 # if GTK_CHECK_VERSION(3,0,0) |
1562 /* Add GTK+ 3 code if necessary. */ | 1562 // Add GTK+ 3 code if necessary. |
1563 /* N.B. GTK+ 3 doesn't allow you to access vbox and action_area via | 1563 // N.B. GTK+ 3 doesn't allow you to access vbox and action_area via |
1564 * the C API. */ | 1564 // the C API. |
1565 # else | 1565 # else |
1566 GtkWidget *vbutton_box; | 1566 GtkWidget *vbutton_box; |
1567 | 1567 |
1568 vbutton_box = gtk_vbutton_box_new(); | 1568 vbutton_box = gtk_vbutton_box_new(); |
1569 gtk_widget_show(vbutton_box); | 1569 gtk_widget_show(vbutton_box); |
1570 gtk_box_pack_end(GTK_BOX(GTK_DIALOG(dialog)->vbox), | 1570 gtk_box_pack_end(GTK_BOX(GTK_DIALOG(dialog)->vbox), |
1571 vbutton_box, TRUE, FALSE, 0); | 1571 vbutton_box, TRUE, FALSE, 0); |
1572 /* Overrule the "action_area" value, hopefully this works... */ | 1572 // Overrule the "action_area" value, hopefully this works... |
1573 GTK_DIALOG(dialog)->action_area = vbutton_box; | 1573 GTK_DIALOG(dialog)->action_area = vbutton_box; |
1574 # endif | 1574 # endif |
1575 } | 1575 } |
1576 | 1576 |
1577 /* | 1577 /* |
1602 * | 1602 * |
1603 * But even the common button labels aren't necessarily translated, | 1603 * But even the common button labels aren't necessarily translated, |
1604 * since anyone can create their own dialogs using Vim functions. | 1604 * since anyone can create their own dialogs using Vim functions. |
1605 * Thus we have to check for those too. | 1605 * Thus we have to check for those too. |
1606 */ | 1606 */ |
1607 if (ok != NULL && ync != NULL) /* almost impossible to fail */ | 1607 if (ok != NULL && ync != NULL) // almost impossible to fail |
1608 { | 1608 { |
1609 # if GTK_CHECK_VERSION(3,10,0) | 1609 # if GTK_CHECK_VERSION(3,10,0) |
1610 if (button_equal(label, ok[0])) label = _("OK"); | 1610 if (button_equal(label, ok[0])) label = _("OK"); |
1611 else if (button_equal(label, ync[0])) label = _("Yes"); | 1611 else if (button_equal(label, ync[0])) label = _("Yes"); |
1612 else if (button_equal(label, ync[1])) label = _("No"); | 1612 else if (button_equal(label, ync[1])) label = _("No"); |
1647 * GUI used to work this way, and I consider the impact on UI consistency | 1647 * GUI used to work this way, and I consider the impact on UI consistency |
1648 * low enough to justify implementing this as a special Vim feature. | 1648 * low enough to justify implementing this as a special Vim feature. |
1649 */ | 1649 */ |
1650 typedef struct _DialogInfo | 1650 typedef struct _DialogInfo |
1651 { | 1651 { |
1652 int ignore_enter; /* no default button, ignore "Enter" */ | 1652 int ignore_enter; // no default button, ignore "Enter" |
1653 int noalt; /* accept accelerators without Alt */ | 1653 int noalt; // accept accelerators without Alt |
1654 GtkDialog *dialog; /* Widget of the dialog */ | 1654 GtkDialog *dialog; // Widget of the dialog |
1655 } DialogInfo; | 1655 } DialogInfo; |
1656 | 1656 |
1657 static gboolean | 1657 static gboolean |
1658 dialog_key_press_event_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) | 1658 dialog_key_press_event_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
1659 { | 1659 { |
1660 DialogInfo *di = (DialogInfo *)data; | 1660 DialogInfo *di = (DialogInfo *)data; |
1661 | 1661 |
1662 /* Ignore hitting Enter (or Space) when there is no default button. */ | 1662 // Ignore hitting Enter (or Space) when there is no default button. |
1663 if (di->ignore_enter && (event->keyval == GDK_Return | 1663 if (di->ignore_enter && (event->keyval == GDK_Return |
1664 || event->keyval == ' ')) | 1664 || event->keyval == ' ')) |
1665 return TRUE; | 1665 return TRUE; |
1666 else /* A different key was pressed, return to normal behavior */ | 1666 else // A different key was pressed, return to normal behavior |
1667 di->ignore_enter = FALSE; | 1667 di->ignore_enter = FALSE; |
1668 | 1668 |
1669 /* Close the dialog when hitting "Esc". */ | 1669 // Close the dialog when hitting "Esc". |
1670 if (event->keyval == GDK_Escape) | 1670 if (event->keyval == GDK_Escape) |
1671 { | 1671 { |
1672 gtk_dialog_response(di->dialog, GTK_RESPONSE_REJECT); | 1672 gtk_dialog_response(di->dialog, GTK_RESPONSE_REJECT); |
1673 return TRUE; | 1673 return TRUE; |
1674 } | 1674 } |
1679 return gtk_window_mnemonic_activate( | 1679 return gtk_window_mnemonic_activate( |
1680 GTK_WINDOW(widget), event->keyval, | 1680 GTK_WINDOW(widget), event->keyval, |
1681 gtk_window_get_mnemonic_modifier(GTK_WINDOW(widget))); | 1681 gtk_window_get_mnemonic_modifier(GTK_WINDOW(widget))); |
1682 } | 1682 } |
1683 | 1683 |
1684 return FALSE; /* continue emission */ | 1684 return FALSE; // continue emission |
1685 } | 1685 } |
1686 | 1686 |
1687 int | 1687 int |
1688 gui_mch_dialog(int type, /* type of dialog */ | 1688 gui_mch_dialog(int type, // type of dialog |
1689 char_u *title, /* title of dialog */ | 1689 char_u *title, // title of dialog |
1690 char_u *message, /* message text */ | 1690 char_u *message, // message text |
1691 char_u *buttons, /* names of buttons */ | 1691 char_u *buttons, // names of buttons |
1692 int def_but, /* default button */ | 1692 int def_but, // default button |
1693 char_u *textfield, /* text for textfield or NULL */ | 1693 char_u *textfield, // text for textfield or NULL |
1694 int ex_cmd UNUSED) | 1694 int ex_cmd UNUSED) |
1695 { | 1695 { |
1696 GtkWidget *dialog; | 1696 GtkWidget *dialog; |
1697 GtkWidget *entry = NULL; | 1697 GtkWidget *entry = NULL; |
1698 char_u *text; | 1698 char_u *text; |
1708 GtkWidget *alignment; | 1708 GtkWidget *alignment; |
1709 | 1709 |
1710 entry = gtk_entry_new(); | 1710 entry = gtk_entry_new(); |
1711 gtk_widget_show(entry); | 1711 gtk_widget_show(entry); |
1712 | 1712 |
1713 /* Make Enter work like pressing OK. */ | 1713 // Make Enter work like pressing OK. |
1714 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); | 1714 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); |
1715 | 1715 |
1716 text = CONVERT_TO_UTF8(textfield); | 1716 text = CONVERT_TO_UTF8(textfield); |
1717 gtk_entry_set_text(GTK_ENTRY(entry), (const char *)text); | 1717 gtk_entry_set_text(GTK_ENTRY(entry), (const char *)text); |
1718 CONVERT_TO_UTF8_FREE(text); | 1718 CONVERT_TO_UTF8_FREE(text); |
1746 dialoginfo.noalt = FALSE; | 1746 dialoginfo.noalt = FALSE; |
1747 } | 1747 } |
1748 else | 1748 else |
1749 dialoginfo.noalt = TRUE; | 1749 dialoginfo.noalt = TRUE; |
1750 | 1750 |
1751 /* Allow activation of mnemonic accelerators without pressing <Alt> when | 1751 // Allow activation of mnemonic accelerators without pressing <Alt> when |
1752 * there is no textfield. Handle pressing Esc. */ | 1752 // there is no textfield. Handle pressing Esc. |
1753 g_signal_connect(G_OBJECT(dialog), "key-press-event", | 1753 g_signal_connect(G_OBJECT(dialog), "key-press-event", |
1754 G_CALLBACK(&dialog_key_press_event_cb), &dialoginfo); | 1754 G_CALLBACK(&dialog_key_press_event_cb), &dialoginfo); |
1755 | 1755 |
1756 if (def_but > 0) | 1756 if (def_but > 0) |
1757 { | 1757 { |
1758 gtk_dialog_set_default_response(GTK_DIALOG(dialog), def_but); | 1758 gtk_dialog_set_default_response(GTK_DIALOG(dialog), def_but); |
1759 dialoginfo.ignore_enter = FALSE; | 1759 dialoginfo.ignore_enter = FALSE; |
1760 } | 1760 } |
1761 else | 1761 else |
1762 /* No default button, ignore pressing Enter. */ | 1762 // No default button, ignore pressing Enter. |
1763 dialoginfo.ignore_enter = TRUE; | 1763 dialoginfo.ignore_enter = TRUE; |
1764 | 1764 |
1765 /* Show the mouse pointer if it's currently hidden. */ | 1765 // Show the mouse pointer if it's currently hidden. |
1766 gui_mch_mousehide(FALSE); | 1766 gui_mch_mousehide(FALSE); |
1767 | 1767 |
1768 response = gtk_dialog_run(GTK_DIALOG(dialog)); | 1768 response = gtk_dialog_run(GTK_DIALOG(dialog)); |
1769 | 1769 |
1770 /* GTK_RESPONSE_NONE means the dialog was programmatically destroyed. */ | 1770 // GTK_RESPONSE_NONE means the dialog was programmatically destroyed. |
1771 if (response != GTK_RESPONSE_NONE) | 1771 if (response != GTK_RESPONSE_NONE) |
1772 { | 1772 { |
1773 if (response == GTK_RESPONSE_ACCEPT) /* Enter pressed */ | 1773 if (response == GTK_RESPONSE_ACCEPT) // Enter pressed |
1774 response = def_but; | 1774 response = def_but; |
1775 if (textfield != NULL) | 1775 if (textfield != NULL) |
1776 { | 1776 { |
1777 text = (char_u *)gtk_entry_get_text(GTK_ENTRY(entry)); | 1777 text = (char_u *)gtk_entry_get_text(GTK_ENTRY(entry)); |
1778 text = CONVERT_FROM_UTF8(text); | 1778 text = CONVERT_FROM_UTF8(text); |
1785 } | 1785 } |
1786 | 1786 |
1787 return response > 0 ? response : 0; | 1787 return response > 0 ? response : 0; |
1788 } | 1788 } |
1789 | 1789 |
1790 #endif /* FEAT_GUI_DIALOG */ | 1790 #endif // FEAT_GUI_DIALOG |
1791 | 1791 |
1792 | 1792 |
1793 #if defined(FEAT_MENU) || defined(PROTO) | 1793 #if defined(FEAT_MENU) || defined(PROTO) |
1794 | 1794 |
1795 void | 1795 void |
1826 GTK_MENU_SHELL(submenu)); | 1826 GTK_MENU_SHELL(submenu)); |
1827 g_object_set_data(G_OBJECT(menu->submenu_id), | 1827 g_object_set_data(G_OBJECT(menu->submenu_id), |
1828 "vim-has-im-menu", GINT_TO_POINTER(TRUE)); | 1828 "vim-has-im-menu", GINT_TO_POINTER(TRUE)); |
1829 } | 1829 } |
1830 # endif | 1830 # endif |
1831 # endif /* FEAT_XIM */ | 1831 # endif // FEAT_XIM |
1832 | 1832 |
1833 # if GTK_CHECK_VERSION(3,22,2) | 1833 # if GTK_CHECK_VERSION(3,22,2) |
1834 { | 1834 { |
1835 GdkEventButton trigger; | 1835 GdkEventButton trigger; |
1836 | 1836 |
1837 /* A pseudo event to have gtk_menu_popup_at_pointer() work. Since the | 1837 // A pseudo event to have gtk_menu_popup_at_pointer() work. Since the |
1838 * function calculates the popup menu position on the basis of the | 1838 // function calculates the popup menu position on the basis of the |
1839 * actual pointer position when it is invoked, the fields x, y, x_root | 1839 // actual pointer position when it is invoked, the fields x, y, x_root |
1840 * and y_root are set to zero for convenience. */ | 1840 // and y_root are set to zero for convenience. |
1841 trigger.type = GDK_BUTTON_PRESS; | 1841 trigger.type = GDK_BUTTON_PRESS; |
1842 trigger.window = gtk_widget_get_window(gui.drawarea); | 1842 trigger.window = gtk_widget_get_window(gui.drawarea); |
1843 trigger.send_event = FALSE; | 1843 trigger.send_event = FALSE; |
1844 trigger.time = gui.event_time; | 1844 trigger.time = gui.event_time; |
1845 trigger.x = 0.0; | 1845 trigger.x = 0.0; |
1860 (GtkMenuPositionFunc)NULL, NULL, | 1860 (GtkMenuPositionFunc)NULL, NULL, |
1861 3U, gui.event_time); | 1861 3U, gui.event_time); |
1862 #endif | 1862 #endif |
1863 } | 1863 } |
1864 | 1864 |
1865 /* Ugly global variable to pass "mouse_pos" flag from gui_make_popup() to | 1865 // Ugly global variable to pass "mouse_pos" flag from gui_make_popup() to |
1866 * popup_menu_position_func(). */ | 1866 // popup_menu_position_func(). |
1867 static int popup_mouse_pos; | 1867 static int popup_mouse_pos; |
1868 | 1868 |
1869 /* | 1869 /* |
1870 * Menu position callback; used by gui_make_popup() to place the menu | 1870 * Menu position callback; used by gui_make_popup() to place the menu |
1871 * at the current text cursor position. | 1871 * at the current text cursor position. |
1890 *y += my; | 1890 *y += my; |
1891 } | 1891 } |
1892 else if (curwin != NULL && gui.drawarea != NULL && | 1892 else if (curwin != NULL && gui.drawarea != NULL && |
1893 gtk_widget_get_window(gui.drawarea) != NULL) | 1893 gtk_widget_get_window(gui.drawarea) != NULL) |
1894 { | 1894 { |
1895 /* Find the cursor position in the current window */ | 1895 // Find the cursor position in the current window |
1896 *x += FILL_X(curwin->w_wincol + curwin->w_wcol + 1) + 1; | 1896 *x += FILL_X(curwin->w_wincol + curwin->w_wcol + 1) + 1; |
1897 *y += FILL_Y(W_WINROW(curwin) + curwin->w_wrow + 1) + 1; | 1897 *y += FILL_Y(W_WINROW(curwin) + curwin->w_wrow + 1) + 1; |
1898 } | 1898 } |
1899 } | 1899 } |
1900 | 1900 |
1911 { | 1911 { |
1912 # if GTK_CHECK_VERSION(3,22,2) | 1912 # if GTK_CHECK_VERSION(3,22,2) |
1913 GdkWindow * const win = gtk_widget_get_window(gui.drawarea); | 1913 GdkWindow * const win = gtk_widget_get_window(gui.drawarea); |
1914 GdkEventButton trigger; | 1914 GdkEventButton trigger; |
1915 | 1915 |
1916 /* A pseudo event to have gtk_menu_popup_at_*() functions work. Since | 1916 // A pseudo event to have gtk_menu_popup_at_*() functions work. Since |
1917 * the position where the menu pops up is automatically adjusted by | 1917 // the position where the menu pops up is automatically adjusted by |
1918 * the functions, none of the fields x, y, x_root and y_root has to be | 1918 // the functions, none of the fields x, y, x_root and y_root has to be |
1919 * set to a specific value here; therefore, they are set to zero for | 1919 // set to a specific value here; therefore, they are set to zero for |
1920 * convenience.*/ | 1920 // convenience. |
1921 trigger.type = GDK_BUTTON_PRESS; | 1921 trigger.type = GDK_BUTTON_PRESS; |
1922 trigger.window = win; | 1922 trigger.window = win; |
1923 trigger.send_event = FALSE; | 1923 trigger.send_event = FALSE; |
1924 trigger.time = GDK_CURRENT_TIME; | 1924 trigger.time = GDK_CURRENT_TIME; |
1925 trigger.x = 0.0; | 1925 trigger.x = 0.0; |
1959 0U, (guint32)GDK_CURRENT_TIME); | 1959 0U, (guint32)GDK_CURRENT_TIME); |
1960 # endif | 1960 # endif |
1961 } | 1961 } |
1962 } | 1962 } |
1963 | 1963 |
1964 #endif /* FEAT_MENU */ | 1964 #endif // FEAT_MENU |
1965 | 1965 |
1966 | 1966 |
1967 /* | 1967 /* |
1968 * We don't create it twice. | 1968 * We don't create it twice. |
1969 */ | 1969 */ |
1970 | 1970 |
1971 typedef struct _SharedFindReplace | 1971 typedef struct _SharedFindReplace |
1972 { | 1972 { |
1973 GtkWidget *dialog; /* the main dialog widget */ | 1973 GtkWidget *dialog; // the main dialog widget |
1974 GtkWidget *wword; /* 'Whole word only' check button */ | 1974 GtkWidget *wword; // 'Whole word only' check button |
1975 GtkWidget *mcase; /* 'Match case' check button */ | 1975 GtkWidget *mcase; // 'Match case' check button |
1976 GtkWidget *up; /* search direction 'Up' radio button */ | 1976 GtkWidget *up; // search direction 'Up' radio button |
1977 GtkWidget *down; /* search direction 'Down' radio button */ | 1977 GtkWidget *down; // search direction 'Down' radio button |
1978 GtkWidget *what; /* 'Find what' entry text widget */ | 1978 GtkWidget *what; // 'Find what' entry text widget |
1979 GtkWidget *with; /* 'Replace with' entry text widget */ | 1979 GtkWidget *with; // 'Replace with' entry text widget |
1980 GtkWidget *find; /* 'Find Next' action button */ | 1980 GtkWidget *find; // 'Find Next' action button |
1981 GtkWidget *replace; /* 'Replace With' action button */ | 1981 GtkWidget *replace; // 'Replace With' action button |
1982 GtkWidget *all; /* 'Replace All' action button */ | 1982 GtkWidget *all; // 'Replace All' action button |
1983 } SharedFindReplace; | 1983 } SharedFindReplace; |
1984 | 1984 |
1985 static SharedFindReplace find_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; | 1985 static SharedFindReplace find_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; |
1986 static SharedFindReplace repl_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; | 1986 static SharedFindReplace repl_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; |
1987 | 1987 |
1989 find_key_press_event( | 1989 find_key_press_event( |
1990 GtkWidget *widget UNUSED, | 1990 GtkWidget *widget UNUSED, |
1991 GdkEventKey *event, | 1991 GdkEventKey *event, |
1992 SharedFindReplace *frdp) | 1992 SharedFindReplace *frdp) |
1993 { | 1993 { |
1994 /* If the user is holding one of the key modifiers we will just bail out, | 1994 // If the user is holding one of the key modifiers we will just bail out, |
1995 * thus preserving the possibility of normal focus traversal. | 1995 // thus preserving the possibility of normal focus traversal. |
1996 */ | |
1997 if (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) | 1996 if (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) |
1998 return FALSE; | 1997 return FALSE; |
1999 | 1998 |
2000 /* the Escape key synthesizes a cancellation action */ | 1999 // the Escape key synthesizes a cancellation action |
2001 if (event->keyval == GDK_Escape) | 2000 if (event->keyval == GDK_Escape) |
2002 { | 2001 { |
2003 gtk_widget_hide(frdp->dialog); | 2002 gtk_widget_hide(frdp->dialog); |
2004 | 2003 |
2005 return TRUE; | 2004 return TRUE; |
2006 } | 2005 } |
2007 | 2006 |
2008 /* It would be delightful if it where possible to do search history | 2007 // It would be delightful if it where possible to do search history |
2009 * operations on the K_UP and K_DOWN keys here. | 2008 // operations on the K_UP and K_DOWN keys here. |
2010 */ | |
2011 | 2009 |
2012 return FALSE; | 2010 return FALSE; |
2013 } | 2011 } |
2014 | 2012 |
2015 static GtkWidget * | 2013 static GtkWidget * |
2091 { | 2089 { |
2092 g_return_val_if_fail(entry != NULL, 0); | 2090 g_return_val_if_fail(entry != NULL, 0); |
2093 g_return_val_if_fail(GTK_IS_ENTRY(entry) == TRUE, 0); | 2091 g_return_val_if_fail(GTK_IS_ENTRY(entry) == TRUE, 0); |
2094 | 2092 |
2095 #if GTK_CHECK_VERSION(2,18,0) | 2093 #if GTK_CHECK_VERSION(2,18,0) |
2096 /* 2.18 introduced a new object GtkEntryBuffer to handle text data for | 2094 // 2.18 introduced a new object GtkEntryBuffer to handle text data for |
2097 * GtkEntry instead of letting each instance of the latter have its own | 2095 // GtkEntry instead of letting each instance of the latter have its own |
2098 * storage for that. The code below is almost identical to the | 2096 // storage for that. The code below is almost identical to the |
2099 * implementation of gtk_entry_get_text_length() for the versions >= 2.18. | 2097 // implementation of gtk_entry_get_text_length() for the versions >= 2.18. |
2100 */ | |
2101 return gtk_entry_buffer_get_length(gtk_entry_get_buffer(entry)); | 2098 return gtk_entry_buffer_get_length(gtk_entry_get_buffer(entry)); |
2102 #elif GTK_CHECK_VERSION(2,14,0) | 2099 #elif GTK_CHECK_VERSION(2,14,0) |
2103 /* 2.14 introduced a new function to avoid memory management bugs which can | 2100 // 2.14 introduced a new function to avoid memory management bugs which can |
2104 * happen when gtk_entry_get_text() is used without due care and attention. | 2101 // happen when gtk_entry_get_text() is used without due care and attention. |
2105 */ | |
2106 return gtk_entry_get_text_length(entry); | 2102 return gtk_entry_get_text_length(entry); |
2107 #else | 2103 #else |
2108 /* gtk_entry_get_text() returns the pointer to the storage allocated | 2104 // gtk_entry_get_text() returns the pointer to the storage allocated |
2109 * internally by the widget. Accordingly, use the one with great care: | 2105 // internally by the widget. Accordingly, use the one with great care: |
2110 * Don't free it nor modify the contents it points to; call the function | 2106 // Don't free it nor modify the contents it points to; call the function |
2111 * every time you need the pointer since its value may have been changed | 2107 // every time you need the pointer since its value may have been changed |
2112 * by the widget. */ | 2108 // by the widget. |
2113 return g_utf8_strlen(gtk_entry_get_text(entry), -1); | 2109 return g_utf8_strlen(gtk_entry_get_text(entry), -1); |
2114 #endif | 2110 #endif |
2115 } | 2111 } |
2116 | 2112 |
2117 static void | 2113 static void |
2118 find_replace_dialog_create(char_u *arg, int do_replace) | 2114 find_replace_dialog_create(char_u *arg, int do_replace) |
2119 { | 2115 { |
2120 GtkWidget *hbox; /* main top down box */ | 2116 GtkWidget *hbox; // main top down box |
2121 GtkWidget *actionarea; | 2117 GtkWidget *actionarea; |
2122 GtkWidget *table; | 2118 GtkWidget *table; |
2123 GtkWidget *tmp; | 2119 GtkWidget *tmp; |
2124 GtkWidget *vbox; | 2120 GtkWidget *vbox; |
2125 gboolean sensitive; | 2121 gboolean sensitive; |
2130 char_u *conv_buffer = NULL; | 2126 char_u *conv_buffer = NULL; |
2131 # define CONV(message) convert_localized_message(&conv_buffer, (message)) | 2127 # define CONV(message) convert_localized_message(&conv_buffer, (message)) |
2132 | 2128 |
2133 frdp = (do_replace) ? (&repl_widgets) : (&find_widgets); | 2129 frdp = (do_replace) ? (&repl_widgets) : (&find_widgets); |
2134 | 2130 |
2135 /* Get the search string to use. */ | 2131 // Get the search string to use. |
2136 entry_text = get_find_dialog_text(arg, &wword, &mcase); | 2132 entry_text = get_find_dialog_text(arg, &wword, &mcase); |
2137 | 2133 |
2138 if (entry_text != NULL && output_conv.vc_type != CONV_NONE) | 2134 if (entry_text != NULL && output_conv.vc_type != CONV_NONE) |
2139 { | 2135 { |
2140 char_u *old_text = entry_text; | 2136 char_u *old_text = entry_text; |
2155 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->mcase), | 2151 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->mcase), |
2156 (gboolean)mcase); | 2152 (gboolean)mcase); |
2157 } | 2153 } |
2158 gtk_window_present(GTK_WINDOW(frdp->dialog)); | 2154 gtk_window_present(GTK_WINDOW(frdp->dialog)); |
2159 | 2155 |
2160 /* For :promptfind dialog, always give keyboard focus to 'what' entry. | 2156 // For :promptfind dialog, always give keyboard focus to 'what' entry. |
2161 * For :promptrepl dialog, give it to 'with' entry if 'what' has an | 2157 // For :promptrepl dialog, give it to 'with' entry if 'what' has an |
2162 * non-empty entry; otherwise, to 'what' entry. */ | 2158 // non-empty entry; otherwise, to 'what' entry. |
2163 gtk_widget_grab_focus(frdp->what); | 2159 gtk_widget_grab_focus(frdp->what); |
2164 if (do_replace && entry_get_text_length(GTK_ENTRY(frdp->what)) > 0) | 2160 if (do_replace && entry_get_text_length(GTK_ENTRY(frdp->what)) > 0) |
2165 gtk_widget_grab_focus(frdp->with); | 2161 gtk_widget_grab_focus(frdp->with); |
2166 | 2162 |
2167 vim_free(entry_text); | 2163 vim_free(entry_text); |
2168 return; | 2164 return; |
2169 } | 2165 } |
2170 | 2166 |
2171 frdp->dialog = gtk_dialog_new(); | 2167 frdp->dialog = gtk_dialog_new(); |
2172 #if GTK_CHECK_VERSION(3,0,0) | 2168 #if GTK_CHECK_VERSION(3,0,0) |
2173 /* Nothing equivalent to gtk_dialog_set_has_separator() in GTK+ 3. */ | 2169 // Nothing equivalent to gtk_dialog_set_has_separator() in GTK+ 3. |
2174 #else | 2170 #else |
2175 gtk_dialog_set_has_separator(GTK_DIALOG(frdp->dialog), FALSE); | 2171 gtk_dialog_set_has_separator(GTK_DIALOG(frdp->dialog), FALSE); |
2176 #endif | 2172 #endif |
2177 gtk_window_set_transient_for(GTK_WINDOW(frdp->dialog), GTK_WINDOW(gui.mainwin)); | 2173 gtk_window_set_transient_for(GTK_WINDOW(frdp->dialog), GTK_WINDOW(gui.mainwin)); |
2178 gtk_window_set_destroy_with_parent(GTK_WINDOW(frdp->dialog), TRUE); | 2174 gtk_window_set_destroy_with_parent(GTK_WINDOW(frdp->dialog), TRUE); |
2321 g_signal_connect(G_OBJECT(frdp->what), "activate", | 2317 g_signal_connect(G_OBJECT(frdp->what), "activate", |
2322 G_CALLBACK(find_replace_cb), | 2318 G_CALLBACK(find_replace_cb), |
2323 GINT_TO_POINTER(FRD_FINDNEXT)); | 2319 GINT_TO_POINTER(FRD_FINDNEXT)); |
2324 } | 2320 } |
2325 | 2321 |
2326 /* whole word only button */ | 2322 // whole word only button |
2327 frdp->wword = gtk_check_button_new_with_label(CONV(_("Match whole word only"))); | 2323 frdp->wword = gtk_check_button_new_with_label(CONV(_("Match whole word only"))); |
2328 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->wword), | 2324 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->wword), |
2329 (gboolean)wword); | 2325 (gboolean)wword); |
2330 if (do_replace) | 2326 if (do_replace) |
2331 #if GTK_CHECK_VERSION(3,4,0) | 2327 #if GTK_CHECK_VERSION(3,4,0) |
2340 #else | 2336 #else |
2341 gtk_table_attach(GTK_TABLE(table), frdp->wword, 0, 1023, 1, 2, | 2337 gtk_table_attach(GTK_TABLE(table), frdp->wword, 0, 1023, 1, 2, |
2342 GTK_FILL, GTK_EXPAND, 2, 2); | 2338 GTK_FILL, GTK_EXPAND, 2, 2); |
2343 #endif | 2339 #endif |
2344 | 2340 |
2345 /* match case button */ | 2341 // match case button |
2346 frdp->mcase = gtk_check_button_new_with_label(CONV(_("Match case"))); | 2342 frdp->mcase = gtk_check_button_new_with_label(CONV(_("Match case"))); |
2347 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->mcase), | 2343 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->mcase), |
2348 (gboolean)mcase); | 2344 (gboolean)mcase); |
2349 if (do_replace) | 2345 if (do_replace) |
2350 #if GTK_CHECK_VERSION(3,4,0) | 2346 #if GTK_CHECK_VERSION(3,4,0) |
2383 vbox = gtk_vbox_new(FALSE, 0); | 2379 vbox = gtk_vbox_new(FALSE, 0); |
2384 #endif | 2380 #endif |
2385 gtk_container_set_border_width(GTK_CONTAINER(vbox), 0); | 2381 gtk_container_set_border_width(GTK_CONTAINER(vbox), 0); |
2386 gtk_container_add(GTK_CONTAINER(tmp), vbox); | 2382 gtk_container_add(GTK_CONTAINER(tmp), vbox); |
2387 | 2383 |
2388 /* 'Up' and 'Down' buttons */ | 2384 // 'Up' and 'Down' buttons |
2389 frdp->up = gtk_radio_button_new_with_label(NULL, CONV(_("Up"))); | 2385 frdp->up = gtk_radio_button_new_with_label(NULL, CONV(_("Up"))); |
2390 gtk_box_pack_start(GTK_BOX(vbox), frdp->up, TRUE, TRUE, 0); | 2386 gtk_box_pack_start(GTK_BOX(vbox), frdp->up, TRUE, TRUE, 0); |
2391 frdp->down = gtk_radio_button_new_with_label( | 2387 frdp->down = gtk_radio_button_new_with_label( |
2392 gtk_radio_button_get_group(GTK_RADIO_BUTTON(frdp->up)), | 2388 gtk_radio_button_get_group(GTK_RADIO_BUTTON(frdp->up)), |
2393 CONV(_("Down"))); | 2389 CONV(_("Down"))); |
2394 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->down), TRUE); | 2390 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->down), TRUE); |
2395 gtk_container_set_border_width(GTK_CONTAINER(vbox), 2); | 2391 gtk_container_set_border_width(GTK_CONTAINER(vbox), 2); |
2396 gtk_box_pack_start(GTK_BOX(vbox), frdp->down, TRUE, TRUE, 0); | 2392 gtk_box_pack_start(GTK_BOX(vbox), frdp->down, TRUE, TRUE, 0); |
2397 | 2393 |
2398 /* vbox to hold the action buttons */ | 2394 // vbox to hold the action buttons |
2399 #if GTK_CHECK_VERSION(3,2,0) | 2395 #if GTK_CHECK_VERSION(3,2,0) |
2400 actionarea = gtk_button_box_new(GTK_ORIENTATION_VERTICAL); | 2396 actionarea = gtk_button_box_new(GTK_ORIENTATION_VERTICAL); |
2401 #else | 2397 #else |
2402 actionarea = gtk_vbutton_box_new(); | 2398 actionarea = gtk_vbutton_box_new(); |
2403 #endif | 2399 #endif |
2404 gtk_container_set_border_width(GTK_CONTAINER(actionarea), 2); | 2400 gtk_container_set_border_width(GTK_CONTAINER(actionarea), 2); |
2405 gtk_box_pack_end(GTK_BOX(hbox), actionarea, FALSE, FALSE, 0); | 2401 gtk_box_pack_end(GTK_BOX(hbox), actionarea, FALSE, FALSE, 0); |
2406 | 2402 |
2407 /* 'Find Next' button */ | 2403 // 'Find Next' button |
2408 #if GTK_CHECK_VERSION(3,10,0) | 2404 #if GTK_CHECK_VERSION(3,10,0) |
2409 frdp->find = create_image_button(NULL, _("Find Next")); | 2405 frdp->find = create_image_button(NULL, _("Find Next")); |
2410 #else | 2406 #else |
2411 frdp->find = create_image_button(GTK_STOCK_FIND, _("Find Next")); | 2407 frdp->find = create_image_button(GTK_STOCK_FIND, _("Find Next")); |
2412 #endif | 2408 #endif |
2421 gtk_box_pack_start(GTK_BOX(actionarea), frdp->find, FALSE, FALSE, 0); | 2417 gtk_box_pack_start(GTK_BOX(actionarea), frdp->find, FALSE, FALSE, 0); |
2422 gtk_widget_grab_default(frdp->find); | 2418 gtk_widget_grab_default(frdp->find); |
2423 | 2419 |
2424 if (do_replace) | 2420 if (do_replace) |
2425 { | 2421 { |
2426 /* 'Replace' button */ | 2422 // 'Replace' button |
2427 #if GTK_CHECK_VERSION(3,10,0) | 2423 #if GTK_CHECK_VERSION(3,10,0) |
2428 frdp->replace = create_image_button(NULL, _("Replace")); | 2424 frdp->replace = create_image_button(NULL, _("Replace")); |
2429 #else | 2425 #else |
2430 frdp->replace = create_image_button(GTK_STOCK_CONVERT, _("Replace")); | 2426 frdp->replace = create_image_button(GTK_STOCK_CONVERT, _("Replace")); |
2431 #endif | 2427 #endif |
2434 gtk_box_pack_start(GTK_BOX(actionarea), frdp->replace, FALSE, FALSE, 0); | 2430 gtk_box_pack_start(GTK_BOX(actionarea), frdp->replace, FALSE, FALSE, 0); |
2435 g_signal_connect(G_OBJECT(frdp->replace), "clicked", | 2431 g_signal_connect(G_OBJECT(frdp->replace), "clicked", |
2436 G_CALLBACK(find_replace_cb), | 2432 G_CALLBACK(find_replace_cb), |
2437 GINT_TO_POINTER(FRD_REPLACE)); | 2433 GINT_TO_POINTER(FRD_REPLACE)); |
2438 | 2434 |
2439 /* 'Replace All' button */ | 2435 // 'Replace All' button |
2440 #if GTK_CHECK_VERSION(3,10,0) | 2436 #if GTK_CHECK_VERSION(3,10,0) |
2441 frdp->all = create_image_button(NULL, _("Replace All")); | 2437 frdp->all = create_image_button(NULL, _("Replace All")); |
2442 #else | 2438 #else |
2443 frdp->all = create_image_button(GTK_STOCK_CONVERT, _("Replace All")); | 2439 frdp->all = create_image_button(GTK_STOCK_CONVERT, _("Replace All")); |
2444 #endif | 2440 #endif |
2448 g_signal_connect(G_OBJECT(frdp->all), "clicked", | 2444 g_signal_connect(G_OBJECT(frdp->all), "clicked", |
2449 G_CALLBACK(find_replace_cb), | 2445 G_CALLBACK(find_replace_cb), |
2450 GINT_TO_POINTER(FRD_REPLACEALL)); | 2446 GINT_TO_POINTER(FRD_REPLACEALL)); |
2451 } | 2447 } |
2452 | 2448 |
2453 /* 'Cancel' button */ | 2449 // 'Cancel' button |
2454 #if GTK_CHECK_VERSION(3,10,0) | 2450 #if GTK_CHECK_VERSION(3,10,0) |
2455 tmp = gtk_button_new_with_mnemonic(_("_Close")); | 2451 tmp = gtk_button_new_with_mnemonic(_("_Close")); |
2456 #else | 2452 #else |
2457 tmp = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | 2453 tmp = gtk_button_new_from_stock(GTK_STOCK_CLOSE); |
2458 #endif | 2454 #endif |
2470 #else | 2466 #else |
2471 tmp = gtk_vseparator_new(); | 2467 tmp = gtk_vseparator_new(); |
2472 #endif | 2468 #endif |
2473 gtk_box_pack_end(GTK_BOX(hbox), tmp, FALSE, FALSE, 10); | 2469 gtk_box_pack_end(GTK_BOX(hbox), tmp, FALSE, FALSE, 10); |
2474 | 2470 |
2475 /* Suppress automatic show of the unused action area */ | 2471 // Suppress automatic show of the unused action area |
2476 #if GTK_CHECK_VERSION(3,0,0) | 2472 #if GTK_CHECK_VERSION(3,0,0) |
2477 # if !GTK_CHECK_VERSION(3,12,0) | 2473 # if !GTK_CHECK_VERSION(3,12,0) |
2478 gtk_widget_hide(gtk_dialog_get_action_area(GTK_DIALOG(frdp->dialog))); | 2474 gtk_widget_hide(gtk_dialog_get_action_area(GTK_DIALOG(frdp->dialog))); |
2479 # endif | 2475 # endif |
2480 #else | 2476 #else |
2512 char_u *find_text; | 2508 char_u *find_text; |
2513 char_u *repl_text; | 2509 char_u *repl_text; |
2514 gboolean direction_down; | 2510 gboolean direction_down; |
2515 SharedFindReplace *sfr; | 2511 SharedFindReplace *sfr; |
2516 | 2512 |
2517 flags = (int)(long)data; /* avoid a lint warning here */ | 2513 flags = (int)(long)data; // avoid a lint warning here |
2518 | 2514 |
2519 /* Get the search/replace strings from the dialog */ | 2515 // Get the search/replace strings from the dialog |
2520 if (flags == FRD_FINDNEXT) | 2516 if (flags == FRD_FINDNEXT) |
2521 { | 2517 { |
2522 repl_text = NULL; | 2518 repl_text = NULL; |
2523 sfr = &find_widgets; | 2519 sfr = &find_widgets; |
2524 } | 2520 } |
2541 gui_do_findrepl(flags, find_text, repl_text, direction_down); | 2537 gui_do_findrepl(flags, find_text, repl_text, direction_down); |
2542 CONVERT_FROM_UTF8_FREE(repl_text); | 2538 CONVERT_FROM_UTF8_FREE(repl_text); |
2543 CONVERT_FROM_UTF8_FREE(find_text); | 2539 CONVERT_FROM_UTF8_FREE(find_text); |
2544 } | 2540 } |
2545 | 2541 |
2546 /* our usual callback function */ | 2542 /* |
2543 * our usual callback function | |
2544 */ | |
2547 static void | 2545 static void |
2548 entry_activate_cb(GtkWidget *widget UNUSED, gpointer data) | 2546 entry_activate_cb(GtkWidget *widget UNUSED, gpointer data) |
2549 { | 2547 { |
2550 gtk_widget_grab_focus(GTK_WIDGET(data)); | 2548 gtk_widget_grab_focus(GTK_WIDGET(data)); |
2551 } | 2549 } |
2566 gboolean nonempty; | 2564 gboolean nonempty; |
2567 | 2565 |
2568 entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); | 2566 entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); |
2569 | 2567 |
2570 if (!entry_text) | 2568 if (!entry_text) |
2571 return; /* shouldn't happen */ | 2569 return; // shouldn't happen |
2572 | 2570 |
2573 nonempty = (entry_text[0] != '\0'); | 2571 nonempty = (entry_text[0] != '\0'); |
2574 | 2572 |
2575 if (dialog == find_widgets.dialog) | 2573 if (dialog == find_widgets.dialog) |
2576 gtk_widget_set_sensitive(find_widgets.find, nonempty); | 2574 gtk_widget_set_sensitive(find_widgets.find, nonempty); |
2587 * ":helpfind" | 2585 * ":helpfind" |
2588 */ | 2586 */ |
2589 void | 2587 void |
2590 ex_helpfind(exarg_T *eap UNUSED) | 2588 ex_helpfind(exarg_T *eap UNUSED) |
2591 { | 2589 { |
2592 /* This will fail when menus are not loaded. Well, it's only for | 2590 // This will fail when menus are not loaded. Well, it's only for |
2593 * backwards compatibility anyway. */ | 2591 // backwards compatibility anyway. |
2594 do_cmdline_cmd((char_u *)"emenu ToolBar.FindHelp"); | 2592 do_cmdline_cmd((char_u *)"emenu ToolBar.FindHelp"); |
2595 } | 2593 } |
2596 | 2594 |
2597 #if defined(FEAT_BROWSE) || defined(PROTO) | 2595 #if defined(FEAT_BROWSE) || defined(PROTO) |
2598 static void | 2596 static void |
2599 recent_func_log_func(const gchar *log_domain UNUSED, | 2597 recent_func_log_func(const gchar *log_domain UNUSED, |
2600 GLogLevelFlags log_level UNUSED, | 2598 GLogLevelFlags log_level UNUSED, |
2601 const gchar *message UNUSED, | 2599 const gchar *message UNUSED, |
2602 gpointer user_data UNUSED) | 2600 gpointer user_data UNUSED) |
2603 { | 2601 { |
2604 /* We just want to suppress the warnings. */ | 2602 // We just want to suppress the warnings. |
2605 /* http://bugzilla.gnome.org/show_bug.cgi?id=664587 */ | 2603 // http://bugzilla.gnome.org/show_bug.cgi?id=664587 |
2606 } | 2604 } |
2607 #endif | 2605 #endif |