Commit b280a434 authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

make use of gnome-dentry-edit, plus some cleanup

Sat Jul 18 16:17:18 1998  George Lebl  <jirka@5z.com>

        * launcher.[ch]: make use of gnome-dentry-edit, plus some
          cleanup

        * panel.c: changed the way the launcher dentries are saved, in
          preparation of making a user defined apps menu

        * menu.c: allow multiple menudirs in a single menu,
          main menu now has the system and the user menu in one
          large menu (this will become configurable in the future)
parent d282f136
Sat Jul 18 16:17:18 1998 George Lebl <jirka@5z.com>
* launcher.[ch]: make use of gnome-dentry-edit, plus some
cleanup
* panel.c: changed the way the launcher dentries are saved, in
preparation of making a user defined apps menu
* menu.c: allow multiple menudirs in a single menu,
main menu now has the system and the user menu in one
large menu (this will become configurable in the future)
Fri Jul 17 02:45:41 1998 George Lebl <jirka@5z.com>
* panel.c,main.c,applet-{lib,widget}.*,menu.c, panel_config_global.c:
......
Sat Jul 18 16:17:18 1998 George Lebl <jirka@5z.com>
* launcher.[ch]: make use of gnome-dentry-edit, plus some
cleanup
* panel.c: changed the way the launcher dentries are saved, in
preparation of making a user defined apps menu
* menu.c: allow multiple menudirs in a single menu,
main menu now has the system and the user menu in one
large menu (this will become configurable in the future)
Fri Jul 17 02:45:41 1998 George Lebl <jirka@5z.com>
* panel.c,main.c,applet-{lib,widget}.*,menu.c, panel_config_global.c:
......
......@@ -18,35 +18,14 @@
#include "panel.h"
#include "panel-util.h"
#include "launcher.h"
#define LAUNCHER_PROPERTIES "launcher_properties"
extern GtkTooltips *panel_tooltips;
static char *default_app_pixmap=NULL;
typedef struct {
int applet_id;
GtkWidget *button;
int signal_click_tag;
GnomeDesktopEntry *dentry;
} Launcher;
typedef struct {
GtkWidget *dialog;
GtkWidget *name_entry;
GtkWidget *comment_entry;
GtkWidget *execute_entry;
GtkWidget *icon_entry;
GtkWidget *documentation_entry;
GtkWidget *terminal_toggle;
/*information about this launcher*/
Launcher *launcher;
GnomeDesktopEntry *dentry;
} Properties;
static void
launch (GtkWidget *widget, void *data)
{
......@@ -90,6 +69,7 @@ create_launcher (char *parameters)
launcher = g_new(Launcher,1);
launcher->button = gtk_button_new ();
launcher->dedit = NULL;
pixmap = NULL;
if(dentry->icon)
pixmap = gnome_pixmap_new_from_file (dentry->icon);
......@@ -97,7 +77,7 @@ create_launcher (char *parameters)
pixmap = NULL;
if (!pixmap) {
if (default_app_pixmap)
pixmap = gnome_pixmap_new_from_file (default_app_pixmap);
pixmap = gnome_pixmap_new_from_file(default_app_pixmap);
else
pixmap = gtk_label_new (_("App"));
}
......@@ -128,152 +108,72 @@ create_launcher (char *parameters)
return launcher;
}
static void
check_dentry_save(GnomeDesktopEntry *dentry)
{
FILE *file;
char *pruned;
char *new_name;
char *appsdir;
file = fopen(dentry->location, "w");
if (file) {
fclose(file);
return;
}
pruned = strrchr(dentry->location, '/');
if (pruned)
pruned++; /* skip over slash */
else
pruned = dentry->location;
appsdir = gnome_util_home_file ("apps");
mkdir (appsdir, 0755);
new_name = g_concat_dir_and_file(appsdir, pruned);
g_free(dentry->location);
dentry->location = new_name;
}
#define free_and_nullify(x) { g_free(x); x = NULL; }
static void
properties_apply_callback(GtkWidget *widget, int page, gpointer data)
{
Properties *prop;
GnomeDesktopEntry *dentry;
GtkWidget *pixmap;
int i, n_args;
char **exec;
Launcher *launcher = data;
GtkWidget *pixmap;
char *icon;
if (page != -1)
return;
prop = data;
dentry = prop->dentry;
free_and_nullify(dentry->name);
free_and_nullify(dentry->comment);
gnome_string_array_free (dentry->exec);
dentry->exec = NULL;
free_and_nullify(dentry->exec);
free_and_nullify(dentry->tryexec);
free_and_nullify(dentry->icon);
free_and_nullify(dentry->docpath);
free_and_nullify(dentry->type);
dentry->name = g_strdup(gtk_entry_get_text(GTK_ENTRY(prop->name_entry)));
dentry->comment = g_strdup(gtk_entry_get_text(GTK_ENTRY(prop->comment_entry)));
/* Handle exec specially: split at spaces. Multiple spaces
must be compacted, hence the weirdness. This
implementation wastes a little memory in some cases. Big
deal. */
exec = gnome_string_split (gtk_entry_get_text(GTK_ENTRY(prop->execute_entry)),
" ", -1);
for (n_args = i = 0; exec[i]; ++i) {
if (! exec[i][0]) {
/* Empty item means multiple spaces found. Remove
it. */
g_free (exec[i]);
} else {
exec[n_args++] = exec[i];
}
}
exec[n_args] = NULL;
dentry->exec_length = n_args;
dentry->exec = exec;
dentry->icon = g_strdup(gtk_entry_get_text(GTK_ENTRY(prop->icon_entry)));
dentry->docpath = g_strdup(gtk_entry_get_text(GTK_ENTRY(prop->documentation_entry)));
dentry->type = g_strdup("Application"); /* FIXME: should handle more cases */
dentry->terminal = GTK_TOGGLE_BUTTON(prop->terminal_toggle)->active;
check_dentry_save(dentry);
gnome_desktop_entry_save(dentry);
dentry=gnome_desktop_entry_load(dentry->location);
gnome_desktop_entry_free(prop->dentry);
prop->dentry = dentry;
gnome_desktop_entry_free(launcher->dentry);
launcher->dentry =
gnome_dentry_get_dentry(GNOME_DENTRY_EDIT(launcher->dedit));
gtk_tooltips_set_tip (panel_tooltips,prop->launcher->button->parent,
dentry->comment,NULL);
gtk_tooltips_set_tip (panel_tooltips,launcher->button->parent,
launcher->dentry->comment,NULL);
pixmap=GTK_BUTTON(prop->launcher->button)->child;
pixmap=GTK_BUTTON(launcher->button)->child;
gtk_container_remove(GTK_CONTAINER(prop->launcher->button),pixmap);
gtk_container_remove(GTK_CONTAINER(launcher->button),pixmap);
pixmap = gnome_pixmap_new_from_file (dentry->icon);
icon = launcher->dentry->icon;
if (icon && *icon) {
/* Sigh, now we need to make them local to the gnome install */
if (*icon != '/') {
launcher->dentry->icon = gnome_pixmap_file (icon);
g_free (icon);
}
pixmap = gnome_pixmap_new_from_file (launcher->dentry->icon);
}
if (!pixmap) {
if (default_app_pixmap)
pixmap = gnome_pixmap_new_from_file (default_app_pixmap);
else
pixmap = gtk_label_new (_("App"));
}
gtk_container_add (GTK_CONTAINER(prop->launcher->button), pixmap);
gtk_container_add (GTK_CONTAINER(launcher->button), pixmap);
gtk_widget_show(pixmap);
/*FIXME: a bad hack to keep it all 48x48*/
gtk_widget_set_usize (prop->launcher->button, 48, 48);
gtk_widget_set_usize (launcher->button, 48, 48);
/*gtk_widget_set_usize (prop->launcher->button, pixmap->requisition.width,
/*gtk_widget_set_usize (launcher->button, pixmap->requisition.width,
pixmap->requisition.height);*/
gtk_signal_disconnect(GTK_OBJECT(prop->launcher->button),
prop->launcher->signal_click_tag);
prop->launcher->signal_click_tag = gtk_signal_connect (GTK_OBJECT(prop->launcher->button), "clicked",
(GtkSignalFunc) launch,
dentry);
gtk_signal_disconnect(GTK_OBJECT(launcher->button),
launcher->signal_click_tag);
/*replace the dentry in launcher structure with the new one */
gnome_desktop_entry_free(prop->launcher->dentry);
prop->launcher->dentry=dentry;
launcher->signal_click_tag =
gtk_signal_connect (GTK_OBJECT(launcher->button), "clicked",
GTK_SIGNAL_FUNC(launch),
launcher->dentry);
}
#undef free_and_nullify
static int
properties_close_callback(GtkWidget *widget, gpointer data)
{
Properties *prop = data;
gtk_object_set_data(GTK_OBJECT(prop->launcher->button),
Launcher *launcher = data;
gtk_object_set_data(GTK_OBJECT(launcher->button),
LAUNCHER_PROPERTIES,NULL);
gtk_signal_disconnect_by_data(GTK_OBJECT(prop->name_entry),widget);
gtk_signal_disconnect_by_data(GTK_OBJECT(prop->comment_entry),widget);
gtk_signal_disconnect_by_data(GTK_OBJECT(prop->execute_entry),widget);
gtk_signal_disconnect_by_data(GTK_OBJECT(prop->icon_entry),widget);
gtk_signal_disconnect_by_data(GTK_OBJECT(prop->documentation_entry),widget);
gtk_signal_disconnect_by_data(GTK_OBJECT(prop->terminal_toggle),widget);
g_free (prop);
launcher->dedit = NULL;
return FALSE;
}
static void
notify_entry_change (GtkWidget *widget, void *data)
notify_change (GtkWidget *widget, void *data)
{
GnomePropertyBox *box = GNOME_PROPERTY_BOX (data);
......@@ -283,72 +183,44 @@ notify_entry_change (GtkWidget *widget, void *data)
static GtkWidget *
create_properties_dialog(GnomeDesktopEntry *dentry, Launcher *launcher)
{
Properties *prop;
GtkWidget *dialog;
GtkWidget *table;
GtkWidget *toggle;
char *exec;
GnomePropertyBoxItem *item;
prop = g_new(Properties, 1);
prop->dentry = dentry;
prop->launcher = launcher;
prop->dialog = dialog = gnome_property_box_new();
dialog = gnome_property_box_new();
gtk_window_set_title(GTK_WINDOW(dialog), _("Launcher properties"));
gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, TRUE);
launcher->dedit =
gnome_dentry_edit_new(
GTK_NOTEBOOK(GNOME_PROPERTY_BOX(dialog)->notebook));
/*FIXME:!!! ugly hack!!! there needs to be a clean way of adding
GnomeDEntryEdit to GnomePropertyBox */
item = g_new (GnomePropertyBoxItem, 1);
item->dirty = FALSE;
GNOME_PROPERTY_BOX(dialog)->items =
g_list_append (GNOME_PROPERTY_BOX(dialog)->items, item);
item = g_new (GnomePropertyBoxItem, 1);
item->dirty = FALSE;
GNOME_PROPERTY_BOX(dialog)->items =
g_list_append (GNOME_PROPERTY_BOX(dialog)->items, item);
table = gtk_table_new(6, 2, FALSE);
gtk_container_border_width(GTK_CONTAINER(table), 4);
gtk_table_set_col_spacings(GTK_TABLE(table), 6);
gtk_table_set_row_spacings(GTK_TABLE(table), 2);
prop->name_entry = create_text_entry(table,
"launcher_name", 0,
_("Name"), dentry->name,
dialog);
prop->comment_entry = create_text_entry(table,
"launcher_comment", 1,
_("Comment"),
dentry->comment, dialog);
exec = gnome_string_joinv (" ", dentry->exec);
prop->execute_entry = create_file_entry(table,
"execute", 2,
_("Execute"), exec,
dialog);
g_free (exec);
prop->icon_entry = create_file_entry(table,
"icon", 3,
_("Icon"), dentry->icon,
dialog);
prop->documentation_entry = create_text_entry(table,
"launcher_document", 4,
_("Documentation"),
dentry->docpath, dialog);
prop->terminal_toggle = toggle =
gtk_check_button_new_with_label(_("Run inside terminal"));
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(toggle),
dentry->terminal ? TRUE : FALSE);
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
GTK_SIGNAL_FUNC (notify_entry_change), dialog);
gtk_table_attach(GTK_TABLE(table), toggle,
0, 2, 5, 6,
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
GTK_FILL | GTK_SHRINK,
0, 0);
gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop->dialog),
table, gtk_label_new (_("Item properties")));
gnome_dentry_edit_set_dentry(GNOME_DENTRY_EDIT(launcher->dedit),
launcher->dentry);
gtk_signal_connect(GTK_OBJECT(launcher->dedit), "changed",
GTK_SIGNAL_FUNC(notify_change),
dialog);
gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
(GtkSignalFunc) properties_close_callback,
prop);
GTK_SIGNAL_FUNC(properties_close_callback),
launcher);
gtk_signal_connect(GTK_OBJECT(dialog), "apply",
GTK_SIGNAL_FUNC(properties_apply_callback), prop);
GTK_SIGNAL_FUNC(properties_apply_callback),
launcher);
return dialog;
}
......@@ -367,16 +239,6 @@ launcher_properties(Launcher *launcher)
return;
}
path = launcher->dentry->location;
dentry = gnome_desktop_entry_load(path);
if (!dentry) {
g_warning("launcher properties: oops, "
"gnome_desktop_entry_load() returned NULL\n"
" on \"%s\"\n", path);
return;
}
dialog = create_properties_dialog(dentry,launcher);
gtk_object_set_data(GTK_OBJECT(launcher->button),
LAUNCHER_PROPERTIES,dialog);
......
......@@ -14,7 +14,8 @@
typedef struct {
int applet_id;
GtkWidget *button;
int signal_click_tag;
int signal_click_tag;
GtkObject *dedit;
GnomeDesktopEntry *dentry;
} Launcher;
......
......@@ -513,7 +513,7 @@ load_applet(char *id_str, char *path, char *params, int width, int height,
if(launcher) {
register_toy(launcher->button,NULL,launcher,
LAUNCHER_ID,NULL, params,pos,panel,
LAUNCHER_ID,NULL,NULL,pos,panel,
NULL,APPLET_LAUNCHER);
gtk_tooltips_set_tip (panel_tooltips,
......
......@@ -287,16 +287,21 @@ get_presorted_from(char *dir)
static int
menu_destroy(GtkWidget *menu, gpointer data)
{
MenuFinfo *mf = gtk_object_get_data(GTK_OBJECT(menu),"mf");
while(mf->finfo) {
FileInfo *fi = mf->finfo->data;
if(fi->name) g_free(fi->name);
g_free(fi);
mf->finfo = g_list_remove_link(mf->finfo, mf->finfo);
GList *mfl = gtk_object_get_data(GTK_OBJECT(menu),"mf");
while(mfl) {
MenuFinfo *mf = mfl->data;
while(mf->finfo) {
FileInfo *fi = mf->finfo->data;
if(fi->name) g_free(fi->name);
g_free(fi);
mf->finfo = g_list_remove_link(mf->finfo, mf->finfo);
}
if(mf->menudir) g_free(mf->menudir);
if(mf->dir_name) g_free(mf->dir_name);
g_free(mf);
mfl = g_list_remove_link(mfl,mfl);
}
if(mf->menudir) g_free(mf->menudir);
if(mf->dir_name) g_free(mf->dir_name);
g_free(mf);
gtk_object_set_data(GTK_OBJECT(menu),"mf",NULL);
return FALSE;
}
......@@ -345,7 +350,8 @@ make_app_menu(GtkWidget *sub, char *pixmap_name,
}
static void add_menu_widget (Menu *menu, char *menudir, int main_menu);
static GtkWidget * create_menu_at (char *menudir, int create_app_menu,
static GtkWidget * create_menu_at (GtkWidget *menu,
char *menudir, int create_app_menu,
int applets, char *dir_name,
int fake_submenus);
......@@ -354,30 +360,80 @@ static GtkWidget * create_menu_at (char *menudir, int create_app_menu,
static GtkWidget *
check_and_reread(GtkWidget *menuw,Menu *menu,int main_menu)
{
MenuFinfo *mf = gtk_object_get_data(GTK_OBJECT(menuw), "mf");
if(!mf)
g_warning("Weird menu doesn't have mf entry");
else {
/*if something has changed or if this is a
fake menu, reread the menu*/
if(mf->fake_menu || !check_finfo_list(mf->finfo)) {
/*we arecreating a whole new menuf or an applet if menu isn't NULL*/
if(menu) {
/*FIXME:
if we are creating a menu we don't support multiple
menu dirs (yet), except for the main menu, but that
will handle it's own thing*/
GList *mfl = gtk_object_get_data(GTK_OBJECT(menuw), "mf");
MenuFinfo *mf;
GList *list;
int need_reread = FALSE;
if(!mfl)
g_warning("Weird menu doesn't have mf entry");
/*check if we need to reread this*/
for(list = mfl; list != NULL; list = g_list_next(list)) {
MenuFinfo *mf = list->data;
if(mf->fake_menu || !check_finfo_list(mf->finfo)) {
need_reread = TRUE;
break;
}
}
mf = mfl->data;
if(need_reread) {
puts("debug: rereading menu");
if(menu) {
/*in case it's a main menu, force reread of
the root_menu*/
if(main_menu)
root_menu = NULL;
add_menu_widget(menu,mf->menudir,
main_menu);
gtk_widget_unref(menuw);
} else {
/*in case it's a main menu, force reread of
the root_menu*/
if(main_menu)
root_menu = NULL;
add_menu_widget(menu,mf->menudir,
main_menu);
gtk_widget_unref(menuw);
}
} else {
GList *mfl = gtk_object_get_data(GTK_OBJECT(menuw), "mf");
GList *list;
int need_reread = FALSE;
int all_fake = TRUE;
if(!mfl)
g_warning("Weird menu doesn't have mf entry");
/*check if we need to reread this*/
for(list = mfl; list != NULL; list = g_list_next(list)) {
MenuFinfo *mf = list->data;
if(!mf->fake_menu)
all_fake = FALSE;
if(!need_reread &&
(mf->fake_menu || !check_finfo_list(mf->finfo)))
need_reread = TRUE;
}
if(need_reread) {
GtkWidget *old_menu = NULL;
/*we are all fake so we want to use the previous
menu widget*/
if(all_fake) {
old_menu = menuw;
gtk_object_set_data(GTK_OBJECT(old_menu), "mf",
NULL);
}
for(list = mfl; list != NULL;
list = g_list_next(list)) {
MenuFinfo *mf = list->data;
char *pixmap_name =
gtk_object_get_data(GTK_OBJECT(menuw),
"pixmap");
menuw = create_menu_at(mf->menudir,
puts("debug: rereading menu");
if(list != mfl)
add_menu_separator(menuw);
menuw = create_menu_at(old_menu,
mf->menudir,
mf->create_app_menu,
mf->applets,
mf->dir_name,
......@@ -387,6 +443,7 @@ check_and_reread(GtkWidget *menuw,Menu *menu,int main_menu)
pixmap_name,
mf->menudir,
mf->dir_name);
old_menu = menuw;
}
}
}
......@@ -407,11 +464,11 @@ static GtkWidget *
create_fake_menu_at (char *menudir,
int create_app_menu,
int applets,
char *dir_name,
int fake_submenus)
char *dir_name)
{
MenuFinfo *mf;
GtkWidget *menu;
GList *list;
menu = gtk_menu_new ();
......@@ -423,7 +480,8 @@ create_fake_menu_at (char *menudir,
mf->fake_menu = TRUE;
mf->finfo = NULL;
gtk_object_set_data(GTK_OBJECT(menu),"mf",mf);
list = g_list_prepend(NULL,mf);
gtk_object_set_data(GTK_OBJECT(menu),"mf",list);
gtk_signal_connect(GTK_OBJECT(menu),"destroy",
GTK_SIGNAL_FUNC(menu_destroy),NULL);
......@@ -432,14 +490,14 @@ create_fake_menu_at (char *menudir,
}
static GtkWidget *
create_menu_at (char *menudir,
create_menu_at (GtkWidget *menu,
char *menudir,
int create_app_menu,
int applets,
char *dir_name,
int fake_submenus)
{
GnomeDesktopEntry *item_info;
GtkWidget *menu;
struct dirent *dent;
struct stat s;
char *filename;
......@@ -449,13 +507,14 @@ create_menu_at (char *menudir,
GList *finfo = NULL;
GList *presorted = NULL;
GList *done = NULL;
GList *mfl = NULL;
char *thisfile;
MenuFinfo *mf;
MenuFinfo *mf = NULL;
dir = opendir (menudir);
if (dir == NULL)
return NULL;
return menu;
/*add dir to the checked files list*/
fi = make_finfo(menudir);
......@@ -477,7 +536,12 @@ create_menu_at (char *menudir,
g_free(filename);
menu = gtk_menu_new ();
if(!menu) {
menu = gtk_menu_new ();
gtk_signal_connect(GTK_OBJECT(menu),"destroy",
GTK_SIGNAL_FUNC(menu_destroy),NULL);
} else
mfl = gtk_object_get_data(GTK_OBJECT(menu), "mf");
while (presorted ||
(dent = readdir (dir)) != NULL) {
......@@ -529,10 +593,10 @@ create_menu_at (char *menudir,
sub = create_fake_menu_at (filename,
create_app_menu,
applets,
menuitem_name,
fake_submenus);
menuitem_name);
else
sub = create_menu_at (filename, create_app_menu,
sub = create_menu_at (NULL,
filename, create_app_menu,
applets, menuitem_name,
fake_submenus);
if (!sub) {
......@@ -621,8 +685,11 @@ create_menu_at (char *menudir,
g_list_free(done);
if (items == 0) {
gtk_widget_destroy (menu);
return NULL;
/*there are no other items in this menu*/
if(!mfl) {
gtk_widget_destroy (menu);
return NULL;
}
}
mf = g_new(MenuFinfo,1);
......@@ -632,10 +699,10 @@ create_menu_at (char *menudir,
mf->dir_name = dir_name?g_strdup(dir_name):NULL;
mf->fake_menu = FALSE;
mf->finfo = finfo;
gtk_object_set_data(GTK_OBJECT(menu),"mf",mf);
gtk_signal_connect(GTK_OBJECT(menu),"destroy",
GTK_SIGNAL_FUNC(menu_destroy),NULL);
mfl = g_list_append(mfl,mf);
gtk_object_set_data(GTK_OBJECT(menu),"mf",mfl);
return menu;
}
......@@ -752,7 +819,7 @@ create_applets_menu(int fake_submenus)
return NULL;
}
applet_menu = create_menu_at(menudir,0,TRUE,NULL,fake_submenus);
applet_menu = create_menu_at(NULL,menudir,0,TRUE,NULL,fake_submenus);
g_free (menudir);
return applet_menu;
}
......@@ -943,6 +1010,44 @@ add_special_entries (GtkWidget *menu, GtkWidget *app_menu, GtkWidget *applet_men
}
static GtkWidget *
create_root_menu(int fake_submenus)
{
GtkWidget *root_menu;
GtkWidget *app_menu;
GtkWidget *applet_menu;
char *menu_base = gnome_unconditional_datadir_file ("apps");
char *menudir;
char *user_menudir;
menudir = g_concat_dir_and_file (menu_base, ".");
g_free (menu_base);
if (!g_file_exists (menudir)) {
g_free (menudir);
return;
}
root_menu = create_menu_at(NULL,menudir,FALSE,FALSE,NULL,fake_submenus);
app_menu = create_menu_at (NULL,menudir, TRUE,FALSE,NULL,fake_submenus);
g_free (menudir);
menu_base = gnome_util_home_file ("apps");
menudir = g_concat_dir_and_file (menu_base, ".");
g_free (menu_base);
mkdir (menudir, 0755);
if (g_file_exists (menudir)) {
add_menu_separator(root_menu);
root_menu = create_menu_at(root_menu,menudir,FALSE,FALSE,
NULL,fake_submenus);
}
g_free (menudir);
applet_menu = create_applets_menu(FALSE);
add_special_entries (root_menu, app_menu, applet_menu);
return root_menu;
}
static void
add_menu_widget (Menu *menu, char *menudir, int main_menu)
{
......@@ -950,19 +1055,12 @@ add_menu_widget (Menu *menu, char *menudir, int main_menu)
GtkWidget *applet_menu;
if (main_menu) {
/*this should not happen init root menu should have
been called (unless there are no panels*/
if(!root_menu) {
root_menu = create_menu_at(menudir,FALSE,FALSE,NULL,
TRUE);
app_menu = create_menu_at (menudir,TRUE,FALSE,NULL,
TRUE);
applet_menu = create_applets_menu(TRUE);
add_special_entries (root_menu, app_menu, applet_menu);
}
if(!root_menu)
root_menu = create_root_menu(TRUE);
menu->menu = root_menu;
} else
menu->menu = create_menu_at (menudir, 0, FALSE,NULL,TRUE);