r3941: Fixed error in tooltip in bulk rename box (Vincent Lef��vre).
[rox-filer/translations.git] / ROX-Filer / src / main.c
blob8b87274e60b2d94890e6327fd872da993dfebdaa
1 /*
2 * $Id$
4 * ROX-Filer, filer for the ROX desktop project
5 * Copyright (C) 2005, the ROX-Filer team.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 * Place, Suite 330, Boston, MA 02111-1307 USA
22 /* main.c - parses command-line options and parameters, plus some global
23 * housekeeping.
25 * New to the code and feeling lost? Read global.h now.
28 #include "config.h"
30 #include <stdlib.h>
31 #include <stdio.h>
32 #include <sys/types.h>
33 #include <signal.h>
34 #include <string.h>
35 #include <sys/wait.h>
36 #include <unistd.h>
37 #include <fcntl.h>
38 #include <pwd.h>
39 #include <grp.h>
40 #include <time.h>
41 #include <libxml/parser.h>
43 #ifdef HAVE_GETOPT_LONG
44 # include <getopt.h>
45 #endif
47 #include <gtk/gtk.h>
48 #include <gdk/gdkx.h> /* For rox_x_error */
50 #include "global.h"
52 #include "main.h"
53 #include "support.h"
54 #include "gui_support.h"
55 #include "filer.h"
56 #include "display.h"
57 #include "mount.h"
58 #include "menu.h"
59 #include "dnd.h"
60 #include "options.h"
61 #include "choices.h"
62 #include "type.h"
63 #include "pixmaps.h"
64 #include "dir.h"
65 #include "diritem.h"
66 #include "action.h"
67 #include "i18n.h"
68 #include "remote.h"
69 #include "pinboard.h"
70 #include "run.h"
71 #include "toolbar.h"
72 #include "bind.h"
73 #include "panel.h"
74 #include "session.h"
75 #include "minibuffer.h"
76 #include "xtypes.h"
78 int number_of_windows = 0; /* Quit when this reaches 0 again... */
79 int to_wakeup_pipe = -1; /* Write here to get noticed */
81 /* Information about the ROX-Filer process */
82 uid_t euid;
83 gid_t egid;
84 int ngroups; /* Number of supplemental groups */
85 gid_t *supplemental_groups = NULL;
87 /* Message to display at the top of each filer window */
88 const gchar *show_user_message = NULL;
90 int home_dir_len;
91 const char *home_dir, *app_dir;
93 GtkTooltips *tooltips = NULL;
95 #define COPYING \
96 N_("Copyright (C) 2005 Thomas Leonard.\n" \
97 "ROX-Filer comes with ABSOLUTELY NO WARRANTY,\n" \
98 "to the extent permitted by law.\n" \
99 "You may redistribute copies of ROX-Filer\n" \
100 "under the terms of the GNU General Public License.\n" \
101 "For more information about these matters, " \
102 "see the file named COPYING.\n")
104 #ifdef HAVE_GETOPT_LONG
105 # define USAGE N_("Try `ROX-Filer/AppRun --help' for more information.\n")
106 # define SHORT_ONLY_WARNING ""
107 #else
108 # define USAGE N_("Try `ROX-Filer/AppRun -h' for more information.\n")
109 # define SHORT_ONLY_WARNING \
110 _("NOTE: Your system does not support long options - \n" \
111 "you must use the short versions instead.\n\n")
112 #endif
114 #define BUGS_TO "<rox-devel@lists.sourceforge.net>"
116 #define HELP N_("Usage: ROX-Filer/AppRun [OPTION]... [FILE]...\n" \
117 "Open each directory or file listed, or the current working\n" \
118 "directory if no arguments are given.\n\n" \
119 " -b, --bottom=PANEL open PAN as a bottom-edge panel\n" \
120 " -c, --client-id=ID used for session management\n" \
121 " -d, --dir=DIR open DIR as directory (not application)\n" \
122 " -D, --close=DIR close DIR and its subdirectories\n" \
123 " -h, --help display this help and exit\n" \
124 " -l, --left=PANEL open PAN as a left-edge panel\n" \
125 " -m, --mime-type=FILE print MIME type of FILE and exit\n" \
126 " -n, --new start new copy; for debugging the filer\n" \
127 " -p, --pinboard=PIN use pinboard PIN as the pinboard\n" \
128 " -r, --right=PANEL open PAN as a right-edge panel\n" \
129 " -R, --RPC invoke method call read from stdin\n" \
130 " -s, --show=FILE open a directory showing FILE\n" \
131 " -S, --rox-session use default panel and pinboard options, and -n\n"\
132 " -t, --top=PANEL open PANEL as a top-edge panel\n" \
133 " -u, --user show user name in each window \n" \
134 " -v, --version display the version information and exit\n" \
135 " -x, --examine=FILE FILE has changed - re-examine it\n" \
136 "\nReport bugs to " BUGS_TO ".\n" \
137 "Home page (including updated versions): http://rox.sourceforge.net/\n")
139 #define SHORT_OPS "c:d:t:b:l:r:op:s:hvnux:m:D:RS"
141 #ifdef HAVE_GETOPT_LONG
142 static struct option long_opts[] =
144 {"dir", 1, NULL, 'd'},
145 {"top", 1, NULL, 't'},
146 {"bottom", 1, NULL, 'b'},
147 {"left", 1, NULL, 'l'},
148 {"override", 0, NULL, 'o'},
149 {"pinboard", 1, NULL, 'p'},
150 {"right", 1, NULL, 'r'},
151 {"help", 0, NULL, 'h'},
152 {"version", 0, NULL, 'v'},
153 {"user", 0, NULL, 'u'},
154 {"new", 0, NULL, 'n'},
155 {"RPC", 0, NULL, 'R'},
156 {"show", 1, NULL, 's'},
157 {"rox-session", 0, NULL, 'S'},
158 {"examine", 1, NULL, 'x'},
159 {"close", 1, NULL, 'D'},
160 {"mime-type", 1, NULL, 'm'},
161 {"client-id", 1, NULL, 'c'},
162 {NULL, 0, NULL, 0},
164 #endif
166 /* Take control of panels away from WM? */
167 Option o_override_redirect;
169 /* Options used when we are called by ROX-Session */
170 enum {
171 SESSION_PANEL_ONLY,
172 SESSION_PINBOARD_ONLY,
173 SESSION_BOTH,
175 Option o_session_panel_or_pin;
176 Option o_session_panel_position;
177 Option o_session_panel_name;
178 Option o_session_pinboard_name;
180 /* Always start a new filer, even if one seems to be already running */
181 gboolean new_copy = FALSE;
183 /* Maps child PIDs to Callback pointers */
184 static GHashTable *death_callbacks = NULL;
185 static gboolean child_died_flag = FALSE;
187 Option o_dnd_no_hostnames;
189 /* Static prototypes */
190 static void show_features(void);
191 static void soap_add(xmlNodePtr body,
192 xmlChar *function,
193 const xmlChar *arg1_name, const xmlChar *arg1_value,
194 const xmlChar *arg2_name, const xmlChar *arg2_value);
195 static void child_died(int signum);
196 static void child_died_callback(void);
197 static void wake_up_cb(gpointer data, gint source, GdkInputCondition condition);
198 static void xrandr_size_change(GdkScreen *screen, gpointer user_data);
199 static void add_default_panel_and_pinboard(xmlNodePtr body);
201 /****************************************************************
202 * EXTERNAL INTERFACE *
203 ****************************************************************/
205 /* The value that goes with an option */
206 #define VALUE (*optarg == '=' ? optarg + 1 : optarg)
208 static int rox_x_error(Display *display, XErrorEvent *error)
210 gchar buf[64];
212 XGetErrorText(display, error->error_code, buf, 63);
214 g_warning ("The program '%s' received an X Window System error.\n"
215 "This probably reflects a bug in the program.\n"
216 "The error was '%s'.\n"
217 " (Details: serial %ld error_code %d request_code %d minor_code %d)\n"
218 " (Note to programmers: normally, X errors are reported asynchronously;\n"
219 " that is, you will receive the error a while after causing it.\n"
220 " To debug your program, run it with the --sync command line\n"
221 " option to change this behavior. You can then get a meaningful\n"
222 " backtrace from your debugger.)",
223 g_get_prgname (),
224 buf,
225 error->serial,
226 error->error_code,
227 error->request_code,
228 error->minor_code);
230 /* Try to cope with BadWindow errors */
231 if (error->error_code == 3)
233 static time_t last_error = 0;
234 time_t now;
235 now = time(NULL);
237 if (last_error + 5 > now)
238 abort(); /* Errors coming too fast... */
240 last_error = now;
242 delayed_error(_("We got a BadWindow error from the X server. "
243 "This might be due to this GTK bug (during drag-and-drop?):\n"
244 "http://bugzilla.gnome.org/show_bug.cgi?id=152151\n"
245 "Trying to continue..."));
246 return 0;
249 abort();
252 /* Parses the command-line to work out what the user wants to do.
253 * Tries to send the request to an already-running copy of the filer.
254 * If that fails, it initialises all the other modules and executes the
255 * request itself.
257 int main(int argc, char **argv)
259 int wakeup_pipe[2];
260 int i;
261 struct sigaction act;
262 guchar *tmp, *dir;
263 gchar *client_id = NULL;
264 gboolean show_user = FALSE;
265 xmlDocPtr rpc, soap_rpc = NULL, reply;
266 xmlNodePtr body;
268 home_dir = g_get_home_dir();
269 home_dir_len = strlen(home_dir);
270 app_dir = g_strdup(getenv("APP_DIR"));
272 /* Get internationalisation up and running. This requires the
273 * choices system, to discover the user's preferred language.
275 choices_init();
276 options_init();
277 i18n_init();
278 xtype_init();
280 #ifdef HAVE_GNOME_VFS
281 if (!gnome_vfs_init())
282 g_warning("Failed to init gnomevfs!");
283 #endif
285 if (!app_dir)
287 g_warning("APP_DIR environment variable was unset!\n"
288 "Use the AppRun script to invoke ROX-Filer...\n");
289 app_dir = g_get_current_dir();
291 #ifdef HAVE_UNSETENV
292 else
294 /* Don't pass it on to our child processes... */
295 unsetenv("APP_DIR");
297 #endif
299 /* Sometimes we want to take special action when a child
300 * process exits. This hash table is used to convert the
301 * child's PID to the callback function.
303 death_callbacks = g_hash_table_new(NULL, NULL);
305 /* Find out some information about ourself */
306 euid = geteuid();
307 egid = getegid();
308 ngroups = getgroups(0, NULL);
309 if (ngroups < 0)
310 ngroups = 0;
311 else if (ngroups > 0)
313 supplemental_groups = g_malloc(sizeof(gid_t) * ngroups);
314 getgroups(ngroups, supplemental_groups);
317 if (argc == 2 && strcmp(argv[1], "-v") == 0)
319 /* This is used by install.sh to test if the filer
320 * compiled OK. Do this test before gtk_init so that
321 * we don't need an X server to install.
323 g_print("ROX-Filer %s\n", VERSION);
324 g_print(_(COPYING));
325 show_features();
326 return EXIT_SUCCESS;
329 option_add_int(&o_override_redirect, "override_redirect", FALSE);
331 option_add_int(&o_session_panel_or_pin, "session_panel_or_pin",
332 SESSION_BOTH);
333 option_add_int(&o_session_panel_position, "session_panel_position",
334 PANEL_BOTTOM);
335 option_add_string(&o_session_panel_name, "session_panel_name",
336 "Default");
337 option_add_string(&o_session_pinboard_name, "session_pinboard_name",
338 "Default");
340 /* The idea here is to convert the command-line arguments
341 * into a SOAP RPC.
342 * We attempt to invoke the call on an already-running copy of
343 * the filer if possible, or execute it ourselves if not.
345 rpc = soap_new(&body);
347 /* Note: must do this before checking our options,
348 * otherwise we report an error for Gtk's options.
350 gtk_init(&argc, &argv);
351 /* Set a default style for the collection widget */
352 gtk_rc_parse_string("style \"rox-default-collection-style\" {\n"
353 " bg[NORMAL] = \"#f3f3f3\"\n"
354 " fg[NORMAL] = \"#000000\"\n"
355 " bg[INSENSITIVE] = \"#bfbfbf\"\n"
356 " fg[INSENSITIVE] = \"#000000\"\n"
357 "}\n"
358 "style \"rox-default-pinboard-style\" {\n"
359 " bg[NORMAL] = \"#666666\"\n"
360 "}\n"
361 "widget \"rox-pinboard\" style : gtk "
362 "\"rox-default-pinboard-style\"\n"
364 "class \"Collection\" style : gtk "
365 "\"rox-default-collection-style\"\n");
367 g_signal_connect(gdk_screen_get_default(), "size-changed",
368 G_CALLBACK(xrandr_size_change), NULL);
370 /* Process each option in turn */
371 while (1)
373 int c;
374 #ifdef HAVE_GETOPT_LONG
375 int long_index;
376 c = getopt_long(argc, argv, SHORT_OPS,
377 long_opts, &long_index);
378 #else
379 c = getopt(argc, argv, SHORT_OPS);
380 #endif
382 if (c == EOF)
383 break; /* No more options */
385 switch (c)
387 case 'n':
388 new_copy = TRUE;
389 break;
390 case 'o':
391 info_message(_("The -o argument is no longer "
392 "used. You can turn on override "
393 "redirect from the Options box "
394 "instead."));
395 break;
396 case 'v':
397 g_print("ROX-Filer %s\n", VERSION);
398 g_print("%s", _(COPYING));
399 show_features();
400 return EXIT_SUCCESS;
401 case 'h':
402 g_print("%s", _(HELP));
403 g_print("%s", _(SHORT_ONLY_WARNING));
404 return EXIT_SUCCESS;
405 case 'D':
406 case 'd':
407 case 'x':
408 /* Argument is a path */
409 if (c == 'd' && VALUE[0] == '/')
410 tmp = g_strdup(VALUE);
411 else
412 tmp = pathdup(VALUE);
413 soap_add(body,
414 c == 'D' ? "CloseDir" :
415 c == 'd' ? "OpenDir" :
416 c == 'x' ? "Examine" : "Unknown",
417 "Filename", tmp,
418 NULL, NULL);
419 g_free(tmp);
420 break;
421 case 's':
422 tmp = g_path_get_dirname(VALUE);
424 if (tmp[0] == '/')
425 dir = NULL;
426 else
427 dir = pathdup(tmp);
429 soap_add(body, "Show",
430 "Directory", dir ? dir : tmp,
431 "Leafname", g_basename(VALUE));
432 g_free(tmp);
433 g_free(dir);
434 break;
435 case 'l':
436 case 'r':
437 case 't':
438 case 'b':
439 /* Argument is a leaf (or starts with /) */
440 soap_add(body, "Panel", "Name", VALUE,
441 "Side", c == 'l' ? "Left" :
442 c == 'r' ? "Right" :
443 c == 't' ? "Top" :
444 c == 'b' ? "Bottom" :
445 "Unknown");
446 break;
447 case 'p':
448 soap_add(body, "Pinboard",
449 "Name", VALUE, NULL, NULL);
450 break;
451 case 'u':
452 show_user = TRUE;
453 break;
454 case 'm':
456 MIME_type *type;
457 type_init();
458 diritem_init();
459 pixmaps_init();
460 type = type_get_type(VALUE);
461 printf("%s/%s\n", type->media_type,
462 type->subtype);
463 return EXIT_SUCCESS;
465 case 'c':
466 client_id = g_strdup(VALUE);
467 break;
468 case 'R':
469 soap_rpc = xmlParseFile("-");
470 if (!soap_rpc)
471 g_error("Invalid XML in RPC");
472 break;
474 case 'S':
475 new_copy = TRUE;
476 add_default_panel_and_pinboard(body);
477 break;
479 default:
480 printf(_(USAGE));
481 return EXIT_FAILURE;
485 tooltips = gtk_tooltips_new();
487 if (euid == 0 || show_user)
488 show_user_message = g_strdup_printf(_("Running as user '%s'"),
489 user_name(euid));
491 /* Add each remaining (non-option) argument to the list of files
492 * to run.
494 i = optind;
495 while (i < argc)
497 tmp = pathdup(argv[i++]);
499 soap_add(body, "Run", "Filename", tmp, NULL, NULL);
501 g_free(tmp);
504 if (soap_rpc)
506 if (body->xmlChildrenNode)
507 g_error("Can't use -R with other options - sorry!");
508 xmlFreeDoc(rpc);
509 body = NULL;
510 rpc = soap_rpc;
512 else if (!body->xmlChildrenNode)
514 /* The user didn't request any action. Open the current
515 * directory.
517 guchar *dir;
519 dir = g_get_current_dir();
520 soap_add(body, "OpenDir", "Filename", dir, NULL, NULL);
521 g_free(dir);
524 option_add_int(&o_dnd_no_hostnames, "dnd_no_hostnames", 1);
526 /* Try to send the request to an already-running copy of the filer */
527 gui_support_init();
528 if (remote_init(rpc, new_copy))
529 return EXIT_SUCCESS; /* It worked - exit */
531 /* Put ourselves into the background (so 'rox' always works the
532 * same, whether we're already running or not).
533 * Not for -n, though (helps when debugging).
535 if (!new_copy)
537 int fd;
538 pid_t child;
540 child = fork();
541 if (child > 0)
542 _exit(0); /* Parent exits */
543 /* Otherwise we're the child (or an error occurred - ignore
544 * it!).
547 /* Close stdin. We don't need it, and it can cause problems if
548 * a child process wants a password, etc...
550 fd = open("/dev/null", O_RDONLY);
551 if (fd > 0)
553 close(0);
554 dup2(fd, 0);
555 close(fd);
559 /* Initialize the rest of the filer... */
561 pixmaps_init();
563 dnd_init();
564 bind_init();
565 dir_init();
566 diritem_init();
567 menu_init();
568 minibuffer_init();
569 filer_init();
570 toolbar_init();
571 display_init();
572 mount_init();
573 type_init();
574 action_init();
576 pinboard_init();
577 panel_init();
579 /* Let everyone update */
580 options_notify();
582 /* When we get a signal, we can't do much right then. Instead,
583 * we send a char down this pipe, which causes the main loop to
584 * deal with the event next time we're idle.
586 pipe(wakeup_pipe);
587 close_on_exec(wakeup_pipe[0], TRUE);
588 close_on_exec(wakeup_pipe[1], TRUE);
589 gdk_input_add_full(wakeup_pipe[0], GDK_INPUT_READ, wake_up_cb,
590 NULL, NULL);
591 to_wakeup_pipe = wakeup_pipe[1];
593 /* If the pipe is full then we're going to get woken up anyway... */
594 set_blocking(to_wakeup_pipe, FALSE);
596 /* Let child processes die */
597 act.sa_handler = child_died;
598 sigemptyset(&act.sa_mask);
599 act.sa_flags = SA_NOCLDSTOP;
600 sigaction(SIGCHLD, &act, NULL);
602 /* Ignore SIGPIPE - check for EPIPE errors instead */
603 act.sa_handler = SIG_IGN;
604 sigemptyset(&act.sa_mask);
605 act.sa_flags = 0;
606 sigaction(SIGPIPE, &act, NULL);
608 /* Set up session managament if available */
609 session_init(client_id);
610 g_free(client_id);
612 /* See if we need to migrate the Choices directories*/
613 choices_migrate();
615 /* Finally, execute the request */
616 reply = run_soap(rpc);
617 xmlFreeDoc(rpc);
618 if (reply)
620 /* Write the result, if any, to stdout */
621 save_xml_file(reply, "-");
622 xmlFreeDoc(reply);
625 /* Try to find out why we crash with GTK 2.4 */
626 XSetErrorHandler(rox_x_error);
628 /* Enter the main loop, processing events until all our windows
629 * are closed.
631 if (number_of_windows > 0)
632 gtk_main();
634 return EXIT_SUCCESS;
637 /* Register a function to be called when process number 'child' dies. */
638 void on_child_death(gint child, CallbackFn callback, gpointer data)
640 Callback *cb;
642 g_return_if_fail(callback != NULL);
644 cb = g_new(Callback, 1);
646 cb->callback = callback;
647 cb->data = data;
649 g_hash_table_insert(death_callbacks, GINT_TO_POINTER(child), cb);
652 void one_less_window(void)
654 if (--number_of_windows < 1)
655 gtk_main_quit();
658 /****************************************************************
659 * INTERNAL FUNCTIONS *
660 ****************************************************************/
662 static void show_features(void)
664 g_print("\n");
665 g_print(_("Compiled with GTK version %s\n"), GTK_VERSION);
666 g_print(_("Running with GTK version %d.%d.%d\n"),
667 gtk_major_version,
668 gtk_minor_version,
669 gtk_micro_version);
670 g_print("\n-- %s --\n\n", _("features set at compile time"));
671 g_print("%s... %s\n", _("Large File Support"),
672 #ifdef LARGE_FILE_SUPPORT
673 _("Yes")
674 #else
675 _("No")
676 #endif
678 g_print("%s... %s\n", _("GNOME-VFS library"),
679 # ifdef HAVE_GNOME_VFS
680 _("Yes")
681 # else
682 _("No (need 2.8.0 or later)")
683 # endif
685 g_print("%s... %s\n", _("Dnotify support"),
686 #ifdef USE_DNOTIFY
687 _("Yes")
688 #else
689 _("No")
690 #endif
692 g_print("%s... %s\n", _("Binary compatibility"),
693 #if defined(HAVE_APSYMBOLS_H) || defined(HAVE_APBUILD_APSYMBOLS_H)
694 _("Yes (can run with older glibc versions)")
695 #else
696 _("No (apsymbols.h not found)")
697 #endif
701 static void soap_add(xmlNodePtr body,
702 xmlChar *function,
703 const xmlChar *arg1_name, const xmlChar *arg1_value,
704 const xmlChar *arg2_name, const xmlChar *arg2_value)
706 xmlNodePtr node;
707 xmlNs *rox;
709 rox = xmlSearchNsByHref(body->doc, body, ROX_NS);
711 node = xmlNewChild(body, rox, function, NULL);
713 if (arg1_name)
715 xmlNewTextChild(node, rox, arg1_name, arg1_value);
716 if (arg2_name)
717 xmlNewTextChild(node, rox, arg2_name, arg2_value);
721 /* This is called as a signal handler; simply ensures that
722 * child_died_callback() will get called later.
724 static void child_died(int signum)
726 child_died_flag = TRUE;
727 write(to_wakeup_pipe, "\0", 1); /* Wake up! */
730 static void child_died_callback(void)
732 int status;
733 gint child;
735 child_died_flag = FALSE;
737 /* Find out which children exited and allow them to die */
740 Callback *cb;
742 child = waitpid(-1, &status, WNOHANG);
744 if (child == 0 || child == -1)
745 return;
747 cb = g_hash_table_lookup(death_callbacks,
748 GINT_TO_POINTER(child));
749 if (cb)
751 cb->callback(cb->data);
752 g_hash_table_remove(death_callbacks,
753 GINT_TO_POINTER(child));
756 } while (1);
759 #define BUFLEN 40
760 /* When data is written to_wakeup_pipe, this gets called from the event
761 * loop some time later. Useful for getting out of signal handlers, etc.
763 static void wake_up_cb(gpointer data, gint source, GdkInputCondition condition)
765 char buf[BUFLEN];
767 read(source, buf, BUFLEN);
769 if (child_died_flag)
770 child_died_callback();
771 #ifdef USE_DNOTIFY
772 if (dnotify_wakeup_flag)
773 dnotify_wakeup();
774 #endif
777 static void xrandr_size_change(GdkScreen *screen, gpointer user_data)
779 gui_store_screen_geometry(screen);
781 panel_update_size();
782 pinboard_update_size();
785 static void add_default_panel_and_pinboard(xmlNodePtr body)
787 char *name, *side;
790 if(o_session_panel_or_pin.int_value != SESSION_PANEL_ONLY)
792 name=o_session_pinboard_name.value;
793 if(!name[0])
794 name="Default";
795 soap_add(body, "Pinboard","Name", name, NULL, NULL);
798 if(o_session_panel_or_pin.int_value != SESSION_PINBOARD_ONLY)
800 name=o_session_panel_name.value;
801 if(!name[0])
802 name="Default";
804 switch(o_session_panel_position.int_value) {
805 case PANEL_TOP: side="Top"; break;
806 case PANEL_BOTTOM: side="Bottom"; break;
807 case PANEL_LEFT: side="Left"; break;
808 case PANEL_RIGHT: side="Right"; break;
810 default:
811 side="Unknown";
812 break;
815 soap_add(body, "Panel", "Name", name, "Side", side);