Mercurial > emacs
comparison src/gtkutil.h @ 109748:e2f8226efb99
Fix -Wwrite_strings in general and for Gtk+ specific code.
* callproc.c (synch_process_death): Make const.
(Fcall_process): Make signame const.
* emacs.c (main): Pass char[] to putenv instead of literal.
* floatfns.c (matherr): Use a const char* variable for x->name.
* font.c (font_open_by_name): Make name const.
* font.h (font_open_by_name): Make name const.
* gtkutil.c (get_utf8_string): Always return an allocated string.
Parameter is const.
(create_dialog, xg_create_one_menuitem, create_menus)
(xg_item_label_same_p, xg_update_menu_item): Free result from
get_utf8_string.
(xg_separator_p, xg_item_label_same_p): label is const.
* gtkutil.h: Replace widget_value with struct _widget_value.
(enum button_type, struct _widget_value): Remove and use the one from
keyboard.h.
* keyboard.h (_widget_value): Add defined USE_GTK. Replace Boolean
with unsigned char and XtPointer with void *.
* menu.c (Fx_popup_menu): error_name is const.
* menu.h (w32_menu_show, ns_menu_show, xmenu_show): error parameter
is const char **.
* w32menu.c (w32_menu_show):
* nsmenu.m (ns_menu_show): error parameter is const char **.
* process.h (synch_process_death): Is const char*.
* xmenu.c (Fx_popup_dialog): error_name is const char*.
(xmenu_show): error parameter is const char **. pane_string is const
char *.
(button_names): Is const char *.
(xdialog_show): error_name and pane_string is const.
* xrdb.c (get_system_app): Make path const and use char *p for non-const
char.
* xselect.c (Fx_get_atom_name): Use char empty[] instead of literal "".
* xsmfns.c (NOSPLASH_OPT): Change to char[].
(smc_save_yourself_CB): Do xstrdup on all ->type and ->name for
props. Free them at the end.
* xterm.c (emacs_class): New char[] for EMACS_CLASS.
(xim_open_dpy, xim_initialize, xim_close_dpy): Use emacs_class.
(x_term_init): Use char[] display_opt and name_opt instead of
string literal. file is const char*.
author | Jan D <jan.h.d@swipnet.se> |
---|---|
date | Wed, 11 Aug 2010 14:34:46 +0200 |
parents | 64732fa6188a |
children | be18c3b67d66 |
comparison
equal
deleted
inserted
replaced
109747:1f617baf8ae5 | 109748:e2f8226efb99 |
---|---|
36 #define XG_FRAME_DATA "emacs_frame" | 36 #define XG_FRAME_DATA "emacs_frame" |
37 | 37 |
38 /* Key for data that menu items hold. */ | 38 /* Key for data that menu items hold. */ |
39 #define XG_ITEM_DATA "emacs_menuitem" | 39 #define XG_ITEM_DATA "emacs_menuitem" |
40 | 40 |
41 /* Button types in menus. */ | |
42 enum button_type | |
43 { | |
44 BUTTON_TYPE_NONE, | |
45 BUTTON_TYPE_TOGGLE, | |
46 BUTTON_TYPE_RADIO | |
47 }; | |
48 | |
49 /* This is a list node in a generic list implementation. */ | 41 /* This is a list node in a generic list implementation. */ |
50 typedef struct xg_list_node_ | 42 typedef struct xg_list_node_ |
51 { | 43 { |
52 struct xg_list_node_ *prev; | 44 struct xg_list_node_ *prev; |
53 struct xg_list_node_ *next; | 45 struct xg_list_node_ *next; |
80 xg_menu_cb_data *cl_data; | 72 xg_menu_cb_data *cl_data; |
81 | 73 |
82 } xg_menu_item_cb_data; | 74 } xg_menu_item_cb_data; |
83 | 75 |
84 | 76 |
85 /* Used to specify menus and dialogs. | |
86 This is an adaption from lwlib for Gtk so we can use more of the same | |
87 code as lwlib in xmenu.c. */ | |
88 typedef struct _widget_value | |
89 { | |
90 /* name of widget */ | |
91 Lisp_Object lname; | |
92 char *name; | |
93 /* value (meaning depend on widget type) */ | |
94 char *value; | |
95 /* keyboard equivalent. no implications for XtTranslations */ | |
96 Lisp_Object lkey; | |
97 char *key; | |
98 /* Help string or nil if none. | |
99 GC finds this string through the frame's menu_bar_vector | |
100 or through menu_items. */ | |
101 Lisp_Object help; | |
102 /* true if enabled */ | |
103 gint enabled; | |
104 /* true if selected */ | |
105 gint selected; | |
106 /* The type of a button. */ | |
107 enum button_type button_type; | |
108 /* Contents of the sub-widgets, also selected slot for checkbox */ | |
109 struct _widget_value *contents; | |
110 /* data passed to callback */ | |
111 gpointer call_data; | |
112 /* next one in the list */ | |
113 struct _widget_value *next; | |
114 | |
115 /* we resource the widget_value structures; this points to the next | |
116 one on the free list if this one has been deallocated. | |
117 */ | |
118 struct _widget_value *free_list; | |
119 } widget_value; | |
120 | |
121 #ifdef HAVE_GTK_FILE_SELECTION_NEW | 77 #ifdef HAVE_GTK_FILE_SELECTION_NEW |
122 extern int use_old_gtk_file_dialog; | 78 extern int use_old_gtk_file_dialog; |
123 #endif | 79 #endif |
80 struct _widget_value; | |
124 | 81 |
125 extern widget_value *malloc_widget_value (void); | 82 extern struct _widget_value *malloc_widget_value (void); |
126 extern void free_widget_value (widget_value *); | 83 extern void free_widget_value (struct _widget_value *); |
127 | 84 |
128 extern int xg_uses_old_file_dialog (void); | 85 extern int xg_uses_old_file_dialog (void); |
129 | 86 |
130 extern char *xg_get_file_name (FRAME_PTR f, | 87 extern char *xg_get_file_name (FRAME_PTR f, |
131 char *prompt, | 88 char *prompt, |
136 extern char *xg_get_font_name (FRAME_PTR f, const char *); | 93 extern char *xg_get_font_name (FRAME_PTR f, const char *); |
137 | 94 |
138 extern GtkWidget *xg_create_widget (const char *type, | 95 extern GtkWidget *xg_create_widget (const char *type, |
139 const char *name, | 96 const char *name, |
140 FRAME_PTR f, | 97 FRAME_PTR f, |
141 widget_value *val, | 98 struct _widget_value *val, |
142 GCallback select_cb, | 99 GCallback select_cb, |
143 GCallback deactivate_cb, | 100 GCallback deactivate_cb, |
144 GCallback hightlight_cb); | 101 GCallback hightlight_cb); |
145 | 102 |
146 extern void xg_modify_menubar_widgets (GtkWidget *menubar, | 103 extern void xg_modify_menubar_widgets (GtkWidget *menubar, |
147 FRAME_PTR f, | 104 FRAME_PTR f, |
148 widget_value *val, | 105 struct _widget_value *val, |
149 int deep_p, | 106 int deep_p, |
150 GCallback select_cb, | 107 GCallback select_cb, |
151 GCallback deactivate_cb, | 108 GCallback deactivate_cb, |
152 GCallback hightlight_cb); | 109 GCallback hightlight_cb); |
153 | 110 |