changeset 14979:f719225f988e

[gaim-migrate @ 17757] show-menu action for a window. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 16 Nov 2006 03:17:27 +0000
parents e601bc7880a6
children c157efddc62a
files console/libgnt/gntstyle.c console/libgnt/gntwindow.c doc/gaim-text.1.in
diffstat 3 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/console/libgnt/gntstyle.c	Thu Nov 16 00:27:30 2006 +0000
+++ b/console/libgnt/gntstyle.c	Thu Nov 16 03:17:27 2006 +0000
@@ -46,7 +46,8 @@
 	return bool_styles[style];
 }
 
-void refine(char *text)
+static void
+refine(char *text)
 {
 	char *s = text, *t = text;
 
--- a/console/libgnt/gntwindow.c	Thu Nov 16 00:27:30 2006 +0000
+++ b/console/libgnt/gntwindow.c	Thu Nov 16 03:17:27 2006 +0000
@@ -9,18 +9,17 @@
 
 static GntBoxClass *parent_class = NULL;
 
-static gboolean (*org_keypress)(GntWidget *widget, const char *text);
 static void (*org_destroy)(GntWidget *widget);
 
 static gboolean
-gnt_window_key_pressed(GntWidget *widget, const char *text)
+show_menu(GntBindable *bind, GList *null)
 {
-	if (strcmp(text, GNT_KEY_CTRL_O) == 0 && GNT_WINDOW(widget)->menu) {
-		gnt_screen_menu_show(GNT_WINDOW(widget)->menu);
+	GntWindow *win = GNT_WINDOW(bind);
+	if (win->menu) {
+		gnt_screen_menu_show(win->menu);
 		return TRUE;
-	} else
-		return org_keypress(widget, text);
-		
+	}
+	return FALSE;
 }
 
 static void
@@ -35,15 +34,17 @@
 static void
 gnt_window_class_init(GntWindowClass *klass)
 {
+	GntBindableClass *bindable = GNT_BINDABLE_CLASS(klass);
 	GntWidgetClass *wid_class = GNT_WIDGET_CLASS(klass);
 	parent_class = GNT_BOX_CLASS(klass);
 
-	org_keypress = wid_class->key_pressed;
-	wid_class->key_pressed = gnt_window_key_pressed;
-
 	org_destroy = wid_class->destroy;
 	wid_class->destroy = gnt_window_destroy;
 
+	gnt_bindable_class_register_action(bindable, "show-menu", show_menu,
+				GNT_KEY_CTRL_O, NULL);
+	gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), bindable);
+
 	GNTDEBUG;
 }
 
--- a/doc/gaim-text.1.in	Thu Nov 16 00:27:30 2006 +0000
+++ b/doc/gaim-text.1.in	Thu Nov 16 03:17:27 2006 +0000
@@ -261,6 +261,11 @@
 # The following will let you open the context-menu in the buddylist with c-b
 .br
 c-b = context-menu
+.br
+
+[GntWindow::binding]
+.br
+c-o = show-menu
 
 The \fBc-\fR corresponds to the \fBControl\fR key. You can also use \fBctrl-\fR
 or \fBctr-\fR or \fBctl-\fR to indicate a combination. For alt-keys, you can use