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

Remove tearoff menus, they sucked. We can readd them when we implement

Thu Jan 10 23:27:54 2002  George Lebl <jirka@5z.com>

	* Makefile.am, foobar-widget.c, menu.[ch], panel-config.c,
	  panel-util.c, panel.c, session.c, tearoffitem.[ch]:
	  Remove tearoff menus, they sucked.  We can readd them when
	  we implement them properly.

	* gnome-run.c:  Port to TreeView, so we are now completely
	  de-deprecated.  Also read from all-applications:/  To
	  actually allways get all entries.
parent 1abec36f
Thu Jan 10 23:27:54 2002 George Lebl <jirka@5z.com>
* Makefile.am, foobar-widget.c, menu.[ch], panel-config.c,
panel-util.c, panel.c, session.c, tearoffitem.[ch]:
Remove tearoff menus, they sucked. We can readd them when
we implement them properly.
* gnome-run.c: Port to TreeView, so we are now completely
de-deprecated. Also read from all-applications:/ To
actually allways get all entries.
2002-01-11 Glynn Foster <glynn.foster@sun.com> 2002-01-11 Glynn Foster <glynn.foster@sun.com>
* applet.c, drawer.c, drawer.h, gnome-panel-properties.c, * applet.c, drawer.c, drawer.h, gnome-panel-properties.c,
......
...@@ -73,7 +73,6 @@ panel_sources = \ ...@@ -73,7 +73,6 @@ panel_sources = \
sliding-widget.c \ sliding-widget.c \
floating-widget.c \ floating-widget.c \
rgb-stuff.c \ rgb-stuff.c \
tearoffitem.c \
panel.c \ panel.c \
applet.c \ applet.c \
logout.c \ logout.c \
...@@ -113,7 +112,6 @@ panel_headers = \ ...@@ -113,7 +112,6 @@ panel_headers = \
sliding-widget.h \ sliding-widget.h \
floating-widget.h \ floating-widget.h \
rgb-stuff.h \ rgb-stuff.h \
tearoffitem.h \
panel.h \ panel.h \
applet.h \ applet.h \
logout.h \ logout.h \
......
...@@ -128,17 +128,6 @@ pixmap_menu_item_new (const char *text, const char *try_file, gboolean force_ima ...@@ -128,17 +128,6 @@ pixmap_menu_item_new (const char *text, const char *try_file, gboolean force_ima
return item; return item;
} }
static void
add_tearoff (GtkMenuShell *menu)
{
GtkWidget *item;
item = gtk_tearoff_menu_item_new ();
if (panel_menu_have_tearoff ())
gtk_widget_show (item);
gtk_menu_shell_prepend (menu, item);
}
static gboolean static gboolean
foobar_leave_notify (GtkWidget *widget, foobar_leave_notify (GtkWidget *widget,
GdkEventCrossing *event) GdkEventCrossing *event)
...@@ -183,8 +172,6 @@ append_actions_menu (GtkWidget *menu_bar) ...@@ -183,8 +172,6 @@ append_actions_menu (GtkWidget *menu_bar)
menu = panel_menu_new (); menu = panel_menu_new ();
add_tearoff (GTK_MENU_SHELL (menu));
menu = panel_menu_new (); menu = panel_menu_new ();
item = pixmap_menu_item_new (_("Run..."), "gnome-run.png", item = pixmap_menu_item_new (_("Run..."), "gnome-run.png",
...@@ -225,8 +212,6 @@ append_actions_menu (GtkWidget *menu_bar) ...@@ -225,8 +212,6 @@ append_actions_menu (GtkWidget *menu_bar)
G_CALLBACK (panel_quit), 0); G_CALLBACK (panel_quit), 0);
setup_internal_applet_drag (item, "LOGOUT:NEW"); setup_internal_applet_drag (item, "LOGOUT:NEW");
add_tearoff (GTK_MENU_SHELL (menu));
item = gtk_menu_item_new_with_label (_("Actions")); item = gtk_menu_item_new_with_label (_("Actions"));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), item); gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), item);
...@@ -496,14 +481,10 @@ append_clock_menu (FoobarWidget *foo, GtkWidget *menu_bar) ...@@ -496,14 +481,10 @@ append_clock_menu (FoobarWidget *foo, GtkWidget *menu_bar)
menu2 = panel_menu_new (); menu2 = panel_menu_new ();
append_format_items (menu2); append_format_items (menu2);
add_tearoff (GTK_MENU_SHELL (menu2));
item = gtk_image_menu_item_new_with_label (_("Format")); item = gtk_image_menu_item_new_with_label (_("Format"));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu2); gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu2);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
add_tearoff (GTK_MENU_SHELL (menu));
item = gtk_menu_item_new (); item = gtk_menu_item_new ();
foo->clock_label = gtk_label_new (""); foo->clock_label = gtk_label_new ("");
...@@ -617,7 +598,7 @@ programs_menu_to_display (GtkWidget *menu) ...@@ -617,7 +598,7 @@ programs_menu_to_display (GtkWidget *menu)
flags |= MAIN_MENU_KDE_SUB; flags |= MAIN_MENU_KDE_SUB;
if (got_distro_menus ()) if (got_distro_menus ())
flags |= MAIN_MENU_DISTRIBUTION_SUB; flags |= MAIN_MENU_DISTRIBUTION_SUB;
create_root_menu (menu, TRUE, flags, TRUE, FALSE, FALSE /* run_item */); create_root_menu (menu, TRUE, flags, FALSE, FALSE /* run_item */);
} }
} }
...@@ -1061,7 +1042,7 @@ foobar_widget_instance_init (FoobarWidget *foo) ...@@ -1061,7 +1042,7 @@ foobar_widget_instance_init (FoobarWidget *foo)
if (got_distro_menus ()) if (got_distro_menus ())
flags |= MAIN_MENU_DISTRIBUTION_SUB; flags |= MAIN_MENU_DISTRIBUTION_SUB;
menu = create_root_menu (NULL, TRUE, flags, TRUE, FALSE, FALSE /* run_item */); menu = create_root_menu (NULL, TRUE, flags, FALSE, FALSE /* run_item */);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), menuitem);
g_signal_connect (G_OBJECT (menu), "show", g_signal_connect (G_OBJECT (menu), "show",
......
This diff is collapsed.
This diff is collapsed.
...@@ -73,8 +73,7 @@ void make_panel_submenu (GtkWidget *menu, ...@@ -73,8 +73,7 @@ void make_panel_submenu (GtkWidget *menu,
gboolean fake_submenus, gboolean fake_submenus,
gboolean is_basep); gboolean is_basep);
GtkWidget * create_panel_root_menu (PanelWidget *panel, GtkWidget * create_panel_root_menu (PanelWidget *panel);
gboolean tearoff);
void menu_properties (Menu *menu); void menu_properties (Menu *menu);
...@@ -84,9 +83,6 @@ void panel_lock (GtkWidget *widget, ...@@ -84,9 +83,6 @@ void panel_lock (GtkWidget *widget,
/*to be called on startup to load in some of the directories*/ /*to be called on startup to load in some of the directories*/
void init_menus (void); void init_menus (void);
void panel_menu_session_save_tornoffs (void);
void panel_menu_session_load_tornoffs (void);
GtkWidget * create_menu_at (GtkWidget *menu, GtkWidget * create_menu_at (GtkWidget *menu,
const char *menudir, const char *menudir,
gboolean applets, gboolean applets,
...@@ -109,7 +105,6 @@ void setup_internal_applet_drag (GtkWidget *menuitem, ...@@ -109,7 +105,6 @@ void setup_internal_applet_drag (GtkWidget *menuitem,
GtkWidget * create_root_menu (GtkWidget *root_menu, GtkWidget * create_root_menu (GtkWidget *root_menu,
gboolean fake_submenus, gboolean fake_submenus,
int flags, int flags,
gboolean tearoff,
gboolean is_basep, gboolean is_basep,
gboolean run_item); gboolean run_item);
...@@ -133,8 +128,6 @@ enum { ...@@ -133,8 +128,6 @@ enum {
#define PANEL_MENU_HAVE_ICONS_KEY "/desktop/gnome/menus/show-icons" #define PANEL_MENU_HAVE_ICONS_KEY "/desktop/gnome/menus/show-icons"
gboolean panel_menu_have_icons (void); gboolean panel_menu_have_icons (void);
#define PANEL_MENU_HAVE_TEAROFF_KEY "/desktop/gnome/interface/menus-have-tearoff"
gboolean panel_menu_have_tearoff (void);
GtkWidget * panel_menu_new (void); GtkWidget * panel_menu_new (void);
void panel_load_menu_image_deferred (GtkWidget *image_menu_item, void panel_load_menu_image_deferred (GtkWidget *image_menu_item,
......
#include <string.h> #include <string.h>
#include <math.h>
#include <libgnomecanvas/libgnomecanvas.h> #include <libgnomecanvas/libgnomecanvas.h>
#include "panel-util.h" #include "panel-util.h"
#include "rgb-stuff.h" #include "rgb-stuff.h"
...@@ -1357,3 +1358,118 @@ start_geginv (void) ...@@ -1357,3 +1358,118 @@ start_geginv (void)
gtk_widget_show_all (geginv); gtk_widget_show_all (geginv);
} }
static gboolean
move_window_handler (gpointer data)
{
int x, y, sx, sy, wx, wy, foox, fooy;
GtkWidget *win = data;
data = g_object_get_data (G_OBJECT (win), "move_speed_x");
sx = GPOINTER_TO_INT (data);
data = g_object_get_data (G_OBJECT (win), "move_speed_y");
sy = GPOINTER_TO_INT (data);
gdk_window_get_pointer (NULL, &x, &y, NULL);
wx = win->allocation.x;
wy = win->allocation.y;
foox = wx + (win->allocation.width / 2);
fooy = wy + (win->allocation.height / 2);
if (sqrt ((foox - x)*(foox - x) + (fooy - y)*(fooy - y)) <
MAX (win->allocation.width, win->allocation.height)) {
if (foox < x) sx -= 5;
else sx += 5;
if (fooy < y) sy -= 5;
else sy += 5;
} else {
sx /= 2;
sy /= 2;
}
if (sx > 50) sx = 50;
else if (sx < -50) sx = -50;
if (sy > 50) sy = 50;
else if (sy < -50) sy = -50;
wx += sx;
wy += sy;
if (wx < 0) wx = 0;
if (wy < 0) wy = 0;
if (wx + win->allocation.width > gdk_screen_width ())
wx = gdk_screen_width () - win->allocation.width;
if (wy + win->allocation.height > gdk_screen_height ())
wy = gdk_screen_height () - win->allocation.height;
gtk_window_move (GTK_WINDOW (win), wx, wy);
win->allocation.x = wx;
win->allocation.y = wy;
data = GINT_TO_POINTER (sx);
g_object_set_data (G_OBJECT (win), "move_speed_x", data);
data = GINT_TO_POINTER (sy);
g_object_set_data (G_OBJECT (win), "move_speed_y", data);
return TRUE;
}
static void
move_window_destroyed (GtkWidget *win)
{
gpointer data = g_object_get_data (G_OBJECT (win), "move_window_handler");
int handler = GPOINTER_TO_INT (data);
if (handler != 0)
gtk_timeout_remove (handler);
g_object_set_data (G_OBJECT (win), "move_window_handler", NULL);
}
static void
doblah (GtkWidget *window)
{
gpointer data = g_object_get_data (G_OBJECT (window), "move_window_handler");
int handler = GPOINTER_TO_INT (data);
if (handler == 0) {
handler = gtk_timeout_add (30, move_window_handler, window);
data = GINT_TO_POINTER (handler);
g_object_set_data (G_OBJECT (window), "move_window_handler", data);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (move_window_destroyed),
NULL);
}
}
gboolean
panel_dialog_window_event (GtkWidget *window,
GdkEvent *event)
{
switch (event->type) {
static int foo = 0;
case GDK_KEY_PRESS:
if((event->key.state & GDK_CONTROL_MASK) && foo < 4) {
switch (event->key.keyval) {
case GDK_r:
case GDK_R:
if(foo == 3) { doblah (window); } foo = 0; break;
case GDK_a:
case GDK_A:
if(foo == 2) { foo++; } else { foo = 0; } break;
case GDK_e:
case GDK_E:
if(foo == 1) { foo++; } else { foo = 0; } break;
case GDK_f:
case GDK_F:
if(foo == 0) { foo++; } else { foo = 0; } break;
default:
foo = 0;
}
}
default:
break;
}
return FALSE;
}
...@@ -7,6 +7,8 @@ G_BEGIN_DECLS ...@@ -7,6 +7,8 @@ G_BEGIN_DECLS
void start_screen_check (void); void start_screen_check (void);
void start_geginv (void); void start_geginv (void);
gboolean panel_dialog_window_event (GtkWidget *window,
GdkEvent *event);
G_END_DECLS G_END_DECLS
......
...@@ -1589,6 +1589,9 @@ panel_config (GtkWidget *panel) ...@@ -1589,6 +1589,9 @@ panel_config (GtkWidget *panel)
GTK_STOCK_CLOSE, GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE, GTK_RESPONSE_CLOSE,
NULL); NULL);
gtk_widget_add_events (ppc->config_window, GDK_KEY_PRESS_MASK);
g_signal_connect (G_OBJECT (ppc->config_window), "event",
G_CALLBACK (panel_dialog_window_event), NULL);
gtk_window_set_wmclass (GTK_WINDOW (ppc->config_window), gtk_window_set_wmclass (GTK_WINDOW (ppc->config_window),
"panel_properties", "Panel"); "panel_properties", "Panel");
gtk_widget_set_events (ppc->config_window, gtk_widget_set_events (ppc->config_window,
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "panel-util.h" #include "panel-util.h"
#include "applet.h" #include "applet.h"
#include "nothing.h"
#include "panel-config-global.h" #include "panel-config-global.h"
extern GlobalConfig global_config; extern GlobalConfig global_config;
...@@ -717,6 +718,9 @@ panel_error_dialog (const char *class, ...@@ -717,6 +718,9 @@ panel_error_dialog (const char *class,
w = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, w = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK, s); GTK_BUTTONS_OK, s);
gtk_widget_add_events (w, GDK_KEY_PRESS_MASK);
g_signal_connect (G_OBJECT (w), "event",
G_CALLBACK (panel_dialog_window_event), NULL);
gtk_window_set_wmclass (GTK_WINDOW (w), gtk_window_set_wmclass (GTK_WINDOW (w),
class, "Panel"); class, "Panel");
g_free (s); g_free (s);
...@@ -750,6 +754,8 @@ panel_info_dialog (const char *class, ...@@ -750,6 +754,8 @@ panel_info_dialog (const char *class,
w = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, w = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO,
GTK_BUTTONS_OK, s); GTK_BUTTONS_OK, s);
g_signal_connect (G_OBJECT (w), "event",
G_CALLBACK (panel_dialog_window_event), NULL);
gtk_window_set_wmclass (GTK_WINDOW (w), gtk_window_set_wmclass (GTK_WINDOW (w),
class, "Panel"); class, "Panel");
g_free (s); g_free (s);
...@@ -1294,6 +1300,9 @@ panel_signal_connect_object_while_alive (GObject *object, ...@@ -1294,6 +1300,9 @@ panel_signal_connect_object_while_alive (GObject *object,
FALSE); FALSE);
} }
#if 0
/* hmmm, we need to use this I think to add a battery applet
* -George */
/* Linux Battery Stuff */ /* Linux Battery Stuff */
static gboolean static gboolean
...@@ -1368,3 +1377,4 @@ battery_exists (void) ...@@ -1368,3 +1377,4 @@ battery_exists (void)
#endif #endif
} }
#endif
...@@ -681,7 +681,7 @@ panel_menu_get (PanelWidget *panel, PanelData *pd) ...@@ -681,7 +681,7 @@ panel_menu_get (PanelWidget *panel, PanelData *pd)
if (pd->menu != NULL) if (pd->menu != NULL)
return pd->menu; return pd->menu;
pd->menu = create_panel_root_menu (panel, TRUE); pd->menu = create_panel_root_menu (panel);
g_signal_connect (G_OBJECT (pd->menu), "deactivate", g_signal_connect (G_OBJECT (pd->menu), "deactivate",
G_CALLBACK (menu_deactivate), pd); G_CALLBACK (menu_deactivate), pd);
return pd->menu; return pd->menu;
......
...@@ -152,11 +152,7 @@ panel_session_do_save (GnomeClient *client, ...@@ -152,11 +152,7 @@ panel_session_do_save (GnomeClient *client,
if (save_panels) if (save_panels)
for (l = panel_list; l; l = l->next) for (l = panel_list; l; l = l->next)
panel_session_save_panel ((PanelData *) l->data); panel_session_save_panel ((PanelData *) l->data);
#ifdef FIXME
/* We need to do tornoff's still */
if (complete_save)
panel_menu_session_save_tornoffs ();
#endif
if (save_applets) { if (save_applets) {
session_unlink_dead_launchers (); session_unlink_dead_launchers ();
...@@ -392,9 +388,5 @@ void session_load (void) { ...@@ -392,9 +388,5 @@ void session_load (void) {
init_menus (); init_menus ();
panel_session_init_panels (); panel_session_init_panels ();
/* FIXME: We still need to load up possible tearoffs
panel_menu_session_load_tornoffs
*/
panel_applet_load_applets_from_gconf (); panel_applet_load_applets_from_gconf ();
} }
#include "config.h"
#include <libgnome/libgnome.h>
#include <gconf/gconf-client.h>
#include "menu.h"
#include "tearoffitem.h"
static void tearoff_item_class_init (TearoffItemClass *klass);
static void tearoff_item_instance_init (TearoffItem *tearoff_menu_item);
GType
tearoff_item_get_type (void)
{
static GType object_type = 0;
if (object_type == 0) {
static const GTypeInfo object_info = {
sizeof (TearoffItemClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) tearoff_item_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (TearoffItem),
0, /* n_preallocs */
(GInstanceInitFunc) tearoff_item_instance_init
};
object_type = g_type_register_static (GTK_TYPE_TEAROFF_MENU_ITEM, "TearoffItem", &object_info, 0);
}
return object_type;
}
GtkWidget*
tearoff_item_new (void)
{
g_return_val_if_fail (panel_menu_have_tearoff (), NULL);
return GTK_WIDGET (g_object_new (tearoff_item_get_type (), NULL));
}
static void
tearoff_item_class_init(TearoffItemClass *klass)
{
GtkMenuItemClass *menu_item_class;
menu_item_class = (GtkMenuItemClass*) klass;
menu_item_class->activate = NULL;
}
static void
tearoff_item_instance_init(TearoffItem *tearoff_menu_item)
{
/* Empty */
}
#ifndef TEAROFF_ITEM_H
#define TEAROFF_ITEM_H
#include <gtk/gtk.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define TEAROFF_TYPE_ITEM (tearoff_item_get_type())
#define TEAROFF_ITEM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TEAROFF_TYPE_ITEM, TearoffItem))
#define TEAROFF_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEAROFF_TYPE_ITEM, TearoffItemClass))
#define TEAROFF_IS_ITEM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEAROFF_TYPE_ITEM))
#define TEAROFF_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEAROFF_TYPE_ITEM))
typedef struct _TearoffItem TearoffItem;
typedef struct _TearoffItemClass TearoffItemClass;
struct _TearoffItem
{
GtkTearoffMenuItem tearoff_menu_item;
};
struct _TearoffItemClass
{
GtkTearoffMenuItemClass parent_class;
};
GType tearoff_item_get_type (void);
GtkWidget* tearoff_item_new (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* TEAROFF_ITEM_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment