Bug Summary

File:charpick/charpick.c
Warning:line 649, column 19
Value stored to 'applet' during its initialization is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name charpick.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/charpick -resource-dir /usr/lib/llvm-16/lib/clang/16 -D HAVE_CONFIG_H -I . -I .. -I . -I . -D CHARPICK_MENU_UI_DIR="/usr/share/cafe/ui" -I /usr/include/cafe-panel-4.0/libcafe-panel-applet -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/gucharmap-2.90 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -internal-isystem /usr/lib/llvm-16/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/rootdir/charpick -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-07-170150-85881-1 -x c charpick.c
1/* charpick.c This is a cafe panel applet that allow users to select
2 * accented (and other) characters to be pasted into other apps.
3 */
4
5#include <cdk/cdkx.h>
6#include <config.h>
7#include <string.h>
8#include <cafe-panel-applet.h>
9#include <cafe-panel-applet-gsettings.h>
10#ifdef HAVE_GUCHARMAP1
11#include <gucharmap/gucharmap.h>
12#endif
13#include "charpick.h"
14
15/* The comment for each char list has the html entity names of the chars */
16/* All gunicar codes should end in 0 */
17
18
19/* This is the default list used when starting charpick the first time */
20/* aacute, agrave, eacute, iacute, oacute, frac12, copy*/
21/* static const gchar *def_list = "áàéíñóœ©"; */
22static const gunichar def_code[] = {225, 224, 233, 237, 241, 243, 189, 169, 1579, 8364, 0};
23
24/* aacute, agrave, acirc, atilde, auml. aring, aelig, ordf */
25/* static const gchar *a_list = "áàâãäåæª"; */
26static const gunichar a_code[] = {225, 224, 226, 227, 228, 229, 230, 170, 0};
27/* static const gchar *cap_a_list = "ÁÀÂÃÄÅƪ"; */
28static const gunichar cap_a_code[] = {192, 193, 194, 195, 196, 197, 198, 170, 0};
29/* ccedil, cent, copy */
30/* static const gchar *c_list = "çÇ¢©"; */
31static const gunichar c_code[] = {231, 199, 162, 169, 0};
32/* eacute, egrave, ecirc, euml, aelig */
33/* static const gchar *e_list = "éèêëæ"; */
34static const gunichar e_code[] = {232, 233, 234, 235, 230, 0};
35/* static const gchar *cap_e_list = "ÉÈÊËÆ"; */
36static const gunichar cap_e_code[] = {200, 201, 202, 203, 198, 0};
37/* iacute, igrave, icirc, iuml */
38/* static const gchar *i_list = "íìîï"; */
39static const gunichar i_code[] = {236, 237, 238, 239, 0};
40/* static const gchar *cap_i_list = "ÍÌÎÏ"; */
41static const gunichar cap_i_code[] = {204, 205, 206, 207, 0};
42/* ntilde (this is the most important line in this program.) */
43/* static const gchar *n_list = "ñ, Ñ"; */
44static const gunichar n_code[] = {241, 209, 0};
45/* oacute, ograve, ocirc, otilde, ouml, oslash, ordm */
46/* static const gchar *o_list = "óòôõöøº"; */
47static const gunichar o_code[] = {242, 243, 244, 245, 246, 248, 176, 0};
48/* static const gchar *cap_o_list = "ÓÒÔÕÖغ"; */
49static const gunichar cap_o_code[] = {210, 211, 212, 213, 214, 216, 176, 0};
50/* szlig, sect, dollar */
51/* static const gchar *s_list = "ߧ$"; */
52static const gunichar s_code[] = {223, 167, 36, 0};
53/* eth, thorn */
54/* static const gchar *t_list = "ðÐþÞ"; */
55static const gunichar t_code[] = {240, 208, 254, 222, 0};
56/* uacute, ugrave, ucirc, uuml */
57/* static const gchar *u_list = "úùûü"; */
58static const gunichar u_code[] = {249, 250, 251, 252, 0};
59/* static const gchar *cap_u_list = "ÚÙÛÜ"; */
60static const gunichar cap_u_code[] = {217, 218, 219, 220, 0};
61/* yacute, yuml, yen Yes, there is no capital yuml in iso 8859-1.*/
62/* static const gchar *y_list = "ýÝÿ¥"; */
63static const gunichar y_code[] = {253, 221, 255, 165, 0};
64
65/* extra characters unrelated to the latin alphabet. All characters in
66 ISO-8859-1 should now be accounted for.*/
67/* not shy macr plusmn */
68/* static const gchar *dash_list = "¬­¯±"; */
69static const gunichar dash_code[] = {172, 173, 175, 177, 0};
70/* laquo raquo uml */
71/* static const gchar *quote_list = "«»š·×"; */
72static const gunichar quote_code[] = {171, 187, 168, 183, 215, 0};
73/* curren, pound, yen, cent, dollar */
74/* static const gchar *currency_list = "€£¥¢$"; */
75static const gunichar currency_code[] = {164, 163, 165, 162, 36, 8364, 0};
76/* sup1 frac12 */
77/* static const gchar *one_list = "¹œŒ"; */
78static const gunichar one_code[] = {185, 178, 179, 188, 189, 190, 0};
79/* µ ¶ ® ¿ ¡ | */
80static const gunichar misc_code[] = {181, 182, 174, 191, 161, 124, 0};
81
82/* language/region specific character groups */
83/* South Africa: Venda, Tswana and Northern Sotho */
84/* static const gchar *ZA_list = "ḓḽṋṱḒḼṊṰṅṄšŠ"; */
85static const gunichar ZA_code[] = {7699, 7741, 7755, 7793, 7698, 7740, 7754, 7792, 7749, 7748, 353, 352, 0};
86/* South Africa: Afrikaans */
87/* static const gchar *af_ZA_list = "áéíóúýêîôûèäëïöüÁÉÍÓÚÝÊÎÔÛÈÄËÏÖÜ"; */
88static const gunichar af_ZA_code[] = {225, 233, 237, 243, 250, 253, 234, 238, 244, 251, 232, 228, 235, 239, 246, 252, 193, 201, 205, 211, 218, 221, 202, 206, 212, 219, 200, 196, 203, 207, 214, 220, 0};
89
90
91static const gunichar * const chartable[] = {
92 def_code,
93 a_code,
94 cap_a_code,
95 c_code,
96 e_code,
97 cap_e_code,
98 i_code,
99 cap_i_code,
100 n_code,
101 o_code,
102 cap_o_code,
103 s_code,
104 t_code,
105 u_code,
106 cap_u_code,
107 y_code,
108 dash_code,
109 quote_code,
110 currency_code,
111 one_code,
112 misc_code,
113 ZA_code,
114 af_ZA_code
115};
116
117/* sets the picked character as the selection when it gets a request */
118static void
119charpick_selection_handler(CtkWidget *widget,
120 CtkSelectionData *selection_data,
121 guint info,
122 guint time,
123 gpointer data)
124{
125 charpick_data *p_curr_data = data;
126 gint num;
127 gchar tmp[7];
128 num = g_unichar_to_utf8 (p_curr_data->selected_unichar, tmp);
129 tmp[num] = '\0';
130
131 ctk_selection_data_set_text (selection_data, tmp, -1);
132
133 return;
134}
135
136/* untoggles the active toggle_button when we lose the selection */
137static gint
138selection_clear_cb (CtkWidget *widget, CdkEventSelection *event,
139 gpointer data)
140{
141 charpick_data *curr_data = data;
142
143 if (curr_data->last_toggle_button)
144 ctk_toggle_button_set_active (curr_data->last_toggle_button, FALSE(0));
145
146 curr_data->last_toggle_button = NULL((void*)0);
147 return TRUE(!(0));
148}
149
150
151static gint
152toggle_button_toggled_cb(CtkToggleButton *button, gpointer data)
153{
154 charpick_data *curr_data = data;
155 gint button_index;
156 gboolean toggled;
157
158 button_index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "index"))((gint) (glong) (g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((button)), (((GType) ((20) << (2)))
))))), "index")))
;
159 toggled = ctk_toggle_button_get_active (button);
160
161 if (toggled)
162 {
163 gunichar unichar;
164 if (curr_data->last_toggle_button && (button != curr_data->last_toggle_button))
165 ctk_toggle_button_set_active (curr_data->last_toggle_button,
166 FALSE(0));
167
168 curr_data->last_toggle_button = button;
169 ctk_widget_grab_focus(curr_data->applet);
170 unichar = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "unichar"))((gint) (glong) (g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((button)), (((GType) ((20) << (2)))
))))), "unichar")))
;
171 curr_data->selected_unichar = unichar;
172 /* set this? widget as the selection owner */
173 ctk_selection_owner_set (curr_data->applet,
174 CDK_SELECTION_PRIMARY((CdkAtom)((gpointer) (gulong) (1))),
175 CDK_CURRENT_TIME0L);
176 ctk_selection_owner_set (curr_data->applet,
177 CDK_SELECTION_CLIPBOARD((CdkAtom)((gpointer) (gulong) (69))),
178 CDK_CURRENT_TIME0L);
179 curr_data->last_index = button_index;
180 }
181
182 return TRUE(!(0));
183}
184
185/* This is a hack around the fact that ctk+ doesn't
186 * propogate button presses on button2/3.
187 */
188static gboolean
189button_press_hack (CtkWidget *widget,
190 CdkEventButton *event,
191 CtkWidget *applet)
192{
193 if (event->button == 3 || event->button == 2) {
194 ctk_propagate_event (applet, (CdkEvent *) event);
195
196 return TRUE(!(0));
197 }
198
199 return FALSE(0);
200}
201
202static gint
203key_press_event(CtkWidget *widget, CdkEventKey *event, gpointer data)
204{
205#if 0
206 charpick_data *p_curr_data = data;
207 const gunichar *code = NULL((void*)0);
208 gchar inputchar = event->keyval;
209
210 switch (inputchar)
211 {
212 case 'a' : code = a_code;
213 break;
214 case 'A' : code = cap_a_code;
215 break;
216 case 'c' :
217 case 'C' : code = c_code;
218 break;
219 case 'e' : code = e_code;
220 break;
221 case 'E' : code = cap_e_code;
222 break;
223 case 'i' : code = i_code;
224 break;
225 case 'I' : code = cap_i_code;
226 break;
227 case 'n' :
228 case 'N' : code = n_code;
229 break;
230 case 'o' : code = o_code;
231 break;
232 case 'O' : code = cap_o_code;
233 break;
234 case 's' : code = s_code;
235 break;
236 case 't' :
237 case 'T' : code = t_code;
238 break;
239 case 'u' : code = u_code;
240 break;
241 case 'U' : code = cap_u_code;
242 break;
243 case 'y' :
244 case 'Y' : code = y_code;
245 break;
246 case '-' : code = dash_code;
247 break;
248 case '\"' : code = quote_code;
249 break;
250 case '$' : code = currency_code;
251 break;
252 case '1' :
253 case '2' :
254 case '3' : code = one_code;
255 break;
256 case 'd' : code = NULL((void*)0);
257 break;
258 default :
259 return FALSE(0);
260 }
261 /* FIXME: what's wrong here ? */
262 if (code)
263 p_curr_data->charlist = g_ucs4_to_utf8 (code, -1, NULL((void*)0), NULL((void*)0), NULL((void*)0));
264 else
265 p_curr_data->charlist = "hello";
266 p_curr_data->last_index = NO_LAST_INDEX-1;
267 p_curr_data->last_toggle_button = NULL((void*)0);
268 build_table(p_curr_data);
269#endif
270 return FALSE(0);
271}
272
273static void
274menuitem_activated (CtkMenuItem *menuitem, charpick_data *curr_data)
275{
276 gchar *string;
277 CafePanelApplet *applet = CAFE_PANEL_APPLET (curr_data->applet)((((CafePanelApplet*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((curr_data->applet)), ((cafe_panel_applet_get_type ())
)))))
;
278
279 string = g_object_get_data (G_OBJECT (menuitem)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), (((GType) ((20) << (2))))))))
, "string");
280 if (g_ascii_strcasecmp (curr_data->charlist, string) == 0)
281 return;
282
283 curr_data->charlist = string;
284 build_table (curr_data);
285 if (g_settings_is_writable (curr_data->settings, "current-list"))
286 g_settings_set_string (curr_data->settings, "current-list", curr_data->charlist);
287}
288
289void
290populate_menu (charpick_data *curr_data)
291{
292 GList *list = curr_data->chartable;
293 GSList *group = NULL((void*)0);
294 CtkMenu *menu;
295 CtkWidget *menuitem;
296
297 if (curr_data->menu)
298 ctk_widget_destroy (curr_data->menu);
299
300 curr_data->menu = ctk_menu_new ();
301 menu = CTK_MENU (curr_data->menu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((curr_data->menu)), ((ctk_menu_get_type ()))))))
;
302
303 while (list) {
304 gchar *string = list->data;
305 menuitem = ctk_radio_menu_item_new_with_label (group, string);
306 group = ctk_radio_menu_item_get_group (CTK_RADIO_MENU_ITEM (menuitem)((((CtkRadioMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_radio_menu_item_get_type (
)))))))
);
307 ctk_widget_show (menuitem);
308 g_object_set_data (G_OBJECT (menuitem)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), (((GType) ((20) << (2))))))))
, "string", string);
309 g_signal_connect (G_OBJECT (menuitem), "activate",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((menuitem)), (((GType) ((20) << (2)
)))))))), ("activate"), (((GCallback) (menuitem_activated))),
(curr_data), ((void*)0), (GConnectFlags) 0)
310 G_CALLBACK (menuitem_activated), curr_data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((menuitem)), (((GType) ((20) << (2)
)))))))), ("activate"), (((GCallback) (menuitem_activated))),
(curr_data), ((void*)0), (GConnectFlags) 0)
;
311 ctk_menu_shell_append (CTK_MENU_SHELL (menu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_shell_get_type ()))))))
, menuitem);
312 if (g_ascii_strcasecmp (curr_data->charlist, string) == 0)
313 ctk_check_menu_item_set_active (CTK_CHECK_MENU_ITEM (menuitem)((((CtkCheckMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_check_menu_item_get_type (
)))))))
, TRUE(!(0)));
314 list = g_list_next (list)((list) ? (((GList *)(list))->next) : ((void*)0));
315 }
316 build_table(curr_data);
317
318 /*Set up custom theme and transparency support*/
319 CtkWidget *toplevel = ctk_widget_get_toplevel (CTK_WIDGET (menu)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_widget_get_type ()))))))
);
320 /* Fix any failures of compiz/other wm's to communicate with ctk for transparency */
321 CdkScreen *screen = ctk_widget_get_screen(CTK_WIDGET(toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toplevel)), ((ctk_widget_get_type ()))))))
);
322 CdkVisual *visual = cdk_screen_get_rgba_visual(screen);
323 ctk_widget_set_visual(CTK_WIDGET(toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toplevel)), ((ctk_widget_get_type ()))))))
, visual);
324 /* Set menu and it's toplevel window to follow panel theme */
325 CtkStyleContext *context;
326 context = ctk_widget_get_style_context (CTK_WIDGET(toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toplevel)), ((ctk_widget_get_type ()))))))
);
327 ctk_style_context_add_class(context,"gnome-panel-menu-bar");
328 ctk_style_context_add_class(context,"cafe-panel-menu-bar");
329}
330
331static void
332chooser_button_clicked (CtkButton *button, charpick_data *curr_data)
333{
334 if (ctk_widget_get_visible (curr_data->menu))
335 ctk_menu_popdown (CTK_MENU (curr_data->menu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((curr_data->menu)), ((ctk_menu_get_type ()))))))
);
336 else {
337 ctk_menu_set_screen (CTK_MENU (curr_data->menu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((curr_data->menu)), ((ctk_menu_get_type ()))))))
,
338 ctk_widget_get_screen (CTK_WIDGET (curr_data->applet)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((curr_data->applet)), ((ctk_widget_get_type ()))))))
));
339
340 ctk_menu_popup_at_widget (CTK_MENU (curr_data->menu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((curr_data->menu)), ((ctk_menu_get_type ()))))))
,
341 CTK_WIDGET (button)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_widget_get_type ()))))))
,
342 CDK_GRAVITY_SOUTH_WEST,
343 CDK_GRAVITY_NORTH_WEST,
344 NULL((void*)0));
345 }
346}
347
348/* Force the button not to have any focus padding and let the focus
349 indication be drawn on the label itself when space is tight. Taken from the clock applet.
350 FIXME : This is an Evil Hack and should be fixed when the focus padding can be overridden at the ctk+ level */
351
352static inline void force_no_button_padding (CtkWidget *widget)
353{
354 CtkCssProvider *provider;
355
356 provider = ctk_css_provider_new ();
357
358 ctk_css_provider_load_from_data (provider,
359 "#charpick-applet-button {\n"
360 "border-width: 0px;\n"
361 "padding: 0px;\n"
362 "margin: 0px;\n"
363 "}",
364 -1,
365 NULL((void*)0));
366 ctk_style_context_add_provider (ctk_widget_get_style_context (widget),
367 CTK_STYLE_PROVIDER (provider)((((CtkStyleProvider*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((provider)), ((ctk_style_provider_get_type (
)))))))
,
368 CTK_STYLE_PROVIDER_PRIORITY_APPLICATION600);
369
370 g_object_unref (provider);
371
372 ctk_widget_set_name (widget, "charpick-applet-button");
373}
374
375/* creates table of buttons, sets up their callbacks, and packs the table in
376 the event box */
377
378void
379build_table(charpick_data *p_curr_data)
380{
381 CtkWidget *box, *button_box, **row_box;
382 CtkWidget *button, *arrow;
383 gint i = 0, len = g_utf8_strlen (p_curr_data->charlist, -1);
384 CtkWidget **toggle_button;
385 gchar *charlist;
386 gint max_width=1, max_height=1;
387 gint size_ratio;
388
389 toggle_button = g_new (CtkWidget *, len)((CtkWidget * *) g_malloc_n ((len), sizeof (CtkWidget *)));
390
391 if (p_curr_data->box)
392 ctk_widget_destroy(p_curr_data->box);
393
394 if (p_curr_data->panel_vertical)
395 box = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
396 else
397 box = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
398 ctk_widget_show (box);
399 p_curr_data->box = box;
400
401 button = ctk_button_new ();
402 if (g_list_length (p_curr_data->chartable) != 1)
403 {
404 ctk_widget_set_tooltip_text (button, _("Available palettes")gettext ("Available palettes"));
405
406 switch (cafe_panel_applet_get_orient (CAFE_PANEL_APPLET (p_curr_data->applet)((((CafePanelApplet*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((p_curr_data->applet)), ((cafe_panel_applet_get_type (
)))))))
)) {
407 case CAFE_PANEL_APPLET_ORIENT_DOWN:
408 arrow = ctk_image_new_from_icon_name ("pan-down-symbolic", CTK_ICON_SIZE_MENU);
409 break;
410 case CAFE_PANEL_APPLET_ORIENT_UP:
411 arrow = ctk_image_new_from_icon_name ("pan-up-symbolic", CTK_ICON_SIZE_MENU);
412 break;
413 case CAFE_PANEL_APPLET_ORIENT_LEFT:
414 arrow = ctk_image_new_from_icon_name ("pan-start-symbolic", CTK_ICON_SIZE_MENU);
415 break;
416 case CAFE_PANEL_APPLET_ORIENT_RIGHT:
417 arrow = ctk_image_new_from_icon_name ("pan-end-symbolic", CTK_ICON_SIZE_MENU);
418 break;
419 default:
420 g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "charpick.c", 420
, ((const char*) (__func__)), ((void*)0)); } while (0)
;
421 }
422 ctk_container_add (CTK_CONTAINER (button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_container_get_type ()))))))
, arrow);
423 ctk_button_set_relief(CTK_BUTTON(button)((((CtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_button_get_type ()))))))
, CTK_RELIEF_NONE);
424
425 /* FIXME : evil hack (see force_no_button_padding) */
426 force_no_button_padding (button);
427
428 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
429 g_signal_connect (G_OBJECT (button), "clicked",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((button)), (((GType) ((20) << (2)))
)))))), ("clicked"), (((GCallback) (chooser_button_clicked)))
, (p_curr_data), ((void*)0), (GConnectFlags) 0)
430 G_CALLBACK (chooser_button_clicked),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((button)), (((GType) ((20) << (2)))
)))))), ("clicked"), (((GCallback) (chooser_button_clicked)))
, (p_curr_data), ((void*)0), (GConnectFlags) 0)
431 p_curr_data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((button)), (((GType) ((20) << (2)))
)))))), ("clicked"), (((GCallback) (chooser_button_clicked)))
, (p_curr_data), ((void*)0), (GConnectFlags) 0)
;
432 g_signal_connect (G_OBJECT (button), "button_press_event",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((button)), (((GType) ((20) << (2)))
)))))), ("button_press_event"), (((GCallback) (button_press_hack
))), (p_curr_data->applet), ((void*)0), (GConnectFlags) 0)
433 G_CALLBACK (button_press_hack),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((button)), (((GType) ((20) << (2)))
)))))), ("button_press_event"), (((GCallback) (button_press_hack
))), (p_curr_data->applet), ((void*)0), (GConnectFlags) 0)
434 p_curr_data->applet)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((button)), (((GType) ((20) << (2)))
)))))), ("button_press_event"), (((GCallback) (button_press_hack
))), (p_curr_data->applet), ((void*)0), (GConnectFlags) 0)
;
435
436 }
437
438 charlist = g_strdup (p_curr_data->charlist)g_strdup_inline (p_curr_data->charlist);
439 for (i = 0; i < len; i++) {
440 gchar label[7];
441 CtkRequisition req;
442 gchar *atk_desc;
443 gchar *name;
444
445 g_utf8_strncpy (label, charlist, 1);
446 charlist = g_utf8_next_char (charlist)(char *)((charlist) + g_utf8_skip[*(const guchar *)(charlist)
])
;
447
448#ifdef HAVE_GUCHARMAP1
449 /* TRANSLATOR: This sentance reads something like 'Insert "PILCROW SIGN"'
450 * hopefully, the name of the unicode character has already
451 * been translated.
452 */
453 name = g_strdup_printf (_("Insert \"%s\"")gettext ("Insert \"%s\""),
454 gucharmap_get_unicode_name (g_utf8_get_char (label)));
455#else
456 name = g_strdup (_("Insert special character"))g_strdup_inline (gettext ("Insert special character"));
457#endif
458
459 toggle_button[i] = ctk_toggle_button_new_with_label (label);
460 atk_desc = g_strdup_printf (_("insert special character %s")gettext ("insert special character %s"), label);
461 set_atk_name_description (toggle_button[i], NULL((void*)0), atk_desc);
462 g_free (atk_desc);
463 ctk_widget_show (toggle_button[i]);
464 ctk_button_set_relief(CTK_BUTTON(toggle_button[i])((((CtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toggle_button[i])), ((ctk_button_get_type ()))))))
, CTK_RELIEF_NONE);
465
466 /* FIXME : evil hack (see force_no_button_padding) */
467 force_no_button_padding (toggle_button[i]);
468
469 ctk_widget_set_tooltip_text (toggle_button[i], name);
470 g_free (name);
471
472 ctk_widget_get_preferred_size (toggle_button[i], NULL((void*)0), &req);
473
474 max_width = MAX (max_width, req.width)(((max_width) > (req.width)) ? (max_width) : (req.width));
475 max_height = MAX (max_height, req.height-2)(((max_height) > (req.height-2)) ? (max_height) : (req.height
-2))
;
476
477 g_object_set_data (G_OBJECT (toggle_button[i])((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toggle_button[i])), (((GType) ((20) << (2))))))))
, "unichar",
478 GINT_TO_POINTER(g_utf8_get_char (label))((gpointer) (glong) (g_utf8_get_char (label))));
479 g_signal_connect (G_OBJECT (toggle_button[i]), "toggled",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((toggle_button[i])), (((GType) ((20) <<
(2))))))))), ("toggled"), (((GCallback) (toggle_button_toggled_cb
))), (p_curr_data), ((void*)0), (GConnectFlags) 0)
480 G_CALLBACK (toggle_button_toggled_cb),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((toggle_button[i])), (((GType) ((20) <<
(2))))))))), ("toggled"), (((GCallback) (toggle_button_toggled_cb
))), (p_curr_data), ((void*)0), (GConnectFlags) 0)
481 p_curr_data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((toggle_button[i])), (((GType) ((20) <<
(2))))))))), ("toggled"), (((GCallback) (toggle_button_toggled_cb
))), (p_curr_data), ((void*)0), (GConnectFlags) 0)
;
482 g_signal_connect (G_OBJECT (toggle_button[i]), "button_press_event",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((toggle_button[i])), (((GType) ((20) <<
(2))))))))), ("button_press_event"), (((GCallback) (button_press_hack
))), (p_curr_data->applet), ((void*)0), (GConnectFlags) 0)
483 G_CALLBACK (button_press_hack), p_curr_data->applet)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((toggle_button[i])), (((GType) ((20) <<
(2))))))))), ("button_press_event"), (((GCallback) (button_press_hack
))), (p_curr_data->applet), ((void*)0), (GConnectFlags) 0)
;
484 }
485
486 if (p_curr_data->panel_vertical) {
487 size_ratio = p_curr_data->panel_size / max_width;
488 button_box = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
489 } else {
490 size_ratio = p_curr_data->panel_size / max_height;
491 button_box = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
492 }
493
494 ctk_box_set_homogeneous (CTK_BOX (button_box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button_box)), ((ctk_box_get_type ()))))))
, TRUE(!(0)));
495 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, button_box, TRUE(!(0)), TRUE(!(0)), 0);
496
497 size_ratio = MAX (size_ratio, 1)(((size_ratio) > (1)) ? (size_ratio) : (1));
498 row_box = g_new0 (CtkWidget *, size_ratio)((CtkWidget * *) g_malloc0_n ((size_ratio), sizeof (CtkWidget
*)))
;
499 for (i=0; i < size_ratio; i++) {
500 if (!p_curr_data->panel_vertical) row_box[i] = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
501 else row_box[i] = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
502 ctk_box_set_homogeneous (CTK_BOX (row_box[i])((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((row_box[i])), ((ctk_box_get_type ()))))))
, TRUE(!(0)));
503 ctk_box_pack_start (CTK_BOX (button_box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button_box)), ((ctk_box_get_type ()))))))
, row_box[i], TRUE(!(0)), TRUE(!(0)), 0);
504 }
505
506 for (i = 0; i <len; i++) {
507 int delta = len/size_ratio;
508 int index;
509
510 if (delta > 0)
511 index = i / delta;
512 else
513 index = i;
514
515 index = CLAMP (index, 0, size_ratio-1)(((index) > (size_ratio-1)) ? (size_ratio-1) : (((index) <
(0)) ? (0) : (index)))
;
516 ctk_box_pack_start (CTK_BOX (row_box[index])((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((row_box[index])), ((ctk_box_get_type ()))))))
, toggle_button[i], TRUE(!(0)), TRUE(!(0)), 0);
517 }
518
519 g_free (toggle_button);
520 g_free (row_box);
521
522 ctk_container_add (CTK_CONTAINER(p_curr_data->applet)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((p_curr_data->applet)), ((ctk_container_get_type ())))
)))
, box);
523 ctk_widget_show_all (p_curr_data->box);
524
525 p_curr_data->last_index = NO_LAST_INDEX-1;
526 p_curr_data->last_toggle_button = NULL((void*)0);
527
528}
529
530static void applet_size_allocate(CafePanelApplet *applet, CtkAllocation *allocation, gpointer data)
531{
532 charpick_data *curr_data = data;
533 if (curr_data->panel_vertical) {
534 if (curr_data->panel_size == allocation->width)
535 return;
536 curr_data->panel_size = allocation->width;
537 } else {
538 if (curr_data->panel_size == allocation->height)
539 return;
540 curr_data->panel_size = allocation->height;
541 }
542
543 build_table (curr_data);
544 return;
545}
546
547static void applet_change_orient(CafePanelApplet *applet, CafePanelAppletOrient o, gpointer data)
548{
549 charpick_data *curr_data = data;
550 if (o == CAFE_PANEL_APPLET_ORIENT_UP ||
551 o == CAFE_PANEL_APPLET_ORIENT_DOWN)
552 curr_data->panel_vertical = FALSE(0);
553 else
554 curr_data->panel_vertical = TRUE(!(0));
555 build_table (curr_data);
556 return;
557}
558
559
560static void
561about (CtkAction *action,
562 charpick_data *curr_data)
563{
564 static const char * const authors[] = {
565 "Alexandre Muñiz <munizao@xprt.net>",
566 "Kevin Vandersloot",
567 "Pablo Barciela <scow@riseup.net>",
568 NULL((void*)0)
569 };
570
571 static const gchar* documenters[] = {
572 "Dan Mueth <d-mueth@uchicago.edu>",
573 N_("Sun GNOME Documentation Team <gdocteam@sun.com>")("Sun GNOME Documentation Team <gdocteam@sun.com>"),
574 N_("MATE Documentation Team")("MATE Documentation Team"),
575 N_("CAFE Documentation Team")("CAFE Documentation Team"),
576 NULL((void*)0)
577 };
578
579#ifdef ENABLE_NLS1
580 const char **p;
581 for (p = documenters; *p; ++p)
582 *p = _(*p)gettext (*p);
583#endif
584
585 ctk_show_about_dialog (NULL((void*)0),
586 "title", _("About Character Palette")gettext ("About Character Palette"),
587 "version", VERSION"1.25.0",
588 "copyright", _("Copyright \xc2\xa9 1998, 2004-2005 GNOME Applets Maintainers and others\n"gettext ("Copyright \xc2\xa9 1998, 2004-2005 GNOME Applets Maintainers and others\n"
"Copyright \xc2\xa9 2012-2020 MATE developers\n" "Copyright \xc2\xa9 2023-2024 Pablo Barciela"
)
589 "Copyright \xc2\xa9 2012-2020 MATE developers\n"gettext ("Copyright \xc2\xa9 1998, 2004-2005 GNOME Applets Maintainers and others\n"
"Copyright \xc2\xa9 2012-2020 MATE developers\n" "Copyright \xc2\xa9 2023-2024 Pablo Barciela"
)
590 "Copyright \xc2\xa9 2023-2024 Pablo Barciela")gettext ("Copyright \xc2\xa9 1998, 2004-2005 GNOME Applets Maintainers and others\n"
"Copyright \xc2\xa9 2012-2020 MATE developers\n" "Copyright \xc2\xa9 2023-2024 Pablo Barciela"
)
,
591 "comments", _("Cafe Panel applet for selecting strange "gettext ("Cafe Panel applet for selecting strange " "characters that are not on my keyboard. "
"Released under GNU General Public Licence.")
592 "characters that are not on my keyboard. "gettext ("Cafe Panel applet for selecting strange " "characters that are not on my keyboard. "
"Released under GNU General Public Licence.")
593 "Released under GNU General Public Licence.")gettext ("Cafe Panel applet for selecting strange " "characters that are not on my keyboard. "
"Released under GNU General Public Licence.")
,
594 "authors", authors,
595 "documenters", documenters,
596 "translator-credits", _("translator-credits")gettext ("translator-credits"),
597 "logo-icon-name", "accessories-character-map",
598 NULL((void*)0));
599}
600
601
602static void
603help_cb (CtkAction *action,
604 charpick_data *curr_data)
605{
606 GError *error = NULL((void*)0);
607
608 ctk_show_uri_on_window (NULL((void*)0),
609 "help:cafe-char-palette",
610 ctk_get_current_event_time (),
611 &error);
612
613 if (error) { /* FIXME: the user needs to see this */
614 g_warning ("help error: %s\n", error->message);
615 g_error_free (error);
616 error = NULL((void*)0);
617 }
618}
619
620static void
621applet_destroy (CtkWidget *widget, gpointer data)
622{
623 charpick_data *curr_data = data;
624
625 g_return_if_fail (curr_data)do { if ((curr_data)) { } else { g_return_if_fail_warning (((
gchar*) 0), ((const char*) (__func__)), "curr_data"); return;
} } while (0)
;
626
627 if (curr_data->about_dialog)
628 ctk_widget_destroy (curr_data->about_dialog);
629 if (curr_data->propwindow)
630 ctk_widget_destroy (curr_data->propwindow);
631 if (curr_data->box)
632 ctk_widget_destroy (curr_data->box);
633 if (curr_data->menu)
634 ctk_widget_destroy (curr_data->menu);
635 g_free (curr_data);
636
637}
638
639void
640save_chartable (charpick_data *curr_data)
641{
642 cafe_panel_applet_settings_set_glist (curr_data->settings,
643 "chartable", curr_data->chartable);
644}
645
646static void
647get_chartable (charpick_data *curr_data)
648{
649 CafePanelApplet *applet = CAFE_PANEL_APPLET (curr_data->applet)((((CafePanelApplet*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((curr_data->applet)), ((cafe_panel_applet_get_type ())
)))))
;
Value stored to 'applet' during its initialization is never read
650 gint i, n;
651 GList *value = NULL((void*)0);
652
653 value = cafe_panel_applet_settings_get_glist (curr_data->settings, "chartable");
654 if (value) {
655 curr_data->chartable = value;
656 }
657 else {
658 n = G_N_ELEMENTS (chartable)(sizeof (chartable) / sizeof ((chartable)[0]));
659 for (i=0; i<n; i++) {
660 gchar *string;
661
662 string = g_ucs4_to_utf8 (chartable[i], -1, NULL((void*)0), NULL((void*)0), NULL((void*)0));
663 curr_data->chartable = g_list_append (curr_data->chartable, string);
664
665 }
666 if ( ! g_settings_is_writable (curr_data->settings, "chartable"))
667 save_chartable (curr_data);
668 }
669
670
671}
672
673static const CtkActionEntry charpick_applet_menu_actions [] = {
674 { "Preferences", "document-properties", N_("_Preferences")("_Preferences"),
675 NULL((void*)0), NULL((void*)0),
676 G_CALLBACK (show_preferences_dialog)((GCallback) (show_preferences_dialog)) },
677 { "Help", "help-browser", N_("_Help")("_Help"),
678 NULL((void*)0), NULL((void*)0),
679 G_CALLBACK (help_cb)((GCallback) (help_cb)) },
680 { "About", "help-about", N_("_About")("_About"),
681 NULL((void*)0), NULL((void*)0),
682 G_CALLBACK (about)((GCallback) (about)) }
683};
684
685void
686set_atk_name_description (CtkWidget *widget, const gchar *name,
687 const gchar *description)
688{
689 AtkObject *aobj;
690 aobj = ctk_widget_get_accessible (widget);
691 /* return if gail is not loaded */
692 if (CTK_IS_ACCESSIBLE (aobj)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(aobj)); GType __t = ((ctk_accessible_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
== FALSE(0))
693 return;
694 if (name)
695 atk_object_set_name (aobj, name);
696 if (description)
697 atk_object_set_description (aobj, description);
698}
699
700static void
701make_applet_accessible (CtkWidget *applet)
702{
703 set_atk_name_description (applet, _("Character Palette")gettext ("Character Palette"), _("Insert characters")gettext ("Insert characters"));
704}
705
706static gboolean
707charpicker_applet_fill (CafePanelApplet *applet)
708{
709 CafePanelAppletOrient orientation;
710 charpick_data *curr_data;
711 CdkAtom utf8_atom;
712 GList *list;
713 gchar *string;
714 CtkActionGroup *action_group;
715 gchar *ui_path;
716
717 g_set_application_name (_("Character Palette")gettext ("Character Palette"));
718
719 ctk_window_set_default_icon_name ("accessories-character-map");
720
721 g_object_set (ctk_settings_get_default (), "ctk-menu-images", TRUE(!(0)), NULL((void*)0));
722 g_object_set (ctk_settings_get_default (), "ctk-button-images", TRUE(!(0)), NULL((void*)0));
723
724 cafe_panel_applet_set_background_widget (applet, CTK_WIDGET (applet)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((applet)), ((ctk_widget_get_type ()))))))
);
725
726 cafe_panel_applet_set_flags (applet, CAFE_PANEL_APPLET_EXPAND_MINOR);
727
728 curr_data = g_new0 (charpick_data, 1)((charpick_data *) g_malloc0_n ((1), sizeof (charpick_data)));
729 curr_data->last_index = NO_LAST_INDEX-1;
730 curr_data->applet = CTK_WIDGET (applet)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((applet)), ((ctk_widget_get_type ()))))))
;
731 curr_data->about_dialog = NULL((void*)0);
732 curr_data->add_edit_dialog = NULL((void*)0);
733 curr_data->settings = cafe_panel_applet_settings_new (applet, "org.cafe.panel.applet.charpick");
734
735 get_chartable (curr_data);
736
737 string = g_settings_get_string (curr_data->settings, "current-list");
738 if (string) {
739 list = curr_data->chartable;
740 while (list) {
741 if (g_ascii_strcasecmp (list->data, string) == 0)
742 curr_data->charlist = list->data;
743 list = g_list_next (list)((list) ? (((GList *)(list))->next) : ((void*)0));
744 }
745 /* FIXME: yeah leak, but this code is full of leaks and evil
746 point shuffling. This should really be rewritten
747 -George */
748 if (curr_data->charlist == NULL((void*)0))
749 curr_data->charlist = string;
750 else
751 g_free (string);
752 } else {
753 curr_data->charlist = curr_data->chartable->data;
754 }
755
756 curr_data->panel_size = cafe_panel_applet_get_size (applet);
757
758 orientation = cafe_panel_applet_get_orient (applet);
759 curr_data->panel_vertical = (orientation == CAFE_PANEL_APPLET_ORIENT_LEFT)
760 || (orientation == CAFE_PANEL_APPLET_ORIENT_RIGHT);
761 build_table (curr_data);
762
763 g_signal_connect (G_OBJECT (curr_data->applet), "key_press_event",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((curr_data->applet)), (((GType) ((20) <<
(2))))))))), ("key_press_event"), (((GCallback) (key_press_event
))), (curr_data), ((void*)0), (GConnectFlags) 0)
764 G_CALLBACK (key_press_event), curr_data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((curr_data->applet)), (((GType) ((20) <<
(2))))))))), ("key_press_event"), (((GCallback) (key_press_event
))), (curr_data), ((void*)0), (GConnectFlags) 0)
;
765
766 utf8_atom = cdk_atom_intern ("UTF8_STRING", FALSE(0));
767 ctk_selection_add_target (curr_data->applet,
768 CDK_SELECTION_PRIMARY((CdkAtom)((gpointer) (gulong) (1))),
769 utf8_atom,
770 0);
771 ctk_selection_add_target (curr_data->applet,
772 CDK_SELECTION_CLIPBOARD((CdkAtom)((gpointer) (gulong) (69))),
773 utf8_atom,
774 0);
775 g_signal_connect (G_OBJECT (curr_data->applet), "selection_get",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((curr_data->applet)), (((GType) ((20) <<
(2))))))))), ("selection_get"), (((GCallback) (charpick_selection_handler
))), (curr_data), ((void*)0), (GConnectFlags) 0)
776 G_CALLBACK (charpick_selection_handler),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((curr_data->applet)), (((GType) ((20) <<
(2))))))))), ("selection_get"), (((GCallback) (charpick_selection_handler
))), (curr_data), ((void*)0), (GConnectFlags) 0)
777 curr_data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((curr_data->applet)), (((GType) ((20) <<
(2))))))))), ("selection_get"), (((GCallback) (charpick_selection_handler
))), (curr_data), ((void*)0), (GConnectFlags) 0)
;
778 g_signal_connect (G_OBJECT (curr_data->applet), "selection_clear_event",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((curr_data->applet)), (((GType) ((20) <<
(2))))))))), ("selection_clear_event"), (((GCallback) (selection_clear_cb
))), (curr_data), ((void*)0), (GConnectFlags) 0)
779 G_CALLBACK (selection_clear_cb),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((curr_data->applet)), (((GType) ((20) <<
(2))))))))), ("selection_clear_event"), (((GCallback) (selection_clear_cb
))), (curr_data), ((void*)0), (GConnectFlags) 0)
780 curr_data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((curr_data->applet)), (((GType) ((20) <<
(2))))))))), ("selection_clear_event"), (((GCallback) (selection_clear_cb
))), (curr_data), ((void*)0), (GConnectFlags) 0)
;
781
782 make_applet_accessible (CTK_WIDGET (applet)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((applet)), ((ctk_widget_get_type ()))))))
);
783
784 /* session save signal */
785 g_signal_connect (G_OBJECT (applet), "change_orient",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((applet)), (((GType) ((20) << (2)))
)))))), ("change_orient"), (((GCallback) (applet_change_orient
))), (curr_data), ((void*)0), (GConnectFlags) 0)
786 G_CALLBACK (applet_change_orient), curr_data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((applet)), (((GType) ((20) << (2)))
)))))), ("change_orient"), (((GCallback) (applet_change_orient
))), (curr_data), ((void*)0), (GConnectFlags) 0)
;
787
788 g_signal_connect (G_OBJECT (applet), "size_allocate",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((applet)), (((GType) ((20) << (2)))
)))))), ("size_allocate"), (((GCallback) (applet_size_allocate
))), (curr_data), ((void*)0), (GConnectFlags) 0)
789 G_CALLBACK (applet_size_allocate), curr_data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((applet)), (((GType) ((20) << (2)))
)))))), ("size_allocate"), (((GCallback) (applet_size_allocate
))), (curr_data), ((void*)0), (GConnectFlags) 0)
;
790
791 g_signal_connect (G_OBJECT (applet), "destroy",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((applet)), (((GType) ((20) << (2)))
)))))), ("destroy"), (((GCallback) (applet_destroy))), (curr_data
), ((void*)0), (GConnectFlags) 0)
792 G_CALLBACK (applet_destroy), curr_data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((applet)), (((GType) ((20) << (2)))
)))))), ("destroy"), (((GCallback) (applet_destroy))), (curr_data
), ((void*)0), (GConnectFlags) 0)
;
793
794 ctk_widget_show_all (CTK_WIDGET (applet)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((applet)), ((ctk_widget_get_type ()))))))
);
795
796 action_group = ctk_action_group_new ("Charpicker Applet Actions");
797 ctk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE"cafe-applets");
798 ctk_action_group_add_actions (action_group,
799 charpick_applet_menu_actions,
800 G_N_ELEMENTS (charpick_applet_menu_actions)(sizeof (charpick_applet_menu_actions) / sizeof ((charpick_applet_menu_actions
)[0]))
,
801 curr_data);
802 ui_path = g_build_filename (CHARPICK_MENU_UI_DIR"/usr/share/cafe/ui", "charpick-applet-menu.xml", NULL((void*)0));
803 cafe_panel_applet_setup_menu_from_file (CAFE_PANEL_APPLET (applet)((((CafePanelApplet*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((applet)), ((cafe_panel_applet_get_type ()))))))
,
804 ui_path, action_group);
805 g_free (ui_path);
806
807 if (cafe_panel_applet_get_locked_down (CAFE_PANEL_APPLET (applet)((((CafePanelApplet*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((applet)), ((cafe_panel_applet_get_type ()))))))
)) {
808 CtkAction *action;
809
810 action = ctk_action_group_get_action (action_group, "Preferences");
811 ctk_action_set_visible (action, FALSE(0));
812 }
813 g_object_unref (action_group);
814
815 register_stock_for_edit ();
816 populate_menu (curr_data);
817
818 return TRUE(!(0));
819}
820
821static gboolean
822charpicker_applet_factory (CafePanelApplet *applet,
823 const gchar *iid,
824 gpointer data)
825{
826 gboolean retval = FALSE(0);
827
828 if (!strcmp (iid, "CharpickerApplet"))
829 retval = charpicker_applet_fill (applet);
830
831 return retval;
832}
833
834CAFE_PANEL_APPLET_OUT_PROCESS_FACTORY ("CharpickerAppletFactory",int main(int argc, char* argv[]) { GOptionContext* context; GError
* error; int retval; do { bindtextdomain ("cafe-applets", "/usr/share/locale"
); bind_textdomain_codeset ("cafe-applets", "UTF-8"); if ((!(
0))) textdomain ("cafe-applets"); } while (0); context = g_option_context_new
(""); g_option_context_add_group (context, ctk_get_option_group
((!(0)))); error = ((void*)0); if (!g_option_context_parse (context
, &argc, &argv, &error)) { if (error) { g_printerr
("Cannot parse arguments: %s.\n", error->message); g_error_free
(error); } else { g_printerr ("Cannot parse arguments.\n"); }
g_option_context_free (context); return 1; } ctk_init (&
argc, &argv); retval = cafe_panel_applet_factory_main ("CharpickerAppletFactory"
,(!(0)), (cafe_panel_applet_get_type ()), charpicker_applet_factory
, ((void*)0)); g_option_context_free (context); return retval
; }
835 PANEL_TYPE_APPLET,int main(int argc, char* argv[]) { GOptionContext* context; GError
* error; int retval; do { bindtextdomain ("cafe-applets", "/usr/share/locale"
); bind_textdomain_codeset ("cafe-applets", "UTF-8"); if ((!(
0))) textdomain ("cafe-applets"); } while (0); context = g_option_context_new
(""); g_option_context_add_group (context, ctk_get_option_group
((!(0)))); error = ((void*)0); if (!g_option_context_parse (context
, &argc, &argv, &error)) { if (error) { g_printerr
("Cannot parse arguments: %s.\n", error->message); g_error_free
(error); } else { g_printerr ("Cannot parse arguments.\n"); }
g_option_context_free (context); return 1; } ctk_init (&
argc, &argv); retval = cafe_panel_applet_factory_main ("CharpickerAppletFactory"
,(!(0)), (cafe_panel_applet_get_type ()), charpicker_applet_factory
, ((void*)0)); g_option_context_free (context); return retval
; }
836 "char-palette",int main(int argc, char* argv[]) { GOptionContext* context; GError
* error; int retval; do { bindtextdomain ("cafe-applets", "/usr/share/locale"
); bind_textdomain_codeset ("cafe-applets", "UTF-8"); if ((!(
0))) textdomain ("cafe-applets"); } while (0); context = g_option_context_new
(""); g_option_context_add_group (context, ctk_get_option_group
((!(0)))); error = ((void*)0); if (!g_option_context_parse (context
, &argc, &argv, &error)) { if (error) { g_printerr
("Cannot parse arguments: %s.\n", error->message); g_error_free
(error); } else { g_printerr ("Cannot parse arguments.\n"); }
g_option_context_free (context); return 1; } ctk_init (&
argc, &argv); retval = cafe_panel_applet_factory_main ("CharpickerAppletFactory"
,(!(0)), (cafe_panel_applet_get_type ()), charpicker_applet_factory
, ((void*)0)); g_option_context_free (context); return retval
; }
837 charpicker_applet_factory,int main(int argc, char* argv[]) { GOptionContext* context; GError
* error; int retval; do { bindtextdomain ("cafe-applets", "/usr/share/locale"
); bind_textdomain_codeset ("cafe-applets", "UTF-8"); if ((!(
0))) textdomain ("cafe-applets"); } while (0); context = g_option_context_new
(""); g_option_context_add_group (context, ctk_get_option_group
((!(0)))); error = ((void*)0); if (!g_option_context_parse (context
, &argc, &argv, &error)) { if (error) { g_printerr
("Cannot parse arguments: %s.\n", error->message); g_error_free
(error); } else { g_printerr ("Cannot parse arguments.\n"); }
g_option_context_free (context); return 1; } ctk_init (&
argc, &argv); retval = cafe_panel_applet_factory_main ("CharpickerAppletFactory"
,(!(0)), (cafe_panel_applet_get_type ()), charpicker_applet_factory
, ((void*)0)); g_option_context_free (context); return retval
; }
838 NULL)int main(int argc, char* argv[]) { GOptionContext* context; GError
* error; int retval; do { bindtextdomain ("cafe-applets", "/usr/share/locale"
); bind_textdomain_codeset ("cafe-applets", "UTF-8"); if ((!(
0))) textdomain ("cafe-applets"); } while (0); context = g_option_context_new
(""); g_option_context_add_group (context, ctk_get_option_group
((!(0)))); error = ((void*)0); if (!g_option_context_parse (context
, &argc, &argv, &error)) { if (error) { g_printerr
("Cannot parse arguments: %s.\n", error->message); g_error_free
(error); } else { g_printerr ("Cannot parse arguments.\n"); }
g_option_context_free (context); return 1; } ctk_init (&
argc, &argv); retval = cafe_panel_applet_factory_main ("CharpickerAppletFactory"
,(!(0)), (cafe_panel_applet_get_type ()), charpicker_applet_factory
, ((void*)0)); g_option_context_free (context); return retval
; }
839