comparison finch/libgnt/gntwm.c @ 16518:403332494b92

Move the toggle-clipboard operation to the default wm.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 27 Apr 2007 13:15:09 +0000
parents 82b6fdd899a9
children f1abdde52538 3af867ef5a15
comparison
equal deleted inserted replaced
16517:62d083364deb 16518:403332494b92
903 draw_taskbar(wm, TRUE); 903 draw_taskbar(wm, TRUE);
904 904
905 return FALSE; 905 return FALSE;
906 } 906 }
907 907
908 static gboolean
909 toggle_clipboard(GntBindable *bindable, GList *n)
910 {
911 static GntWidget *clip;
912 gchar *text;
913 int maxx, maxy;
914 if (clip) {
915 gnt_widget_destroy(clip);
916 clip = NULL;
917 return TRUE;
918 }
919 getmaxyx(stdscr, maxy, maxx);
920 text = gnt_get_clipboard_string();
921 clip = gnt_hwindow_new(FALSE);
922 GNT_WIDGET_SET_FLAGS(clip, GNT_WIDGET_TRANSIENT);
923 GNT_WIDGET_SET_FLAGS(clip, GNT_WIDGET_NO_BORDER);
924 gnt_box_set_pad(GNT_BOX(clip), 0);
925 gnt_box_add_widget(GNT_BOX(clip), gnt_label_new(" "));
926 gnt_box_add_widget(GNT_BOX(clip), gnt_label_new(text));
927 gnt_box_add_widget(GNT_BOX(clip), gnt_label_new(" "));
928 gnt_widget_set_position(clip, 0, 0);
929 gnt_widget_draw(clip);
930 g_free(text);
931 return TRUE;
932 }
933
908 static void 934 static void
909 gnt_wm_class_init(GntWMClass *klass) 935 gnt_wm_class_init(GntWMClass *klass)
910 { 936 {
911 int i; 937 int i;
912 938
1037 "\033" GNT_KEY_CTRL_J, NULL); 1063 "\033" GNT_KEY_CTRL_J, NULL);
1038 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-scroll-up", window_scroll_up, 1064 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-scroll-up", window_scroll_up,
1039 "\033" GNT_KEY_CTRL_K, NULL); 1065 "\033" GNT_KEY_CTRL_K, NULL);
1040 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "help-for-widget", help_for_widget, 1066 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "help-for-widget", help_for_widget,
1041 "\033" "/", NULL); 1067 "\033" "/", NULL);
1068 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "toggle-clipboard",
1069 toggle_clipboard, "\033" "C", NULL);
1042 1070
1043 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass)); 1071 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass));
1044 1072
1045 /* Make sure Alt+x are detected properly. */ 1073 /* Make sure Alt+x are detected properly. */
1046 for (i = '0'; i <= '9'; i++) { 1074 for (i = '0'; i <= '9'; i++) {