2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 3
10
* of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
#include "applet-struct.h"
21
#include "applet-screenshot.h"
22
#include "applet-notifications.h"
25
CD_APPLET_ON_CLICK_BEGIN
27
myData.bFromShortkey = FALSE;
28
cd_screenshot_take (NULL);
29
CD_APPLET_ON_CLICK_END
32
static void _on_got_answer (int iClickedButton, GtkWidget *pInteractiveWidget, gpointer data, CairoDialog *pDialog)
35
if (iClickedButton == 0 || iClickedButton == -1) // ok button or Enter.
37
myData.bFromShortkey = TRUE;
38
CDScreenshotOptions *pOptions = cd_screenshot_get_options_from_widget (pInteractiveWidget);
39
if (pOptions->bActiveWindow && pOptions->iDelay == 0)
41
cd_screenshot_take (pOptions);
46
static void _take_screenshot_with_options (void)
48
GtkWidget *pWidget = cd_screenshot_build_options_widget ();
49
myData.pDialog = gldi_dialog_show (D_("Screenshot"), myIcon, myContainer,
51
MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE,
52
pWidget, (CairoDockActionOnAnswerFunc)_on_got_answer, NULL, (GFreeFunc)NULL);
55
CD_APPLET_ON_MIDDLE_CLICK_BEGIN
56
_take_screenshot_with_options ();
57
CD_APPLET_ON_MIDDLE_CLICK_END
60
CD_APPLET_ON_BUILD_MENU_BEGIN
61
gchar *cLabel = g_strdup_printf ("%s (%s)", D_("Screenshot with options"), D_("middle-click"));
62
CD_APPLET_ADD_IN_MENU_WITH_STOCK (cLabel, GLDI_ICON_NAME_PROPERTIES, _take_screenshot_with_options, CD_APPLET_MY_MENU);
64
CD_APPLET_ON_BUILD_MENU_END
67
void cd_screenshot_on_keybinding_pull (const gchar *keystring, gpointer user_data)
69
myData.bFromShortkey = TRUE;
70
cd_screenshot_take (NULL);