# HG changeset patch # User Mark Doliner # Date 1188779919 0 # Node ID 674ddbc424395ca27222cbe72e8363719a44f7e9 # Parent 917b6f45c458415005ac620fba80aab6eae9597b# Parent 87e9d418cbf6e8cc77b56f4bf25f691654f719eb merge of '514cdf59e606c86640192584273de4c182a79a1d' and 'e5101eace9f50967e557b55caf184feb72a57578' diff -r 917b6f45c458 -r 674ddbc42439 finch/plugins/gntclipboard.c --- a/finch/plugins/gntclipboard.c Sun Sep 02 17:55:16 2007 +0000 +++ b/finch/plugins/gntclipboard.c Mon Sep 03 00:38:39 2007 +0000 @@ -38,10 +38,12 @@ #include #include #include +#include #include #include +#ifdef HAVE_X11 static pid_t child = 0; static gulong sig_handle; @@ -49,7 +51,6 @@ static void set_clip(gchar *string) { -#ifdef HAVE_X11 Window w; XEvent e, respond; XSelectionRequestEvent *req; @@ -89,14 +90,12 @@ return; } } -#endif return; } static void clipboard_changed(GntWM *wm, gchar *string) { -#ifdef HAVE_X11 if (child) { kill(child, SIGTERM); } @@ -104,8 +103,8 @@ set_clip(string); _exit(0); } +} #endif -} static gboolean plugin_load(PurplePlugin *plugin) @@ -113,25 +112,35 @@ #ifdef HAVE_X11 if (!XOpenDisplay(NULL)) { purple_debug_warning("gntclipboard", "Couldn't find X display\n"); + purple_notify_error(NULL, _("Error"), _("Error loading the plugin."), + _("Couldn't find X display")); return FALSE; } -#endif if (!getenv("WINDOWID")) { purple_debug_warning("gntclipboard", "Couldn't find window\n"); + purple_notify_error(NULL, _("Error"), _("Error loading the plugin."), + _("Couldn't find window")); return FALSE; } sig_handle = g_signal_connect(G_OBJECT(gnt_get_clipboard()), "clipboard_changed", G_CALLBACK(clipboard_changed), NULL); return TRUE; +#else + purple_notify_error(NULL, _("Error"), _("Error loading the plugin."), + _("This plugin cannot be loaded because it was not built with X11 support.")); + return FALSE; +#endif } static gboolean plugin_unload(PurplePlugin *plugin) { +#ifdef HAVE_X11 if (child) { kill(child, SIGTERM); child = 0; } g_signal_handler_disconnect(G_OBJECT(gnt_get_clipboard()), sig_handle); +#endif return TRUE; }