~cairo-dock-team/cairo-dock-plug-ins/plug-ins

« back to all changes in this revision

Viewing changes to Screenshot/src/applet-notifications.c

  • Committer: Matthieu Baerts
  • Date: 2014-10-19 00:26:10 UTC
  • Revision ID: matttbe@gmail.com-20141019002610-ulf26s9b4c4rw10r
We just switched from BZR to Git.
Follow us on Github: https://github.com/Cairo-Dock

Note: we will only use Github to manage our source code and all pull requests.
Please continue to report your bugs/ideas/messages on our forum or Launchpad! 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
* This file is a part of the Cairo-Dock project
3
 
*
4
 
* Copyright : (C) see the 'copyright' file.
5
 
* E-mail    : see the 'copyright' file.
6
 
*
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.
11
 
*
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/>.
18
 
*/
19
 
 
20
 
#include "applet-struct.h"
21
 
#include "applet-screenshot.h"
22
 
#include "applet-notifications.h"
23
 
 
24
 
 
25
 
CD_APPLET_ON_CLICK_BEGIN
26
 
        // take screenshot
27
 
        myData.bFromShortkey = FALSE;
28
 
        cd_screenshot_take (NULL);
29
 
CD_APPLET_ON_CLICK_END
30
 
 
31
 
 
32
 
static void _on_got_answer (int iClickedButton, GtkWidget *pInteractiveWidget, gpointer data, CairoDialog *pDialog)
33
 
{
34
 
        CD_APPLET_ENTER;
35
 
        if (iClickedButton == 0 || iClickedButton == -1)  // ok button or Enter.
36
 
        {
37
 
                myData.bFromShortkey = TRUE;
38
 
                CDScreenshotOptions *pOptions = cd_screenshot_get_options_from_widget (pInteractiveWidget);
39
 
                if (pOptions->bActiveWindow && pOptions->iDelay == 0)
40
 
                        pOptions->iDelay = 1;
41
 
                cd_screenshot_take (pOptions);
42
 
        }
43
 
        CD_APPLET_LEAVE ();
44
 
 
45
 
}
46
 
static void _take_screenshot_with_options (void)
47
 
{
48
 
        GtkWidget *pWidget = cd_screenshot_build_options_widget ();
49
 
        myData.pDialog = gldi_dialog_show (D_("Screenshot"), myIcon, myContainer,
50
 
                0,
51
 
                MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE,
52
 
                pWidget, (CairoDockActionOnAnswerFunc)_on_got_answer, NULL, (GFreeFunc)NULL);
53
 
}
54
 
 
55
 
CD_APPLET_ON_MIDDLE_CLICK_BEGIN
56
 
        _take_screenshot_with_options ();
57
 
CD_APPLET_ON_MIDDLE_CLICK_END
58
 
 
59
 
 
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);
63
 
        g_free (cLabel);
64
 
CD_APPLET_ON_BUILD_MENU_END
65
 
 
66
 
 
67
 
void cd_screenshot_on_keybinding_pull (const gchar *keystring, gpointer user_data)
68
 
{
69
 
        myData.bFromShortkey = TRUE;
70
 
        cd_screenshot_take (NULL);
71
 
}