Only in .: gnome-libs.patch diff -ru ./libgnomeui/gnome-app.c ../diff/gnome-libs-1.2.8/libgnomeui/gnome-app.c --- ./libgnomeui/gnome-app.c Thu Sep 21 07:45:17 2000 +++ ../diff/gnome-libs-1.2.8/libgnomeui/gnome-app.c Mon Dec 4 13:43:47 2000 @@ -18,7 +18,11 @@ #include "config.h" #include +#include +#include #include +#include +#include #include "libgnome/gnome-defs.h" #include "libgnome/gnome-i18nP.h" #include "libgnome/gnome-util.h" @@ -27,9 +31,11 @@ #include "libgnomeui/gnome-preferences.h" #include "libgnomeui/gnome-dock.h" #include "libgnomeui/gnome-window-icon.h" +#include "libgnorba/gnorba.h" #include "gnome-app.h" + #define LAYOUT_CONFIG_PATH "Placement/Dock" static void gnome_app_class_init (GnomeAppClass *class); @@ -43,6 +49,7 @@ static GtkWindowClass *parent_class; + static gchar * read_layout_config (GnomeApp *app) { @@ -131,11 +138,13 @@ app->enable_layout_config = TRUE; gnome_window_icon_set_from_default (GTK_WINDOW (app)); } + static void gnome_app_show (GtkWidget *widget) { GnomeApp *app; + GtkWidget *menu; app = GNOME_APP (widget); @@ -162,6 +171,10 @@ gtk_widget_show (app->vbox); gtk_widget_show (app->dock); + menu = gtk_object_get_data (GTK_OBJECT (app), "menu"); + + if (menu) + gtk_widget_show (menu); if (GTK_WIDGET_CLASS (parent_class)->show != NULL) (*GTK_WIDGET_CLASS (parent_class)->show) (widget); @@ -213,6 +226,7 @@ return GTK_WIDGET (app); } + /** * gnome_app_construct * @app: Pointer to newly-created GNOME app object. @@ -239,6 +253,7 @@ gnome_app_destroy (GtkObject *object) { GnomeApp *app; + GtkWidget *menu; g_return_if_fail (object != NULL); g_return_if_fail (GNOME_IS_APP (object)); @@ -257,6 +272,11 @@ app->layout = NULL; } + menu = gtk_object_get_data (GTK_OBJECT (app), "menu"); + + if (menu) + gtk_widget_destroy (menu); + if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -322,13 +342,16 @@ * Description: * Sets the menu bar of the application window. **/ - void gnome_app_set_menus (GnomeApp *app, GtkMenuBar *menubar) { + GtkWidget *prevbar; GtkWidget *dock_item; + GtkWidget *menu; GtkAccelGroup *ag; GnomeDockItemBehavior behavior; + GnomeMenubarPlacement placement = gnome_preferences_get_menubar_placement(); + long data; g_return_if_fail(app != NULL); g_return_if_fail(GNOME_IS_APP(app)); @@ -336,6 +359,45 @@ g_return_if_fail(menubar != NULL); g_return_if_fail(GTK_IS_MENU_BAR(menubar)); + prevbar = app->menubar; + app->menubar = GTK_WIDGET (menubar); + gtk_widget_show (GTK_WIDGET (menubar)); + + ag = gtk_object_get_data(GTK_OBJECT(app), "GtkAccelGroup"); + if (ag && !g_slist_find(gtk_accel_groups_from_object (GTK_OBJECT (app)), ag)) + gtk_window_add_accel_group(GTK_WINDOW(app), ag); + + if (placement == GNOME_MENUBAR_PLACEMENT_GLOBAL) { + gtk_menu_bar_set_shadow_type (GTK_MENU_BAR (app->menubar), GTK_SHADOW_NONE); + menu = gtk_object_get_data (GTK_OBJECT (app), "menu"); + if (!menu) { + menu = gtk_window_new (GTK_WINDOW_DIALOG); + gtk_window_set_default_size (GTK_WINDOW(menu), + gdk_screen_width(), + 1); + gtk_object_set_data (GTK_OBJECT (app), "menu", menu); + gtk_container_add (GTK_CONTAINER (menu), + GTK_WIDGET(menubar)); + gtk_widget_realize (menu); + + if (!GTK_WIDGET_REALIZED (GTK_WIDGET (app))) + gtk_widget_realize (GTK_WIDGET (app)); + gtk_window_set_transient_for (GTK_WINDOW (menu), + GTK_WINDOW (app)); + data = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_MENU", + FALSE); + gdk_property_change (menu->window, + gdk_atom_intern ("_NET_WM_WINDOW_TYPE", FALSE), + XA_ATOM, 32, GDK_PROP_MODE_REPLACE, + (unsigned char *)&data, 1); + } else { + gtk_container_remove (GTK_CONTAINER (menu), GTK_WIDGET(prevbar)); + gtk_container_add (GTK_CONTAINER (menu), GTK_WIDGET(menubar)); + } + return; + } + + behavior = (GNOME_DOCK_ITEM_BEH_EXCLUSIVE | GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL); @@ -346,11 +408,10 @@ behavior); gtk_container_add (GTK_CONTAINER (dock_item), GTK_WIDGET (menubar)); - app->menubar = GTK_WIDGET (menubar); - - /* To have menubar relief agree with the toolbar (and have the relief outside of - * smaller handles), substitute the dock item's relief for the menubar's relief, - * but don't change the size of the menubar in the process. */ + /* To have menubar relief agree with the toolbar (and have the + * relief outside of smaller handles), substitute the dock + * item's relief for the menubar's relief, but don't change + * the size of the menubar in the process. */ gtk_menu_bar_set_shadow_type (GTK_MENU_BAR (app->menubar), GTK_SHADOW_NONE); if (gnome_preferences_get_menubar_relief ()) { guint border_width; @@ -375,12 +436,7 @@ GNOME_DOCK_TOP, 0, 0, 0, TRUE); - gtk_widget_show (GTK_WIDGET (menubar)); gtk_widget_show (GTK_WIDGET (dock_item)); - - ag = gtk_object_get_data(GTK_OBJECT(app), "GtkAccelGroup"); - if (ag && !g_slist_find(gtk_accel_groups_from_object (GTK_OBJECT (app)), ag)) - gtk_window_add_accel_group(GTK_WINDOW(app), ag); } diff -ru ./libgnomeui/gnome-preferences.c ../diff/gnome-libs-1.2.8/libgnomeui/gnome-preferences.c --- ./libgnomeui/gnome-preferences.c Sun Jul 4 14:27:32 1999 +++ ../diff/gnome-libs-1.2.8/libgnomeui/gnome-preferences.c Sun Oct 29 04:41:55 2000 @@ -47,6 +47,7 @@ TRUE, /* Menus have a tearoff bar */ TRUE, /* Menu items have icons in them */ TRUE, /* Disable the Imlib cache */ + GNOME_MENUBAR_PLACEMENT_LOCAL, /* Menubar Placement */ GTK_WINDOW_DIALOG, /* Dialogs are treated specially */ GTK_WIN_POS_CENTER, /* Put dialogs in center of screen. */ GNOME_MDI_NOTEBOOK, /* Use notebook MDI mode. */ @@ -118,6 +119,15 @@ #define STATUSBAR_INTERACTIVE_KEY "StatusBar_is_Interactive" #define STATUSBAR_METER_ON_RIGHT "StatusBar_Meter_on_Right" +#define MENUBAR_PLACEMENT_KEY "MenubarPlacement" + +static const gchar * const menubar_placements [] = { + "Local", + "Global" +}; + +#define NUM_MENUBAR_PLACEMENTS 2 + #define MENUBAR_DETACHABLE_KEY "Menubar_detachable" #define MENUBAR_RELIEF_KEY "Menubar_relieved" @@ -268,6 +278,15 @@ gnome_config_pop_prefix(); gnome_config_push_prefix(APP); + s = gnome_config_get_string(MENUBAR_PLACEMENT_KEY); + + if ( ! enum_from_strings((int*) &settings->menubar_placement, s, + menubar_placements, NUM_MENUBAR_PLACEMENTS) ) { + g_warning("Didn't recognize menubar placement in libgnomeui config"); + } + + g_free(s); + b = gnome_config_get_bool_with_default(MENUBAR_DETACHABLE_KEY"=true", NULL); settings->menubar_detachable = b; @@ -375,6 +394,8 @@ gnome_config_pop_prefix(); gnome_config_push_prefix(APP); + gnome_config_set_string(MENUBAR_PLACEMENT_KEY, + menubar_placements[settings->menubar_placement]); gnome_config_set_bool(MENUBAR_DETACHABLE_KEY, settings->menubar_detachable); gnome_config_set_bool(MENUBAR_RELIEF_KEY, @@ -552,6 +573,20 @@ gnome_preferences_set_statusbar_meter_on_right (gboolean statusbar_meter_on_right) { prefs.statusbar_meter_on_right = statusbar_meter_on_right; +} + + +/* Placement of the menu bars, either global (contained in an applet) + or local (contained the application window). */ +GnomeMenubarPlacement + gnome_preferences_get_menubar_placement (void) +{ + return prefs.menubar_placement; +} + +void gnome_preferences_set_menubar_placement (GnomeMenubarPlacement p) +{ + prefs.menubar_placement = p; } diff -ru ./libgnomeui/gnome-preferences.h ../diff/gnome-libs-1.2.8/libgnomeui/gnome-preferences.h --- ./libgnomeui/gnome-preferences.h Mon Jan 18 19:06:29 1999 +++ ../diff/gnome-libs-1.2.8/libgnomeui/gnome-preferences.h Sun Oct 29 04:44:06 2000 @@ -15,6 +15,12 @@ BEGIN_GNOME_DECLS +/* Menu Placement */ +typedef enum { + GNOME_MENUBAR_PLACEMENT_LOCAL, + GNOME_MENUBAR_PLACEMENT_GLOBAL +}GnomeMenubarPlacement; + /* Global config choices. App-specific choices are handled in GnomeApp. */ typedef struct _GnomePreferences GnomePreferences; @@ -39,6 +45,7 @@ int menus_have_tearoff : 1; int menus_have_icons : 1; int disable_imlib_cache : 1; + GnomeMenubarPlacement menubar_placement; GtkWindowType dialog_type; GtkWindowPosition dialog_position; GnomeMDIMode mdi_mode; @@ -70,6 +77,11 @@ gboolean gnome_preferences_get_statusbar_meter_on_right (void); void gnome_preferences_set_statusbar_meter_on_right (gboolean status_meter_on_right); +/* Placement of the menu bars, either global (contained in an applet) + or local (contained the application window). */ +GnomeMenubarPlacement + gnome_preferences_get_menubar_placement (void); +void gnome_preferences_set_menubar_placement (GnomeMenubarPlacement p); /* Whether menubars can be detached */ gboolean gnome_preferences_get_menubar_detachable (void);