1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
2 /*
3 ** Login : <ctaf42@gmail.com>
4 ** Started on  Fri Nov 30 05:31:31 2007 GESTES Cedric
5 ** $Id$
6 **
7 ** Author(s):
8 **  - Cedric GESTES <ctaf42@gmail.com>
9 **
10 ** Copyright (C) 2007 GESTES Cedric
11 ** This program is free software; you can redistribute it and/or modify
12 ** it under the terms of the GNU General Public License as published by
13 ** the Free Software Foundation; either version 3 of the License, or
14 ** (at your option) any later version.
15 **
16 ** This program is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 ** GNU General Public License for more details.
20 **
21 ** You should have received a copy of the GNU General Public License
22 ** along with this program; if not, write to the Free Software
23 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25 
26 #include <stdlib.h>
27 #include <string.h>
28 #include <signal.h>
29 
30 #include <vte/vte.h>
31 
32 #include "terminal-init.h"
33 #include "terminal-callbacks.h"
34 #include "terminal-struct.h"
35 #include "terminal-widget.h"
36 #include "terminal-menu-functions.h"
37 
38 
39 CD_APPLET_ON_CLICK_BEGIN
40 {
41 	// on cree ou montre le dialogue/desklet
42 	if (! myData.tab)
43 		terminal_build_and_show_tab ();
44 	else if (myData.dialog)
45 		gldi_dialog_toggle_visibility (myData.dialog);
46 	// on donne le focus au terminal de l'onglet courant.
47 	cd_terminal_grab_focus ();
48 }
49 CD_APPLET_ON_CLICK_END
50 
51 
52 CD_APPLET_ON_MIDDLE_CLICK_BEGIN
53 {
54 	if (myConfig.cTerminal != NULL)
55 		cairo_dock_launch_command (myConfig.cTerminal);
56 	else
57 		cairo_dock_launch_command (cairo_dock_get_default_terminal ());
58 }
59 CD_APPLET_ON_MIDDLE_CLICK_END
60 
61 
on_new_tab(GtkMenuItem * menu_item,gpointer * data)62 static void on_new_tab(GtkMenuItem *menu_item, gpointer *data)
63 {
64 	terminal_new_tab();
65 }
on_rename_tab(GtkMenuItem * menu_item,gpointer * data)66 static void on_rename_tab(GtkMenuItem *menu_item, gpointer *data)
67 {
68 	terminal_rename_tab (NULL);
69 }
on_close_tab(GtkMenuItem * menu_item,gpointer * data)70 static void on_close_tab(GtkMenuItem *menu_item, gpointer *data)
71 {
72 	terminal_close_tab (NULL);
73 }
74 CD_APPLET_ON_BUILD_MENU_BEGIN
75 {
76 	// Menu on the icon (when clicking on a tab or in the terminal, another menu is raised)
77 	CD_APPLET_ADD_IN_MENU_WITH_STOCK (D_("New Tab"), GLDI_ICON_NAME_NEW, on_new_tab, CD_APPLET_MY_MENU);
78 	CD_APPLET_ADD_IN_MENU_WITH_STOCK (D_("Rename current Tab"), GLDI_ICON_NAME_EDIT, on_rename_tab, CD_APPLET_MY_MENU);
79 	CD_APPLET_ADD_IN_MENU_WITH_STOCK (D_("Close current Tab"), GLDI_ICON_NAME_CLOSE, on_close_tab, CD_APPLET_MY_MENU);
80 }
81 CD_APPLET_ON_BUILD_MENU_END
82