Commit ff890d14 authored by Jacob Berkman's avatar Jacob Berkman Committed by Jacob Berkman

Right now floating a panel menu doesn't work. I will fix this when I'm not

1999-12-29  Jacob Berkman  <jberkman@andrew.cmu.edu>

Right now floating a panel menu doesn't work.  I will fix
this when I'm not so tired.

* session.c (load_default_applets1): change the defaults
to show a panel and desktop sub menu

* gnome-run.c (show_run_dialog): don't use pixmaps on
the buttons

* basep-widget.c (basep_widget_autohide): evi^H^H^Hvery
beautiful and elegant way of not hiding when an applet
pops up a menu (eg, tasklist), without adding any API

* menu-fentry.c (init_fr_chunks): use memchunks for the
file and dir recs.  This might help mem usage a little.

* menu.h: add flags for panel and desktop menus

* menu-properties.c (create_properties_dialog):
(properties_apply_callback): deal with new menu flags
for panel and desktop

* nothing.cP: use the new and improved GEGL
* menu.c (about_cb): ditto

1999-12-28  Jacob Berkman  <jberkman@andrew.cmu.edu>

* menu.c (about_cb): only show one about box
(add_drawers_from_dir): clean up code a little to not
indent so much
(add_menu_to_panel): don't mask with _MENU_* and _MENU_*_SUB,
only _MENU_*_SUB
parent 65f39e9a
1999-12-29 Jacob Berkman <jberkman@andrew.cmu.edu>
Right now floating a panel menu doesn't work. I will fix
this when I'm not so tired.
* session.c (load_default_applets1): change the defaults
to show a panel and desktop sub menu
* gnome-run.c (show_run_dialog): don't use pixmaps on
the buttons
* basep-widget.c (basep_widget_autohide): evi^H^H^Hvery
beautiful and elegant way of not hiding when an applet
pops up a menu (eg, tasklist), without adding any API
* menu-fentry.c (init_fr_chunks): use memchunks for the
file and dir recs. This might help mem usage a little.
* menu.h: add flags for panel and desktop menus
* menu-properties.c (create_properties_dialog):
(properties_apply_callback): deal with new menu flags
for panel and desktop
* nothing.cP: use the new and improved GEGL
* menu.c (about_cb): ditto
1999-12-28 Jacob Berkman <jberkman@andrew.cmu.edu>
* menu.c (about_cb): only show one about box
(add_drawers_from_dir): clean up code a little to not
indent so much
(add_menu_to_panel): don't mask with _MENU_* and _MENU_*_SUB,
only _MENU_*_SUB
Wed Dec 15 14:59:17 1999 George Lebl <jirka@5z.com>
* panel.[ch],applet-widget.c: fix warnings
......
1999-12-29 Jacob Berkman <jberkman@andrew.cmu.edu>
Right now floating a panel menu doesn't work. I will fix
this when I'm not so tired.
* session.c (load_default_applets1): change the defaults
to show a panel and desktop sub menu
* gnome-run.c (show_run_dialog): don't use pixmaps on
the buttons
* basep-widget.c (basep_widget_autohide): evi^H^H^Hvery
beautiful and elegant way of not hiding when an applet
pops up a menu (eg, tasklist), without adding any API
* menu-fentry.c (init_fr_chunks): use memchunks for the
file and dir recs. This might help mem usage a little.
* menu.h: add flags for panel and desktop menus
* menu-properties.c (create_properties_dialog):
(properties_apply_callback): deal with new menu flags
for panel and desktop
* nothing.cP: use the new and improved GEGL
* menu.c (about_cb): ditto
1999-12-28 Jacob Berkman <jberkman@andrew.cmu.edu>
* menu.c (about_cb): only show one about box
(add_drawers_from_dir): clean up code a little to not
indent so much
(add_menu_to_panel): don't mask with _MENU_* and _MENU_*_SUB,
only _MENU_*_SUB
Wed Dec 15 14:59:17 1999 George Lebl <jirka@5z.com>
* panel.[ch],applet-widget.c: fix warnings
......
......@@ -1433,6 +1433,16 @@ basep_widget_autohide (gpointer data)
if (panel_applet_in_drag || basep->drawers_open>0)
return TRUE;
if (!gdk_pointer_is_grabbed ()) {
if (gdk_pointer_grab (GDK_ROOT_PARENT(), FALSE,
0, NULL, NULL, GDK_CURRENT_TIME)
!= GrabSuccess) {
return TRUE;
} else {
gdk_pointer_ungrab (GDK_CURRENT_TIME);
}
}
gnome_triggers_vdo("", NULL, supinfo);
if (GTK_WIDGET_REALIZED(basep)) {
......
......@@ -11,6 +11,7 @@
extern GlobalConfig global_config;
extern GSList *panel_list;
extern PanelWidget *current_panel;
static int
watch_xerrors(Display *disp, XErrorEvent *errev)
......@@ -80,6 +81,13 @@ panel_global_keys_filter(GdkXEvent *gdk_xevent, GdkEvent *event)
if(!num_subkeys) {
GtkWidget *menu =
make_popup_panel_menu ();
GtkWidget *basep = current_panel->panel_parent;
if (IS_BASEP_WIDGET(basep)) {
BASEP_WIDGET(basep)->autohide_inhibit
= TRUE;
basep_widget_autohide (
BASEP_WIDGET (basep));
}
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
NULL, NULL, 0, GDK_CURRENT_TIME);
}
......
......@@ -42,8 +42,11 @@ string_callback (GtkWidget *w, int button_num, gpointer data)
s = gtk_editable_get_chars (GTK_EDITABLE (
gnome_file_entry_gtk_entry (fentry)),
0, -1);
if (strlen (s) == 0) {
g_free (s);
return;
}
gnome_entry_load_history (entry);
gnome_entry_prepend_history (entry, 1, s);
gnome_entry_save_history (entry);
gnome_config_sync ();
......@@ -70,27 +73,26 @@ show_run_dialog ()
GtkWidget *dialog;
GtkWidget *fentry;
GtkWidget *entry;
GtkWidget *gentry;
dialog = gnome_dialog_new(_("Run Program"), NULL);
gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (dialog),
_("Run"),
GNOME_STOCK_PIXMAP_EXEC);
gnome_dialog_append_button (GNOME_DIALOG (dialog),
GNOME_STOCK_BUTTON_CANCEL);
dialog = gnome_dialog_new(_("Run Program"),
_("Run"), _("Cancel"), NULL);
gnome_dialog_set_default (GNOME_DIALOG (dialog), 0);
gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE);
fentry = gnome_file_entry_new( "gnome-run",
fentry = gnome_file_entry_new ("gnome-run",
_("Select a program to run"));
gnome_entry_load_history (GNOME_ENTRY (
gnome_file_entry_gnome_entry (GNOME_FILE_ENTRY (fentry))));
gentry = gnome_file_entry_gnome_entry (GNOME_FILE_ENTRY (fentry));
gnome_entry_load_history (GNOME_ENTRY (gentry));
gnome_entry_prepend_history (GNOME_ENTRY (gentry), FALSE, "");
gtk_window_set_focus (GTK_WINDOW (dialog),
gnome_file_entry_gtk_entry (
GNOME_FILE_ENTRY (fentry)));
gtk_combo_set_use_arrows_always (GTK_COMBO (
gnome_file_entry_gnome_entry (GNOME_FILE_ENTRY (fentry))),
TRUE);
gtk_signal_connect(GTK_OBJECT (dialog), "clicked",
GTK_SIGNAL_FUNC (string_callback), fentry);
......
......@@ -261,6 +261,8 @@ main(int argc, char **argv)
/*set the globals*/
load_up_globals();
init_fr_chunks ();
init_menus();
......
......@@ -25,6 +25,16 @@
static GSList *dir_list = NULL;
static GMemChunk *file_chunk = NULL;
static GMemChunk *dir_chunk = NULL;
void
init_fr_chunks ()
{
file_chunk = g_mem_chunk_create (FileRec, 64, G_ALLOC_AND_FREE);
dir_chunk = g_mem_chunk_create (DirRec, 16, G_ALLOC_AND_FREE);
}
/*reads in the order file and makes a list*/
static GSList *
get_presorted_from(char *dir)
......@@ -130,7 +140,10 @@ fr_free(FileRec *fr, int free_fr)
}
if(free_fr) {
dir_list = g_slist_remove(dir_list,fr);
g_free(fr);
if (fr->type == FILE_REC_DIR)
g_chunk_free (fr, dir_chunk);
else
g_chunk_free (fr, file_chunk);
} else {
if(fr->type == FILE_REC_DIR)
memset(fr,0,sizeof(DirRec));
......@@ -152,7 +165,7 @@ fr_fill_dir(FileRec *fr, int sublevels)
g_return_if_fail(fr!=NULL);
g_return_if_fail(fr->name!=NULL);
ffr = g_new0(FileRec,1);
ffr = g_chunk_new0 (FileRec, file_chunk);
ffr->type = FILE_REC_EXTRA;
ffr->name = g_concat_dir_and_file(fr->name,".order");
ffr->parent = dr;
......@@ -190,7 +203,7 @@ fr_fill_dir(FileRec *fr, int sublevels)
dentry = gnome_desktop_entry_load(name);
if(dentry) {
ffr = g_new0(FileRec,1);
ffr = g_chunk_new0 (FileRec, file_chunk);
ffr->type = FILE_REC_FILE;
ffr->name = name;
ffr->mtime = s.st_mtime;
......@@ -224,7 +237,7 @@ fr_read_dir(DirRec *dr, char *mdir, struct stat *dstat, int sublevels)
/*this will zero all fields*/
if(!dr)
dr = g_new0(DirRec,1);
dr = g_chunk_new0 (DirRec, dir_chunk);
fr = (FileRec *)dr;
if(fr->last_stat < curtime-1) {
......
......@@ -53,7 +53,7 @@ FileRec * fr_replace(FileRec *fr);
FileRec * fr_check_and_reread(FileRec *fr);
FileRec * fr_get_dir(char *mdir);
void init_fr_chunks (void);
END_GNOME_DECLS
#endif
......@@ -88,18 +88,25 @@ properties_apply_callback(GtkWidget *widget, int page, gpointer data)
{
Menu *menu = data;
GtkWidget *main_menu = gtk_object_get_data(GTK_OBJECT(widget), "main_menu");
GtkWidget *system_off = gtk_object_get_data(GTK_OBJECT(widget), "system_off");
GtkWidget *system = gtk_object_get_data(GTK_OBJECT(widget), "system");
GtkWidget *system_sub = gtk_object_get_data(GTK_OBJECT(widget), "system_sub");
GtkWidget *user_off = gtk_object_get_data(GTK_OBJECT(widget), "user_off");
GtkWidget *user = gtk_object_get_data(GTK_OBJECT(widget), "user");
GtkWidget *user_sub = gtk_object_get_data(GTK_OBJECT(widget), "user_sub");
GtkWidget *applets_off = gtk_object_get_data(GTK_OBJECT(widget), "applets_off");
GtkWidget *applets = gtk_object_get_data(GTK_OBJECT(widget), "applets");
GtkWidget *applets_sub = gtk_object_get_data(GTK_OBJECT(widget), "applets_sub");
GtkWidget *redhat_off = gtk_object_get_data(GTK_OBJECT(widget), "redhat_off");
GtkWidget *redhat = gtk_object_get_data(GTK_OBJECT(widget), "redhat");
GtkWidget *redhat_sub = gtk_object_get_data(GTK_OBJECT(widget), "redhat_sub");
GtkWidget *kde_off = gtk_object_get_data(GTK_OBJECT(widget), "kde_off");
GtkWidget *kde = gtk_object_get_data(GTK_OBJECT(widget), "kde");
GtkWidget *kde_sub = gtk_object_get_data(GTK_OBJECT(widget), "kde_sub");
GtkWidget *debian_off = gtk_object_get_data(GTK_OBJECT(widget), "debian_off");
GtkWidget *debian = gtk_object_get_data(GTK_OBJECT(widget), "debian");
GtkWidget *debian_sub = gtk_object_get_data(GTK_OBJECT(widget), "debian_sub");
GtkWidget *panel = gtk_object_get_data(GTK_OBJECT(widget), "panel");
GtkWidget *panel_sub = gtk_object_get_data(GTK_OBJECT(widget), "panel_sub");
GtkWidget *desktop = gtk_object_get_data(GTK_OBJECT(widget), "desktop");
GtkWidget *desktop_sub = gtk_object_get_data(GTK_OBJECT(widget), "desktop_sub");
GtkWidget *pathentry = gtk_object_get_data(GTK_OBJECT(widget), "path");
char *s;
......@@ -129,54 +136,46 @@ properties_apply_callback(GtkWidget *widget, int page, gpointer data)
else
menu->path = g_strdup(s);
}
if(GTK_TOGGLE_BUTTON(system_off)->active)
menu->main_menu_flags &=~ (MAIN_MENU_SYSTEM|MAIN_MENU_SYSTEM_SUB);
else if(GTK_TOGGLE_BUTTON(system_sub)->active)
menu->main_menu_flags |= MAIN_MENU_SYSTEM|MAIN_MENU_SYSTEM_SUB;
else {
menu->main_menu_flags = 0;
if (GTK_TOGGLE_BUTTON(system_sub)->active)
menu->main_menu_flags |= MAIN_MENU_SYSTEM_SUB;
else if (GTK_TOGGLE_BUTTON(system)->active)
menu->main_menu_flags |= MAIN_MENU_SYSTEM;
menu->main_menu_flags &=~ MAIN_MENU_SYSTEM_SUB;
}
if(GTK_TOGGLE_BUTTON(user_off)->active)
menu->main_menu_flags &=~ (MAIN_MENU_USER|MAIN_MENU_USER_SUB);
else if(GTK_TOGGLE_BUTTON(user_sub)->active)
menu->main_menu_flags |= MAIN_MENU_USER|MAIN_MENU_USER_SUB;
else {
if(GTK_TOGGLE_BUTTON(user_sub)->active)
menu->main_menu_flags |= MAIN_MENU_USER_SUB;
else if (GTK_TOGGLE_BUTTON (user)->active)
menu->main_menu_flags |= MAIN_MENU_USER;
menu->main_menu_flags &=~ MAIN_MENU_USER_SUB;
}
if(GTK_TOGGLE_BUTTON(applets_off)->active)
menu->main_menu_flags &=~ (MAIN_MENU_APPLETS|MAIN_MENU_APPLETS_SUB);
else if(GTK_TOGGLE_BUTTON(applets_sub)->active)
menu->main_menu_flags |= MAIN_MENU_APPLETS|MAIN_MENU_APPLETS_SUB;
else {
if(GTK_TOGGLE_BUTTON(applets_sub)->active)
menu->main_menu_flags |= MAIN_MENU_APPLETS_SUB;
else if (GTK_TOGGLE_BUTTON (applets)->active)
menu->main_menu_flags |= MAIN_MENU_APPLETS;
menu->main_menu_flags &=~ MAIN_MENU_APPLETS_SUB;
}
if(GTK_TOGGLE_BUTTON(redhat_off)->active)
menu->main_menu_flags &=~ (MAIN_MENU_REDHAT|MAIN_MENU_REDHAT_SUB);
else if(GTK_TOGGLE_BUTTON(redhat_sub)->active)
menu->main_menu_flags |= MAIN_MENU_REDHAT|MAIN_MENU_REDHAT_SUB;
else {
if(GTK_TOGGLE_BUTTON(redhat_sub)->active)
menu->main_menu_flags |= MAIN_MENU_REDHAT_SUB;
else if (GTK_TOGGLE_BUTTON (redhat)->active)
menu->main_menu_flags |= MAIN_MENU_REDHAT;
menu->main_menu_flags &=~ MAIN_MENU_REDHAT_SUB;
}
if(GTK_TOGGLE_BUTTON(debian_off)->active)
menu->main_menu_flags &=~ (MAIN_MENU_DEBIAN|MAIN_MENU_DEBIAN_SUB);
else if(GTK_TOGGLE_BUTTON(debian_sub)->active)
menu->main_menu_flags |= MAIN_MENU_DEBIAN|MAIN_MENU_DEBIAN_SUB;
else {
if(GTK_TOGGLE_BUTTON(debian_sub)->active)
menu->main_menu_flags |= MAIN_MENU_DEBIAN_SUB;
else if (GTK_TOGGLE_BUTTON (debian)->active)
menu->main_menu_flags |= MAIN_MENU_DEBIAN;
menu->main_menu_flags &=~ MAIN_MENU_DEBIAN_SUB;
}
if(GTK_TOGGLE_BUTTON(kde_off)->active)
menu->main_menu_flags &=~ (MAIN_MENU_KDE|MAIN_MENU_KDE_SUB);
else if(GTK_TOGGLE_BUTTON(kde_sub)->active)
menu->main_menu_flags |= MAIN_MENU_KDE|MAIN_MENU_KDE_SUB;
else {
if(GTK_TOGGLE_BUTTON(kde_sub)->active)
menu->main_menu_flags |= MAIN_MENU_KDE_SUB;
else if (GTK_TOGGLE_BUTTON (kde)->active)
menu->main_menu_flags |= MAIN_MENU_KDE;
menu->main_menu_flags &=~ MAIN_MENU_KDE_SUB;
}
if(GTK_TOGGLE_BUTTON(panel_sub)->active)
menu->main_menu_flags |= MAIN_MENU_PANEL_SUB;
else if (GTK_TOGGLE_BUTTON(panel)->active)
menu->main_menu_flags |= MAIN_MENU_PANEL;
if(GTK_TOGGLE_BUTTON(desktop_sub)->active)
menu->main_menu_flags |= MAIN_MENU_DESKTOP_SUB;
else if (GTK_TOGGLE_BUTTON(desktop)->active)
menu->main_menu_flags |= MAIN_MENU_DESKTOP;
if(menu->menu)
gtk_widget_destroy(menu->menu);
......@@ -255,11 +254,11 @@ add_menu_type_options(GtkObject *dialog, GtkTable *table, int row,
char *p;
GtkWidget *w;
GtkWidget *rb;
#if 0
/*sanity checks*/
if(!on)
sub = FALSE;
#endif
w = gtk_label_new(title);
gtk_table_attach_defaults(table,w,0,1,row,row+1);
......@@ -268,7 +267,7 @@ add_menu_type_options(GtkObject *dialog, GtkTable *table, int row,
p = g_strconcat(ident,"_off",NULL);
gtk_object_set_data(dialog,p,w);
g_free(p);
if(!on)
if(!on && !sub)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),TRUE);
gtk_signal_connect (GTK_OBJECT (w), "toggled",
GTK_SIGNAL_FUNC (toggle_prop),
......@@ -288,8 +287,9 @@ add_menu_type_options(GtkObject *dialog, GtkTable *table, int row,
w = gtk_radio_button_new_with_label (gtk_radio_button_group(GTK_RADIO_BUTTON(rb)),
_("On the main menu"));
gtk_object_set_data (dialog, ident, w);
gtk_table_attach_defaults(table,w,1,2,row,row+1);
if(on && !sub)
if(on)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),TRUE);
gtk_signal_connect (GTK_OBJECT (w), "toggled",
GTK_SIGNAL_FUNC (toggle_prop),
......@@ -351,7 +351,7 @@ create_properties_dialog(Menu *menu)
gtk_object_set_data(GTK_OBJECT(dialog),"main_frame",f);
gtk_box_pack_start(GTK_BOX(vbox),f,FALSE,FALSE,0);
table = gtk_table_new(5,4,FALSE);
table = gtk_table_new(7,4,FALSE);
gtk_container_set_border_width(GTK_CONTAINER(table),GNOME_PAD_SMALL);
gtk_container_add(GTK_CONTAINER(f),table);
......@@ -379,7 +379,15 @@ create_properties_dialog(Menu *menu)
_("Debian menu (if found): "),"debian",
menu->main_menu_flags&MAIN_MENU_DEBIAN,
menu->main_menu_flags&MAIN_MENU_DEBIAN_SUB);
add_menu_type_options(GTK_OBJECT(dialog),GTK_TABLE(table),6,
_("Panel menu: "),"panel",
menu->main_menu_flags&MAIN_MENU_PANEL,
menu->main_menu_flags&MAIN_MENU_PANEL_SUB);
add_menu_type_options(GTK_OBJECT(dialog),GTK_TABLE(table),7,
_("Desktop menu: "),"desktop",
menu->main_menu_flags&MAIN_MENU_DESKTOP,
menu->main_menu_flags&MAIN_MENU_DESKTOP_SUB);
f = gtk_frame_new(_("Normal menu"));
if(!menu->path || strcmp(menu->path,".")==0)
gtk_widget_set_sensitive(f,FALSE);
......
......@@ -22,6 +22,7 @@
#include "panel-include.h"
#include "panel-widget.h"
#include "tearoffitem.h"
#include "gnome-run.h"
#define TEAROFF_MENUS 1
/*#define PANEL_DEBUG 1*/
......@@ -80,7 +81,7 @@ init_menus(void)
static void
about_cb (GtkWidget *widget, gpointer data)
{
GtkWidget *about;
static GtkWidget *about;
char *authors[] = {
"George Lebl (jirka@5z.com)",
"Jacob Berkman (jberkman@andrew.cmu.edu)",
......@@ -95,16 +96,23 @@ about_cb (GtkWidget *widget, gpointer data)
NULL
};
if (about) {
gdk_window_show (about->window);
gdk_window_raise (about->window);
return;
}
about = gnome_about_new ( _("The GNOME Panel"), VERSION,
"(C) 1998, 1999 the Free Software Foundation",
(const gchar **)authors,
_("This program is responsible for launching "
"other applications, embedding small applets "
"within itself, world peace, and random X crashes."),
"gnome-gegl.png");
"gnome-gegl2.png");
gtk_signal_connect (GTK_OBJECT (about), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&about);
gtk_widget_show (about);
return;
}
static void
......@@ -333,6 +341,8 @@ add_drawers_from_dir(char *dirname, char *name, int pos, PanelWidget *panel)
char *dentry_name;
char *subdir_name;
char *pixmap_name;
char *p;
char *filename = NULL;
GSList *list, *li;
if(!g_file_exists(dirname))
......@@ -362,32 +372,36 @@ add_drawers_from_dir(char *dirname, char *name, int pos, PanelWidget *panel)
list = get_files_from_menudir(dirname);
for(li = list; li!= NULL; li = g_slist_next(li)) {
char *filename = g_concat_dir_and_file(dirname, li->data);
struct stat s;
GnomeDesktopEntry *dentry;
g_free (filename);
g_free(li->data);
if (stat (filename, &s) == 0) {
if (S_ISDIR (s.st_mode)) {
add_drawers_from_dir(filename,NULL,INT_MAX/2,
newpanel);
} else {
char *p = strrchr(filename,'.');
if (p &&
(strcmp(p,".desktop")==0 ||
strcmp(p,".kdelnk")==0)) {
/*we load the applet at the right
side, that is end of the drawer*/
dentry = gnome_desktop_entry_load (filename);
if (dentry)
load_launcher_applet_full (filename,
dentry,
newpanel,
INT_MAX/2);
}
}
filename = g_concat_dir_and_file(dirname, li->data);
if (stat (filename, &s) != 0)
continue;
if (S_ISDIR (s.st_mode)) {
add_drawers_from_dir(filename,NULL,INT_MAX/2,
newpanel);
continue;
}
p = strrchr(filename,'.');
if (p && (strcmp(p,".desktop")==0 ||
strcmp(p,".kdelnk")==0)) {
/*we load the applet at the right
side, that is end of the drawer*/
dentry = gnome_desktop_entry_load (filename);
if (dentry)
load_launcher_applet_full (filename,
dentry,
newpanel,
INT_MAX/2);
}
g_free(filename);
}
g_free(filename);
g_slist_free(list);
}
......@@ -406,20 +420,21 @@ static void
add_menu_to_panel (GtkWidget *widget, gpointer data)
{
MenuFinfo *mf = data;
int flags = MAIN_MENU_SYSTEM|MAIN_MENU_USER|
MAIN_MENU_SYSTEM_SUB|MAIN_MENU_USER_SUB|
MAIN_MENU_APPLETS|MAIN_MENU_APPLETS_SUB;
int flags = MAIN_MENU_SYSTEM_SUB | MAIN_MENU_USER_SUB |
MAIN_MENU_APPLETS_SUB | MAIN_MENU_PANEL_SUB |
MAIN_MENU_DESKTOP_SUB;
/*guess redhat menus*/
if(g_file_exists(REDHAT_MENUDIR))
flags |= MAIN_MENU_REDHAT|MAIN_MENU_REDHAT_SUB;
if (g_file_exists(REDHAT_MENUDIR))
flags |= MAIN_MENU_REDHAT_SUB;
/*guess KDE menus*/
if(g_file_exists(KDE_MENUDIR))
flags |= MAIN_MENU_KDE|MAIN_MENU_KDE_SUB;
flags |= MAIN_MENU_KDE_SUB;
/*guess debian menus*/
if (g_file_exists(DEBIAN_MENUDIR))
flags |= MAIN_MENU_DEBIAN|MAIN_MENU_DEBIAN_SUB;
flags |= MAIN_MENU_DEBIAN_SUB;
if(mf)
load_menu_applet(mf->menudir,flags, current_panel, 0);
......@@ -475,8 +490,10 @@ restore_grabs(GtkWidget *w, gpointer data)
GTK_MENU_SHELL (xgrab_shell)->have_xgrab =
(gdk_pointer_grab (xgrab_shell->window, TRUE,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK,
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK,
NULL, cursor, 0) == 0);
gdk_cursor_destroy (cursor);
}
......@@ -3165,7 +3182,7 @@ static GtkWidget * make_panel_menu(int fake_submenus, int tearoff);
static void
panel_menu_tearoff_new_menu(GtkWidget *w, gpointer data)
{
GtkWidget *menu = make_panel_menu(TRUE,FALSE);
GtkWidget *menu = create_panel_menu (NULL, TRUE, FALSE);
/*set the panel to use as the data*/
gtk_object_set_data(GTK_OBJECT(menu),"menu_panel",current_panel);
......@@ -3176,78 +3193,68 @@ panel_menu_tearoff_new_menu(GtkWidget *w, gpointer data)
show_tearoff_menu(menu, _("Panel"));
}
static void
desktop_menu_tearoff_new_menu (GtkWidget *w, gpointer data)
{
GtkWidget *menu = create_desktop_menu (NULL, TRUE, FALSE);
show_tearoff_menu (menu, _("Desktop"));
}
static GtkWidget *
make_panel_menu(int fake_submenus, int tearoff)
create_panel_submenu(GtkWidget *menu, int fake_submenus, int tearoff)
{
GtkWidget *menuitem;
GtkWidget *panel_menu;
panel_menu = gtk_menu_new();
if (!menu)
menu = gtk_menu_new();
if(tearoff) {
menuitem = tearoff_item_new();
gtk_widget_show(menuitem);
gtk_menu_prepend(GTK_MENU(panel_menu),menuitem);
gtk_menu_prepend (GTK_MENU (menu), menuitem);
gtk_signal_connect(GTK_OBJECT(menuitem),"activate",
GTK_SIGNAL_FUNC(panel_menu_tearoff_new_menu),
NULL);
}
make_panel_submenu(panel_menu,fake_submenus);
make_panel_submenu (menu, fake_submenus);
add_menu_separator (panel_menu);
add_menu_separator (menu);
menuitem = gtk_menu_item_new ();
setup_menuitem (menuitem,
gnome_stock_pixmap_widget(panel_menu,
gnome_stock_pixmap_widget(menu,
GNOME_STOCK_PIXMAP_ABOUT),
_("About..."));
gtk_menu_append (GTK_MENU (panel_menu), menuitem);
_("About the panel..."));
gtk_menu_append (GTK_MENU (menu), menuitem);
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC(about_cb),
NULL);
return panel_menu;
return menu;
}
static void
add_special_entries (GtkWidget *menu, int fake_submenus)
static GtkWidget *
create_desktop_menu (GtkWidget *menu, int fake_submenus, int tearoff)
{
GtkWidget *menuitem;
GtkWidget *panel_menu;
char *char_tmp;
/* Panel entry */
add_menu_separator (menu);
panel_menu = make_panel_menu(fake_submenus,TRUE);
menuitem = gtk_menu_item_new ();
setup_menuitem_try_pixmap (menuitem,
"gnome-panel.png",
_("Panel"));
gtk_menu_append (GTK_MENU (menu), menuitem);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem),panel_menu);
add_menu_separator (menu);
if (!menu)
menu = gtk_menu_new ();
char_tmp = gnome_is_program_in_path("gnome-about");
if(char_tmp) {
menuitem = gtk_menu_item_new ();
setup_menuitem (menuitem,
gnome_stock_pixmap_widget(menu,
GNOME_STOCK_PIXMAP_ABOUT),
_("About GNOME..."));
gtk_menu_append (GTK_MENU (menu), menuitem);
gtk_signal_connect_full(GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC(about_gnome_cb),NULL,
char_tmp, (GtkDestroyNotify)g_free,
FALSE,TRUE);
add_menu_separator (menu);
if(tearoff) {
menuitem = tearoff_item_new();
gtk_widget_show(menuitem);
gtk_menu_prepend (GTK_MENU (menu), menuitem);
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC(desktop_menu_tearoff_new_menu),
NULL);
}
char_tmp = gnome_is_program_in_path ("xscreensaver");
if (char_tmp) {
......@@ -3270,56 +3277,79 @@ add_special_entries (GtkWidget *menu, int fake_submenus)
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC(panel_quit), 0);
setup_internal_applet_drag(menuitem, "LOGOUT:NEW");
char_tmp = gnome_is_program_in_path("gnome-about");
if(char_tmp) {
add_menu_separator (menu);
menuitem = gtk_menu_item_new ();
setup_menuitem (menuitem,
gnome_stock_pixmap_widget(menu,
GNOME_STOCK_PIXMAP_ABOUT),
_("About GNOME..."));
gtk_menu_append (GTK_MENU (menu), menuitem);
gtk_signal_connect_full(GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC(about_gnome_cb),NULL,
char_tmp, (GtkDestroyNotify)g_free,
FALSE,TRUE);
}
return menu;
}
static void
run_cb (GtkWidget *w, gpointer data)
{
show_run_dialog ();
}
static GtkWidget *
create_root_menu(int fake_submenus, int flags)
create_root_menu(int fake_submenus, int flags, int tearoff)
{
GtkWidget *root_menu;
GtkWidget *menu;
GtkWidget *menuitem;
int need_separ = FALSE;