Mon, 04 Oct 2021 03:30:49 -0500
Update to gplugin 0.35.0
Testing Done:
Compiled and ran in the devenv.
Reviewed at https://reviews.imfreedom.org/r/994/
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
1 | /** |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
2 | * Copyright (C) 2007 Richard Nelson <wabz@whatsbeef.net> |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
3 | * |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
4 | * This program is free software; you can redistribute it and/or modify |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
5 | * it under the terms of the GNU General Public License as published by |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
6 | * the Free Software Foundation; either version 2 of the License, or |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
7 | * (at your option) any later version. |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
8 | * |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
9 | * This program is distributed in the hope that it will be useful, |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
12 | * GNU General Public License for more details. |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
13 | * |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
14 | * You should have received a copy of the GNU General Public License |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
15 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19750
diff
changeset
|
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
17 | */ |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
18 | |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
19 | #include <glib.h> |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40359
diff
changeset
|
20 | #include <glib/gi18n-lib.h> |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
21 | |
|
36751
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
22 | #define PLUGIN_ID "gntclipboard" |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
23 | #define PLUGIN_DOMAIN (g_quark_from_static_string(PLUGIN_ID)) |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
24 | |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
25 | #ifdef HAVE_X11 |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
26 | #include <X11/Xlib.h> |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
27 | #include <X11/Xutil.h> |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
28 | #include <X11/Xatom.h> |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
29 | #endif |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
30 | |
| 15843 | 31 | #include <sys/types.h> |
| 32 | #include <signal.h> | |
| 33 | ||
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
34 | #include <glib.h> |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
35 | |
|
40359
ca141ea93b83
Make all of finch use purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40131
diff
changeset
|
36 | #include <purple.h> |
|
ca141ea93b83
Make all of finch use purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40131
diff
changeset
|
37 | |
|
35877
6c3ab2fd4412
cross-win32: fix finch build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
38 | #include <gnt.h> |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
39 | |
|
40508
2ebcb8eb5c01
create a global header for finch
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
40 | #include <finch.h> |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
41 | |
|
19750
67bbae7ab8fc
Show a helpful error message when the plugin fails to load.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
42 | #ifdef HAVE_X11 |
| 15843 | 43 | static pid_t child = 0; |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
44 | |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
45 | static gulong sig_handle; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
46 | |
| 15843 | 47 | static void |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
48 | set_clip(gchar *string) |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
49 | { |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
50 | Window w; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
51 | XEvent e, respond; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
52 | XSelectionRequestEvent *req; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
53 | const char *ids; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
54 | Display *dpy = XOpenDisplay(NULL); |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
55 | |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
56 | if (!dpy) |
| 15843 | 57 | return; |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
58 | ids = getenv("WINDOWID"); |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
59 | if (ids == NULL) |
| 15843 | 60 | return; |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
61 | w = atoi(ids); |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
62 | XSetSelectionOwner(dpy, XA_PRIMARY, w, CurrentTime); |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
63 | XFlush(dpy); |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
64 | XSelectInput(dpy, w, StructureNotifyMask); |
| 15843 | 65 | while (TRUE) { |
| 66 | XNextEvent(dpy, &e); /* this blocks. */ | |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
67 | req = &e.xselectionrequest; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
68 | if (e.type == SelectionRequest) { |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
69 | XChangeProperty(dpy, |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
70 | req->requestor, |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
71 | req->property, |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
72 | XA_STRING, |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
73 | 8, PropModeReplace, |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
74 | (unsigned char *)string, |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
75 | strlen(string)); |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
76 | respond.xselection.property = req->property; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
77 | respond.xselection.type = SelectionNotify; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
78 | respond.xselection.display = req->display; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
79 | respond.xselection.requestor = req->requestor; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
80 | respond.xselection.selection = req->selection; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
81 | respond.xselection.target= req->target; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
82 | respond.xselection.time = req->time; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
83 | XSendEvent(dpy, req->requestor, 0, 0, &respond); |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
84 | XFlush (dpy); |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
85 | } else if (e.type == SelectionClear) { |
| 15843 | 86 | return; |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
87 | } |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
88 | } |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
89 | } |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
90 | |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
91 | static void |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
92 | clipboard_changed(GntWM *wm, gchar *string) |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
93 | { |
| 15843 | 94 | if (child) { |
| 95 | kill(child, SIGTERM); | |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
96 | } |
|
39906
79a00e51853d
finch: Fix incorrect call to fork.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39886
diff
changeset
|
97 | if ((child = fork()) == 0) { |
| 15843 | 98 | set_clip(string); |
| 99 | _exit(0); | |
| 100 | } | |
|
19750
67bbae7ab8fc
Show a helpful error message when the plugin fails to load.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
101 | } |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
102 | #endif |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
103 | |
|
40895
9406fe45ca7b
Convert the Finch plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40511
diff
changeset
|
104 | static GPluginPluginInfo * |
|
9406fe45ca7b
Convert the Finch plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40511
diff
changeset
|
105 | gnt_clipboard_query(GError **error) { |
|
36751
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
106 | const gchar * const authors[] = { |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
107 | "Richard Nelson <wabz@whatsbeef.net>", |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
108 | NULL |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
109 | }; |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
110 | |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
111 | return finch_plugin_info_new( |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
112 | "id", PLUGIN_ID, |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
113 | "name", N_("GntClipboard"), |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
114 | "version", DISPLAY_VERSION, |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
115 | "category", N_("Utility"), |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
116 | "summary", N_("Clipboard plugin"), |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
117 | "description", N_("When the gnt clipboard contents change, the " |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
118 | "contents are made available to X, if possible."), |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
119 | "authors", authors, |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
120 | "website", PURPLE_WEBSITE, |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
121 | "abi-version", PURPLE_ABI_VERSION, |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
122 | NULL |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
123 | ); |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
124 | } |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
125 | |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
126 | static gboolean |
|
40895
9406fe45ca7b
Convert the Finch plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40511
diff
changeset
|
127 | gnt_clipboard_load(GPluginPlugin *plugin, GError **error) { |
|
15954
f59ab2031ceb
Build gntclipboard plugin by default. If we don't want this, at least
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15924
diff
changeset
|
128 | #ifdef HAVE_X11 |
| 15843 | 129 | if (!XOpenDisplay(NULL)) { |
| 15884 | 130 | purple_debug_warning("gntclipboard", "Couldn't find X display\n"); |
|
19750
67bbae7ab8fc
Show a helpful error message when the plugin fails to load.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
131 | purple_notify_error(NULL, _("Error"), _("Error loading the plugin."), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
25633
diff
changeset
|
132 | _("Couldn't find X display"), NULL); |
| 15843 | 133 | return FALSE; |
| 134 | } | |
| 135 | if (!getenv("WINDOWID")) { | |
| 15884 | 136 | purple_debug_warning("gntclipboard", "Couldn't find window\n"); |
|
19750
67bbae7ab8fc
Show a helpful error message when the plugin fails to load.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
137 | purple_notify_error(NULL, _("Error"), _("Error loading the plugin."), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
25633
diff
changeset
|
138 | _("Couldn't find window"), NULL); |
| 15843 | 139 | return FALSE; |
| 140 | } | |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
141 | sig_handle = g_signal_connect(G_OBJECT(gnt_get_clipboard()), "clipboard_changed", G_CALLBACK(clipboard_changed), NULL); |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
142 | return TRUE; |
|
19750
67bbae7ab8fc
Show a helpful error message when the plugin fails to load.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
143 | #else |
|
36751
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
144 | g_set_error(error, PLUGIN_DOMAIN, 0, _("This plugin cannot be loaded " |
|
a9f6ae7c308e
Refactored finch plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
145 | "because it was not built with X11 support.")); |
|
19750
67bbae7ab8fc
Show a helpful error message when the plugin fails to load.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
146 | return FALSE; |
|
67bbae7ab8fc
Show a helpful error message when the plugin fails to load.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
147 | #endif |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
148 | } |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
149 | |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
150 | static gboolean |
|
41078
84e48180ef67
Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents:
40895
diff
changeset
|
151 | gnt_clipboard_unload(GPluginPlugin *plugin, gboolean shutdown, GError **error) { |
|
19750
67bbae7ab8fc
Show a helpful error message when the plugin fails to load.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
152 | #ifdef HAVE_X11 |
| 15843 | 153 | if (child) { |
| 154 | kill(child, SIGTERM); | |
| 155 | child = 0; | |
| 156 | } | |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
157 | g_signal_handler_disconnect(G_OBJECT(gnt_get_clipboard()), sig_handle); |
|
19750
67bbae7ab8fc
Show a helpful error message when the plugin fails to load.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
158 | #endif |
|
15814
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
159 | return TRUE; |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
160 | } |
|
2db42c6a13fa
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).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
161 | |
|
40895
9406fe45ca7b
Convert the Finch plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40511
diff
changeset
|
162 | GPLUGIN_NATIVE_PLUGIN_DECLARE(gnt_clipboard) |