comparison console/libgnt/gntmain.c @ 15751:0eb7846f9e7e

Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste). If you use the s.so WM, pressing alt-shift-c ("toggle-clipboard") will toggle display of the clipboard contents in a possibly easy-to-copy-with-the-x-mouse window. This includes a plugin which interacts with the X selection, which is not built by default.
author Richard Nelson <wabz@pidgin.im>
date Fri, 02 Mar 2007 01:48:11 +0000
parents acc8a838ad94
children c2c2a854f5b3
comparison
equal deleted inserted replaced
15750:f403bc58ba07 15751:0eb7846f9e7e
8 #include <gmodule.h> 8 #include <gmodule.h>
9 9
10 #include "gnt.h" 10 #include "gnt.h"
11 #include "gntbox.h" 11 #include "gntbox.h"
12 #include "gntcolors.h" 12 #include "gntcolors.h"
13 #include "gntclipboard.h"
13 #include "gntkeys.h" 14 #include "gntkeys.h"
14 #include "gntmenu.h" 15 #include "gntmenu.h"
15 #include "gntstyle.h" 16 #include "gntstyle.h"
16 #include "gnttree.h" 17 #include "gnttree.h"
17 #include "gntutils.h" 18 #include "gntutils.h"
46 static void setup_io(); 47 static void setup_io();
47 48
48 static gboolean refresh_screen(); 49 static gboolean refresh_screen();
49 50
50 GntWM *wm; 51 GntWM *wm;
52 static GntClipboard *clipboard;
51 53
52 /** 54 /**
53 * Mouse support: 55 * Mouse support:
54 * - bring a window on top if you click on its taskbar 56 * - bring a window on top if you click on its taskbar
55 * - click on the top-bar of the active window and drag+drop to move a window 57 * - click on the top-bar of the active window and drag+drop to move a window
345 signal(SIGPIPE, SIG_IGN); 347 signal(SIGPIPE, SIG_IGN);
346 348
347 g_type_init(); 349 g_type_init();
348 350
349 init_wm(); 351 init_wm();
352
353 clipboard = g_object_new(GNT_TYPE_CLIPBOARD, NULL);
350 } 354 }
351 355
352 void gnt_main() 356 void gnt_main()
353 { 357 {
354 wm->loop = g_main_loop_new(NULL, FALSE); 358 wm->loop = g_main_loop_new(NULL, FALSE);
473 g_signal_connect(G_OBJECT(wm->menu), "hide", G_CALLBACK(reset_menu), NULL); 477 g_signal_connect(G_OBJECT(wm->menu), "hide", G_CALLBACK(reset_menu), NULL);
474 478
475 return TRUE; 479 return TRUE;
476 } 480 }
477 481
482 void gnt_set_clipboard_string(gchar *string)
483 {
484 gnt_clipboard_set_string(clipboard, string);
485 }
486
487 GntClipboard *gnt_get_clipboard()
488 {
489 return clipboard;
490 }
491 gchar *gnt_get_clipboard_string()
492 {
493 return gnt_clipboard_get_string(clipboard);
494 }