Tue, 29 Apr 2014 10:39:57 +0200
scrncap: capture screenshots
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
1 | /* |
|
35936
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
2 | * Screen Capture - a plugin that allows taking screenshots and sending them |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
3 | * to your buddies as inline images. |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
4 | * |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or modify |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
7 | * the Free Software Foundation; either version 2 of the License, or |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
9 | * |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
14 | * |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
16 | * along with this program; if not, write to the Free Software |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
18 | */ |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
19 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
20 | /* TODO: disable, when prpl doesn't support inline images */ |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
21 | /* TODO: add "Insert screenshot" to the Conversation window menu */ |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
22 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
23 | #include "internal.h" |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
24 | |
|
35936
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
25 | #include "debug.h" |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
26 | #include "version.h" |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
27 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
28 | #include "gtkconv.h" |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
29 | #include "gtkplugin.h" |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
30 | #include "gtkwebviewtoolbar.h" |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
31 | #include "pidginstock.h" |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
32 | |
|
35936
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
33 | #define SCRNCAP_SHOOTING_TIMEOUT 500 |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
34 | |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
35 | static gboolean is_shooting = FALSE; |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
36 | guint shooting_timeout = 0; |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
37 | |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
38 | static inline void |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
39 | scrncap_conv_set_data(PidginConversation *gtkconv, const gchar *key, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
40 | gpointer value) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
41 | { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
42 | g_return_if_fail(gtkconv != NULL); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
43 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
44 | g_object_set_data(G_OBJECT(gtkconv->tab_cont), key, value); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
45 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
46 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
47 | static inline gpointer |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
48 | scrncap_conv_get_data(PidginConversation *gtkconv, const gchar *key) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
49 | { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
50 | g_return_val_if_fail(gtkconv != NULL, NULL); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
51 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
52 | return g_object_get_data(G_OBJECT(gtkconv->tab_cont), key); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
53 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
54 | |
|
35936
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
55 | static inline gboolean |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
56 | scrncap_do_screenshot_cb(gpointer _webview) |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
57 | { |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
58 | PidginWebView *webview = PIDGIN_WEBVIEW(_webview); |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
59 | GdkPixbuf *screenshot; |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
60 | GdkWindow *root; |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
61 | gint orig_x, orig_y, width, height; |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
62 | |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
63 | root = gdk_get_default_root_window(); |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
64 | gdk_window_get_origin(root, &orig_x, &orig_y); |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
65 | gdk_drawable_get_size(root, &width, &height); |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
66 | |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
67 | /* for gtk3 should be gdk_pixbuf_get_from_window */ |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
68 | screenshot = gdk_pixbuf_get_from_drawable( |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
69 | NULL, root, NULL, |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
70 | orig_x, orig_y, 0, 0, width, height); |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
71 | |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
72 | gdk_pixbuf_save(screenshot, "screenshot.png", "png", NULL, NULL); |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
73 | is_shooting = FALSE; |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
74 | |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
75 | return G_SOURCE_REMOVE; |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
76 | } |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
77 | |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
78 | static inline void |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
79 | scrncap_do_screenshot(GtkAction *action, PidginWebView *webview) |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
80 | { |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
81 | if (is_shooting) |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
82 | return; |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
83 | is_shooting = TRUE; |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
84 | |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
85 | shooting_timeout = purple_timeout_add(SCRNCAP_SHOOTING_TIMEOUT, |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
86 | scrncap_do_screenshot_cb, webview); |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
87 | } |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
88 | |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
89 | static void |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
90 | scrncap_conversation_init(PidginConversation *gtkconv) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
91 | { |
|
35936
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
92 | PidginWebView *webview; |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
93 | PidginWebViewToolbar *toolbar; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
94 | GtkAction *action; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
95 | GtkToolItem *scrncap_btn_wide; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
96 | GtkWidget *scrncap_btn_lean; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
97 | gint pos = -1, i; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
98 | GtkToolbar *wide_view, *lean_view; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
99 | GtkMenu *wide_menu = NULL; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
100 | GList *wide_children, *it; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
101 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
102 | if (scrncap_conv_get_data(gtkconv, "scrncap-btn-wide") != NULL) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
103 | return; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
104 | |
|
35936
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
105 | webview = PIDGIN_WEBVIEW(gtkconv->entry); |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
106 | toolbar = PIDGIN_WEBVIEWTOOLBAR(pidgin_webview_get_toolbar(webview)); |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
107 | g_return_if_fail(toolbar != NULL); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
108 | wide_view = GTK_TOOLBAR(pidgin_webviewtoolbar_get_wide_view(toolbar)); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
109 | g_return_if_fail(wide_view != NULL); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
110 | lean_view = GTK_TOOLBAR(pidgin_webviewtoolbar_get_lean_view(toolbar)); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
111 | g_return_if_fail(lean_view != NULL); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
112 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
113 | action = gtk_action_new("InsertScreenshot", _("_Screenshot"), |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
114 | _("Insert screenshot"), PIDGIN_STOCK_TOOLBAR_INSERT_SCREENSHOT); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
115 | gtk_action_set_is_important(action, TRUE); |
|
35936
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
116 | g_signal_connect(G_OBJECT(action), "activate", |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
117 | G_CALLBACK(scrncap_do_screenshot), webview); |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
118 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
119 | scrncap_btn_wide = GTK_TOOL_ITEM(gtk_action_create_tool_item(action)); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
120 | scrncap_conv_set_data(gtkconv, "scrncap-btn-wide", scrncap_btn_wide); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
121 | for (i = 0; i < gtk_toolbar_get_n_items(wide_view); i++) { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
122 | GtkToolItem *ref_item = gtk_toolbar_get_nth_item(wide_view, i); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
123 | const gchar *action_name; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
124 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
125 | action_name = g_object_get_data(G_OBJECT(ref_item), |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
126 | "action-name"); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
127 | if (g_strcmp0(action_name, "InsertImage") == 0) { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
128 | pos = i + 1; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
129 | break; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
130 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
131 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
132 | gtk_toolbar_insert(wide_view, scrncap_btn_wide, pos); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
133 | gtk_widget_show(GTK_WIDGET(scrncap_btn_wide)); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
134 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
135 | for (i = 0; i < gtk_toolbar_get_n_items(lean_view); i++) { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
136 | GtkToolItem *ref_item = gtk_toolbar_get_nth_item(lean_view, i); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
137 | const gchar *action_name; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
138 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
139 | action_name = g_object_get_data(G_OBJECT(ref_item), "action-name"); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
140 | if (g_strcmp0(action_name, "insert") == 0) { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
141 | wide_menu = g_object_get_data(G_OBJECT(ref_item), "menu"); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
142 | break; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
143 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
144 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
145 | g_return_if_fail(wide_menu); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
146 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
147 | pos = -1; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
148 | wide_children = gtk_container_get_children(GTK_CONTAINER(wide_menu)); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
149 | for (it = wide_children, i = 0; it; it = g_list_next(it), i++) { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
150 | GtkWidget *child = it->data; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
151 | const gchar *action_name; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
152 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
153 | action_name = g_object_get_data(G_OBJECT(child), "action-name"); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
154 | if (g_strcmp0(action_name, "InsertImage") == 0) { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
155 | pos = i + 1; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
156 | break; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
157 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
158 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
159 | g_list_free(wide_children); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
160 | if (pos < 0) { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
161 | g_warn_if_fail(pos >= 0); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
162 | pos = 0; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
163 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
164 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
165 | scrncap_btn_lean = gtk_action_create_menu_item(action); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
166 | scrncap_conv_set_data(gtkconv, "scrncap-btn-lean", scrncap_btn_lean); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
167 | gtk_menu_shell_insert(GTK_MENU_SHELL(wide_menu), |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
168 | GTK_WIDGET(scrncap_btn_lean), pos); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
169 | gtk_widget_show(GTK_WIDGET(scrncap_btn_lean)); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
170 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
171 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
172 | static void |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
173 | scrncap_conversation_uninit(PidginConversation *gtkconv) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
174 | { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
175 | GtkWidget *scrncap_btn_wide, *scrncap_btn_lean; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
176 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
177 | scrncap_btn_wide = scrncap_conv_get_data(gtkconv, "scrncap-btn-wide"); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
178 | if (scrncap_btn_wide == NULL) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
179 | return; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
180 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
181 | scrncap_btn_lean = scrncap_conv_get_data(gtkconv, "scrncap-btn-lean"); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
182 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
183 | gtk_widget_destroy(scrncap_btn_wide); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
184 | if (scrncap_btn_lean) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
185 | gtk_widget_destroy(scrncap_btn_lean); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
186 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
187 | scrncap_conv_set_data(gtkconv, "scrncap-btn-wide", NULL); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
188 | scrncap_conv_set_data(gtkconv, "scrncap-btn-lean", NULL); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
189 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
190 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
191 | static gboolean |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
192 | scrncap_plugin_load(PurplePlugin *plugin) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
193 | { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
194 | GList *it; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
195 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
196 | purple_signal_connect(pidgin_conversations_get_handle(), |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
197 | "conversation-displayed", plugin, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
198 | PURPLE_CALLBACK(scrncap_conversation_init), NULL); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
199 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
200 | it = purple_conversations_get_all(); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
201 | for (; it; it = g_list_next(it)) { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
202 | PurpleConversation *conv = it->data; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
203 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
204 | if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
205 | continue; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
206 | scrncap_conversation_init(PIDGIN_CONVERSATION(conv)); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
207 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
208 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
209 | return TRUE; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
210 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
211 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
212 | static gboolean |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
213 | scrncap_plugin_unload(PurplePlugin *plugin) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
214 | { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
215 | GList *it; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
216 | |
|
35936
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
217 | if (shooting_timeout > 0) |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
218 | purple_timeout_remove(shooting_timeout); |
|
ca0d86573352
scrncap: capture screenshots
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
219 | |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
220 | it = purple_conversations_get_all(); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
221 | for (; it; it = g_list_next(it)) { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
222 | PurpleConversation *conv = it->data; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
223 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
224 | if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
225 | continue; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
226 | scrncap_conversation_uninit(PIDGIN_CONVERSATION(conv)); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
227 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
228 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
229 | return TRUE; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
230 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
231 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
232 | static PidginPluginUiInfo scrncap_ui_info = |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
233 | { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
234 | NULL, /* config */ |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
235 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
236 | /* padding */ |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
237 | NULL, NULL, NULL, NULL |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
238 | }; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
239 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
240 | static PurplePluginInfo scrncap_info = |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
241 | { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
242 | PURPLE_PLUGIN_MAGIC, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
243 | PURPLE_MAJOR_VERSION, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
244 | PURPLE_MINOR_VERSION, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
245 | PURPLE_PLUGIN_STANDARD, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
246 | PIDGIN_PLUGIN_TYPE, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
247 | 0, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
248 | NULL, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
249 | PURPLE_PRIORITY_DEFAULT, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
250 | "gtk-screencap", |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
251 | N_("Screen Capture"), |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
252 | DISPLAY_VERSION, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
253 | N_("Send screenshots to your buddies."), |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
254 | N_("Adds an option to send a screenshot as an inline image. " |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
255 | "It works only with protocols that supports inline images."), |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
256 | "Tomasz Wasilczyk <twasilczyk@pidgin.im>", |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
257 | PURPLE_WEBSITE, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
258 | scrncap_plugin_load, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
259 | scrncap_plugin_unload, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
260 | NULL, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
261 | &scrncap_ui_info, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
262 | NULL, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
263 | NULL, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
264 | NULL, |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
265 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
266 | /* padding */ |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
267 | NULL, NULL, NULL, NULL |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
268 | }; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
269 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
270 | static void |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
271 | scrncap_init_plugin(PurplePlugin *plugin) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
272 | { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
273 | #if 0 |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
274 | purple_prefs_add_none("/plugins"); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
275 | purple_prefs_add_none("/plugins/gtk"); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
276 | purple_prefs_add_none("/plugins/gtk/screencap"); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
277 | #endif |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
278 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
279 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
280 | PURPLE_INIT_PLUGIN(screencap, scrncap_init_plugin, scrncap_info) |