~ubuntu-branches/ubuntu/saucy/cairo-dock-plug-ins/saucy

« back to all changes in this revision

Viewing changes to terminal/src/terminal-init.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2009-08-26 21:07:39 UTC
  • Revision ID: james.westby@ubuntu.com-20090826210739-gyjuuqezrzuluao4
Tags: upstream-2.0.8.1
ImportĀ upstreamĀ versionĀ 2.0.8.1

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
/*
 
21
** Login : <ctaf42@gmail.com>
 
22
** Started on  Fri Nov 30 05:31:31 2007 GESTES Cedric
 
23
** $Id$
 
24
**
 
25
** Copyright (C) 2007 GESTES Cedric
 
26
** This program is free software; you can redistribute it and/or modify
 
27
** it under the terms of the GNU General Public License as published by
 
28
** the Free Software Foundation; either version 3 of the License, or
 
29
** (at your option) any later version.
 
30
**
 
31
** This program is distributed in the hope that it will be useful,
 
32
** but WITHOUT ANY WARRANTY; without even the implied warranty of
 
33
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
34
** GNU General Public License for more details.
 
35
**
 
36
** You should have received a copy of the GNU General Public License
 
37
** along with this program; if not, write to the Free Software
 
38
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
39
*/
 
40
 
 
41
#include "stdlib.h"
 
42
 
 
43
#include "terminal-config.h"
 
44
#include "terminal-menu-functions.h"
 
45
#include "terminal-struct.h"
 
46
#include "terminal-widget.h"
 
47
#include "terminal-init.h"
 
48
 
 
49
 
 
50
CD_APPLET_DEFINITION ("terminal",
 
51
        2, 0, 7,
 
52
        CAIRO_DOCK_CATEGORY_ACCESSORY,
 
53
        N_("Add a terminal to your dock !\n"
 
54
        "Left/middle click to show/hide terminal (you can bind a keyboard shortcut for it.)\n"
 
55
        "You can drag'n'drop files or text and select an action.\n"
 
56
        "You can open many tabs, rename them, change their color (right-click on a tab to interact on it)\n"
 
57
        "To open a new tab : type 'CTRL+t' or double-click next to the last tab\n"
 
58
        "To close a tab : type 'CTRL+w' or middle-click on it."),
 
59
        "Ctaf (Cedric Gestes) & Fabounet (Fabrice Rey)")
 
60
 
 
61
 
 
62
CD_APPLET_INIT_BEGIN
 
63
{
 
64
        CD_APPLET_REGISTER_FOR_CLICK_EVENT;
 
65
        CD_APPLET_REGISTER_FOR_MIDDLE_CLICK_EVENT;
 
66
        CD_APPLET_REGISTER_FOR_BUILD_MENU_EVENT;
 
67
 
 
68
        if (myDesklet != NULL)  // on cree le terminal pour avoir qqch a afficher dans le desklet.
 
69
        {
 
70
                terminal_build_and_show_tab ();
 
71
                CD_APPLET_SET_STATIC_DESKLET;
 
72
        }
 
73
        if (myDock)  // en mode desklet, on n'a pas besoin de l'icone.
 
74
        {
 
75
                CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE;  // set the default icon if none is specified in conf.
 
76
        }
 
77
}
 
78
CD_APPLET_INIT_END
 
79
 
 
80
 
 
81
CD_APPLET_STOP_BEGIN
 
82
{
 
83
  CD_APPLET_UNREGISTER_FOR_CLICK_EVENT;
 
84
  CD_APPLET_UNREGISTER_FOR_MIDDLE_CLICK_EVENT;
 
85
  CD_APPLET_UNREGISTER_FOR_BUILD_MENU_EVENT;
 
86
}
 
87
CD_APPLET_STOP_END
 
88
 
 
89
 
 
90
CD_APPLET_RELOAD_BEGIN
 
91
{
 
92
        if (CD_APPLET_MY_CONFIG_CHANGED)
 
93
        {
 
94
                if (! myData.tab)
 
95
                {
 
96
                        if (myDesklet != NULL)  // on cree le terminal pour avoir qqch a afficher dans le desklet.
 
97
                                terminal_build_and_show_tab ();
 
98
                }
 
99
                else if (CD_APPLET_MY_CONTAINER_TYPE_CHANGED)
 
100
                {
 
101
                        if (myDesklet != NULL)  // il faut passer du dialogue au desklet.
 
102
                        {
 
103
                                myData.tab = cairo_dock_steal_widget_from_its_container (myData.tab);
 
104
                                cairo_dock_dialog_unreference (myData.dialog);
 
105
                                myData.dialog = NULL;
 
106
                                cairo_dock_add_interactive_widget_to_desklet (myData.tab, myDesklet);
 
107
                                cairo_dock_set_desklet_renderer_by_name (myDesklet, NULL, NULL, ! CAIRO_DOCK_LOAD_ICONS_FOR_DESKLET, NULL);
 
108
                                CD_APPLET_SET_STATIC_DESKLET;
 
109
                        }
 
110
                        else  // il faut passer du desklet au dialogue
 
111
                        {
 
112
                                myData.dialog = cd_terminal_build_dialog ();
 
113
                                cairo_dock_hide_dialog (myData.dialog);
 
114
                        }
 
115
                }
 
116
                
 
117
                if (myData.tab)
 
118
                {
 
119
                        term_apply_settings();
 
120
                }
 
121
                
 
122
                if (myDock)  // en mode desklet, on n'a pas besoin de l'icone.
 
123
                {
 
124
                        CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE;  // set the default icon if none is specified in conf.
 
125
                }
 
126
        }
 
127
}
 
128
CD_APPLET_RELOAD_END